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
ConstructorsConstructorDescriptionDefaultPaymentManagementService(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 TypeMethodDescriptionvoidarchiveAllByOwnerTypeAndOwnerId(@NonNull String ownerType, @NonNull String ownerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) ArchivesPaymentsfor the given owner type and owner id.voidarchiveAllByOwnerTypeAndOwnerId(@NonNull String ownerType, @NonNull String ownerId, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) ArchivesPaymentsfor the given owner type and owner id.voidarchivePayment(@NonNull String id, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Archives thePaymentbased on the provided id.protected voidarchivePayment(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 ofpaymentsprovided.protected UpdatePaymentsResponseblockCustomerMutability(@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_FINALIZATIONrestriction to the Payment'sPayment.getAccessRestrictions().protected AddressbuildBillingAddress(PaymentAccount paymentAccount) Deprecated, for removal: This API element is subject to removal in a future version.no longer usedprotected PbuildPayment(@NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequestbuildPaymentValidationRequest(@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 UpdatePaymentsResponsebuildUpdatePaymentsResponse(List<Payment> failedPayments, List<Payment> successfulPayments, Map<String, String> failureMessages) protected booleancanUpdatePaymentAmount(@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 aPaymentbased on the providedCreatePaymentRequest.protected StringgetApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected StringgetIpAddress(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected StringgetMessage(@NonNull String errorMessage, Object... args) protected org.springframework.context.MessageSourceprotected CustomerPaymentAccountProvider<PaymentAccount>Deprecated.no longer usedprotected com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtilprotected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProviderprotected PaymentLockService<P>protected StringgetPaymentLockToken(PaymentLockTokens paymentLockTokens, @NonNull String paymentId) protected PaymentService<P>protected PaymentSummaryServiceprotected PaymentTransactionService<PaymentTransaction>protected SavedPaymentMethodManagementServiceprotected StringgetTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.common.extension.TypeFactoryprotected StringgetUserAgent(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected booleanhasCustomerMutabilityBlockForPaymentFinalization(@NonNull Payment payment) protected booleanhasSuccessfulTransactionOfType(@NonNull Payment payment, @NonNull String transactionType) protected booleanisPaymentGatewaySupported(String gatewayType) Checks ifPaymentGatewayConfigurationhas been registered for the payment'sPayment.getGatewayType()protected List<PaymentTransaction>markTransactionsIneligibleForAutomaticReversal(P payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Marks themanagement stateof the givenpayment's transactionstoDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED.protected PmodifyPaymentMethodProperties(P payment, @NonNull CreatePaymentRequest createPaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidpopulateAddressesByType(@NonNull Payment payment, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequest paymentValidationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected PpopulateAndValidatePaymentUpdates(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected PpopulatePaymentFromRequest(P payment, @NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected PpopulatePaymentFromSavedPayment(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 PpopulatePaymentFromSavedPayment(P payment, @NonNull String savedPaymentMethodId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates the givenPaymentwith the saved payment method specified inPayment.getSavedPaymentMethodId().protected voidpopulatePaymentOwningUser(P payment, @NonNull CreatePaymentRequest createPaymentRequest, CustomerRef customerRef) Populates the properties describing the owning user of the givenPayment.protected PpopulatePaymentUpdatesFromRequest(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected PpopulatePaymentUpdatesFromSavedPayment(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_FINALIZATIONfromPayment.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.voidsetPaymentCallbackSecurityTokenUtil(com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil paymentCallbackSecurityTokenUtil) voidsetPaymentSummaryService(PaymentSummaryService paymentSummaryService) voidsetSavedPaymentMethodManagementService(SavedPaymentMethodManagementService savedPaymentMethodManagementService) protected PsetupPaymentForClone(P payment) protected booleanshouldMarkTransactionsIneligibleForAutomaticReversal(P payment, @NonNull UpdatePaymentRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines if the givenUpdatePaymentRequestshould 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 ofpaymentsprovided from the CSR.transferPaymentsToCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpaymentsprovided to the CSR.updatePayment(@NonNull String id, @NonNull UpdatePaymentRequest updateRequest, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePaymentbased on the providedUpdatePaymentRequest.protected voidupdatePaymentAmount(@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 thePaymentfor the customer based on the providedUpdatePaymentRequest.protected voidvalidateCreatedPayment(@NonNull Payment payment, @NonNull CreatePaymentRequest createPaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check the validity of the providedPaymentthat is to be created.protected voidvalidateGatewayType(@NonNull Payment payment) Validate that thePaymenthas a supportedPayment.getGatewayType()value.protected voidvalidatePaymentAmounts(@NonNull Payment payment) Validate that thePaymentamount is not a negative amount.protected voidvalidatePaymentGatewayProperties(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that thePaymentsufficiently represents a payment method for the declaredPayment.getGatewayType().protected voidvalidateRequestToSavePayment(@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 voidvalidateUpdatePaymentRequest(@NonNull Payment payment, @NonNull UpdatePaymentRequest updatePaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validate that the updates provided by theUpdatePaymentRequestparameter 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:PaymentManagementServiceCreates aPaymentbased on the providedCreatePaymentRequest.- Specified by:
createPaymentin interfacePaymentManagementService<P extends Payment>- Parameters:
createPaymentRequest- The request payload used to build a newPayment.contextInfo- Context information related to multitenancy.- Returns:
- A
Paymentbased 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:PaymentManagementServiceFind a list of payments for the given payment ids.- Specified by:
readAllByPaymentIdsin 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:PaymentManagementServiceFind a page of payments for the given owner type and owner id.- Specified by:
readAllByOwnerTypeAndOwnerIdin 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:PaymentManagementServiceUpdates thePaymentfor the customer based on the providedUpdatePaymentRequest. The default implementation archives the payment ifUpdatePaymentRequest.getAmount()is equal to zero.- Specified by:
updatePaymentForCustomerin 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:PaymentManagementServiceUpdates thePaymentbased on the providedUpdatePaymentRequest. The default implementation archives the payment ifUpdatePaymentRequest.getAmount()is equal to zero.- Specified by:
updatePaymentin 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:PaymentManagementServiceArchives thePaymentbased on the provided id.- Specified by:
archivePaymentin 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:PaymentManagementServiceArchivesPaymentsfor the given owner type and owner id.- Specified by:
archiveAllByOwnerTypeAndOwnerIdin 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:PaymentManagementServiceArchivesPaymentsfor the given owner type and owner id.- Specified by:
archiveAllByOwnerTypeAndOwnerIdin 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:PaymentManagementServiceFinalizes the list ofpaymentsprovided.- Specified by:
blockCustomerMutabilityin 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:PaymentManagementServiceAdds theDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKED_FOR_PAYMENT_FINALIZATIONrestriction to the Payment'sPayment.getAccessRestrictions().- Specified by:
blockCustomerMutabilityForPaymentFinalizationin 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:PaymentManagementServiceUnlocks the payments for the customer mutability by removing theDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKED_FOR_PAYMENT_FINALIZATIONfromPayment.getAccessRestrictions().- Specified by:
removeCustomerMutabilityBlockForPaymentFinalizationin 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:PaymentManagementServiceTransfers the list ofpaymentsprovided to the CSR.- Specified by:
transferPaymentsToCSRin 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:PaymentManagementServiceTransfers the list ofpaymentsprovided from the CSR.- Specified by:
transferPaymentsFromCSRin 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 givenCreatePaymentRequestwill be used instead.- Parameters:
payment- thePaymentto populate the owning user properties forcreatePaymentRequest- theCreatePaymentRequestfor thePaymentcustomerRef- 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 givenPaymentwith 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 providedPaymentthat 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 thePaymenthas a supportedPayment.getGatewayType()value.- Parameters:
payment- The candidate payment to be added.- Throws:
InvalidCreatePaymentRequestException- if the provided gatewayType is not supported
-
isPaymentGatewaySupported
Checks ifPaymentGatewayConfigurationhas been registered for the payment'sPayment.getGatewayType()- Parameters:
gatewayType- The gateway type specified by aPayment- Returns:
- whether or not
PaymentGatewayConfigurationhas been registered for the payment'sPayment.getGatewayType()
-
validatePaymentAmounts
Validate that thePaymentamount 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 thePaymentsufficiently 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:
falseif 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 givenUpdatePaymentRequestshould mark thePayment.getTransactions()toDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED.- Parameters:
payment- thePaymentbeing updatedupdateRequest- theUpdatePaymentRequestcontaining the details to update thePaymentcontext- 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 stateof the givenpayment's transactionstoDefaultTransactionManagementStates.AUTOMATIC_REVERSAL_NOT_ALLOWED.- Parameters:
payment- thePaymentcontaining thePaymentTransactionsto mark themanagement stateforcontext- context information around sandbox and multitenant state- Returns:
- the
PaymentTransactionswith 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 theUpdatePaymentRequestparameter 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)
-