The PaymentRules.xml file is a read-only file used to configure the payment rules for a store or store group. This file is located in the following directory:
WAS_installdir/installedApps/cell_name/WC_instance_name.ear/xml/config/payments/edp/rules
WAS_userdir/installedApps/cell_name/WC_instance_name.ear/xml/config/payments/edp/rules
The following example shows the target states for the payment rules provided in WebSphere Commerce.
Example:
<?xml version="1.0" encoding="UTF-8"?> <PaymentRules xmlns:> <PaymentRule name="No Validation or Reservation"> <PrimePaymentEvent targetState="DNE" /> <ReservePaymentEvent targetState="DNE" /> <FinalizePaymentEvent targetState="DEPOSITED" /> </PaymentRule> <PaymentRule name="No Validation with Approval on Reservation"> <PrimePaymentEvent targetState="DNE" /> <ReservePaymentEvent targetState="APPROVED" /> <FinalizePaymentEvent targetState="DEPOSITED" /> </PaymentRule> <PaymentRule name="No Validation with Deposit at Reservation"> <PrimePaymentEvent targetState="DNE" /> <ReservePaymentEvent targetState="DEPOSITED" /> <FinalizePaymentEvent targetState="DEPOSITED" /> </PaymentRule> <PaymentRule name="Early Approval"> <PrimePaymentEvent targetState="APPROVED" /> <ReservePaymentEvent targetState="APPROVED" /> <FinalizePaymentEvent targetState="DEPOSITED" /> </PaymentRule> <PaymentRule name="Validation with Deposit at Reservation"> <PrimePaymentEvent targetState="APPROVED" /> <ReservePaymentEvent targetState="DEPOSITED" /> <FinalizePaymentEvent targetState="DEPOSITED" /> </PaymentRule> <PaymentRule name="Early Deposit"> <PrimePaymentEvent targetState="DEPOSITED" /> <ReservePaymentEvent targetState="DEPOSITED" /> <FinalizePaymentEvent targetState="DEPOSITED" /> </PaymentRule> </PaymentRules>
Description:
- Each entry defines the desired target state for the relevant payment amount for each of the business events for an order:
- PrimePaymentEvent applies to the order capture business event (when the customer clicks the Buy button)
- ReservePaymentEvent applies to the release to fulfillment business event (when the order is released to a warehouse or some other entity for fulfillment)
- FinalizePaymentEvent applies to the fulfillment business event (when the order is filled and items are boxed and shipped)
- The relevant amount is the amount being processed in each business event.
- For PrimePaymentEvent, the relevant amount is the amount of goods available in stock during order capture.
- For ReservePaymentEvent, the relevant amount is the total amount of the releases involved in the particular release to fulfillment.
- For FinalizePaymentEvent, the relevant amount is the amount of the release being fulfilled.
- The basic assumption is that amounts can be approved (APPROVED) and deposited (DEPOSITED). If an amount does not need to be approved or deposited, the target state is DNE (does not exist), meaning the amount does not yet exist as a payment transaction.
The following parameters affect the behavior of event-driven payments.
- name
- The name of the payment rule (for example, Early Validation).
- targetState
- The target state a payment should be in under that payment rule for each business event (primePayment, reservePayment, and finalizePayment). The targetState in each payment action rule conforms to these restrictions:
- The targetState values are uppercase.
- The targetState for FinalizePaymentEvent is DEPOSITED to complete the payment action rule.
- The targetState for a phase is the same as the previous phase or more restrictive. The order of restriction is: DNE, APPROVED, DEPOSITED. For example, if the targetState for PrimePaymentEvent is APPROVED, then the ReservePaymentEvent is either APPROVED or DEPOSITED (which is more restrictive). If the targetState for ReservePaymentEvent is APPROVED, the targetState for FinalizePaymentEvent is DEPOSITED. During an actual order payment, this does not mean that the approval action will occur twice if the approval action was performed already in the previous action. It means that the next phase cannot have a less restrictive action. For instance, the targetState for ReservePaymentEvent cannot be DNE if the targetState for PrimePaymentEvent is APPROVED.
- Payment rules and target states lists the possible combinations of target states that are valid.