Currency implementation representing payment by real money through a configured payment gateway, rather than a stored account balance. Has no balance of its own - balance always reports zero and funds are always treated as sufficient - because the actual debit is delegated to whichever PaymentProviderApplication is identified by the "paymentProvider" request parameter. Used as the default currency for cart checkout and product purchases across the ecommerce, shopping cart and signup flows.
Implements: Currency
Properties
| Property | Returns | Description |
|---|---|---|
| currencyId | String | The unique identifier for this currency type, used wherever a cart or line item records which currency it was paid in. |
Inherited from Currency
Methods
debit(Cart c, List<DebitItem> debitItems)
Returns: void
Debits the appropriate account for the given cart by the total of the supplied debit items.
| Parameter | Description |
|---|---|
c | the cart the debit is for |
debitItems | the individual line items to debit |
debit(Cart c, List<DebitItem> debitItems, Map<String,String> parameters, Profile profile, Branch websiteBranch)
Returns: String
Debits the appropriate account for the given cart on behalf of the given profile, by the total of the supplied debit items.
| Parameter | Description |
|---|---|
c | the cart the debit is for |
debitItems | the individual line items to debit |
parameters | payment-related form parameters supplied by the caller |
profile | the profile whose account is debited |
websiteBranch | the website branch the payment is being made against |
Methods
getCurrencyId()
Returns: String
The unique identifier for this currency type, used wherever a cart or line item records which currency it was paid in.
balance(BaseEntity entity)
Returns: BigDecimal
The available balance for this currency, which is always zero since cash payments are not backed by a stored balance.
| Parameter | Description |
|---|---|
entity | the entity whose balance would be checked |
debit(Cart c, List<DebitItem> debitItems, Map<String,String> parameters, Branch websiteBranch)
Returns: String
Processes payment for the given cart by delegating to the payment provider application identified by the "paymentProvider" request parameter.
| Parameter | Description |
|---|---|
c | the cart being paid for |
debitItems | the line items to charge |
parameters | request parameters, must include "paymentProvider" naming the payment gateway application |
websiteBranch | the website branch the payment is made within |
debit(Cart c, List<DebitItem> debitItems, Map<String,String> parameters, Profile purchaser, Branch websiteBranch)
Returns: String
Processes payment for the given cart on behalf of a specific purchaser, by delegating to the payment provider application identified by the "paymentProvider" request parameter.
| Parameter | Description |
|---|---|
c | the cart being paid for |
debitItems | the line items to charge |
parameters | request parameters, must include "paymentProvider" naming the payment gateway application |
purchaser | the profile making the payment |
websiteBranch | the website branch the payment is made within |
isBalanceSufficient(BaseEntity entity, BigDecimal amount)
Returns: boolean
Whether the given entity has sufficient balance to pay the given amount, which is always true since cash payments are not constrained by a stored balance.
| Parameter | Description |
|---|---|
entity | the entity whose balance would be checked |
amount | the amount that would be debited |
isForEntity(Profile profile, Organisation org)
Returns: BaseEntity
The entity that holds the cash balance for the given profile and organisation, which is simply the profile itself.
| Parameter | Description |
|---|---|
profile | the profile making the payment |
org | the organisation the payment is made within |