Interface PaymentAccessValidationService
- All Known Implementing Classes:
DefaultPaymentAccessValidationService
public interface PaymentAccessValidationService
Validates access to the payment based on passed in context.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanshouldAllowExistingPaymentArchival(CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, Payment existingPayment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) WhenCreatePaymentRequest.isShouldArchiveExistingPayments()is set to true, this method can be called to verify whether a found candidate existing payment can be archived.voidvalidateCreatePaymentAllowed(CreatePaymentRequest createPaymentRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates if payment can be created.default voidvalidateCustomerPaymentRequest(Payment payment, CustomerRef customerRef, UpdatePaymentRequest updatePaymentRequest, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates access to the payment based on the passed in context.voidvalidateCustomerPaymentRequest(Payment payment, CustomerRef customerRef, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates access to the payment based on the passed in context
-
Method Details
-
validateCustomerPaymentRequest
void validateCustomerPaymentRequest(Payment payment, CustomerRef customerRef, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates access to the payment based on the passed in context- Parameters:
payment- thePaymentrequiring accesscustomerRef- theCustomerRefto validate againstlockToken- the current lock tokencontext- context information surrounding multitenant state- Throws:
PaymentManagementAccessException- if the request is blocked
-
validateCustomerPaymentRequest
default void validateCustomerPaymentRequest(Payment payment, CustomerRef customerRef, UpdatePaymentRequest updatePaymentRequest, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates access to the payment based on the passed in context. In the case of aPaymentupdate request, the details of theUpdatePaymentRequestcan be factored into determining if the customer's request should be allowed or blocked- Parameters:
payment- thePaymentrequiring accesscustomerRef- theCustomerRefto validate againstupdatePaymentRequest- the request payload related to an update request (only present for update requests)lockToken- the current lock tokencontext- context information surrounding multitenant state- Throws:
PaymentManagementAccessException- if the request is blocked
-
shouldAllowExistingPaymentArchival
default boolean shouldAllowExistingPaymentArchival(CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, Payment existingPayment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) WhenCreatePaymentRequest.isShouldArchiveExistingPayments()is set to true, this method can be called to verify whether a found candidate existing payment can be archived. Typically, this should reject based on the same conditions invalidateCustomerPaymentRequest(Payment, CustomerRef, String, ContextInfo).- Parameters:
createPaymentRequest- aCreatePaymentRequestwhich has requested archival of existing payments viaCreatePaymentRequest.isShouldArchiveExistingPayments()customerRef- theCustomerRefthat is attempting to create the payment with archival of existing payments. Will be null if this is a system-initiated operation.existingPayment- an existing payment that was found and is being considered for archivalcontextInfo- context information surrounding multitenant state- Returns:
- true if the existing payment can be archived, false otherwise
-
validateCreatePaymentAllowed
void validateCreatePaymentAllowed(CreatePaymentRequest createPaymentRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validates if payment can be created. WhenPaymentValidationProperties.getCustomerMutabilityBlockedCreateCheck()contains an entry withBoolean.TRUEforCreatePaymentRequest.getOwnerType()and there is already a payment matchingCreatePaymentRequest.getOwnerType()andCreatePaymentRequest.getOwnerId()withPayment.getAccessRestrictions()containingDefaultPaymentManagementAccessRestrictions.CUSTOMER_MUTABILITY_BLOCKEDthen validation fails.- Parameters:
createPaymentRequest- a request to create thePaymentcontext- context information surrounding multitenant state- Throws:
PaymentManagementAccessException- if the request is blocked- Since:
- Payment Transaction Service 2.0.9, Release Train 2.2.2, Payment Transaction Service 2.0.9, Release Train 2.1.6
-