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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCustomerPaymentManagementEndpoint(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) protected com.broadleafcommerce.paymentgateway.domain.PaymentInfobuildPaymentInfo(@NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected com.broadleafcommerce.paymentgateway.domain.UpdateGatewayPaymentRequestbuildUpdateGatewayPaymentRequest(@NonNull UpdatePaymentRequest req, @NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) createPayment(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, CreatePaymentRequest createPaymentRequest, CustomerRef customerRef) protected StringgetApplicationId(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected PaymentAccessValidationServiceprotected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProviderprotected PaymentManagementService<Payment>protected PaymentService<Payment>protected PaymentSummaryServiceprotected PaymentVersionValidationServiceprotected StringgetTenantId(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected com.broadleafcommerce.common.extension.TypeFactoryorg.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) voidsetPaymentGatewayResourceProvider(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider) voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) updateGatewayPaymentIfNecessary(@NonNull UpdatePaymentRequest request, @NonNull Payment payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) 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 booleanvalidateCustomerPaymentRequest(@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:
-
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 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
-
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- 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
-
updateGatewayPaymentIfNecessary
@Nullable protected Map<String,Object> updateGatewayPaymentIfNecessary(@NonNull @NonNull UpdatePaymentRequest request, @NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
buildUpdateGatewayPaymentRequest
protected com.broadleafcommerce.paymentgateway.domain.UpdateGatewayPaymentRequest buildUpdateGatewayPaymentRequest(@NonNull @NonNull UpdatePaymentRequest req, @NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
buildPaymentInfo
protected com.broadleafcommerce.paymentgateway.domain.PaymentInfo buildPaymentInfo(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getApplicationId
@Nullable protected String getApplicationId(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getTenantId
@Nullable protected String getTenantId(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getPaymentManagementService
-
getPaymentGatewayResourceProvider
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider getPaymentGatewayResourceProvider() -
setPaymentGatewayResourceProvider
@Autowired public void setPaymentGatewayResourceProvider(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider) -
getPaymentService
-
getPaymentSummaryService
-
getPaymentVersionValidationService
-
getPaymentAccessValidationService
-
getSavedPaymentMethodAccessValidationService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-