Charge Installment Settled
The money of a credit card payment reached the school for an installment of a charge it receives: the installment PAID, received in a bank account of the school on the day it was expected, with its charge and the payment. Published by cna-one's settlement routine, one message per installment it settles. No consumer yet.
Overview
Fact: the installment a credit card payment covers is settled. A credit card payment leaves its installments PENDING_SETTLEMENT, each with the day its money is expected at the school, as Charge Installment PaidCharge Installment PaidEventv1.0.0A payment now covers an installment of a charge a school receives: the installment after the payment, PAID or, on a cred...Ownercna-platformSchemaMapView docs already said; on that day the money arrives and the installment becomes PAID. The payload has the same shape as Charge Installment PaidCharge Installment PaidEventv1.0.0A payment now covers an installment of a charge a school receives: the installment after the payment, PAID or, on a cred...Ownercna-platformSchemaMapView docs: the installment right after the write, with its charge, and the payment, which does not change.
When it is published. CNA OneCNA OneServicev1.0.0Franchise operating system (franchises and employees, pricing, products and learning books, school operations, receivabl...PublishesGrantApplicationAccess, EmployeeCreated +19SubscribesInviteUser, FranchiseCreated +17Ownercna-platformMapRepoView docs‘s scheduled job settle-due-charge-installments (hourly by default, SETTLE_CHARGE_INSTALLMENTS_CRON) runs settleDueChargeInstallments, which publishes through chargeInstallmentSettledProducer:
- It settles each installment pending settlement whose expected day has come, read in the time zone of its school, so the same run can settle an installment in one school and not yet in another. Each installment is written in its own transaction:
PAID, the receipt of what it was due on the day of the sale in the oldest active bank account of its school, dated on the expected day, and a settled entry in the history of its charge, by the system. - It works in batches of 20 and publishes once per batch, one message per installment the batch settled, in a single produce call. A batch that settles nothing publishes nothing.
- An installment settles once: it is checked again under a lock when written, a row another process holds is skipped, and a second run writes and publishes nothing again.
- An installment that fails, for instance in a school with no active bank account, stays pending settlement and publishes nothing; its failure is reported on its own, and the next run tries it again.
status is PAID and expectedSettlementOn keeps the day the money was expected and received on. payment is the credit card payment, still in force: the settlement does not change payment.origin, which belongs to the payment.
Undoing the credit card payment later opens every installment it covers again, settled or still pending settlement, and publishes Charge Installment Payment UndoneCharge Installment Payment UndoneEventv1.0.0The school undid the payment of an installment of a charge it receives: the installment open again (PENDING), with its c...Ownercna-platformSchemaMapView docs for each.
No consumer yet. A consumer that only cares whether the payer paid reads Charge Installment PaidCharge Installment PaidEventv1.0.0A payment now covers an installment of a charge a school receives: the installment after the payment, PAID or, on a cred...Ownercna-platformSchemaMapView docs; this event tells when the school actually has the money.
Kafka
Topic (aggregateRoot) | ChargeInstallment |
Message key (routingKey) | payload.id |
| Contract owner | ONE |
metadata.event | ChargeInstallmentSettled |
| Consumer group | (none yet) |
Payload schema
Source of truth
ChargeInstallmentPaidPayload is the type of Charge Installment PaidCharge Installment PaidEventv1.0.0A payment now covers an installment of a charge a school receives: the installment after the payment, PAID or, on a cred...Ownercna-platformSchemaMapView docs.
import { ChargeInstallmentPaidPayload } from "events/one/chargeInstallment/ChargeInstallmentPaid";
class ChargeInstallmentSettled extends Event<ChargeInstallmentPaidPayload> { public static owner = "ONE"; public static aggregateRoot = "ChargeInstallment"; public static routingKey = "id"; public static version = "1.0.0";}The class exists only in cna-one.
Custom properties
| Property | Value |
|---|---|
| Contract Ownerx-contract-owner | ONE |
| Kafka Topicx-kafka-topic | ChargeInstallment |
| Message Keyx-message-key | id |
| Sourcex-source | cna-one api/app/events/one/chargeInstallment/ChargeInstallmentSettled.ts |
Id (UUID) of the installment (financial.charge_installments). Kafka message key.
School (franchise) the installment belongs to.
Charge (financial.charges) the installment belongs to.
Code of the charge, unique per school: COB-<year>-<number>, e.g. COB-2026-0012.
Contract (school_ops.contracts) the charge bills, or null for a charge with no contract.
Student (school_ops.students) the charge is for, or null.
Enrollment (module) the installment is owed for. Set only when its charge bills a single item of the contract; null otherwise.
Contract line the installment is owed for. Set only when its charge bills a single item of the contract; null otherwise.
Person (common.persons) who pays the charge. For the charges of a contract, the contract holder.
Kind of revenue the installment is (cna-one RevenueType).
ENROLLMENT_FEE OTHER_FEE LEARNING_BOOK TUITION TERMINATION_SETTLEMENT AD_HOCPosition of the installment in its schedule, from 1.
How many installments the schedule has.
Day the installment is due, YYYY-MM-DD, no time zone.
Decimal as a string with two places: the amount of the installment before discounts, late fee and interest.
Status of the installment after the settlement (cna-one ChargeInstallmentStatus): always PAID.
PENDING PAID PENDING_SETTLEMENT UNDER_RENEGOTIATION CANCELLED REVERSEDDay the credit card payment was expected to reach the school and was received on, YYYY-MM-DD. Always set in this event.
The credit card payment the installment was pending on. It still covers the installment; the settlement does not change it.