mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-06 05:23:38 +00:00
Adds DJF to freight.payments_currency_enum (migration 3860000000000, alone in its own migration per Postgres's ADD VALUE-in-a-transaction restriction) and to manual_payment_settings (djf_enabled column, migration 3870000000000, default true). Replaces the binary ETB/USD assumptions that would have silently mispriced or discarded a DJF booking: - booking-pricing / contract-pricing: usdToEtb scalar -> a rate table keyed by source currency (ExchangeService.getRateTable), so a contract-frozen rate converts into whatever currency the booking is paid in instead of being dropped when neither leg is ETB or USD. - warehouse-fee / booking-wagon-cancellation: normalizeCurrency no longer coerces anything non-ETB to USD. - additional-charge: convertAmount no longer bails out for a currency that isn't literally ETB or USD. - manual-payment-settings: isEnabled/enabledCurrencies cover DJF. Widens the three @IsIn(['ETB','USD']) DTO validators, and adds DJF to the export/report currency filter option lists. Claude-Session: https://claude.ai/code/session_01CZy77vCWhka3pnmVF9NDkL
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { BaseEntity } from "@edr/api-common";
|
|
import { Column, Entity } from "typeorm";
|
|
|
|
/**
|
|
* Single-row table controlling whether Finance may settle invoices by hand
|
|
* (bank transfer / counter payment) instead of the customer paying online.
|
|
*
|
|
* Per currency on purpose: the two channels are operationally different — USD
|
|
* bookings have always been bank-transfer-only, while ETB normally goes
|
|
* through the gateway and manual settlement is the exception. Switching one
|
|
* off must not switch off the other.
|
|
*/
|
|
@Entity({ schema: "freight", name: "manual_payment_settings" })
|
|
export class ManualPaymentSetting extends BaseEntity {
|
|
/** Manual settlement allowed for ETB invoices. */
|
|
@Column({ name: "etb_enabled", type: "boolean", default: false })
|
|
etbEnabled!: boolean;
|
|
|
|
/** Manual settlement allowed for USD invoices. */
|
|
@Column({ name: "usd_enabled", type: "boolean", default: true })
|
|
usdEnabled!: boolean;
|
|
|
|
/** Manual settlement allowed for DJF invoices. */
|
|
@Column({ name: "djf_enabled", type: "boolean", default: true })
|
|
djfEnabled!: boolean;
|
|
|
|
/** IAM user id of the last operator to change either toggle. */
|
|
@Column({ name: "updated_by_id", type: "uuid", nullable: true })
|
|
updatedById?: string | null;
|
|
}
|