Class AbstractPaymentReversalFulfillmentStatusChangeListener

    • Field Detail

      • STATUSES_ELIGIBLE_FOR_CAPTURE

        protected static final Set<String> STATUSES_ELIGIBLE_FOR_CAPTURE
    • Constructor Detail

      • AbstractPaymentReversalFulfillmentStatusChangeListener

        public AbstractPaymentReversalFulfillmentStatusChangeListener​(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService,
                                                                      PaymentAuthReversalService paymentAuthReversalService,
                                                                      OrderProvider<com.broadleafcommerce.order.client.domain.Order> orderProvider,
                                                                      FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillmentProvider,
                                                                      ResourceLockProvider resourceLockProvider)
    • Method Detail

      • getOrder

        protected com.broadleafcommerce.order.client.domain.Order getOrder​(@NonNull
                                                                           @NonNull FulfillmentStatusChangeEvent event)
        Get the Order in the event, refreshing in case any payment changes have occurred on the order.
        Parameters:
        event - the event of the fulfillment being fulfilled
        Returns:
        the retrieved order based on the event
      • processEventInternal

        protected abstract void processEventInternal​(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment,
                                                     com.broadleafcommerce.order.client.domain.Order order,
                                                     String previousFulfillmentStatus,
                                                     @Nullable
                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        This should be extended to invoke the business logic for reversing non-captured payments. This will be utilized from processEvent(Message) which will have already handled locking and hydrating the order and fulfillment.
        Parameters:
        fulfillment - the fulfillment which changed status
        order - the order containing the fulfillment
        previousFulfillmentStatus - the original status of the fulfillment before the change
        contextInfo - context information surrounding sandboxing and multitenant state
      • reverseRemainingOrderAuthPaymentsIfNeeded

        protected boolean reverseRemainingOrderAuthPaymentsIfNeeded​(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment,
                                                                    com.broadleafcommerce.order.client.domain.Order order,
                                                                    @Nullable
                                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        If the entire order is guaranteed to no longer have any more fulfillments to capture, then reverse any remaining authorized but not captured payments on the order.
        Parameters:
        fulfillment - the fulfillment which changed status
        order - the order containing the fulfillment
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        true if any order authorized payments were reversed, else false
      • entireOrderDoneCapturing

        protected boolean entireOrderDoneCapturing​(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment,
                                                   com.broadleafcommerce.order.client.domain.Order order,
                                                   @Nullable
                                                   com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Determines if this order will not have any more captures applied against its payments.
        Parameters:
        fulfillment - the fulfillment which was cancelled
        order - the order to check if it could be captured again
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        whether this order will not have any more payment captures
      • cannotBeCaptured

        protected boolean cannotBeCaptured​(String fulfillmentStatus)
      • getIdempotentMessageService

        protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentMessageService()
      • getOrderProvider

        protected OrderProvider<com.broadleafcommerce.order.client.domain.Order> getOrderProvider()
      • getFulfillmentProvider

        protected FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> getFulfillmentProvider()