Class PaymentRequest
- All Implemented Interfaces:
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();
- Author:
- Elbert Bautista (elbertbautista)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadditionalField
(String key, Object value) adjustmentsTotal
(javax.money.MonetaryAmount adjustmentsTotal) applicationId
(String applicationId) billTo()
You should only call this once, as it will create a new bill to address if called more than once.boolean
completeCheckoutOnCallback
(boolean completeCheckoutOnCallback) createMultiUseToken
(boolean createMultiUseToken) You should only call this once, as it will create a new credit card if called more than once.boolean
customer()
You should only call this once, as it will create a new customer if called more than once.You should only call this once, as it will create a new gift card if called more than once.boolean
getAdditionalField
(String key) Any extra properties needed to define the requested transactionjavax.money.MonetaryAmount
The order's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment discounts.The application id associated with the current request.The billing address associated with this transactionFor sale/authorize transactions, this will be the Credit Card object that was charged.Any customer information that relates to this transactionAny customer credit accounts that have been processed.Any gift cards that have been processed.The items associated to the transaction's related orderDeprecated.Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.javax.money.MonetaryAmount
The order's total usually excluding adjustments, tax, and shipping.The Payment ID that this transaction is associated withA description of the payment owner associated with this transactionThe id of the entity that owns the payment.Describes the owner of the payment.The Type of Payment that this transaction response representsjavax.money.MonetaryAmount
The order's total shipping costIf shipping information is captured on the gateway, the values sent back will be put hereThe base url of the site that is making this payment request.Any information required to execute recurring billingjavax.money.MonetaryAmount
The order's total tax costThe tenant id associated with the current request.The transaction reference that is passed to the payment gateway.javax.money.MonetaryAmount
The order's total cost including tax & shipping chargesgiftCard()
You should only call this once, as it will create a new gift card if called more than once.boolean
Sets whether or not this module should complete checkout on callback.boolean
Determines whether a multi-use token should be created.lineItem()
orderDescription
(String orderDescription) Deprecated.In favor ofpaymentOwnerDescription
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.orderSubtotal
(javax.money.MonetaryAmount orderSubtotal) paymentOwnerDescription
(String paymentOwnerDescription) paymentOwnerId
(String ownerId) paymentOwnerType
(String ownerType) paymentType
(PaymentType paymentType) shippingTotal
(javax.money.MonetaryAmount shippingTotal) shipTo()
You should only call this once, as it will create a new customer if called more than once.boolean
You should only call this once, as it will create a new subscription if called more than once.boolean
taxTotal
(javax.money.MonetaryAmount taxTotal) transactionReferenceId
(String transactionReferenceId) transactionTotal
(javax.money.MonetaryAmount transactionTotal)
-
Constructor Details
-
PaymentRequest
public PaymentRequest()
-
-
Method Details
-
customer
You should only call this once, as it will create a new customer if called more than once. Use the getter if you need to append more information later. -
creditCard
You should only call this once, as it will create a new credit card if called more than once. Use the getter if you need to append more information later. -
subscription
You should only call this once, as it will create a new subscription if called more than once. Use the getter if you need to append more information later. -
shipTo
You should only call this once, as it will create a new customer if called more than once. Use the getter if you need to append more information later. -
billTo
You should only call this once, as it will create a new bill to address if called more than once. Use the getter if you need to append more information later. -
giftCard
You should only call this once, as it will create a new gift card if called more than once. Use the getter if you need to append more information later. -
customerCredit
You should only call this once, as it will create a new gift card if called more than once. Use the getter if you need to append more information later. -
lineItem
-
additionalField
-
orderId
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.Sets the Order ID that this transaction is associated with.- Returns:
- the
PaymentRequest
-
getOrderId
Deprecated.In favor ofpaymentOwnerType
andpaymentOwnerId
.Gets the Order ID that this transaction is associated with.- Returns:
- the Order ID that this transaction is associated with.
-
paymentOwnerType
-
paymentOwnerId
-
paymentId
-
createMultiUseToken
-
paymentOwnerDescription
-
orderDescription
Deprecated.In favor ofpaymentOwnerDescription
Sets a description of the order associated with this transaction- Returns:
- the
PaymentRequest
-
getOrderDescription
Deprecated.In favor ofpaymentOwnerDescription
Gets a description of the order associated with this transaction.- Returns:
- a description of the order associated with this transaction.
-
orderSubtotal
-
adjustmentsTotal
-
shippingTotal
-
taxTotal
-
transactionTotal
-
paymentType
-
transactionReferenceId
-
completeCheckoutOnCallback
-
applicationId
-
tenantId
-
shipToPopulated
public boolean shipToPopulated() -
billToPopulated
public boolean billToPopulated() -
creditCardPopulated
public boolean creditCardPopulated() -
customerPopulated
public boolean customerPopulated() -
subscriptionPopulated
public boolean subscriptionPopulated() -
getAdditionalField
-
getCustomer
Any customer information that relates to this transaction- Returns:
- any customer information that relates to this transaction
-
getShipTo
If shipping information is captured on the gateway, the values sent back will be put here- Returns:
- the customer's shipping address
-
getBillTo
The billing address associated with this transaction- Returns:
- the customer's billing address
-
getCreditCard
For sale/authorize transactions, this will be the Credit Card object that was charged. This data is useful for showing on an order confirmation screen.- Returns:
- any relevant credit card data
-
getSubscription
Any information required to execute recurring billing- Returns:
- any relevant recurring billing data
-
getGiftCards
Any gift cards that have been processed. This data is useful for showing on an order confirmation screen- Returns:
- any relevant gift card data
-
getCustomerCredits
Any customer credit accounts that have been processed. This data is useful for showing on an order confirmation screen- Returns:
- any relevant customer credit data
-
getPaymentOwnerType
Describes the owner of the payment. For example, the payment could have originated with a cart or a subscription, therefore this value might be CART or SUBSCRIPTION.- Returns:
- The type describing the owner of the payment.
-
getPaymentOwnerId
The id of the entity that owns the payment. For example, this may be a cart id, or a subscription billing cycle id.- Returns:
- The id of the entity that owns the payment.
-
getPaymentOwnerDescription
A description of the payment owner associated with this transaction- Returns:
- A description of the payment owner associated with this transaction.
-
getPaymentId
The Payment ID that this transaction is associated with- Returns:
- the Payment ID that this transaction is associated with
-
isCreateMultiUseToken
public boolean isCreateMultiUseToken()Determines whether a multi-use token should be created.- Returns:
- true if a multi-use token should be created, otherwise false
-
getLineItems
The items associated to the transaction's related order- Returns:
- the items associated to the transaction's related order
-
getPaymentType
The Type of Payment that this transaction response represents- Returns:
- the Type of Payment that this transaction response represents
- See Also:
-
getTransactionReferenceId
The transaction reference that is passed to the payment gateway. This reference can be used to link the request to the gateway's record of the transaction in the case that the calling application does not receive a response from the gateway.- Returns:
- The transaction reference that is passed to the payment gateway.
-
getOrderSubtotal
public javax.money.MonetaryAmount getOrderSubtotal()The order's total usually excluding adjustments, tax, and shipping.- Returns:
- The order's total usually excluding adjustments, tax, and shipping.
-
getAdjustmentsTotal
public javax.money.MonetaryAmount getAdjustmentsTotal()The order's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment discounts.- Returns:
- The order's adjustments (a.k.a discounts) total, usually excluding excluding shipping/fulfillment discounts.
-
getShippingTotal
public javax.money.MonetaryAmount getShippingTotal()The order's total shipping cost- Returns:
- The order's total shipping cost
-
getTaxTotal
public javax.money.MonetaryAmount getTaxTotal()The order's total tax cost- Returns:
- The order's total tax cost
-
getTransactionTotal
public javax.money.MonetaryAmount getTransactionTotal()The order's total cost including tax & shipping charges- Returns:
- The order's total cost including tax & shipping charges
-
isCompleteCheckoutOnCallback
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.
-
getSiteBaseUrl
The base url of the site that is making this payment request. This value will most commonly be used to help define a "return url" or "cancel url" that is used by the payment gateway to communicate information back to our server. This is most applicable in a multi-tenant context where the site context may vary (www.site1.com vs www.site2.com), but the relative return path (/payment-gateway/return) and cancel path (/payment-gateway/cancel) remains the same.- Returns:
- The base url of the site that is making this payment request.
-
getAdditionalFields
Any extra properties needed to define the requested transaction- Returns:
- Any extra properties needed to define the requested transaction
-
getTenantId
The tenant id associated with the current request. -
getApplicationId
The application id associated with the current request.
-
paymentOwnerDescription