wallet-core: add wire method check in new coin selection
This commit is contained in:
parent
ba5f8ad386
commit
cffc4347a0
@ -21,10 +21,8 @@ import { Duration, PreparePayResultType } from "@gnu-taler/taler-util";
|
|||||||
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
||||||
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
|
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
|
||||||
import {
|
import {
|
||||||
BankService,
|
|
||||||
ExchangeService,
|
ExchangeService,
|
||||||
FakebankService,
|
FakebankService,
|
||||||
getPayto,
|
|
||||||
getRandomIban,
|
getRandomIban,
|
||||||
GlobalTestState,
|
GlobalTestState,
|
||||||
MerchantPrivateApi,
|
MerchantPrivateApi,
|
||||||
@ -32,11 +30,7 @@ import {
|
|||||||
setupDb,
|
setupDb,
|
||||||
WalletCli,
|
WalletCli,
|
||||||
} from "../harness/harness.js";
|
} from "../harness/harness.js";
|
||||||
import {
|
import { withdrawViaBank } from "../harness/helpers.js";
|
||||||
createSimpleTestkudosEnvironment,
|
|
||||||
withdrawViaBank,
|
|
||||||
makeTestPayment,
|
|
||||||
} from "../harness/helpers.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for wallet balance error messages / different types of insufficient balance.
|
* Test for wallet balance error messages / different types of insufficient balance.
|
||||||
|
@ -47,6 +47,7 @@ import {
|
|||||||
j2s,
|
j2s,
|
||||||
Logger,
|
Logger,
|
||||||
NotificationType,
|
NotificationType,
|
||||||
|
parsePaytoUri,
|
||||||
parsePayUri,
|
parsePayUri,
|
||||||
PayCoinSelection,
|
PayCoinSelection,
|
||||||
PreparePayResult,
|
PreparePayResult,
|
||||||
@ -898,6 +899,19 @@ export async function selectCandidates(
|
|||||||
if (exchangeDetails?.currency !== req.contractTermsAmount.currency) {
|
if (exchangeDetails?.currency !== req.contractTermsAmount.currency) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let wireMethodSupported = false;
|
||||||
|
for (const acc of exchangeDetails.wireInfo.accounts) {
|
||||||
|
const pp = parsePaytoUri(acc.payto_uri);
|
||||||
|
checkLogicInvariant(!!pp);
|
||||||
|
if (pp.targetType === req.wireMethod) {
|
||||||
|
wireMethodSupported = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!wireMethodSupported) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
exchangeDetails.wireInfo.accounts;
|
||||||
let accepted = false;
|
let accepted = false;
|
||||||
for (const allowedExchange of req.exchanges) {
|
for (const allowedExchange of req.exchanges) {
|
||||||
if (allowedExchange.exchangePub === exchangeDetails.masterPublicKey) {
|
if (allowedExchange.exchangePub === exchangeDetails.masterPublicKey) {
|
||||||
|
Loading…
Reference in New Issue
Block a user