summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-19 11:28:47 +0200
committerFlorian Dold <florian@dold.me>2022-09-19 11:28:47 +0200
commitcffc4347a0b3a7b6024b4d274e7225f49f75eb08 (patch)
treedef9ea28a2876e9dbf4115fb68cf674b423291e8 /packages/taler-wallet-core/src/operations/pay.ts
parentba5f8ad3867adc114e3b580090767fe95b68a146 (diff)
downloadwallet-core-cffc4347a0b3a7b6024b4d274e7225f49f75eb08.tar.gz
wallet-core-cffc4347a0b3a7b6024b4d274e7225f49f75eb08.tar.bz2
wallet-core-cffc4347a0b3a7b6024b4d274e7225f49f75eb08.zip
wallet-core: add wire method check in new coin selection
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index 52b23713d..a498ab28d 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -47,6 +47,7 @@ import {
j2s,
Logger,
NotificationType,
+ parsePaytoUri,
parsePayUri,
PayCoinSelection,
PreparePayResult,
@@ -898,6 +899,19 @@ export async function selectCandidates(
if (exchangeDetails?.currency !== req.contractTermsAmount.currency) {
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;
for (const allowedExchange of req.exchanges) {
if (allowedExchange.exchangePub === exchangeDetails.masterPublicKey) {