Class OrderPaymentImpl
- All Implemented Interfaces:
Serializable,MultiTenantCloneable<OrderPayment>,CurrencyCodeIdentifiable,Status,OrderPayment
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BigDecimalprotected ArchiveStatusprotected Addressprotected Stringprotected Longprotected Orderprotected Stringprotected List<PaymentTransaction>protected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransaction(PaymentTransaction transaction) A more declarative way to invoke {@link #getTransactions().add()}.<G extends OrderPayment>
CreateResponse<G>booleanThe amount that this payment is allotted for.Returns a successful transaction with typePaymentTransactionType.AUTHORIZEorPaymentTransactionType.AUTHORIZE_AND_CAPTUREif one exists.Gets the billing address associated with this payment.The currency that this payment should be taken in.Gets the gateway that was used to process this order payment.getId()Returns the initial transaction for this order payment.getOrder()The soft link to aReferencedentity which will be stored in the blSecurePU persistence unit.Convenience method to get the calculated status of this order payment based on the state of theOrderPayment.getTransactions()Returns all of the transactions on this payment that were successful for the given type.Looks through all of the transactions for this payment and adds up the amount for the given transaction type.All of the transactions that have been applied to this particular payment.Returns a transaction for given type.getType()The type of this payment like Credit Card or Gift Card.inthashCode()booleanisActive()booleanLooks through all of the transactions for this payment and returns whether or not it contains a successful transaction of typePaymentTransactionType.AUTHORIZE_AND_CAPTUREorPaymentTransactionType.AUTHORIZEbooleanReturns whether or not this payment is considered to be the final payment on the order.voidThe amount that this payment is allotted for.voidsetArchived(Character archived) voidsetBillingAddress(Address billingAddress) Sets the billing address associated with this payment.voidvoidvoidsetPaymentGatewayType(PaymentGatewayType gatewayType) Gets the gateway that was used to process this order payment.voidsetReferenceNumber(String referenceNumber) Sets the soft link to aReferencedentity stored in the blSecurePU persistence unit.voidsetTransactions(List<PaymentTransaction> transactions) All of the transactions that have been applied to this particular payment.voidsetType(PaymentType type) Sets the type of this payment like Credit Card or Gift Card
-
Field Details
-
id
-
order
-
billingAddress
-
amount
-
referenceNumber
-
type
-
gatewayType
-
transactions
-
archiveStatus
-
-
Constructor Details
-
OrderPaymentImpl
public OrderPaymentImpl()
-
-
Method Details
-
getAmount
Description copied from interface:OrderPaymentThe amount that this payment is allotted for. The summation of all of theOrderPayments for a particularOrdershould equalOrder.getTotal()- Specified by:
getAmountin interfaceOrderPayment
-
setAmount
Description copied from interface:OrderPaymentThe amount that this payment is allotted for. The summation of all of theOrderPayments for a particularOrdershould equalOrder.getTotal()- Specified by:
setAmountin interfaceOrderPayment
-
getId
- Specified by:
getIdin interfaceOrderPayment
-
setId
- Specified by:
setIdin interfaceOrderPayment
-
getOrder
- Specified by:
getOrderin interfaceOrderPayment
-
setOrder
- Specified by:
setOrderin interfaceOrderPayment
-
getBillingAddress
Description copied from interface:OrderPaymentGets the billing address associated with this payment. This might be null for some payments where no billing address is required (like gift cards or account credit)- Specified by:
getBillingAddressin interfaceOrderPayment
-
setBillingAddress
Description copied from interface:OrderPaymentSets the billing address associated with this payment. This might be null for some payments where no billing address is required (like gift cards or account credit)- Specified by:
setBillingAddressin interfaceOrderPayment
-
getReferenceNumber
Description copied from interface:OrderPaymentThe soft link to aReferencedentity which will be stored in the blSecurePU persistence unit. If you are not attempting to store credit cards in your own database (which is the usual, recommended case) then this will not be used or set. If you do use this reference number, this can be anything that is unique (like System.currentTimeMillis()).- Specified by:
getReferenceNumberin interfaceOrderPayment
-
setReferenceNumber
Description copied from interface:OrderPaymentSets the soft link to aReferencedentity stored in the blSecurePU persistence unit. This will likely not be used as the common case is to not store credit cards yourself.- Specified by:
setReferenceNumberin interfaceOrderPayment
-
getType
Description copied from interface:OrderPaymentThe type of this payment like Credit Card or Gift Card.- Specified by:
getTypein interfaceOrderPayment
-
setType
Description copied from interface:OrderPaymentSets the type of this payment like Credit Card or Gift Card- Specified by:
setTypein interfaceOrderPayment
-
getGatewayType
Description copied from interface:OrderPaymentGets the gateway that was used to process this order payment. Only a SINGLE payment gateway can modify transactions on a particular order payment.- Specified by:
getGatewayTypein interfaceOrderPayment
-
setPaymentGatewayType
Description copied from interface:OrderPaymentGets the gateway that was used to process this order payment. Only a SINGLE payment gateway can modify transactions on a particular order payment.
It usually does not make sense to modify the gateway type after it has already been set once. Instead, consider just archiving this payment type (by deleting it) and creating a new payment for the new gateway.
- Specified by:
setPaymentGatewayTypein interfaceOrderPayment
-
getTransactions
Description copied from interface:OrderPaymentAll of the transactions that have been applied to this particular payment. Transactions are denoted by the various
PaymentTransactionTypes. In almost all scenarios (as in, 99.9999% of all cases) there will be a at least onePaymentTransactionfor everyOrderPayment.To add a transaction to an
OrderPaymentseeOrderPayment.addTransaction(PaymentTransaction).- Specified by:
getTransactionsin interfaceOrderPayment
-
setTransactions
Description copied from interface:OrderPaymentAll of the transactions that have been applied to this particular payment. Transactions are denoted by the various
PaymentTransactionTypes. In almost all scenarios (as in, 99.9999% of all cases) there will be a at least onePaymentTransactionfor everyOrderPayment.To add a transaction to an
OrderPaymentseeOrderPayment.addTransaction(PaymentTransaction).- Specified by:
setTransactionsin interfaceOrderPayment
-
addTransaction
Description copied from interface:OrderPaymentA more declarative way to invoke {@link #getTransactions().add()}. This is the preferred way to add a transaction to this payment.- Specified by:
addTransactionin interfaceOrderPayment
-
getTransactionsForType
Description copied from interface:OrderPaymentReturns a transaction for given type. This is useful when validating whether or not aPaymentTransactioncan actually be added to this payment. For instance, there can only be a singlePaymentTransactionType.AUTHORIZEfor a payment.- Specified by:
getTransactionsForTypein interfaceOrderPayment- Parameters:
type- the type of transaction to look for withinOrderPayment.getTransactions()- Returns:
- a list of transactions or an empty list if there are no transaction of that type
-
getInitialTransaction
Description copied from interface:OrderPaymentReturns the initial transaction for this order payment. Implementation-wise this would be any PaymentTransaction whose parentTransaction is NULL.- Specified by:
getInitialTransactionin interfaceOrderPayment- Returns:
- the initial transaction for this order payment or null if there isn't any
-
getAuthorizeTransaction
Description copied from interface:OrderPaymentReturns a successful transaction with typePaymentTransactionType.AUTHORIZEorPaymentTransactionType.AUTHORIZE_AND_CAPTUREif one exists. Note there can only be a single authorize transaction for a given payment.- Specified by:
getAuthorizeTransactionin interfaceOrderPayment- Returns:
-
getTransactionAmountForType
Description copied from interface:OrderPaymentLooks through all of the transactions for this payment and adds up the amount for the given transaction type. This ignores whether the transaction was successful or not- Specified by:
getTransactionAmountForTypein interfaceOrderPayment- Returns:
- the amount of all of the transactions for the given type
-
getSuccessfulTransactionAmountForType
Description copied from interface:OrderPaymentReturns all of the transactions on this payment that were successful for the given type.- Specified by:
getSuccessfulTransactionAmountForTypein interfaceOrderPayment- Parameters:
type- the type of transaction- Returns:
- the amount of all of the transaction on this payment for the given type that have been successful
-
getStatus
Description copied from interface:OrderPaymentConvenience method to get the calculated status of this order payment based on the state of theOrderPayment.getTransactions()- Specified by:
getStatusin interfaceOrderPayment- Returns:
OrderPaymentStatus
-
isConfirmed
public boolean isConfirmed()Description copied from interface:OrderPaymentLooks through all of the transactions for this payment and returns whether or not it contains a successful transaction of typePaymentTransactionType.AUTHORIZE_AND_CAPTUREorPaymentTransactionType.AUTHORIZE- Specified by:
isConfirmedin interfaceOrderPayment- Returns:
-
isFinalPayment
public boolean isFinalPayment()Description copied from interface:OrderPaymentReturns whether or not this payment is considered to be the final payment on the order. The default implementation considers those payment of typePaymentType.THIRD_PARTY_ACCOUNTandPaymentType.CREDIT_CARDfinal payments because integrations with external Payment Gateways require it.For example, a THIRD_PARTY_ACCOUNT payment's (e.g. PayPal Express Checkout) amount to charge to the customer will be automatically calculated based on other payments that have already been applied to the order, such as GIFT_CARDs or ACCOUNT_CREDITs. This final amount (OrderPayment) will be sent to the gateway.
- Specified by:
isFinalPaymentin interfaceOrderPayment- Returns:
-
getCurrency
Description copied from interface:OrderPaymentThe currency that this payment should be taken in. This is a delegate to {@link #getOrder()#getCurrency()}.- Specified by:
getCurrencyin interfaceOrderPayment
-
getCurrencyCode
- Specified by:
getCurrencyCodein interfaceCurrencyCodeIdentifiable
-
getArchived
- Specified by:
getArchivedin interfaceStatus
-
setArchived
- Specified by:
setArchivedin interfaceStatus
-
isActive
public boolean isActive() -
equals
-
hashCode
public int hashCode() -
createOrRetrieveCopyInstance
public <G extends OrderPayment> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException - Specified by:
createOrRetrieveCopyInstancein interfaceMultiTenantCloneable<OrderPayment>- Throws:
CloneNotSupportedException
-