Class AccountPaymentManagementEndpoint
java.lang.Object
com.broadleafcommerce.paymenttransaction.web.endpoint.AccountPaymentManagementEndpoint
@FrameworkRestController
@FrameworkMapping("/account-payments")
@DataRouteByKey("paymentTransaction")
public class AccountPaymentManagementEndpoint
extends Object
- Author:
 - Chris Kittrell (ckittrell), Sunny Yu
 
- 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionAccountPaymentManagementEndpoint(PaymentManagementService<Payment> paymentManagementService, PaymentService<Payment> paymentService, PaymentSummaryService paymentSummaryService, PaymentVersionValidationService paymentVersionValidationService, PaymentAccessValidationService paymentAccessValidationService, SavedPaymentMethodAccessValidationService savedPaymentMethodAccessValidationService)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidarchivePayment(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 PaymentAccessValidationServiceprotected PaymentManagementService<Payment>protected PaymentService<Payment>protected PaymentSummaryServiceprotected PaymentVersionValidationServiceorg.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>validateAccountPaymentReadAllRequest(@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 booleanvalidatePaymentAccess(@NonNull Payment payment, @NonNull CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the givenCustomerRef's access to the givenPayment.protected voidvalidateSavedPaymentMethodIfNecessary(@NonNull CreatePaymentRequest req, @NonNull CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the saved payment method ownership for the givenCreatePaymentRequestandCustomerRefif the saved payment method id is specified.protected voidvalidateSavedPaymentMethodIfNecessary(@NonNull UpdatePaymentRequest req, @NonNull CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the saved payment method ownership for the givenUpdatePaymentRequestandCustomerRefif the saved payment method id is specified. 
- 
Field Details
- 
BASE_URI
- See Also:
 
 
 - 
 - 
Constructor Details
- 
AccountPaymentManagementEndpoint
public AccountPaymentManagementEndpoint(PaymentManagementService<Payment> paymentManagementService, PaymentService<Payment> paymentService, PaymentSummaryService paymentSummaryService, PaymentVersionValidationService paymentVersionValidationService, PaymentAccessValidationService paymentAccessValidationService, SavedPaymentMethodAccessValidationService savedPaymentMethodAccessValidationService)  
 - 
 - 
Method Details
- 
createPayment
@FrameworkPostMapping(consumes="application/json") @Policy(permissionRoots="ACCOUNT_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="ACCOUNT_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="ACCOUNT_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="ACCOUNT_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 givenCreatePaymentRequestandCustomerRefif the saved payment method id is specified.- Parameters:
 req- theCreatePaymentRequestto validatecustomerRef- theCustomerRefthat 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 givenUpdatePaymentRequestandCustomerRefif the saved payment method id is specified.- Parameters:
 req- theUpdatePaymentRequestto validatecustomerRef- theCustomerRefthat is attempting to update the paymentcontextInfo- context information related to multitenancy
 - 
validateAccountPaymentReadAllRequest
protected org.springframework.data.domain.Page<Payment> validateAccountPaymentReadAllRequest(@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)  - 
validatePaymentAccess
protected boolean validatePaymentAccess(@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- thePaymentbeing accessedcustomerRef- theCustomerRefrepresenting 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
 
 -