Records points being taken off a balance in a rewards programme, because they were spent or because they expired. A debit belongs to a Reward, which is the points bucket it draws down, and names the entity whose balance is reduced. Balances are not stored as a running total: they are worked out by summing the Points credits and the PointsDebit rows for a reward, so a debit is written once and never adjusted afterwards. The reason code says what kind of debit it is, with E for expired and P for purchase, and for a purchase the cart id, item type and item id link the debit back to what was bought. PointsDebit is auditable, so deleting one is recorded and can be restored from the audit trail.

Group: Database Entities

Implements: Serializable, RewardTransactionItem, Auditable


Properties

PropertyReturnsDescription
auditOrgOrganisationThe organisation that audit records for this debit are written against, taken from the reward's organisation rather than from the debit's own issuer organisation.
cartIdStringIdentifier of the shopping cart the purchase belonged to, so that several debits raised by one checkout can be grouped back together.
createdDateDateWhen this debit row was written. It can be later than the issued date, for example when points are backdated or loaded by an import.
expiredDateDateWhen these points were treated as having expired. Set on debits raised by points expiry, and expired returns true when either this is set or the reason code is E.
idlongDatabase identifier of this debit, assigned when the row is first saved.
issuedByProfileThe admin user who debited the points. Blank for debits created by the import process, and set to the admin who created the record for manually created debits.
issuedDateDateThe date the points are treated as having been taken. Balance sums and points history filter and sort on this rather than on the created date, so a backdated debit still lands in the right period. Required.
issuedToBaseEntityThe entity whose points balance this debit reduces. Normally the profile that earned the points, but it can be any BaseEntity such as a group or an organisation. Required.
issuerOrgOrganisationThe organisation that runs the rewards programme these points belong to. Debits are looked up within this organisation, so it must match the admin organisation of anyone reading them.
itemIdLongDatabase id of the purchased item named by the item type.
itemTypeStringEntity name of the thing the points were spent on, for example Auction or ProductOrder. Combined with the item id it identifies the purchase.
numPointsdoubleThe number of points this debit removes from the balance.
pointsTagPointsTagOptional tag used to group points into categories for reporting. It is copied from the credit record when the debit is created from one, so it is null for a debit raised directly against a reward.
reasonStringFree-text explanation of why the points were taken, shown to the member in their points history. Optional, and up to 20000 characters.
reasonCodeStringShort code categorising the debit, used to filter and group points reporting. The codes the platform itself writes are E for expired and P for purchase, and any other code can be stored by an app.
rewardRewardThe reward, meaning the points bucket, that this debit draws down. Every balance and reporting query for points is scoped to a reward.

Methods

getId() · getPointsTag() · getIssuerOrg() · getReward() · getIssuedTo() · getIssuedDate() · getNumPoints() · getReason() · getReasonCode() · getItemType() · getCartId() · getItemId() · getExpiredDate() · getCreatedDate() · expired() · getIssuedBy() · asCredit() · asDebit() · getAuditOrg()

getId()

Returns: long

Database identifier of this debit, assigned when the row is first saved.

getPointsTag()

Returns: PointsTag

Optional tag used to group points into categories for reporting. It is copied from the credit record when the debit is created from one, so it is null for a debit raised directly against a reward.

getIssuerOrg()

Returns: Organisation

The organisation that runs the rewards programme these points belong to. Debits are looked up within this organisation, so it must match the admin organisation of anyone reading them.

getReward()

Returns: Reward

The reward, meaning the points bucket, that this debit draws down. Every balance and reporting query for points is scoped to a reward.

getIssuedTo()

Returns: BaseEntity

The entity whose points balance this debit reduces. Normally the profile that earned the points, but it can be any BaseEntity such as a group or an organisation. Required.

getIssuedDate()

Returns: Date

The date the points are treated as having been taken. Balance sums and points history filter and sort on this rather than on the created date, so a backdated debit still lands in the right period. Required.

getNumPoints()

Returns: double

The number of points this debit removes from the balance.

getReason()

Returns: String

Free-text explanation of why the points were taken, shown to the member in their points history. Optional, and up to 20000 characters.

getReasonCode()

Returns: String

Short code categorising the debit, used to filter and group points reporting. The codes the platform itself writes are E for expired and P for purchase, and any other code can be stored by an app.

getItemType()

Returns: String

Entity name of the thing the points were spent on, for example Auction or ProductOrder. Combined with the item id it identifies the purchase.

getCartId()

Returns: String

Identifier of the shopping cart the purchase belonged to, so that several debits raised by one checkout can be grouped back together.

getItemId()

Returns: Long

Database id of the purchased item named by the item type.

getExpiredDate()

Returns: Date

When these points were treated as having expired. Set on debits raised by points expiry, and expired returns true when either this is set or the reason code is E.

getCreatedDate()

Returns: Date

When this debit row was written. It can be later than the issued date, for example when points are backdated or loaded by an import.

expired()

Returns: boolean

Whether this debit represents points expiring rather than being spent. True when the reason code is E or an expired date has been set.

getIssuedBy()

Returns: Profile

The admin user who debited the points. Blank for debits created by the import process, and set to the admin who created the record for manually created debits.

asCredit()

Returns: Points

Always null, because a debit is not a credit. RewardTransactionItem exposes both asCredit and asDebit so code walking a member's points transactions can tell the two apart without a type check.

asDebit()

Returns: PointsDebit

Returns this debit. RewardTransactionItem exposes both asCredit and asDebit so code walking a member's points transactions can tell the two apart without a type check.

getAuditOrg()

Returns: Organisation

The organisation that audit records for this debit are written against, taken from the reward's organisation rather than from the debit's own issuer organisation.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.