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

PropertyReturnsDescription
countintNumber of times payment has been attempted for this instalment. Starts at zero and is increased by one on each attempt.
dueDateDateDate 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.
idlongDatabase identifier for this due transaction.
inCompletebooleanWhether this instalment is still outstanding, that is its state is IN_PROGRESS. Not persisted, it is derived from the payment state.
lastAttemptDateDate payment was last attempted for this instalment, stored as a date only. Null until the first attempt is made.
lastPtxPaymentTransactionThe payment transaction created by the most recent attempt, which carries the gateway result for that attempt. Null until the first attempt is made.
paymentStateStateWhere 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.
rtxRecurringTransactionThe 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.

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

ParameterDescription
countthe attempt count to set

setDueDate(Date dueDate)

Returns: void

Sets the date this instalment fell due. Only the date part is stored.

ParameterDescription
dueDatethe date the payment falls due

setId(long id)

Returns: void

Sets the database identifier. Normally only assigned by the persistence layer.

ParameterDescription
idthe primary key to assign

setLastAttempt(Date lastAttempt)

Returns: void

Sets the date payment was last attempted. Only the date part is stored.

ParameterDescription
lastAttemptthe date of the most recent payment attempt

setLastPtx(PaymentTransaction lastPtx)

Returns: void

Sets the payment transaction produced by the most recent attempt.

ParameterDescription
lastPtxthe payment transaction from the most recent attempt

setRtx(RecurringTransaction rtx)

Returns: void

Sets the recurring transaction this instalment belongs to. Required.

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

ParameterDescription
paymentStatethe payment state to set
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.