aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/withdraw.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-10-07 14:45:25 +0200
committerFlorian Dold <florian@dold.me>2022-10-07 14:45:25 +0200
commitf479ca01390483a8744207bd9b64ea3b7322231c (patch)
tree9cd6c45a0b11b382441e8ab269de1f158eaf76e8 /packages/taler-wallet-core/src/operations/withdraw.ts
parenta93a0cae131da4c3dd3f30ac5300f16f759758ff (diff)
downloadwallet-core-f479ca01390483a8744207bd9b64ea3b7322231c.tar.xz
wallet-core: fix/deduplicate funding payto URI generation for withdrawals
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts22
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index d768bbeb2..fb5e2c70a 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -1483,6 +1483,19 @@ export async function getFundingPaytoUrisTx(
.runReadWrite((tx) => getFundingPaytoUris(tx, withdrawalGroupId));
}
+export function augmentPaytoUrisForWithdrawal(
+ plainPaytoUris: string[],
+ reservePub: string,
+ instructedAmount: AmountJson,
+): string[] {
+ return plainPaytoUris.map((x) =>
+ addPaytoQueryParams(x, {
+ amount: Amounts.stringify(instructedAmount),
+ message: `Taler Withdrawal ${reservePub}`,
+ }),
+ );
+}
+
/**
* Get payto URIs that can be used to fund a withdrawal operation.
*/
@@ -1512,11 +1525,10 @@ export async function getFundingPaytoUris(
);
return [];
}
- return plainPaytoUris.map((x) =>
- addPaytoQueryParams(x, {
- amount: Amounts.stringify(withdrawalGroup.instructedAmount),
- message: `Taler Withdrawal ${withdrawalGroup.reservePub}`,
- }),
+ return augmentPaytoUrisForWithdrawal(
+ plainPaytoUris,
+ withdrawalGroup.reservePub,
+ withdrawalGroup.instructedAmount,
);
}