Class DefaultPaymentManagementService<P extends Payment>
java.lang.Object
com.broadleafcommerce.paymenttransaction.service.DefaultPaymentManagementService<P>
- All Implemented Interfaces:
PaymentManagementService<P>
public class DefaultPaymentManagementService<P extends Payment>
extends Object
implements PaymentManagementService<P>
- Author:
- Chris Kittrell (ckittrell)
-
Constructor Summary
ConstructorDescriptionDefaultPaymentManagementService
(PaymentService<P> paymentService, PaymentLockService<P> paymentLockService, PaymentTransactionService<PaymentTransaction> paymentTransactionService, com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider, CustomerPaymentAccountProvider<PaymentAccount> paymentAccountProvider, org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archiveAllByOwnerTypeAndOwnerId
(@NonNull String ownerType, @NonNull String ownerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) ArchivesPayments
for the given owner type and owner id.void
archiveAllByOwnerTypeAndOwnerId
(@NonNull String ownerType, @NonNull String ownerId, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) ArchivesPayments
for the given owner type and owner id.void
archivePayment
(@NonNull String id, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Archives thePayment
based on the provided id.protected void
archivePayment
(P payment, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) blockCustomerMutability
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull PaymentLockTokens paymentLockTokens, boolean shouldMarkTransactionsIneligibleForAutomaticReversal, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finalizes the list ofpayments
provided.protected UpdatePaymentsResponse
blockCustomerMutability
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull PaymentLockTokens paymentLockTokens, @NonNull PaymentManagementAccessRestrictions restriction, boolean shouldMarkTransactionsIneligibleForAutomaticReversal, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) blockCustomerMutabilityForPaymentFinalization
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds theDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKED_FOR_PAYMENT_FINALIZATION
restriction to the Payment'sPayment.getAccessRestrictions()
.protected Address
buildBillingAddress
(PaymentAccount paymentAccount) Deprecated, for removal: This API element is subject to removal in a future version.no longer usedprotected P
buildPayment
(@NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequest
buildPaymentValidationRequest
(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected List<com.broadleafcommerce.paymentgateway.domain.PaymentTransaction>
buildTransactions
(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected UpdatePaymentsResponse
buildUpdatePaymentsResponse
(List<Payment> failedPayments, List<Payment> successfulPayments, Map<String, String> failureMessages) protected boolean
canUpdatePaymentAmount
(@NonNull Payment payment) This method checks if the payment amount can be changed.createPayment
(@NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates aPayment
based on the providedCreatePaymentRequest
.protected String
getApplicationIdFromContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected String
getIpAddress
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected String
getMessage
(@NonNull String errorMessage, Object... args) protected org.springframework.context.MessageSource
protected CustomerPaymentAccountProvider<PaymentAccount>
Deprecated.no longer usedprotected com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider
protected PaymentLockService<P>
protected String
getPaymentLockToken
(PaymentLockTokens paymentLockTokens, @NonNull String paymentId) protected PaymentService<P>
protected PaymentSummaryService
protected PaymentTransactionService<PaymentTransaction>
protected SavedPaymentMethodManagementService
protected String
getTenantIdFromContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.common.extension.TypeFactory
protected String
getUserAgent
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected boolean
hasCustomerMutabilityBlockForPaymentFinalization
(@NonNull Payment payment) protected boolean
hasSuccessfulTransactionOfType
(@NonNull Payment payment, @NonNull String transactionType) protected boolean
isPaymentGatewaySupported
(String gatewayType) Checks ifPaymentGatewayConfiguration
has been registered for the payment'sPayment.getGatewayType()
protected List<PaymentTransaction>
markTransactionsIneligibleForAutomaticReversal
(P payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Marks themanagement state
of the givenpayment's transactions
toDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED
.protected P
modifyPaymentMethodProperties
(P payment, @NonNull CreatePaymentRequest createPaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
populateAddressesByType
(@NonNull Payment payment, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequest paymentValidationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected P
populateAndValidatePaymentUpdates
(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected P
populatePaymentFromRequest
(P payment, @NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected P
populatePaymentFromSavedPayment
(P payment, @NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.protected P
populatePaymentFromSavedPayment
(P payment, @NonNull String savedPaymentMethodId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates the givenPayment
with the saved payment method specified inPayment.getSavedPaymentMethodId()
.protected void
populatePaymentOwningUser
(P payment, @NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef) Populates the properties describing the owning user of the givenPayment
.protected P
populatePaymentUpdatesFromRequest
(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected P
populatePaymentUpdatesFromSavedPayment
(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) org.springframework.data.domain.Page<P>
readAllByOwnerTypeAndOwnerId
(@NonNull String ownerType, @NonNull String ownerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find a page of payments for the given owner type and owner id.readAllByPaymentIds
(Iterable<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find a list of payments for the given payment ids.removeCustomerMutabilityBlockForPaymentFinalization
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Unlocks the payments for the customer mutability by removing theDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKED_FOR_PAYMENT_FINALIZATION
fromPayment.getAccessRestrictions()
.protected List<PaymentTransaction>
requestReversalForEligibleTransactions
(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deprecated.protected List<PaymentTransaction>
requestReversalForEligibleTransactions
(@NonNull Payment payment, String reversalReason, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected List<PaymentTransaction>
requestReversalForTransactions
(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deprecated.void
setPaymentCallbackSecurityTokenUtil
(com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil paymentCallbackSecurityTokenUtil) void
setPaymentSummaryService
(PaymentSummaryService paymentSummaryService) void
setSavedPaymentMethodManagementService
(SavedPaymentMethodManagementService savedPaymentMethodManagementService) protected P
setupPaymentForClone
(P payment) protected boolean
shouldMarkTransactionsIneligibleForAutomaticReversal
(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines if the givenUpdatePaymentRequest
should mark thePayment.getTransactions()
toDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED
.transferPaymentsFromCSR
(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpayments
provided from the CSR.transferPaymentsToCSR
(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpayments
provided to the CSR.updatePayment
(@NonNull String id, @NonNull UpdatePaymentRequest updateRequest, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePayment
based on the providedUpdatePaymentRequest
.protected void
updatePaymentAmount
(@NonNull Payment payment, @NonNull javax.money.MonetaryAmount amount, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) updatePaymentForCustomer
(@NonNull String id, @NonNull UpdatePaymentRequest updateRequest, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePayment
for the customer based on the providedUpdatePaymentRequest
.protected void
validateCreatedPayment
(@NonNull Payment payment, @NonNull CreatePaymentRequest createPaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check the validity of the providedPayment
that is to be created.protected void
validateGatewayType
(@NonNull Payment payment) Validate that thePayment
has a supportedPayment.getGatewayType()
value.protected void
validatePaymentAmounts
(@NonNull Payment payment) Validate that thePayment
amount is not a negative amount.protected void
validatePaymentGatewayProperties
(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that thePayment
sufficiently represents a payment method for the declaredPayment.getGatewayType()
.protected void
validateRequestToSavePayment
(@NonNull Payment payment) Validate that the request to save the payment method for future use is not done for an already saved payment method.protected void
validateUpdatePaymentRequest
(@NonNull Payment payment, @NonNull UpdatePaymentRequest updatePaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that the updates provided by theUpdatePaymentRequest
parameter will produce a validPayment
.
-
Constructor Details
-
DefaultPaymentManagementService
public DefaultPaymentManagementService(PaymentService<P> paymentService, PaymentLockService<P> paymentLockService, PaymentTransactionService<PaymentTransaction> paymentTransactionService, com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider, @Nullable CustomerPaymentAccountProvider<PaymentAccount> paymentAccountProvider, org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
createPayment
public P createPayment(@NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentManagementService
Creates aPayment
based on the providedCreatePaymentRequest
.- Specified by:
createPayment
in interfacePaymentManagementService<P extends Payment>
- Parameters:
createPaymentRequest
- The request payload used to build a newPayment
.contextInfo
- Context information related to multitenancy.- Returns:
- A
Payment
based on the providedCreatePaymentRequest
.
-
readAllByPaymentIds
public List<P> readAllByPaymentIds(@NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
Find a list of payments for the given payment ids.- Specified by:
readAllByPaymentIds
in interfacePaymentManagementService<P extends Payment>
- Parameters:
ids
- , The ids of the payments.context
- Context information related to multitenancy.- Returns:
- A list of payments for the given ids.
-
readAllByOwnerTypeAndOwnerId
public org.springframework.data.domain.Page<P> readAllByOwnerTypeAndOwnerId(@NonNull @NonNull String ownerType, @NonNull @NonNull String ownerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
Find a page of payments for the given owner type and owner id.- Specified by:
readAllByOwnerTypeAndOwnerId
in interfacePaymentManagementService<P extends Payment>
- Parameters:
ownerType
- The type of the payment's owner.ownerId
- The id of the payment's owner.page
- The requested page of results from the database.context
- Context information related to multitenancy.- Returns:
- A page of payments for the given owner type and id.
-
updatePaymentForCustomer
@Nullable public P updatePaymentForCustomer(@NonNull @NonNull String id, @NonNull @NonNull UpdatePaymentRequest updateRequest, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
Updates thePayment
for the customer based on the providedUpdatePaymentRequest
. The default implementation archives the payment ifUpdatePaymentRequest.getAmount()
is equal to zero.- Specified by:
updatePaymentForCustomer
in interfacePaymentManagementService<P extends Payment>
- Parameters:
id
- The context id for thePayment
.updateRequest
- The request payload used to update thePayment
.lockToken
- Token granted to resource that owns the payment lock.context
- Context information related to multitenancy.- Returns:
- The updated
Payment
.
-
updatePayment
@Nullable public P updatePayment(@NonNull @NonNull String id, @NonNull @NonNull UpdatePaymentRequest updateRequest, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
Updates thePayment
based on the providedUpdatePaymentRequest
. The default implementation archives the payment ifUpdatePaymentRequest.getAmount()
is equal to zero.- Specified by:
updatePayment
in interfacePaymentManagementService<P extends Payment>
- Parameters:
id
- The context id for thePayment
.updateRequest
- The request payload used to update thePayment
.lockToken
- Token granted to resource that owns the payment lock.context
- Context information related to multitenancy.- Returns:
- The updated
Payment
.
-
archivePayment
@Transactional("paymentTransactionTransactionManager") public void archivePayment(@NonNull @NonNull String id, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
Archives thePayment
based on the provided id.- Specified by:
archivePayment
in interfacePaymentManagementService<P extends Payment>
- Parameters:
id
- The context id for thePayment
.lockToken
- Token granted to resource that owns the payment lock.context
- Context information related to multitenancy.
-
archiveAllByOwnerTypeAndOwnerId
@Transactional("paymentTransactionTransactionManager") public void archiveAllByOwnerTypeAndOwnerId(@NonNull @NonNull String ownerType, @NonNull @NonNull String ownerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
ArchivesPayments
for the given owner type and owner id.- Specified by:
archiveAllByOwnerTypeAndOwnerId
in interfacePaymentManagementService<P extends Payment>
- Parameters:
ownerType
- The type of the payment's owner.ownerId
- The id of the payment's owner.context
- Context information related to multitenancy.
-
archiveAllByOwnerTypeAndOwnerId
@Transactional("paymentTransactionTransactionManager") public void archiveAllByOwnerTypeAndOwnerId(@NonNull @NonNull String ownerType, @NonNull @NonNull String ownerId, @Nullable PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:PaymentManagementService
ArchivesPayments
for the given owner type and owner id.- Specified by:
archiveAllByOwnerTypeAndOwnerId
in interfacePaymentManagementService<P extends Payment>
- Parameters:
ownerType
- The type of the payment's owner.ownerId
- The id of the payment's owner.paymentLockTokens
- Token granted to resource that owns the payment lock.context
- Context information related to multitenancy.
-
blockCustomerMutability
public UpdatePaymentsResponse blockCustomerMutability(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentLockTokens paymentLockTokens, boolean shouldMarkTransactionsIneligibleForAutomaticReversal, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentManagementService
Finalizes the list ofpayments
provided.- Specified by:
blockCustomerMutability
in interfacePaymentManagementService<P extends Payment>
- Parameters:
payments
- the page of payments to finalizepaymentLockTokens
- the collection of payment lock tokens to grant access to the paymentsshouldMarkTransactionsIneligibleForAutomaticReversal
- whether or not to mark the payments as ineligible for automatic reversalcontextInfo
- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
blockCustomerMutabilityForPaymentFinalization
public UpdatePaymentsResponse blockCustomerMutabilityForPaymentFinalization(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentManagementService
Adds theDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKED_FOR_PAYMENT_FINALIZATION
restriction to the Payment'sPayment.getAccessRestrictions()
.- Specified by:
blockCustomerMutabilityForPaymentFinalization
in interfacePaymentManagementService<P extends Payment>
- Parameters:
payments
- the page of payments to updatepaymentLockTokens
- the collection of payment lock tokens to grant access to the paymentscontextInfo
- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
blockCustomerMutability
protected UpdatePaymentsResponse blockCustomerMutability(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentLockTokens paymentLockTokens, @NonNull @NonNull PaymentManagementAccessRestrictions restriction, boolean shouldMarkTransactionsIneligibleForAutomaticReversal, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
removeCustomerMutabilityBlockForPaymentFinalization
public UpdatePaymentsResponse removeCustomerMutabilityBlockForPaymentFinalization(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentManagementService
Unlocks the payments for the customer mutability by removing theDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKED_FOR_PAYMENT_FINALIZATION
fromPayment.getAccessRestrictions()
.- Specified by:
removeCustomerMutabilityBlockForPaymentFinalization
in interfacePaymentManagementService<P extends Payment>
- Parameters:
payments
- the page of payments to unlockpaymentLockTokens
- the collection of payment lock tokens to grant access to the paymentscontextInfo
- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
transferPaymentsToCSR
public UpdatePaymentsResponse transferPaymentsToCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentManagementService
Transfers the list ofpayments
provided to the CSR.- Specified by:
transferPaymentsToCSR
in interfacePaymentManagementService<P extends Payment>
- Parameters:
payments
- the page of payments to transferpaymentLockTokens
- the collection of payment lock tokens to grant access to the paymentscontextInfo
- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
transferPaymentsFromCSR
public UpdatePaymentsResponse transferPaymentsFromCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentManagementService
Transfers the list ofpayments
provided from the CSR.- Specified by:
transferPaymentsFromCSR
in interfacePaymentManagementService<P extends Payment>
- Parameters:
payments
- the page of payments to transferpaymentLockTokens
- the collection of payment lock tokens to grant access to the paymentscontextInfo
- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
archivePayment
-
getPaymentLockToken
@Nullable protected String getPaymentLockToken(@Nullable PaymentLockTokens paymentLockTokens, @NonNull @NonNull String paymentId) -
hasCustomerMutabilityBlockForPaymentFinalization
protected boolean hasCustomerMutabilityBlockForPaymentFinalization(@NonNull @NonNull Payment payment) -
buildUpdatePaymentsResponse
-
buildPayment
protected P buildPayment(@NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
populatePaymentFromRequest
protected P populatePaymentFromRequest(@NonNull P payment, @NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
modifyPaymentMethodProperties
protected P modifyPaymentMethodProperties(@NonNull P payment, @NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getIpAddress
@Nullable protected String getIpAddress(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getUserAgent
@Nullable protected String getUserAgent(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
populatePaymentOwningUser
protected void populatePaymentOwningUser(@NonNull P payment, @NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef) Populates the properties describing the owning user of the givenPayment
.The owning user properties will be resolved first using the given
CustomerRef
. If they cannot be resolved, the values specified in the givenCreatePaymentRequest
will be used instead.- Parameters:
payment
- thePayment
to populate the owning user properties forcreatePaymentRequest
- theCreatePaymentRequest
for thePayment
customerRef
- theCustomerRef
-
populatePaymentFromSavedPayment
@Deprecated(forRemoval=true) protected P populatePaymentFromSavedPayment(@NonNull P payment, @NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version. -
populatePaymentFromSavedPayment
protected P populatePaymentFromSavedPayment(@NonNull P payment, @NonNull @NonNull String savedPaymentMethodId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates the givenPayment
with the saved payment method specified inPayment.getSavedPaymentMethodId()
. -
buildBillingAddress
Deprecated, for removal: This API element is subject to removal in a future version.no longer used -
validateCreatedPayment
protected void validateCreatedPayment(@NonNull @NonNull Payment payment, @NonNull @NonNull CreatePaymentRequest createPaymentRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check the validity of the providedPayment
that is to be created.- Parameters:
payment
- The candidate payment to be created.createPaymentRequest
- The request to add a payment.contextInfo
- Context information around sandbox and multitenant state- Throws:
InvalidCreatePaymentRequestException
- if the create payment request produced an invalid payment
-
validateGatewayType
Validate that thePayment
has a supportedPayment.getGatewayType()
value.- Parameters:
payment
- The candidate payment to be added.- Throws:
InvalidCreatePaymentRequestException
- if the provided gatewayType is not supported
-
isPaymentGatewaySupported
Checks ifPaymentGatewayConfiguration
has been registered for the payment'sPayment.getGatewayType()
- Parameters:
gatewayType
- The gateway type specified by aPayment
- Returns:
- whether or not
PaymentGatewayConfiguration
has been registered for the payment'sPayment.getGatewayType()
-
validatePaymentAmounts
Validate that thePayment
amount is not a negative amount.- Parameters:
payment
- The candidate payment to be added.- Throws:
InvalidCreatePaymentRequestException
- if the provided payment amount is negative
-
validateRequestToSavePayment
Validate that the request to save the payment method for future use is not done for an already saved payment method.- Parameters:
payment
- The candidate payment method to be added.- Throws:
InvalidCreatePaymentRequestException
- if the provided payment method cannot be saved for future use
-
validatePaymentGatewayProperties
protected void validatePaymentGatewayProperties(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that thePayment
sufficiently represents a payment method for the declaredPayment.getGatewayType()
.- Parameters:
payment
- The candidate payment to be added.contextInfo
- Context information around sandbox and multitenant state- Throws:
com.broadleafcommerce.paymentgateway.service.exception.InvalidPaymentConfigurationException
- if the payment doesn't include sufficient data to execute transactions for the related gateway
-
populateAndValidatePaymentUpdates
protected P populateAndValidatePaymentUpdates(@NonNull P payment, @NonNull @NonNull UpdatePaymentRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
populatePaymentUpdatesFromRequest
protected P populatePaymentUpdatesFromRequest(@NonNull P payment, @NonNull @NonNull UpdatePaymentRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
populatePaymentUpdatesFromSavedPayment
protected P populatePaymentUpdatesFromSavedPayment(@NonNull P payment, @NonNull @NonNull UpdatePaymentRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
updatePaymentAmount
protected void updatePaymentAmount(@NonNull @NonNull Payment payment, @NonNull @NonNull javax.money.MonetaryAmount amount, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
canUpdatePaymentAmount
This method checks if the payment amount can be changed.- Returns:
false
if the payment is a single use payment, and it has successfully authorized amount, or it is awaiting 3DS or external interaction result. Otherwise returnstrue
.
-
hasSuccessfulTransactionOfType
-
requestReversalForTransactions
@Deprecated protected List<PaymentTransaction> requestReversalForTransactions(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deprecated. -
requestReversalForEligibleTransactions
@Deprecated protected List<PaymentTransaction> requestReversalForEligibleTransactions(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deprecated. -
requestReversalForEligibleTransactions
protected List<PaymentTransaction> requestReversalForEligibleTransactions(@NonNull @NonNull Payment payment, @Nullable String reversalReason, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
shouldMarkTransactionsIneligibleForAutomaticReversal
protected boolean shouldMarkTransactionsIneligibleForAutomaticReversal(@NonNull P payment, @NonNull @NonNull UpdatePaymentRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines if the givenUpdatePaymentRequest
should mark thePayment.getTransactions()
toDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED
.- Parameters:
payment
- thePayment
being updatedupdateRequest
- theUpdatePaymentRequest
containing the details to update thePayment
context
- context information around sandbox and multitenant state- Returns:
- true if the
Payment.getTransactions()
should be marked toDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED
, otherwise false
-
markTransactionsIneligibleForAutomaticReversal
protected List<PaymentTransaction> markTransactionsIneligibleForAutomaticReversal(@NonNull P payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Marks themanagement state
of the givenpayment's transactions
toDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED
.- Parameters:
payment
- thePayment
containing thePaymentTransactions
to mark themanagement state
forcontext
- context information around sandbox and multitenant state- Returns:
- the
PaymentTransactions
with the updatedmanagement state
-
validateUpdatePaymentRequest
protected void validateUpdatePaymentRequest(@NonNull @NonNull Payment payment, @NonNull @NonNull UpdatePaymentRequest updatePaymentRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that the updates provided by theUpdatePaymentRequest
parameter will produce a validPayment
.- Parameters:
payment
- The payment that is to be updated.updatePaymentRequest
- The request to update a payment.contextInfo
- Context information around sandbox and multitenant state- Throws:
InvalidUpdatePaymentRequestException
- if the update payment request produced an invalid payment
-
buildPaymentValidationRequest
protected com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequest buildPaymentValidationRequest(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
populateAddressesByType
protected void populateAddressesByType(@NonNull @NonNull Payment payment, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequest paymentValidationRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
buildTransactions
-
setupPaymentForClone
-
getMessage
-
getApplicationIdFromContext
@Nullable protected String getApplicationIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getTenantIdFromContext
@Nullable protected String getTenantIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getPaymentService
-
getPaymentLockService
-
getPaymentTransactionService
-
getPaymentGatewayResourceProvider
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider getPaymentGatewayResourceProvider() -
getPaymentAccountProvider
@Deprecated @Nullable protected CustomerPaymentAccountProvider<PaymentAccount> getPaymentAccountProvider()Deprecated.no longer used -
getMessageSource
protected org.springframework.context.MessageSource getMessageSource() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getPaymentSummaryService
-
setPaymentSummaryService
-
getSavedPaymentMethodManagementService
-
setSavedPaymentMethodManagementService
@Autowired public void setSavedPaymentMethodManagementService(SavedPaymentMethodManagementService savedPaymentMethodManagementService) -
getPaymentCallbackSecurityTokenUtil
@Nullable protected com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil getPaymentCallbackSecurityTokenUtil() -
setPaymentCallbackSecurityTokenUtil
@Autowired(required=false) public void setPaymentCallbackSecurityTokenUtil(@Nullable com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil paymentCallbackSecurityTokenUtil)
-