[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: allow confirming
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: allow confirming peer-push-credit via txid |
Date: |
Sat, 24 Jun 2023 17:49:56 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 1f31ebc3c wallet-core: allow confirming peer-push-credit via txid
1f31ebc3c is described below
commit 1f31ebc3cc4b116f4d762f974e803c7ef85ab51f
Author: Florian Dold <florian@dold.me>
AuthorDate: Sat Jun 24 17:49:53 2023 +0200
wallet-core: allow confirming peer-push-credit via txid
---
packages/taler-util/src/wallet-types.ts | 7 ++++++-
.../src/operations/pay-peer-push-credit.ts | 20 ++++++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/packages/taler-util/src/wallet-types.ts
b/packages/taler-util/src/wallet-types.ts
index cff7637c6..233c95047 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -2409,8 +2409,12 @@ export const codecForCheckPeerPullPaymentRequest =
export interface ConfirmPeerPushCreditRequest {
/**
* Transparent identifier of the incoming peer push payment.
+ *
+ * @deprecated specify transactionId instead!
*/
- peerPushPaymentIncomingId: string;
+ peerPushPaymentIncomingId?: string;
+
+ transactionId?: string;
}
export interface AcceptPeerPushPaymentResponse {
transactionId: TransactionIdStr;
@@ -2424,6 +2428,7 @@ export const codecForConfirmPeerPushPaymentRequest =
(): Codec<ConfirmPeerPushCreditRequest> =>
buildCodecForObject<ConfirmPeerPushCreditRequest>()
.property("peerPushPaymentIncomingId", codecForString())
+ .property("transactionId", codecForString())
.build("ConfirmPeerPushCreditRequest");
export interface ConfirmPeerPullDebitRequest {
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
index 53a569a92..341dccb7a 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
@@ -71,6 +71,7 @@ import {
TransitionInfo,
constructTransactionIdentifier,
notifyTransition,
+ parseTransactionIdentifier,
stopLongpolling,
} from "./transactions.js";
import {
@@ -617,12 +618,27 @@ export async function confirmPeerPushCredit(
req: ConfirmPeerPushCreditRequest,
): Promise<AcceptPeerPushPaymentResponse> {
let peerInc: PeerPushPaymentIncomingRecord | undefined;
+ let peerPushPaymentIncomingId: string;
+ if (req.peerPushPaymentIncomingId) {
+ peerPushPaymentIncomingId = req.peerPushPaymentIncomingId;
+ } 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");
+ }
+ peerPushPaymentIncomingId = parsedTx.peerPushPaymentIncomingId;
+ } else {
+ throw Error("no transaction ID (or deprecated peerPushPaymentIncomingId)
provided");
+ }
await ws.db
.mktx((x) => [x.contractTerms, x.peerPushPaymentIncoming])
.runReadWrite(async (tx) => {
peerInc = await tx.peerPushPaymentIncoming.get(
- req.peerPushPaymentIncomingId,
+ peerPushPaymentIncomingId,
);
if (!peerInc) {
return;
@@ -643,7 +659,7 @@ export async function confirmPeerPushCredit(
const transactionId = constructTransactionIdentifier({
tag: TransactionType.PeerPushCredit,
- peerPushPaymentIncomingId: req.peerPushPaymentIncomingId,
+ peerPushPaymentIncomingId,
});
return {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: allow confirming peer-push-credit via txid,
gnunet <=