feat(finance): add settlement currency and cycle fx rates

This commit is contained in:
2026-03-10 16:46:59 +04:00
parent 4c0508f618
commit fb85219409
38 changed files with 3546 additions and 114 deletions

View File

@@ -42,6 +42,7 @@ async function readApprovalPayload(request: Request): Promise<{
async function readSettingsUpdatePayload(request: Request): Promise<{
initData: string
settlementCurrency?: string
rentAmountMajor?: string
rentCurrency?: string
rentDueDay: number
@@ -58,6 +59,7 @@ async function readSettingsUpdatePayload(request: Request): Promise<{
const text = await clonedRequest.text()
let parsed: {
settlementCurrency?: string
rentAmountMajor?: string
rentCurrency?: string
rentDueDay?: number
@@ -89,6 +91,11 @@ async function readSettingsUpdatePayload(request: Request): Promise<{
rentAmountMajor: parsed.rentAmountMajor
}
: {}),
...(typeof parsed.settlementCurrency === 'string'
? {
settlementCurrency: parsed.settlementCurrency
}
: {}),
...(typeof parsed.rentCurrency === 'string'
? {
rentCurrency: parsed.rentCurrency
@@ -212,6 +219,7 @@ async function readRentWeightPayload(request: Request): Promise<{
function serializeBillingSettings(settings: HouseholdBillingSettingsRecord) {
return {
householdId: settings.householdId,
settlementCurrency: settings.settlementCurrency,
rentAmountMinor: settings.rentAmountMinor?.toString() ?? null,
rentCurrency: settings.rentCurrency,
rentDueDay: settings.rentDueDay,