[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fix re-purchase detection
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fix re-purchase detection |
Date: |
Fri, 06 Dec 2019 00:56:43 +0100 |
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 c8c84911 fix re-purchase detection
c8c84911 is described below
commit c8c84911ce4f69900ffbbf5accff827c78d9e13b
Author: Florian Dold <address@hidden>
AuthorDate: Fri Dec 6 00:56:31 2019 +0100
fix re-purchase detection
---
src/headless/taler-wallet-cli.ts | 18 ++++++++++++++++++
src/wallet-impl/pay.ts | 6 ++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index 71bccade..2073c257 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -27,6 +27,7 @@ import { Logger } from "../util/logging";
import * as Amounts from "../util/amounts";
import { decodeCrock } from "../crypto/talerCrypto";
import { OperationFailedAndReportedError } from "../wallet-impl/errors";
+import { Bank } from "./bank";
const logger = new Logger("taler-wallet-cli.ts");
@@ -434,6 +435,23 @@ testCli
console.log(tipUri);
});
+testCli
+ .subcommand("genWithdrawUri", "gen-withdraw-uri", {
+ help: "Generate a taler://withdraw URI.",
+ })
+ .requiredOption("amount", ["-a", "--amount"], clk.STRING, {
+ default: "TESTKUDOS:20",
+ })
+ .requiredOption("bank", ["-b", "--bank"], clk.STRING, {
+ default: "https://bank.test.taler.net/",
+ })
+ .action(async (args) => {
+ const b = new Bank(args.genWithdrawUri.bank);
+ const user = await b.registerRandomUser();
+ const url = await b.generateWithdrawUri(user, args.genWithdrawUri.amount);
+ console.log(url);
+ });
+
testCli
.subcommand("genRefundUri", "gen-refund-uri", {
help: "Generate a taler://refund URI.",
diff --git a/src/wallet-impl/pay.ts b/src/wallet-impl/pay.ts
index cec1b6bc..1375a22c 100644
--- a/src/wallet-impl/pay.ts
+++ b/src/wallet-impl/pay.ts
@@ -593,6 +593,7 @@ async function processDownloadProposalImpl(
fulfillmentUrl,
);
if (differentPurchase) {
+ console.log("repurchase detected");
p.proposalStatus = ProposalStatus.REPURCHASE;
p.repurchaseProposalId = differentPurchase.proposalId;
await tx.put(Stores.proposals, p);
@@ -756,7 +757,7 @@ export async function preparePay(
};
}
- const proposalId = await startDownloadProposal(
+ let proposalId = await startDownloadProposal(
ws,
uriResult.downloadUrl,
uriResult.sessionId,
@@ -771,6 +772,7 @@ export async function preparePay(
if (!existingProposalId) {
throw Error("invalid proposal state");
}
+ console.log("using existing purchase for same product");
proposal = await oneShotGet(ws.db, Stores.proposals, existingProposalId);
if (!proposal) {
throw Error("existing proposal is in wrong state");
@@ -787,7 +789,7 @@ export async function preparePay(
throw Error("BUG: proposal is in invalid state");
}
- console.log("proposal", proposal);
+ proposalId = proposal.proposalId;
// First check if we already payed for it.
const purchase = await oneShotGet(ws.db, Stores.purchases, proposalId);
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: fix re-purchase detection,
gnunet <=