aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-05 15:38:47 +0200
committerFlorian Dold <florian@dold.me>2022-09-05 15:38:47 +0200
commit43b893b8c4538f66b7f0161a85277e4db82bb192 (patch)
tree7a8ae8a978b2f05e493bfe73c9ef5555bc8f9116 /packages/taler-wallet-core/src/operations
parentb37fbdb59dc54794a96269aa432078abf36d3a09 (diff)
downloadwallet-core-43b893b8c4538f66b7f0161a85277e4db82bb192.tar.xz
consider supported wire types when selecting coins
Also add an integration test to check for the correct wallet behavior.
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index d41a20e71..8193bf86a 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,
@@ -241,6 +242,20 @@ export async function getCandidatePayCoins(
continue;
}
+ const wireTypes = new Set<string>();
+ for (const acc of exchangeDetails.wireInfo.accounts) {
+ const p = parsePaytoUri(acc.payto_uri);
+ if (p) {
+ wireTypes.add(p.targetType);
+ }
+ }
+
+ if (!wireTypes.has(req.wireMethod)) {
+ // Exchange can't be used, because it doesn't support
+ // the wire type that the merchant requested.
+ continue;
+ }
+
// is the exchange explicitly allowed?
for (const allowedExchange of req.allowedExchanges) {
if (allowedExchange.exchangePub === exchangeDetails.masterPublicKey) {
@@ -1338,7 +1353,7 @@ export async function getContractTermsDetails(
throw Error("proposal is in invalid state");
}
- return proposal.download.contractData
+ return proposal.download.contractData;
}
/**