Charge Installment Paid
A payment now covers an installment of a charge a school receives: the installment after the payment, PAID or, on a credit card, PENDING_SETTLEMENT, with its charge and the payment. Published by cna-one when the school registers a payment or a credit card sale, one message per installment the payment covers. No consumer yet.
Overview
Fact: a payment was registered for an installment of a charge the school receives. The payload is the installment right after the write, with the charge it belongs to (code, contract, student, payer) and the payment that now covers it.
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, through chargeInstallmentPaidProducer, after the transaction that stores the payment, its cash entries and the history of each charge, from two flows:
registerChargePayment: the payment the school registers for installments of one contract, or of one charge with no contract;registerCardSale: the credit card sale of every open installment of a charge, one card installment each, within the limit of the charge.
- One message per installment the payment covers, all in a single produce call.
payment.amountis the total of the payment, not the amount of this installment. - A payment by any method but a credit card pays the installment:
statusisPAID, and the amount it was due onpayment.paidOnenters a cash account of the school. - A credit card payment leaves each installment
PENDING_SETTLEMENT: the money has not reached the school yet, and no cash entry is written.registerChargePaymenttakes a credit card in a single card installment, expected 30 days afterpayment.paidOn. In a card sale, the first open installment by due day is expected 30 days after the sale, the second 60, and so on, andpayment.cardInstallmentsis how many installments the sale took. When the money arrives, Charge Installment SettledCharge Installment SettledEventv1.0.0The money of a credit card payment reached the school for an installment of a charge it receives: the installment PAID, ...Ownercna-platformSchemaMapView docs publishes the installmentPAID. - A refused payment (an installment paid by someone else in the meantime) stores and publishes nothing.
payment.origin is SCHOOL for a payment an employee registered, the only kind today. INTEGRATION is kept for a payment with no author, such as one a payment gateway confirms.
The payload carries no CPF, contact or card data. It does not carry what the installment was due on the day of the payment, late fee and interest included, either: a credit card payment does not store that amount per installment.
No consumer yet. Activating a contract does not consume this event: cna-one moves a PENDING_PAYMENT contract to ACTIVE on its first payment of a TUITION or LEARNING_BOOK installment inside the payment’s own transaction (cna-br/cna-one#1322, not in production yet), and undoing the payment leaves the contract active. 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 takes the fact back.
Kafka
Topic (aggregateRoot) | ChargeInstallment |
Message key (routingKey) | payload.id |
| Contract owner | ONE |
metadata.event | ChargeInstallmentPaid |
| Consumer group | (none yet) |
Payload schema
Source of truth
ChargeInstallmentPaidPayload is exported from this file and shared with 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 and Charge Installment SettledCharge Installment SettledEventv1.0.0The money of a credit card payment reached the school for an installment of a charge it receives: the installment PAID, ...Ownercna-platformSchemaMapView docs.
export type ChargeInstallmentPaidPayload = { id: string; franchiseId: string; chargeId: string; chargeCode: string; contractId: string | null; studentId: string | null; enrollmentId: string | null; contractItemId: string | null; payerPersonId: string; revenueType: RevenueType; number: number; totalNumber: number; dueOn: string; originalAmount: string; status: ChargeInstallmentStatus; expectedSettlementOn: string | null; payment: { id: string; origin: "SCHOOL" | "INTEGRATION"; paymentMethod: PaymentMethod; amount: string; paidOn: string; externalReference: string | null; cardInstallments: number | null; undoneAt: string | null; };};
class ChargeInstallmentPaid extends Event<ChargeInstallmentPaidPayload> { public static owner = "ONE"; public static aggregateRoot = "ChargeInstallment"; public static routingKey = "id"; public static version = "1.0.0";}RevenueType and ChargeInstallmentStatus come from db/enums/financial/ChargeInstallment.ts, PaymentMethod from db/enums/financial/ChargePayment.ts. 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/ChargeInstallmentPaid.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, the school code and seven hexadecimal digits, e.g. COB-SP-090-1A2B3C4.
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 payment (cna-one ChargeInstallmentStatus): PAID, or PENDING_SETTLEMENT for a credit card payment whose money has not reached the school yet.
PENDING PAID PENDING_SETTLEMENT UNDER_RENEGOTIATION CANCELLED REVERSEDDay the credit card payment is expected to reach the school, YYYY-MM-DD. Set only for a credit card payment; null otherwise.
The payment that now covers the installment.