One instalment of a recurring transaction that has fallen due, tracking that single payment through however many attempts it takes to succeed or fail. A due transaction is created from a RecurringTransaction when its next date arrives, and starts in the IN_PROGRESS state. Each attempt increments the count, stamps lastAttempt and points lastPtx at the PaymentTransaction that was tried. The payment scanner picks up rows that are still IN_PROGRESS, so a row leaves the queue only when it moves to COMPLETE, FAILED or CANCELLED.
Group: Database Entities
Implements: Serializable
Properties
| Property | Returns | Description |
|---|---|---|
| count | int | Number of times payment has been attempted for this instalment. Starts at zero and is increased by one on each attempt. |
| dueDate | Date | Date this instalment fell due, copied from the recurring transaction's next date when the row was created. Stored as a date only, with no time of day. |
| id | long | Database identifier for this due transaction. |
| inComplete | boolean | Whether this instalment is still outstanding, that is its state is IN_PROGRESS. Not persisted, it is derived from the payment state. |
| lastAttempt | Date | Date payment was last attempted for this instalment, stored as a date only. Null until the first attempt is made. |
| lastPtx | PaymentTransaction | The payment transaction created by the most recent attempt, which carries the gateway result for that attempt. Null until the first attempt is made. |
| paymentState | State | Where this instalment has got to, stored as a string. IN_PROGRESS means it is still queued for the payment scanner, and COMPLETE, FAILED and CANCELLED are all final. Never null. |
| rtx | RecurringTransaction | The recurring transaction this instalment was raised from, which holds the schedule, the amount and the payer. Never null. |
Methods
getCount() · getDueDate() · getId() · getLastAttempt() · getLastPtx() · getRtx() · getPaymentState() · incrementCountAndDate(Date lastAttempt) · isInComplete() · setCount(int count) · setDueDate(Date dueDate) · setId(long id) · setLastAttempt(Date lastAttempt) · setLastPtx(PaymentTransaction lastPtx) · setRtx(RecurringTransaction rtx) · setPaymentState(State paymentState)
getCount()
Returns: int
Number of times payment has been attempted for this instalment. Starts at zero and is increased by one on each attempt.
getDueDate()
Returns: Date
Date this instalment fell due, copied from the recurring transaction's next date when the row was created. Stored as a date only, with no time of day.
getId()
Returns: long
Database identifier for this due transaction.
getLastAttempt()
Returns: Date
Date payment was last attempted for this instalment, stored as a date only. Null until the first attempt is made.
getLastPtx()
Returns: PaymentTransaction
The payment transaction created by the most recent attempt, which carries the gateway result for that attempt. Null until the first attempt is made.
getRtx()
Returns: RecurringTransaction
The recurring transaction this instalment was raised from, which holds the schedule, the amount and the payer. Never null.
getPaymentState()
Returns: State
Where this instalment has got to, stored as a string. IN_PROGRESS means it is still queued for the payment scanner, and COMPLETE, FAILED and CANCELLED are all final. Never null.
incrementCountAndDate(Date lastAttempt)
Returns: void
Records another payment attempt by increasing the attempt count by one and setting the date of the last attempt. Does not save the row.
| Parameter | Description |
|---|---|
lastAttempt | the date this attempt was made |
isInComplete()
Returns: boolean
Whether this instalment is still outstanding, that is its state is IN_PROGRESS. Not persisted, it is derived from the payment state.
setCount(int count)
Returns: void
Sets the number of payment attempts recorded against this instalment.
| Parameter | Description |
|---|---|
count | the attempt count to set |
setDueDate(Date dueDate)
Returns: void
Sets the date this instalment fell due. Only the date part is stored.
| Parameter | Description |
|---|---|
dueDate | the date the payment falls due |
setId(long id)
Returns: void
Sets the database identifier. Normally only assigned by the persistence layer.
| Parameter | Description |
|---|---|
id | the primary key to assign |
setLastAttempt(Date lastAttempt)
Returns: void
Sets the date payment was last attempted. Only the date part is stored.
| Parameter | Description |
|---|---|
lastAttempt | the date of the most recent payment attempt |
setLastPtx(PaymentTransaction lastPtx)
Returns: void
Sets the payment transaction produced by the most recent attempt.
| Parameter | Description |
|---|---|
lastPtx | the payment transaction from the most recent attempt |
setRtx(RecurringTransaction rtx)
Returns: void
Sets the recurring transaction this instalment belongs to. Required.
| Parameter | Description |
|---|---|
rtx | the owning recurring transaction |
setPaymentState(State paymentState)
Returns: void
Sets the payment state. Moving it away from IN_PROGRESS takes the instalment out of the payment scanner's queue.
| Parameter | Description |
|---|---|
paymentState | the payment state to set |