Credit state machine
The following diagram shows the state machine for a Credit as used by Payment plug-in controller. It describes how a credit moves from state to state when financial transactions, queries, or external edits are made against a payment and payment plug-ins are used to process payment transactions. The credit state is persisted in the PPCCREDIT table.
- When newly created (New), a Credit can only be a target of a credit financial transaction.
- When in a Crediting state, the only possible financial transaction is reverseCredit. If successful, the Credit moves to a Canceled state. The Credit can also move to a Credited state by a query update or by an explicit edit operation performed by the Payment plug-in controller. Edit operations are common for offline payment transactions and in timeout situations.
- When in a Credit state, a Credit can be canceled by a full reverseCredit (the total credited amount is reversed). With a partial reverseCredit (amount to be reversed is less than the total credited amount) transaction, the Credit stays in a Credited state.
- When a financial transaction fails, the Credit goes to the Failed state.
- End states for Credits are Failed and Canceled.