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

PropertyReturnsDescription
currencyIdStringThe 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.

ParameterDescription
cthe cart the debit is for
debitItemsthe 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.

ParameterDescription
cthe cart the debit is for
debitItemsthe individual line items to debit
parameterspayment-related form parameters supplied by the caller
profilethe profile whose account is debited
websiteBranchthe 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.

ParameterDescription
entitythe 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.

ParameterDescription
cthe cart being paid for
debitItemsthe line items to charge
parametersrequest parameters, must include "paymentProvider" naming the payment gateway application
websiteBranchthe 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.

ParameterDescription
cthe cart being paid for
debitItemsthe line items to charge
parametersrequest parameters, must include "paymentProvider" naming the payment gateway application
purchaserthe profile making the payment
websiteBranchthe 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.

ParameterDescription
entitythe entity whose balance would be checked
amountthe 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.

ParameterDescription
profilethe profile making the payment
orgthe organisation the payment is made within
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.