summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-08 01:06:13 +0100
committerFlorian Dold <florian@dold.me>2024-03-08 01:06:13 +0100
commitb4ab2fcdf3e1bbc0ca9096661a1812481dca58b3 (patch)
treec6e09a24003360ff377a9cb64247a43d0adba851 /packages/taler-wallet-core
parentae34a78ff026e2e96b1e15319157d36c57745665 (diff)
downloadwallet-core-b4ab2fcdf3e1bbc0ca9096661a1812481dca58b3.tar.gz
wallet-core-b4ab2fcdf3e1bbc0ca9096661a1812481dca58b3.tar.bz2
wallet-core-b4ab2fcdf3e1bbc0ca9096661a1812481dca58b3.zip
wallet-core: remove deprecated peer...PaymentId
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r--packages/taler-wallet-core/src/pay-peer-pull-debit.ts17
-rw-r--r--packages/taler-wallet-core/src/pay-peer-push-credit.ts22
-rw-r--r--packages/taler-wallet-core/src/testing.ts2
3 files changed, 14 insertions, 27 deletions
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
index 0ccca82a2..114d2366a 100644
--- a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
@@ -561,18 +561,11 @@ export async function confirmPeerPullDebit(
req: ConfirmPeerPullDebitRequest,
): Promise<AcceptPeerPullPaymentResponse> {
let peerPullDebitId: string;
-
- if (req.transactionId) {
- const parsedTx = parseTransactionIdentifier(req.transactionId);
- if (!parsedTx || parsedTx.tag !== TransactionType.PeerPullDebit) {
- throw Error("invalid peer-pull-debit transaction identifier");
- }
- peerPullDebitId = parsedTx.peerPullDebitId;
- } else if (req.peerPullDebitId) {
- peerPullDebitId = req.peerPullDebitId;
- } else {
- throw Error("invalid request, transactionId or peerPullDebitId required");
+ const parsedTx = parseTransactionIdentifier(req.transactionId);
+ if (!parsedTx || parsedTx.tag !== TransactionType.PeerPullDebit) {
+ throw Error("invalid peer-pull-debit transaction identifier");
}
+ peerPullDebitId = parsedTx.peerPullDebitId;
const peerPullInc = await wex.db.runReadOnlyTx(
["peerPullDebit"],
@@ -583,7 +576,7 @@ export async function confirmPeerPullDebit(
if (!peerPullInc) {
throw Error(
- `can't accept unknown incoming p2p pull payment (${req.peerPullDebitId})`,
+ `can't accept unknown incoming p2p pull payment (${req.transactionId})`,
);
}
diff --git a/packages/taler-wallet-core/src/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
index f6ba429a6..ecc1e827f 100644
--- a/packages/taler-wallet-core/src/pay-peer-push-credit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
@@ -901,20 +901,14 @@ export async function confirmPeerPushCredit(
): Promise<AcceptPeerPushPaymentResponse> {
let peerInc: PeerPushPaymentIncomingRecord | undefined;
let peerPushCreditId: string;
- if (req.peerPushCreditId) {
- peerPushCreditId = req.peerPushCreditId;
- } else if (req.transactionId) {
- const parsedTx = parseTransactionIdentifier(req.transactionId);
- if (!parsedTx) {
- throw Error("invalid transaction ID");
- }
- if (parsedTx.tag !== TransactionType.PeerPushCredit) {
- throw Error("invalid transaction ID type");
- }
- peerPushCreditId = parsedTx.peerPushCreditId;
- } else {
- throw Error("no transaction ID (or deprecated peerPushCreditId) provided");
+ const parsedTx = parseTransactionIdentifier(req.transactionId);
+ if (!parsedTx) {
+ throw Error("invalid transaction ID");
+ }
+ if (parsedTx.tag !== TransactionType.PeerPushCredit) {
+ throw Error("invalid transaction ID type");
}
+ peerPushCreditId = parsedTx.peerPushCreditId;
logger.trace(`confirming peer-push-credit ${peerPushCreditId}`);
@@ -934,7 +928,7 @@ export async function confirmPeerPushCredit(
if (!peerInc) {
throw Error(
- `can't accept unknown incoming p2p push payment (${req.peerPushCreditId})`,
+ `can't accept unknown incoming p2p push payment (${req.transactionId})`,
);
}
diff --git a/packages/taler-wallet-core/src/testing.ts b/packages/taler-wallet-core/src/testing.ts
index 795f963d0..b192e7b70 100644
--- a/packages/taler-wallet-core/src/testing.ts
+++ b/packages/taler-wallet-core/src/testing.ts
@@ -821,7 +821,7 @@ export async function runIntegrationTest2(
});
await confirmPeerPullDebit(wex, {
- peerPullDebitId: peerPullInc.peerPullDebitId,
+ transactionId: peerPullInc.transactionId,
});
await waitUntilTransactionWithAssociatedRefreshesFinal(