fix: use Olkypay as default bank for fiat bank transfers#3863
fix: use Olkypay as default bank for fiat bank transfers#3863TaprootFreak wants to merge 4 commits into
Conversation
This reverts commit bd6296f. 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.
davidleomay
left a comment
There was a problem hiding this comment.
This one-line fix is correct, but the underlying issue is that getDefaultBankByPaymentMethod uses a hardcoded constant while the actual receiving bank is determined dynamically by BankService.getBank(selector) at execution time. These can diverge — the next time a new EUR bank is added, the hardcoded default will be wrong again.
BankService.getBank takes { currency, paymentMethod } and matches a receive bank from the DB — exactly the information already available at each call site (from for currency, paymentMethodIn for method). Consider:
- Injecting
BankServiceintoTransactionHelper(no circular dependency — bank module doesn't import TransactionHelper) - Using
(await bankService.getBank({ currency, paymentMethod })).namefor BANK/INSTANT cases instead of hardcoding - Keeping CARD hardcoded (Checkout is a card processor, not a bank entity)
That way the fee quote always uses the same bank the system routes to at execution time.
| static getDefaultBankByPaymentMethod(paymentMethod: PaymentMethod): CardBankName | IbanBankName { | ||
| switch (paymentMethod) { | ||
| case FiatPaymentMethod.BANK: | ||
| return IbanBankName.YAPEAL; |
There was a problem hiding this comment.
This fix corrects the bank name, but getDefaultBankByPaymentMethod still uses a hardcoded constant while BankService.getBank(selector) dynamically matches the actual receiving bank from the DB. When the next EUR bank is added, this default will be stale again.
Could instead call bankService.getBank({ currency, paymentMethod }) for BANK and INSTANT cases — all the needed info (from/currency, paymentMethodIn) is already available at each call site. The CARD case would stay hardcoded since Checkout is a card processor, not a bank entity.
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.
|
Superseded by #3864 which additionally handles vIBAN resolution. |
Summary
getDefaultBankByPaymentMethod(BANK)returned Yapeal (2% bank fee) instead of Olkypay (0.5%), causing the frontend to display inflated bank fees in EUR buy quotesIbanBankName.YAPEALtoIbanBankName.OLKYto match the actual receiving bank (LU116060002000005040 = Olkypay)Test plan
yarn lintcleanyarn format:checkcleanyarn buildcleanyarn test -- --testPathPattern=transaction-helper— 6/6 pass