Skip to content

fix(payment): align quoted bank fee with actual deposit bank#3864

Open
joshuakrueger-dfx wants to merge 2 commits into
developfrom
fix/quote-bank-fee-deposit-bank
Open

fix(payment): align quoted bank fee with actual deposit bank#3864
joshuakrueger-dfx wants to merge 2 commits into
developfrom
fix/quote-bank-fee-deposit-bank

Conversation

@joshuakrueger-dfx

@joshuakrueger-dfx joshuakrueger-dfx commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

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's bankIn like the deposit account in BuyService.getBankInfo:
    • active user vIBAN (with receiving bank) → vIBAN bank
    • otherwise → BankService.getBank selector (same as payment infos), with the previous static mapping as fallback
  • VirtualIbanService: extract vIBAN bank + eligibility into shared statics, reused in BuyService.getBankInfo; eligibility restricted to CHF (EUR vIBANs no longer exist — Yapeal EUR is receive=false), so getBankInfo no longer attempts EUR vIBAN creation
  • BankSelectorInput.amount optional (unused by getBank)

No entity/DTO/API contract changes — no migration, no frontend sync needed.

Test plan

  • npm run format / lint / type-check clean
  • Full jest suite green (76 suites, 1024 tests)
  • Unit tests for getBankIn (deposit bank, active vIBAN, no vIBAN, instant, card, fallback)
  • Staging: quote a EUR buy (method Bank) — fees.bankVariable shows 0.5% (Olky) instead of 2%
  • Staging: quote as user with active CHF vIBAN — bank resolves to Yapeal

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';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32b6581currencies 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;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants