Class CustomerPaymentManagementEndpoint
java.lang.Object
com.broadleafcommerce.paymenttransaction.web.endpoint.CustomerPaymentManagementEndpoint
@FrameworkRestController
@FrameworkMapping("/customer-payments")
@DataRouteByKey("paymentTransaction")
public class CustomerPaymentManagementEndpoint
extends Object
- Author:
- Chris Kittrell (ckittrell)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCustomerPaymentManagementEndpoint
(PaymentManagementService<Payment> paymentManagementService, PaymentService<Payment> paymentService, PaymentSummaryService paymentSummaryService, PaymentVersionValidationService paymentVersionValidationService, PaymentAccessValidationService paymentAccessValidationService, SavedPaymentMethodAccessValidationService savedPaymentMethodAccessValidationService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
archivePayment
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String paymentId, Integer paymentVersion, CustomerRef customerRef) createPayment
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, CreatePaymentRequest createPaymentRequest, CustomerRef customerRef) protected PaymentAccessValidationService
protected PaymentManagementService<Payment>
protected PaymentService<Payment>
protected PaymentSummaryService
protected PaymentVersionValidationService
org.springframework.data.domain.Page<PaymentSummary>
readAllPaymentsForOwner
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String ownerType, String ownerId, CustomerRef customerRef, org.springframework.data.domain.Pageable page) org.springframework.http.ResponseEntity<PaymentSummary>
updatePayment
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String paymentId, UpdatePaymentRequest req, Integer paymentVersion, CustomerRef customerRef) protected org.springframework.data.domain.Page<Payment>
validateCustomerPaymentReadAllRequest
(@NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull CustomerRef customerRef, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected boolean
validateCustomerPaymentRequest
(@NonNull Payment payment, @NonNull CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the givenCustomerRef
's access to the givenPayment
.protected void
validateSavedPaymentMethodIfNecessary
(@NonNull CreatePaymentRequest req, @NonNull CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the saved payment method ownership for the givenCreatePaymentRequest
andCustomerRef
if the saved payment method id is specified.protected void
validateSavedPaymentMethodIfNecessary
(@NonNull UpdatePaymentRequest req, @NonNull CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the saved payment method ownership for the givenUpdatePaymentRequest
andCustomerRef
if the saved payment method id is specified.
-
Field Details
-
BASE_URI
- See Also:
-
CUSTOMER_AUTHENTICATION_FAILED
- See Also:
-
CUSTOMER_FORBIDDEN_ACCESS
- See Also:
-
-
Constructor Details
-
CustomerPaymentManagementEndpoint
public CustomerPaymentManagementEndpoint(PaymentManagementService<Payment> paymentManagementService, PaymentService<Payment> paymentService, PaymentSummaryService paymentSummaryService, PaymentVersionValidationService paymentVersionValidationService, PaymentAccessValidationService paymentAccessValidationService, SavedPaymentMethodAccessValidationService savedPaymentMethodAccessValidationService)
-
-
Method Details
-
createPayment
@FrameworkPostMapping(consumes="application/json") @Policy(permissionRoots="CUSTOMER_PAYMENT_MANAGEMENT") public PaymentSummary createPayment(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestBody CreatePaymentRequest createPaymentRequest, CustomerRef customerRef) -
readAllPaymentsForOwner
@FrameworkGetMapping(params={"ownerType","ownerId"}) @Policy(permissionRoots="CUSTOMER_PAYMENT_MANAGEMENT") public org.springframework.data.domain.Page<PaymentSummary> readAllPaymentsForOwner(@ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestParam String ownerType, @RequestParam String ownerId, CustomerRef customerRef, @PageableDefault(size=50) org.springframework.data.domain.Pageable page) -
updatePayment
@FrameworkPatchMapping(value="/{id}", consumes="application/json") @Policy(permissionRoots="CUSTOMER_PAYMENT_MANAGEMENT") public org.springframework.http.ResponseEntity<PaymentSummary> updatePayment(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String paymentId, @RequestBody UpdatePaymentRequest req, Integer paymentVersion, CustomerRef customerRef) -
archivePayment
@FrameworkDeleteMapping("/{id}") @Policy(permissionRoots="CUSTOMER_PAYMENT_MANAGEMENT") public void archivePayment(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String paymentId, Integer paymentVersion, CustomerRef customerRef) -
validateSavedPaymentMethodIfNecessary
protected void validateSavedPaymentMethodIfNecessary(@NonNull @NonNull CreatePaymentRequest req, @NonNull @NonNull CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the saved payment method ownership for the givenCreatePaymentRequest
andCustomerRef
if the saved payment method id is specified.- Parameters:
req
- theCreatePaymentRequest
to validatecustomerRef
- theCustomerRef
that is attempting to create the paymentcontextInfo
- context information related to multitenancy
-
validateSavedPaymentMethodIfNecessary
protected void validateSavedPaymentMethodIfNecessary(@NonNull @NonNull UpdatePaymentRequest req, @NonNull @NonNull CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the saved payment method ownership for the givenUpdatePaymentRequest
andCustomerRef
if the saved payment method id is specified.- Parameters:
req
- theUpdatePaymentRequest
to validatecustomerRef
- theCustomerRef
that is attempting to update the paymentcontextInfo
- context information related to multitenancy
-
validateCustomerPaymentReadAllRequest
protected org.springframework.data.domain.Page<Payment> validateCustomerPaymentReadAllRequest(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull CustomerRef customerRef, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
validateCustomerPaymentRequest
protected boolean validateCustomerPaymentRequest(@NonNull @NonNull Payment payment, @NonNull @NonNull CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the givenCustomerRef
's access to the givenPayment
.- Parameters:
payment
- thePayment
being accessedcustomerRef
- theCustomerRef
representing the user attempting to access the paymentcontextInfo
- Context information around sandbox and multitenant state- Returns:
- true if payment can be accessed by the given
CustomerRef
, otherwise false
-
getPaymentManagementService
-
getPaymentService
-
getPaymentSummaryService
-
getPaymentVersionValidationService
-
getPaymentAccessValidationService
-
getSavedPaymentMethodAccessValidationService
-