From 7cf61622a68b4c339d3831c5552ee3265439c873 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:10:33 +0200 Subject: [PATCH 1/4] fix: use Olkypay as default bank for fiat bank transfers --- .../supporting/payment/services/transaction-helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subdomains/supporting/payment/services/transaction-helper.ts b/src/subdomains/supporting/payment/services/transaction-helper.ts index 23121ba12c..c924b9ee1b 100644 --- a/src/subdomains/supporting/payment/services/transaction-helper.ts +++ b/src/subdomains/supporting/payment/services/transaction-helper.ts @@ -854,7 +854,7 @@ export class TransactionHelper implements OnModuleInit { static getDefaultBankByPaymentMethod(paymentMethod: PaymentMethod): CardBankName | IbanBankName { switch (paymentMethod) { case FiatPaymentMethod.BANK: - return IbanBankName.YAPEAL; + return IbanBankName.OLKY; case FiatPaymentMethod.CARD: return CardBankName.CHECKOUT; case FiatPaymentMethod.INSTANT: From bd6296f5c1dae124ebbf7d3015738999691a771f Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:17:21 +0200 Subject: [PATCH 2/4] fix: use default bank method in sell-crypto fee preparation --- .../process/services/buy-fiat-preparation.service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts b/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts index cd08f8f740..17534add44 100644 --- a/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts +++ b/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts @@ -13,7 +13,6 @@ import { PayoutFrequency } from 'src/subdomains/core/payment-link/entities/payme import { ReviewStatus } from 'src/subdomains/generic/kyc/enums/review-status.enum'; import { KycStatus, RiskStatus, UserDataStatus } from 'src/subdomains/generic/user/models/user-data/user-data.enum'; import { UserStatus } from 'src/subdomains/generic/user/models/user/user.enum'; -import { IbanBankName } from 'src/subdomains/supporting/bank/bank/dto/bank.dto'; import { FiatOutputType } from 'src/subdomains/supporting/fiat-output/fiat-output.entity'; import { FiatOutputService } from 'src/subdomains/supporting/fiat-output/fiat-output.service'; import { PayInStatus } from 'src/subdomains/supporting/payin/entities/crypto-input.entity'; @@ -209,7 +208,7 @@ export class BuyFiatPreparationService { CryptoPaymentMethod.CRYPTO, FiatPaymentMethod.BANK, undefined, - IbanBankName.YAPEAL, + TransactionHelper.getDefaultBankByPaymentMethod(FiatPaymentMethod.BANK), entity.user, ); From d1922cc70c58b421a7b20bdc1aaab7b76ff33bb0 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:23:46 +0200 Subject: [PATCH 3/4] Revert "fix: use default bank method in sell-crypto fee preparation" This reverts commit bd6296f5c. The change was unnecessary: sell flow uses paymentMethodIn=CRYPTO, so Bank fees are never collected (fee.service.ts:391-394). bankOut does not affect sell fee calculation. --- .../process/services/buy-fiat-preparation.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts b/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts index 17534add44..cd08f8f740 100644 --- a/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts +++ b/src/subdomains/core/sell-crypto/process/services/buy-fiat-preparation.service.ts @@ -13,6 +13,7 @@ import { PayoutFrequency } from 'src/subdomains/core/payment-link/entities/payme import { ReviewStatus } from 'src/subdomains/generic/kyc/enums/review-status.enum'; import { KycStatus, RiskStatus, UserDataStatus } from 'src/subdomains/generic/user/models/user-data/user-data.enum'; import { UserStatus } from 'src/subdomains/generic/user/models/user/user.enum'; +import { IbanBankName } from 'src/subdomains/supporting/bank/bank/dto/bank.dto'; import { FiatOutputType } from 'src/subdomains/supporting/fiat-output/fiat-output.entity'; import { FiatOutputService } from 'src/subdomains/supporting/fiat-output/fiat-output.service'; import { PayInStatus } from 'src/subdomains/supporting/payin/entities/crypto-input.entity'; @@ -208,7 +209,7 @@ export class BuyFiatPreparationService { CryptoPaymentMethod.CRYPTO, FiatPaymentMethod.BANK, undefined, - TransactionHelper.getDefaultBankByPaymentMethod(FiatPaymentMethod.BANK), + IbanBankName.YAPEAL, entity.user, ); From 6414407d233b10e68ef0be95d83d2abe2af1a97d Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Wed, 10 Jun 2026 15:19:10 +0200 Subject: [PATCH 4/4] fix: use dynamic bank lookup for fee quotes instead of hardcoded default Replace hardcoded getDefaultBankByPaymentMethod(BANK) with dynamic BankService.getBank() lookup that matches the actual receive bank at execution time. This ensures fee quotes always use the same bank the system routes payments to, regardless of which bank is configured as the receive bank for a given currency. Call sites updated in buy/sell controllers and getTxDetails. --- .../buy-crypto/routes/buy/buy.controller.ts | 2 +- .../__tests__/transaction-helper.spec.ts | 4 ++++ .../core/sell-crypto/route/sell.controller.ts | 2 +- .../payment/services/transaction-helper.ts | 17 +++++++++++------ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/subdomains/core/buy-crypto/routes/buy/buy.controller.ts b/src/subdomains/core/buy-crypto/routes/buy/buy.controller.ts index 9224b7ce36..e15ecd56c8 100644 --- a/src/subdomains/core/buy-crypto/routes/buy/buy.controller.ts +++ b/src/subdomains/core/buy-crypto/routes/buy/buy.controller.ts @@ -286,7 +286,7 @@ export class BuyController { userId, FiatPaymentMethod.BANK, CryptoPaymentMethod.CRYPTO, - TransactionHelper.getDefaultBankByPaymentMethod(FiatPaymentMethod.BANK), + await this.transactionHelper.getDefaultBank(FiatPaymentMethod.BANK, 'EUR'), undefined, await this.fiatService.getFiatByName('EUR'), buy.asset, diff --git a/src/subdomains/core/history/__tests__/transaction-helper.spec.ts b/src/subdomains/core/history/__tests__/transaction-helper.spec.ts index c614eb0ac0..2c97c6037e 100644 --- a/src/subdomains/core/history/__tests__/transaction-helper.spec.ts +++ b/src/subdomains/core/history/__tests__/transaction-helper.spec.ts @@ -14,6 +14,7 @@ import { createDefaultUserData } from 'src/subdomains/generic/user/models/user-d import { WalletService } from 'src/subdomains/generic/user/models/wallet/wallet.service'; import { createDefaultBankTx } from 'src/subdomains/supporting/bank-tx/bank-tx/__mocks__/bank-tx.entity.mock'; import { CardBankName, IbanBankName } from 'src/subdomains/supporting/bank/bank/dto/bank.dto'; +import { BankService } from 'src/subdomains/supporting/bank/bank/bank.service'; import { createDefaultCheckoutTx } from 'src/subdomains/supporting/fiat-payin/__mocks__/checkout-tx.entity.mock'; import { createDefaultCryptoInput } from 'src/subdomains/supporting/payin/entities/__mocks__/crypto-input.entity.mock'; import { @@ -46,6 +47,7 @@ describe('TransactionHelper', () => { let buyService: BuyService; let assetService: AssetService; let countryService: CountryService; + let bankService: BankService; beforeEach(async () => { specRepo = createMock(); @@ -60,6 +62,7 @@ describe('TransactionHelper', () => { buyService = createMock(); assetService = createMock(); countryService = createMock(); + bankService = createMock(); const module: TestingModule = await Test.createTestingModule({ imports: [TestSharedModule], @@ -77,6 +80,7 @@ describe('TransactionHelper', () => { { provide: BuyService, useValue: buyService }, { provide: AssetService, useValue: assetService }, { provide: CountryService, useValue: countryService }, + { provide: BankService, useValue: bankService }, TestUtil.provideConfig(), ], }).compile(); diff --git a/src/subdomains/core/sell-crypto/route/sell.controller.ts b/src/subdomains/core/sell-crypto/route/sell.controller.ts index 750890c2cd..bad2044bfc 100644 --- a/src/subdomains/core/sell-crypto/route/sell.controller.ts +++ b/src/subdomains/core/sell-crypto/route/sell.controller.ts @@ -246,7 +246,7 @@ export class SellController { CryptoPaymentMethod.CRYPTO, FiatPaymentMethod.BANK, undefined, - TransactionHelper.getDefaultBankByPaymentMethod(FiatPaymentMethod.BANK), + await this.transactionHelper.getDefaultBank(FiatPaymentMethod.BANK, sell.fiat.name), await this.assetService.getNativeAsset(defaultBlockchain), sell.fiat, ); diff --git a/src/subdomains/supporting/payment/services/transaction-helper.ts b/src/subdomains/supporting/payment/services/transaction-helper.ts index c924b9ee1b..e3034c2423 100644 --- a/src/subdomains/supporting/payment/services/transaction-helper.ts +++ b/src/subdomains/supporting/payment/services/transaction-helper.ts @@ -37,6 +37,7 @@ import { FeeService, UserFeeRequest } from 'src/subdomains/supporting/payment/se import { Price } from 'src/subdomains/supporting/pricing/domain/entities/price'; import { BankTxReturn } from '../../bank-tx/bank-tx-return/bank-tx-return.entity'; import { BankTx } from '../../bank-tx/bank-tx/entities/bank-tx.entity'; +import { BankService } from '../../bank/bank/bank.service'; import { CardBankName, IbanBankName } from '../../bank/bank/dto/bank.dto'; import { CryptoInput, PayInConfirmationType } from '../../payin/entities/crypto-input.entity'; import { PriceCurrency, PriceValidity, PricingService } from '../../pricing/services/pricing.service'; @@ -77,6 +78,7 @@ export class TransactionHelper implements OnModuleInit { private readonly buyService: BuyService, private readonly assetService: AssetService, private readonly countryService: CountryService, + private readonly bankService: BankService, ) {} onModuleInit() { @@ -269,8 +271,8 @@ export class TransactionHelper implements OnModuleInit { const chfPrice = await this.pricingService.getPrice(txAsset, PriceCurrency.CHF, PriceValidity.ANY); const txAmountChf = chfPrice.convert(txAmount); - const bankIn = TransactionHelper.getDefaultBankByPaymentMethod(paymentMethodIn); - const bankOut = TransactionHelper.getDefaultBankByPaymentMethod(paymentMethodOut); + const bankIn = await this.getDefaultBank(paymentMethodIn, from.name); + const bankOut = await this.getDefaultBank(paymentMethodOut, isFiat(to) ? to.name : undefined); const wallet = walletName ? await this.walletService.getByIdOrName(undefined, walletName) : undefined; @@ -853,17 +855,20 @@ export class TransactionHelper implements OnModuleInit { static getDefaultBankByPaymentMethod(paymentMethod: PaymentMethod): CardBankName | IbanBankName { switch (paymentMethod) { - case FiatPaymentMethod.BANK: - return IbanBankName.OLKY; case FiatPaymentMethod.CARD: return CardBankName.CHECKOUT; - case FiatPaymentMethod.INSTANT: - return IbanBankName.OLKY; default: return undefined; } } + async getDefaultBank(paymentMethod: PaymentMethod, currency: string): Promise { + if (![FiatPaymentMethod.BANK, FiatPaymentMethod.INSTANT].includes(paymentMethod as FiatPaymentMethod)) + return undefined; + const bank = await this.bankService.getBank({ amount: 0, currency, paymentMethod: paymentMethod as FiatPaymentMethod }); + return bank?.name as IbanBankName; + } + private async getSourceSpecs(from: Active, { fee, volume }: TxSpec, priceValidity: PriceValidity): Promise { const price = await this.pricingService.getPrice(from, PriceCurrency.CHF, priceValidity).then((p) => p.invert());