mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 17:34:03 +00:00
feat(finance): add settlement currency and cycle fx rates
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user