Interface AlipayPaymentTransactionStrategy

All Known Implementing Classes:
DefaultAlipayPaymentTransactionStrategy

public interface AlipayPaymentTransactionStrategy
Deals with payment transaction when the transaction is in process
  • Method Details

    • createForNewRequest

      void createForNewRequest(OrderModel orderModel, String requestUrl)
      Saves new transaction entry once new direct_pay request is created
      Parameters:
      orderModel - the order
      requestUrl - accessible URL
    • saveForStatusCheck

      AlipayPaymentTransactionEntryModel saveForStatusCheck(OrderModel orderModel, AlipayRawPaymentStatus checkTradeResponseData)
      Saves alipay payment transaction entry upon the completion of payment status check
      Parameters:
      orderModel - the order
      checkTradeResponseData - the trade status check
      Returns:
      AlipayPaymentTransactionEntryModel
    • updateForNotification

      void updateForNotification(OrderModel orderModel, AlipayRawDirectPayNotification directPayNotifyResponseData)
      Updates alipay payment transaction and entry upon receiving notification data from alipay
      Parameters:
      orderModel - order handled by the notification data OrderModel
      directPayNotifyResponseData - notification from alipay AlipayRawDirectPayNotification
    • updateForCancelPayment

      void updateForCancelPayment(OrderModel orderModel, AlipayRawCancelPaymentResult alipayRawCancelPaymentResult)
      Updates alipay payment transaction and entry upon canceling trade
      Parameters:
      orderModel - transaction related order
      alipayRawCancelPaymentResult - response from alipay upon canceling trade AlipayRawCancelPaymentResult
    • updateForError

      void updateForError(OrderModel orderModel, AlipayRawDirectPayErrorInfo aipayRawDirectPayErrorInfo)
      Updates alipay payment transaction and entry upon receiving error data from alipay
      Parameters:
      orderModel - order handled by the error data
      aipayRawDirectPayErrorInfo - error data from alipay AlipayRawDirectPayErrorInfo
    • checkCaptureTransactionEntry

      boolean checkCaptureTransactionEntry(OrderModel orderModel, TransactionStatus status)
      Checks if the alipay payment transaction exists under an order that has capture entry
      Parameters:
      orderModel - order needed to check
      status - transaction status TransactionStatus
      Returns:
      false if the transaction exists
    • getPaymentTransactionEntry

      Optional<AlipayPaymentTransactionEntryModel> getPaymentTransactionEntry(OrderModel orderModel, TransactionStatus status, PaymentTransactionType paymentTransactionType)
      Finds payment transaction entry with given parameters
      Parameters:
      orderModel - order needed to check
      status - transaction status TransactionStatus
      paymentTransactionType - payment transaction status PaymentTransactionType
      Returns:
      an optional describing the result of AlipayPaymentTransactionEntryModel if a value is present, otherwise an empty Optional
    • getPaymentTransactionWithCaptureEntry

      Optional<AlipayPaymentTransactionModel> getPaymentTransactionWithCaptureEntry(OrderModel orderModel, TransactionStatus status)
      Finds payment transaction whose type is capture
      Parameters:
      orderModel - order needed to check
      status - transaction status TransactionStatus
      Returns:
      an Optional describing the result of AlipayPaymentTransactionEntryModel if a value is present, otherwise an empty Optional
    • updateForRefundNotification

      Map<OrderModel,Boolean> updateForRefundNotification(List<AlipayRefundData> alipayRefundData)
      Updates transaction for refund notification
      Parameters:
      alipayRefundDatas - refund data AlipayRefundData}
      Returns:
      refund order payment status map
    • updateTransactionForRefundRequest

      void updateTransactionForRefundRequest(OrderModel orderModel, AlipayRefundRequestData alipayRefundRequestData)
      Creates a transaction entry when user creates a refund request
      Parameters:
      orderModel - order needed to refund
      alipayRefundRequestData - request data sent to alipay