feat: ( payments ) convert ETB to method currency before charging

This commit is contained in:
Abubeker Yasin
2026-06-29 11:55:31 +03:00
parent c6e56d1c4f
commit b70e9ea2cd
7 changed files with 100 additions and 65 deletions

View File

@@ -210,7 +210,8 @@ export class DMoneyProvider implements PaymentProvider {
business_type: "OnlineMerchant" as const,
title: `${input.orderRef}`,
total_amount: totalAmount,
trans_currency: this.currency,
// Charge the currency the caller already converted to; never relabel it provider-side.
trans_currency: input.currency,
timeout_express: this.timeoutExpress,
...(redirectUrl ? { redirect_url: redirectUrl } : {}),
},
@@ -341,9 +342,6 @@ export class DMoneyProvider implements PaymentProvider {
private get language(): string {
return this.config.get<string>("dmoney.language") ?? "en";
}
private get currency(): string {
return this.config.get<string>("dmoney.currency") ?? "FDJ";
}
private get privateKey(): string {
return this.config.get<string>("dmoney.privateKey") ?? "";
}

View File

@@ -208,8 +208,9 @@ export class WaafiProvider implements PaymentProvider {
transactionInfo: {
referenceId: input.merchantOrderId,
amount: this.toAmount(input.amountMinor),
// Waafi has no ETB; `waafi.currency` overrides the booking currency when set.
currency: this.currency || input.currency,
// Charge exactly the currency the caller already converted to (passenger/freight resolve
// the method's settlement currency). The provider never relabels the currency.
currency: input.currency,
description: `${input.orderRef}`,
},
},
@@ -298,9 +299,6 @@ export class WaafiProvider implements PaymentProvider {
private get paymentMethod(): string {
return this.config.get<string>("waafi.paymentMethod") ?? "MWALLET_ACCOUNT";
}
private get currency(): string {
return this.config.get<string>("waafi.currency") ?? "";
}
private get successUrl(): string {
return this.config.get<string>("waafi.successUrl") ?? "";
}