Class DefaultPaymentAccessValidationService

java.lang.Object
com.broadleafcommerce.paymenttransaction.service.validation.DefaultPaymentAccessValidationService
All Implemented Interfaces:
PaymentAccessValidationService

public class DefaultPaymentAccessValidationService extends Object implements PaymentAccessValidationService
Default implementation of PaymentAccessValidationService.
  • Constructor Details

    • DefaultPaymentAccessValidationService

      public DefaultPaymentAccessValidationService(PaymentTTLValidationService paymentTTLValidationService, PaymentManagementService<Payment> paymentManagementService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
  • Method Details

    • validateCustomerPaymentRequest

      public void validateCustomerPaymentRequest(@NonNull @NonNull Payment payment, @NonNull @NonNull CustomerRef customerRef, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentAccessValidationService
      Validates access to the payment based on the passed in context
      Specified by:
      validateCustomerPaymentRequest in interface PaymentAccessValidationService
      Parameters:
      payment - the Payment requiring access
      customerRef - the CustomerRef to validate against
      lockToken - the current lock token
      context - context information surrounding multitenant state
    • validatePaymentCustomerRef

      protected void validatePaymentCustomerRef(@NonNull @NonNull Payment payment, @NonNull @NonNull CustomerRef customerRef, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • isCustomerMutabilityBlocked

      protected boolean isCustomerMutabilityBlocked(@NonNull @NonNull Payment payment)
    • isCustomerMutabilityBlockedForPaymentFinalization

      protected boolean isCustomerMutabilityBlockedForPaymentFinalization(@NonNull @NonNull Payment payment)
    • customerMatches

      protected boolean customerMatches(@NonNull @NonNull Payment payment, @NonNull @NonNull CustomerRef customer)
      Validates if the owning user of the Payment matches the given CustomerRef.

      This is to ensure that the currently authenticated user, the given CustomerRef, has access to the Payment.

      Parameters:
      payment - the Payment to check the owning user for
      customer - the CustomerRef to check against
      Returns:
      true if the payment's owning user matches the given CustomerRef, otherwise false
    • validateAccessForAnonymousOwnedPayment

      protected boolean validateAccessForAnonymousOwnedPayment(@NonNull @NonNull Payment payment, @NonNull @NonNull CustomerRef customerRef)
      Validates access for anonymous owned Payment for the given CustomerRef, which checks against the Payment.getOwningUserEmailAddress() and CustomerRef.getUsername() by default.

      Override this method for additional validations or if CustomerRef.getUsername() is not the same as the customer email.

      Parameters:
      payment - the Payment being accessed
      customerRef - the CustomerRef to check against
      Returns:
      true if access is allowed, otherwise false.
    • getPaymentTTLValidationService

      protected PaymentTTLValidationService getPaymentTTLValidationService()
    • getPaymentManagementService

      protected PaymentManagementService<Payment> getPaymentManagementService()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getPaymentTransactionServiceProperties

      protected PaymentTransactionServiceProperties getPaymentTransactionServiceProperties()
    • setPaymentTransactionServiceProperties

      @Autowired public void setPaymentTransactionServiceProperties(PaymentTransactionServiceProperties paymentTransactionServiceProperties)