public class PaymentRequest extends Object implements Serializable
A DTO that is comprised of all the information that is sent to a Payment Gateway to complete a transaction. This DTO uses a modified builder pattern in order to provide an easy way of constructing the request. You can construct a DTO using the following notation:
IMPORTANT: note that some of the convenience methods generate a new instance of the object. (e.g. billTo, shipTo, etc...) So, if you need to modify the shipping or billing information after you have invoked requestDTO.shipTo()..., use the getShipTo() method to append more information. Otherwise, you will overwrite the shipping information with a new instance.
PaymentRequest paymentRequest = new PaymentRequest()
.orderId(referenceNumber)
.customer()
.customerId("1")
.done()
.shipTo()
.firstName("Bill")
.lastName("Broadleaf")
.addressLine1("123 Test Dr.")
.city("Austin")
.stateRegion("TX")
.postalCode("78759")
.done()
.billTo()
.firstName("Bill")
.lastName("Broadleaf")
.addressLine1("123 Test Dr.")
.city("Austin")
.stateRegion("TX")
.postalCode("78759")
.done()
.shippingTotal(0)
.taxTotal(0)
.orderDescription("My Order Description")
.orderSubtotal(10.00)
.transactionTotal(10.00)
.lineItem()
.name("My Product")
.description("My Product Description")
.shortDescription("My Product Short Description")
.systemId("1")
.amount(10.00)
.quantity(1)
.itemTotal(10.00)
.tax(0)
.total(10.00)
.done();
Constructor and Description |
---|
PaymentRequest() |
Modifier and Type | Method and Description |
---|---|
PaymentRequest |
additionalField(String key,
Object value) |
PaymentRequest |
adjustmentsTotal(javax.money.MonetaryAmount adjustmentsTotal) |
Address<PaymentRequest> |
billTo()
You should only call this once, as it will create a new bill to address if called more than
once.
|
boolean |
billToPopulated() |
PaymentRequest |
completeCheckoutOnCallback(boolean completeCheckoutOnCallback) |
CreditCard<PaymentRequest> |
creditCard()
You should only call this once, as it will create a new credit card if called more than once.
|
boolean |
creditCardPopulated() |
GatewayCustomer<PaymentRequest> |
customer()
You should only call this once, as it will create a new customer if called more than once.
|
CustomerCredit<PaymentRequest> |
customerCredit()
You should only call this once, as it will create a new gift card if called more than once.
|
boolean |
customerPopulated() |
PaymentRequest |
gatewayRequestType(PaymentGatewayRequestType gatewayRequestType) |
Object |
getAdditionalField(String key) |
Map<String,Object> |
getAdditionalFields()
Any extra properties needed to define the requested transaction
|
javax.money.MonetaryAmount |
getAdjustmentsTotal()
The order's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment
discounts.
|
Address<PaymentRequest> |
getBillTo()
The billing address associated with this transaction
|
CreditCard<PaymentRequest> |
getCreditCard()
For sale/authorize transactions, this will be the Credit Card object that was charged.
|
GatewayCustomer<PaymentRequest> |
getCustomer()
Any customer information that relates to this transaction
|
List<CustomerCredit<PaymentRequest>> |
getCustomerCredits()
Any customer credit accounts that have been processed.
|
PaymentGatewayRequestType |
getGatewayRequestType()
Additional information about the request that can be used by the gateway implementation to
inform/direct portions of its functionality
|
List<GiftCard<PaymentRequest>> |
getGiftCards()
Any gift cards that have been processed.
|
List<LineItem> |
getLineItems()
The items associated to the transaction's related order
|
String |
getOrderDescription()
A description of the order associated with this transaction
|
String |
getOrderId() |
javax.money.MonetaryAmount |
getOrderSubtotal()
The order's total usually excluding adjustments, tax, and shipping.
|
String |
getPaymentId()
The Payment ID that this transaction is associated with
|
PaymentType |
getPaymentType()
The Type of Payment that this transaction response represents
|
javax.money.MonetaryAmount |
getShippingTotal()
The order's total shipping cost
|
Address<PaymentRequest> |
getShipTo()
If shipping information is captured on the gateway, the values sent back will be put here
|
String |
getSiteBaseUrl()
The base url of the site that is making this payment request.
|
String |
getSourceId()
The id of the entity that caused this payment to be created.
|
String |
getSourceType()
Describes the origination of the payment.
|
Subscription<PaymentRequest> |
getSubscription()
Any information required to execute recurring billing
|
javax.money.MonetaryAmount |
getTaxTotal()
The order's total tax cost
|
String |
getTransactionReferenceId()
The transaction reference that is passed to the payment gateway.
|
javax.money.MonetaryAmount |
getTransactionTotal()
The order's total cost including tax & shipping charges
|
GiftCard<PaymentRequest> |
giftCard()
You should only call this once, as it will create a new gift card if called more than once.
|
boolean |
isCompleteCheckoutOnCallback()
Sets whether or not this module should complete checkout on callback.
|
LineItem |
lineItem() |
PaymentRequest |
orderDescription(String orderDescription) |
PaymentRequest |
orderId(String orderId) |
PaymentRequest |
orderSubtotal(javax.money.MonetaryAmount orderSubtotal) |
PaymentRequest |
paymentId(String paymentId) |
PaymentRequest |
paymentType(PaymentType paymentType) |
PaymentRequest |
shippingTotal(javax.money.MonetaryAmount shippingTotal) |
Address<PaymentRequest> |
shipTo()
You should only call this once, as it will create a new customer if called more than once.
|
boolean |
shipToPopulated() |
PaymentRequest |
sourceId(String sourceId) |
PaymentRequest |
sourceType(String sourceType) |
Subscription<PaymentRequest> |
subscription()
You should only call this once, as it will create a new subscription if called more than
once.
|
boolean |
subscriptionPopulated() |
PaymentRequest |
taxTotal(javax.money.MonetaryAmount taxTotal) |
PaymentRequest |
transactionReferenceId(String transactionReferenceId) |
PaymentRequest |
transactionTotal(javax.money.MonetaryAmount transactionTotal) |
public GatewayCustomer<PaymentRequest> customer()
public CreditCard<PaymentRequest> creditCard()
public Subscription<PaymentRequest> subscription()
public Address<PaymentRequest> shipTo()
public Address<PaymentRequest> billTo()
public GiftCard<PaymentRequest> giftCard()
public CustomerCredit<PaymentRequest> customerCredit()
public LineItem lineItem()
public PaymentRequest additionalField(String key, Object value)
public PaymentRequest orderId(String orderId)
public String getOrderId()
public PaymentRequest sourceType(String sourceType)
public PaymentRequest sourceId(String sourceId)
public PaymentRequest paymentId(String paymentId)
public PaymentRequest orderDescription(String orderDescription)
public PaymentRequest orderSubtotal(javax.money.MonetaryAmount orderSubtotal)
public PaymentRequest adjustmentsTotal(javax.money.MonetaryAmount adjustmentsTotal)
public PaymentRequest shippingTotal(javax.money.MonetaryAmount shippingTotal)
public PaymentRequest taxTotal(javax.money.MonetaryAmount taxTotal)
public PaymentRequest transactionTotal(javax.money.MonetaryAmount transactionTotal)
public PaymentRequest paymentType(PaymentType paymentType)
public PaymentRequest gatewayRequestType(PaymentGatewayRequestType gatewayRequestType)
public PaymentRequest transactionReferenceId(String transactionReferenceId)
public PaymentRequest completeCheckoutOnCallback(boolean completeCheckoutOnCallback)
public boolean shipToPopulated()
public boolean billToPopulated()
public boolean creditCardPopulated()
public boolean customerPopulated()
public boolean subscriptionPopulated()
public GatewayCustomer<PaymentRequest> getCustomer()
public Address<PaymentRequest> getShipTo()
public Address<PaymentRequest> getBillTo()
public CreditCard<PaymentRequest> getCreditCard()
public Subscription<PaymentRequest> getSubscription()
public List<GiftCard<PaymentRequest>> getGiftCards()
public List<CustomerCredit<PaymentRequest>> getCustomerCredits()
public String getPaymentId()
public String getSourceType()
public String getSourceId()
public String getOrderDescription()
public List<LineItem> getLineItems()
public PaymentType getPaymentType()
public PaymentGatewayRequestType getGatewayRequestType()
public String getTransactionReferenceId()
public javax.money.MonetaryAmount getOrderSubtotal()
public javax.money.MonetaryAmount getAdjustmentsTotal()
public javax.money.MonetaryAmount getShippingTotal()
public javax.money.MonetaryAmount getTaxTotal()
public javax.money.MonetaryAmount getTransactionTotal()
public boolean isCompleteCheckoutOnCallback()
Sets whether or not this module should complete checkout on callback. In most Credit Card gateway implementation, this should be set to 'TRUE' and should not be configurable as the gateway expects it to tbe the final step in the checkout process.
In gateways where it does not expect to be the last step in the checkout process, for example BLC Gift Card Module, PayPal Express Checkout, etc... The callback from the gateway can be configured whether or not to complete checkout.
public String getSiteBaseUrl()
Copyright © 2021. All rights reserved.