fix(payment): align quoted bank fee with actual deposit bank#3864
fix(payment): align quoted bank fee with actual deposit bank#3864joshuakrueger-dfx wants to merge 2 commits into
Conversation
| import { FiatService } from 'src/shared/models/fiat/fiat.service'; | ||
| import { Buy } from 'src/subdomains/core/buy-crypto/routes/buy/buy.entity'; | ||
| import { UserData } from 'src/subdomains/generic/user/models/user-data/user-data.entity'; | ||
| import { KycLevel } from 'src/subdomains/generic/user/models/user-data/user-data.enum'; |
There was a problem hiding this comment.
currencies includes EUR but EUR vIBANs no longer exist (Yapeal EUR has receive=false). This causes isUserEligible to return true for EUR users, triggering vIBAN creation attempts in getBankInfo that silently fail and an incorrect Yapeal fee quote in getBankIn (see other comment). Should be ['CHF'] only.
There was a problem hiding this comment.
Fixed in 32b6581 — currencies is now ['CHF'], so getBankInfo no longer attempts EUR vIBAN creation.
| const virtualIban = await this.virtualIbanService.getActiveForUserAndCurrency(userData, from.name); | ||
| if (virtualIban?.bank.receive) return virtualIban.bank.name; | ||
| if (VirtualIbanService.isUserEligible(from.name, userData)) return VirtualIbanService.bankName; | ||
| } |
There was a problem hiding this comment.
This early return is wrong for EUR (see other comment on currencies). For CHF it's redundant — bankService.getBank('CHF') already returns Yapeal CHF and there's no CHF bank fee anyway. The active vIBAN check above already handles existing vIBANs. This line should be removed; let bankService.getBank resolve the bank for everyone without an active vIBAN.
There was a problem hiding this comment.
Fixed in 32b6581 — eligibility prediction removed from getBankIn; users without an active vIBAN now resolve via bankService.getBank. Test updated accordingly (EUR KYC 50+ without vIBAN → Olky).
…prediction from quote bank resolution
Summary
The fee breakdown in quotes (
getTxDetails) resolved the bank for the bank fee via a hardcoded payment-method mapping (Bank → Yapeal,Instant → Olky). The effective fee calculation (buy-crypto-preparation) resolves the bank from the actual deposit account of the incoming bank tx. Since #3644 differentiates EUR bank fees per bank (Olky 0.5%, Yapeal 2%), quotes for EUR bank transfers displayed the Yapeal 2% percent fee while the payment effectively lands at Olkypay and is charged 0.5%.Changes
TransactionHelper.getBankIn: resolve the quote'sbankInlike the deposit account inBuyService.getBankInfo:BankService.getBankselector (same as payment infos), with the previous static mapping as fallbackVirtualIbanService: extract vIBAN bank + eligibility into shared statics, reused inBuyService.getBankInfo; eligibility restricted to CHF (EUR vIBANs no longer exist — Yapeal EUR isreceive=false), sogetBankInfono longer attempts EUR vIBAN creationBankSelectorInput.amountoptional (unused bygetBank)No entity/DTO/API contract changes — no migration, no frontend sync needed.
Test plan
npm run format/lint/type-checkcleangetBankIn(deposit bank, active vIBAN, no vIBAN, instant, card, fallback)Bank) —fees.bankVariableshows 0.5% (Olky) instead of 2%