Class PaymentValidationRequest

java.lang.Object
com.broadleafcommerce.paymentgateway.domain.PaymentValidationRequest
All Implemented Interfaces:
Serializable

public class PaymentValidationRequest extends Object implements Serializable

This entity is designed to store payment methods associated to a Cart, the getAmount() the user is to be charged via that payment method, and the history of attempted transactions (authorizations, charges, refunds, etc.) against that payment method for the owning Cart. Every payment gateway interaction should have its results stored in the transactions collection.

Author:
Chad Harchar (charchar), Chris Kittrell (ckittrell)
See Also:
  • Constructor Details

    • PaymentValidationRequest

      public PaymentValidationRequest()
  • Method Details

    • getCurrency

      @Nullable public javax.money.CurrencyUnit getCurrency()
      The currency gathered from the getAmount()
      Returns:
      The currency gathered from the payment amount
    • addressByType

      public Address<PaymentValidationRequest> addressByType(String addressType)
    • addAddress

      public Address<PaymentValidationRequest> addAddress(String addressType, Address<PaymentValidationRequest> address)
      Adds an Address to the map, identified by the provided addressType.
      Parameters:
      addressType - The type of address that is to be added
      address - The address that is to be added
      Returns:
      The address that was added to the map.
    • getAddress

      @Nullable public Address<PaymentValidationRequest> getAddress(String addressType)
      Gathers one of the payment's related addresses by type
      Returns:
      The payment's related address identified by type
    • getShouldSavePaymentToCustomer

      @Deprecated(since="1.0.2", forRemoval=true) public boolean getShouldSavePaymentToCustomer()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 1.0.2, in favor of shouldSavePaymentForFutureUse() to support owning user types other than a customer (i.e. account).
    • shouldSavePaymentForFutureUse

      public boolean shouldSavePaymentForFutureUse()
      Should the payment method be saved to the owning user
      Returns:
      Should the payment method be saved to the owning user
    • getId

      public String getId()
      The id of this payment.
      Returns:
      The id of this payment.
    • getName

      public String getName()
      The name of this payment. This name is typically something like "Visa ending in 1234".
      Returns:
      The name of this payment.
    • getOwnerType

      public String getOwnerType()
      Describes the owner of the payment. For example, the payment could have originated with a cart or a subscription, therefore this value might be CART or SUBSCRIPTION.
      Returns:
      The type describing the owner of the payment
    • getOwnerId

      public String getOwnerId()
      The id of the entity that owns this payment. For example, this may be a cart id, or a subscription billing cycle id.
      Returns:
      The id of the entity that owns this payment.
    • getOwningUserType

      public String getOwningUserType()
      Describes the owning user type of the payment. For example, the payment could belong to a customer, therefore this value might be BLC_CUSTOMER.
      Returns:
      The type describing the owning user of the payment
    • getOwningUserId

      public String getOwningUserId()
      The id of the owning user that owns this payment. For example, this may be a customer id.
      Returns:
      The id of the owning user that owns this payment.
    • getType

      public String getType()
      The type of this payment like Credit Card or Gift Card.
      Returns:
      The type of this payment like Credit Card or Gift Card.
    • getGatewayType

      public String getGatewayType()
      The gateway used to process this payment. Only a SINGLE payment gateway can modify transactions on a particular payment.
      Returns:
      The gateway used to process this payment.
    • getAmount

      public javax.money.MonetaryAmount getAmount()
      The amount for which this payment is allotted. If specified, the amount details should be equal to this amount using the following equation: transactionAmount = subtotal + fulfillmentTotal + feesTotal - adjustmentsTotal + taxTotal - includedTaxTotal.
      Returns:
      The amount for which this payment is allotted.
    • getSubtotal

      public javax.money.MonetaryAmount getSubtotal()
      The payment's total usually excluding adjustments, tax, fees, and shipping. Note: Only the amount is required, but if this value is included, then the fulfillmentTotal, feesTotal, adjustmentsTotal, taxTotal, & includedTaxTotal should be included also.
      Returns:
      The payment's total usually excluding adjustments, tax, fees, and shipping.
    • getAdjustmentsTotal

      public javax.money.MonetaryAmount getAdjustmentsTotal()
      The payment's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment discounts. Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, feesTotal, taxTotal, & includedTaxTotal should be included also.
      Returns:
      The payment's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment discounts.
    • getFulfillmentTotal

      public javax.money.MonetaryAmount getFulfillmentTotal()
      The payment's total fulfillment cost. Note: Only the amount is required, but if this value is included, then the subtotal, feesTotal, adjustmentsTotal, taxTotal, & includedTaxTotal should be included also.
      Returns:
      The payment's total fulfillment cost.
    • getFeesTotal

      public javax.money.MonetaryAmount getFeesTotal()
      The total fees related to the transaction amount Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, adjustmentsTotal, taxTotal, & includedTaxTotal should be included also.
      Returns:
      The total fees related to the transaction amount
    • getTaxTotal

      public javax.money.MonetaryAmount getTaxTotal()
      The payment's total tax cost. Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, feesTotal, adjustmentsTotal, & includedTaxTotal should be included also.
      Returns:
      The payment's total tax cost.
    • getIncludedTaxTotal

      public javax.money.MonetaryAmount getIncludedTaxTotal()
      The amount of taxes that are included in the subtotal (VAT). Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, feesTotal, adjustmentsTotal, & taxTotal should be included also.
      Returns:
      The amount of taxes that are included in the subtotal (VAT).
    • getAddressByType

      public Map<String,Address<PaymentValidationRequest>> getAddressByType()
      The collection of related addresses that may include billing or shipping addresses
      Returns:
      The collection of related addresses
    • getPaymentMethodProperties

      public Map<String,String> getPaymentMethodProperties()
      Map to capture any information about the payment method needed to perform gateway transactions
      Returns:
      Map to capture any information about the payment method needed to perform gateway transactions
    • getAttributes

      public Map<String,String> getAttributes()
      General use map to capture any additional attributes needed for this PaymentValidationRequest
      Returns:
      General use map to capture any additional attributes needed for this PaymentValidationRequest
    • getTransactions

      public List<PaymentTransaction> getTransactions()
      Transaction data representing each payment gateway interaction related to this payment.
      Returns:
      Transactions related to this payment.
    • isSingleUsePaymentMethod

      public boolean isSingleUsePaymentMethod()
      Whether or not the underlying payment method can only be used once. In most cases, we're managing a single-use token that represents a credit card. This flag is especially important for managing payments with successful transactions. In those cases, the token has already been used and cannot be reused. If we need modify the payment's amount, then we may actually need to archive the existing payment, and create a new payment, with a new underlying token. Additionally, this flag is helpful when needing to re-authorize an expired authorization transaction. In that case, if the payment represents a single-use payment method, then the re-authorization may not be possible, and you'll need to seek an alternative form of payment.
      Returns:
      Whether or not the underlying payment method can only be used once
    • getVersion

      public Integer getVersion()
      The version of this payment. Used for checking that the requested version of the payment is up-to-date before saving changes. Required for any request which results in an update being made to the payment. This should never be manually incremented/decremented.
    • setId

      public void setId(String id)
      The id of this payment.
      Parameters:
      id - The id of this payment.
    • setName

      public void setName(String name)
      The name of this payment. This name is typically something like "Visa ending in 1234".
      Parameters:
      name - The name of this payment.
    • setOwnerType

      public void setOwnerType(String ownerType)
      Describes the owner of the payment. For example, the payment could have originated with a cart or a subscription, therefore this value might be CART or SUBSCRIPTION.
      Parameters:
      ownerType - The type describing the owner of the payment
    • setOwnerId

      public void setOwnerId(String ownerId)
      The id of the entity that owns this payment. For example, this may be a cart id, or a subscription billing cycle id.
      Parameters:
      ownerId - The id of the entity that owns this payment.
    • setOwningUserType

      public void setOwningUserType(String owningUserType)
      Describes the owning user type of the payment. For example, the payment could belong to a customer, therefore this value might be BLC_CUSTOMER.
      Parameters:
      owningUserType - The type describing the owning user of the payment
    • setOwningUserId

      public void setOwningUserId(String owningUserId)
      The id of the owning user that owns this payment. For example, this may be a customer id.
      Parameters:
      owningUserId - The id of the owning user that owns this payment.
    • setType

      public void setType(String type)
      The type of this payment like Credit Card or Gift Card.
      Parameters:
      type - The type of this payment like Credit Card or Gift Card.
    • setGatewayType

      public void setGatewayType(String gatewayType)
      The gateway used to process this payment. Only a SINGLE payment gateway can modify transactions on a particular payment.
      Parameters:
      gatewayType - The gateway used to process this payment.
    • setAmount

      public void setAmount(javax.money.MonetaryAmount amount)
      The amount for which this payment is allotted. If specified, the amount details should be equal to this amount using the following equation: transactionAmount = subtotal + fulfillmentTotal + feesTotal - adjustmentsTotal + taxTotal - includedTaxTotal.
      Parameters:
      amount - The amount for which this payment is allotted.
    • setSubtotal

      public void setSubtotal(javax.money.MonetaryAmount subtotal)
      The payment's total usually excluding adjustments, tax, fees, and shipping. Note: Only the amount is required, but if this value is included, then the fulfillmentTotal, feesTotal, adjustmentsTotal, taxTotal, & includedTaxTotal should be included also.
      Parameters:
      subtotal - The payment's total usually excluding adjustments, tax, fees, and shipping.
    • setAdjustmentsTotal

      public void setAdjustmentsTotal(javax.money.MonetaryAmount adjustmentsTotal)
      The payment's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment discounts. Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, feesTotal, taxTotal, & includedTaxTotal should be included also.
      Parameters:
      adjustmentsTotal - The payment's adjustments (a.k.a discounts) total, usually excluding shipping/fulfillment discounts.
    • setFulfillmentTotal

      public void setFulfillmentTotal(javax.money.MonetaryAmount fulfillmentTotal)
      The payment's total fulfillment cost. Note: Only the amount is required, but if this value is included, then the subtotal, feesTotal, adjustmentsTotal, taxTotal, & includedTaxTotal should be included also.
      Parameters:
      fulfillmentTotal - The payment's total fulfillment cost.
    • setFeesTotal

      public void setFeesTotal(javax.money.MonetaryAmount feesTotal)
      The total fees related to the transaction amount Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, adjustmentsTotal, taxTotal, & includedTaxTotal should be included also.
      Parameters:
      feesTotal - The total fees related to the transaction amount
    • setTaxTotal

      public void setTaxTotal(javax.money.MonetaryAmount taxTotal)
      The payment's total tax cost. Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, feesTotal, adjustmentsTotal, & includedTaxTotal should be included also.
      Parameters:
      taxTotal - The payment's total tax cost.
    • setIncludedTaxTotal

      public void setIncludedTaxTotal(javax.money.MonetaryAmount includedTaxTotal)
      The amount of taxes that are included in the subtotal (VAT). Note: Only the amount is required, but if this value is included, then the subtotal, fulfillmentTotal, feesTotal, adjustmentsTotal, & taxTotal should be included also.
      Parameters:
      includedTaxTotal - The amount of taxes that are included in the subtotal (VAT).
    • setAddressByType

      public void setAddressByType(Map<String,Address<PaymentValidationRequest>> addressByType)
      The collection of related addresses that may include billing or shipping addresses
      Parameters:
      addressByType - The collection of related addresses
    • setPaymentMethodProperties

      public void setPaymentMethodProperties(Map<String,String> paymentMethodProperties)
      Map to capture any information about the payment method needed to perform gateway transactions
      Parameters:
      paymentMethodProperties - Map to capture any information about the payment method needed to perform gateway transactions
    • setAttributes

      public void setAttributes(Map<String,String> attributes)
      General use map to capture any additional attributes needed for this PaymentValidationRequest
      Parameters:
      attributes - General use map to capture any additional attributes needed for this PaymentValidationRequest
    • setTransactions

      public void setTransactions(List<PaymentTransaction> transactions)
      Transaction data representing each payment gateway interaction related to this payment.
      Parameters:
      transactions - Transactions related to this payment.
    • setSingleUsePaymentMethod

      public void setSingleUsePaymentMethod(boolean singleUsePaymentMethod)
      Whether or not the underlying payment method can only be used once. In most cases, we're managing a single-use token that represents a credit card. This flag is especially important for managing payments with successful transactions. In those cases, the token has already been used and cannot be reused. If we need modify the payment's amount, then we may actually need to archive the existing payment, and create a new payment, with a new underlying token. Additionally, this flag is helpful when needing to re-authorize an expired authorization transaction. In that case, if the payment represents a single-use payment method, then the re-authorization may not be possible, and you'll need to seek an alternative form of payment.
      Parameters:
      singleUsePaymentMethod - Whether or not the underlying payment method can only be used once
    • setShouldSavePaymentToCustomer

      @Deprecated public void setShouldSavePaymentToCustomer(boolean shouldSavePaymentToCustomer)
      Deprecated.
      since 1.0.2, in favor of shouldSavePaymentForFutureUse to support owning user types other than a customer (i.e. account).
    • setShouldSavePaymentForFutureUse

      public void setShouldSavePaymentForFutureUse(boolean shouldSavePaymentForFutureUse)
      Should the payment method be saved to the owning user.
      Parameters:
      shouldSavePaymentForFutureUse - Should the payment method be saved to the owning user
    • setVersion

      public void setVersion(Integer version)
      The version of this payment. Used for checking that the requested version of the payment is up-to-date before saving changes. Required for any request which results in an update being made to the payment. This should never be manually incremented/decremented.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object