event \ action

lastResetAt set to

nextResetAt set to

autodebitAt set to

posting emitted

Subscription creation

event time

-

-

-

Subscription activated

-

event time + 1m

event time + 7d

charge

changed autodebit date

-

given autodebit date

given autodebit date

-

nextResetAt reached

event time

nextResetAt + 1m

-

-

autodebitAt reached

-

-

autodebitAt + 1m

pay

pay now

-

-

autodebitAt + 1m

pay (no debt)

charged & autodebitAt reached

-

-

chargedAt + 1m

pay

charged & pay now

-

-

chargedAt + 1m

pay (no debt)

subscription un-freezed out of last cycle (now >= nextResetAt)

previous nextResetAt

event time + 1m

event time + 1m

pay

subscription downgrade

-

-

-

-

subscription upgrade

event time

event time + 1m

event time + 1m

pay (no debt)

Each action where a posting is required shall be triggered by a message from TM about a successful posting. To handle errors during the processing, we want to include an idempotencyKey with each posting.


As we may need to create multiple postings of the same type in case one fails (e.g. customer didn’t have money for Pay Now, but made a top-up in the meantime), we have to allow for a “regeneration“ of idempotencyKey. As such, on "request" for a posting of a specific type, there will be a UUID (idempotencyKey) created and stored in the DB to be used for this posting. This UUID will be released on a message from TM, be it success or failure.