Mutable request bean for awarding or debiting reward points to a participant. Created via PointsManager.newPointsRequest() and configured with a participant, a points value and, optionally, a reward, points tag or reason code, award and expiry dates, a team and a cart. Passed to PointsManager.processPointsRequest() to create the resulting points credit or debit: a positive numPoints creates an award, a negative numPoints creates a debit for the absolute value.
Properties
| Property | Returns | Description |
|---|---|---|
| attachmentHash | String | The hash of a supporting file attached to this award. Only supported when the participant is a profile, not an organisation. |
| awardDate | Date | The date the resulting award or debit is recorded as having been issued. If not set, the current date and time is used when the request is processed. |
| cart | Cart | The cart this request's debit is being applied for. Only applicable for debits: if set, the cart's Kademi id is recorded on the resulting PointsDebit's cartId field. |
| expiryDate | Date | The date the points from an award expire, after which they can no longer be redeemed. Only meaningful for a credit; null if the reward's own expiry rules should apply instead. |
| invalidateBalance | Boolean | Whether the participant's cached points balance should be invalidated as part of processing this request. Null is treated as false. |
| numPoints | double | The number of points this request applies: a positive value creates an award (credit) for that many points, a negative value creates a debit for the absolute value. A value of zero causes processing to do nothing. |
| participant | BaseEntity | The profile or organisation this points request applies to. Must be set before the request is processed. |
| pas | PointsAllocationSource | The points allocation source, if any, this request is generated from. Only used when the participant is an organisation, to attribute the resulting debit or credit to the source that produced it. |
| reason | String | Free text explaining why the points were awarded or debited. Shown to the participant alongside the resulting transaction. |
| reward | Reward | The reward, ie the points bucket, this request is awarded from or debited against. May be null, in which case the participant's default reward is used when the request is processed. |
| tagOrReasonCode | String | For a credit, the points tag classifying the award; for a debit, the reason code recorded against it. May be blank. |
| team | Organisation | The team the points are being awarded to when the participant is an organisation. If set, it must match the participant organisation itself. |
Methods
getParticipant() · setParticipant(BaseEntity participant) · getReward() · setReward(Reward reward) · getPas() · setPas(PointsAllocationSource pas) · getNumPoints() · setNumPoints(double numPoints) · getReason() · setReason(String reason) · getAwardDate() · setAwardDate(Date awardDate) · getExpiryDate() · setExpiryDate(Date expiryDate) · getInvalidateBalance() · setInvalidateBalance(Boolean invalidateBalance) · getTagOrReasonCode() · setTagOrReasonCode(String tagOrReasonCode) · getAttachmentHash() · setAttachmentHash(String attachmentHash) · getTeam() · setTeam(Organisation team) · getCart() · setCart(Cart cart)
getParticipant()
Returns: BaseEntity
The profile or organisation this points request applies to. Must be set before the request is processed.
setParticipant(BaseEntity participant)
Returns: void
Sets the profile or organisation this points request applies to.
| Parameter | Description |
|---|---|
participant | the participant to be awarded or debited points |
getReward()
Returns: Reward
The reward, ie the points bucket, this request is awarded from or debited against. May be null, in which case the participant's default reward is used when the request is processed.
setReward(Reward reward)
Returns: void
Sets the reward, ie the points bucket, this request is awarded from or debited against.
| Parameter | Description |
|---|---|
reward | the reward to apply this request to |
getPas()
Returns: PointsAllocationSource
The points allocation source, if any, this request is generated from. Only used when the participant is an organisation, to attribute the resulting debit or credit to the source that produced it.
setPas(PointsAllocationSource pas)
Returns: void
Sets the points allocation source this request originates from.
| Parameter | Description |
|---|---|
pas | the points allocation source to attribute this request to |
getNumPoints()
Returns: double
The number of points this request applies: a positive value creates an award (credit) for that many points, a negative value creates a debit for the absolute value. A value of zero causes processing to do nothing.
setNumPoints(double numPoints)
Returns: void
Sets the number of points to grant, if positive, or to deduct, if negative.
| Parameter | Description |
|---|---|
numPoints | the number of points to award or debit |
getReason()
Returns: String
Free text explaining why the points were awarded or debited. Shown to the participant alongside the resulting transaction.
setReason(String reason)
Returns: void
Sets the free text reason to record against this request.
| Parameter | Description |
|---|---|
reason | the reason for the award or debit |
getAwardDate()
Returns: Date
The date the resulting award or debit is recorded as having been issued. If not set, the current date and time is used when the request is processed.
setAwardDate(Date awardDate)
Returns: void
Sets the date the resulting award or debit is recorded as having been issued.
| Parameter | Description |
|---|---|
awardDate | the award date to record, or null to use the current date when processed |
getExpiryDate()
Returns: Date
The date the points from an award expire, after which they can no longer be redeemed. Only meaningful for a credit; null if the reward's own expiry rules should apply instead.
setExpiryDate(Date expiryDate)
Returns: void
Sets the date the points from the resulting award expire.
| Parameter | Description |
|---|---|
expiryDate | the expiry date for the award, or null to use the reward's own expiry rules |
getInvalidateBalance()
Returns: Boolean
Whether the participant's cached points balance should be invalidated as part of processing this request. Null is treated as false.
setInvalidateBalance(Boolean invalidateBalance)
Returns: void
Sets whether the participant's cached points balance should be invalidated as part of processing this request.
| Parameter | Description |
|---|---|
invalidateBalance | true to invalidate the cached balance, false or null to leave it as is |
getTagOrReasonCode()
Returns: String
For a credit, the points tag classifying the award; for a debit, the reason code recorded against it. May be blank.
setTagOrReasonCode(String tagOrReasonCode)
Returns: void
Sets the points tag, for a credit, or reason code, for a debit, to record against this request.
| Parameter | Description |
|---|---|
tagOrReasonCode | the points tag or reason code to record |
getAttachmentHash()
Returns: String
The hash of a supporting file attached to this award. Only supported when the participant is a profile, not an organisation.
setAttachmentHash(String attachmentHash)
Returns: void
Sets the hash of a supporting file to attach to this award.
| Parameter | Description |
|---|---|
attachmentHash | the attachment hash to record |
getTeam()
Returns: Organisation
The team the points are being awarded to when the participant is an organisation. If set, it must match the participant organisation itself.
setTeam(Organisation team)
Returns: void
Sets the team the points are being awarded to when the participant is an organisation.
| Parameter | Description |
|---|---|
team | the team to award the points to |
getCart()
Returns: Cart
The cart this request's debit is being applied for. Only applicable for debits: if set, the cart's Kademi id is recorded on the resulting PointsDebit's cartId field.
setCart(Cart cart)
Returns: void
Sets the cart this request's debit is being applied for.
| Parameter | Description |
|---|---|
cart | the cart to record the resulting debit against |