[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: dynamic pay request timeout
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: dynamic pay request timeout |
Date: |
Mon, 07 Sep 2020 12:24:27 +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 be77ee28 dynamic pay request timeout
be77ee28 is described below
commit be77ee284a819f7932831bd85e88c47c655addb2
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Mon Sep 7 15:54:22 2020 +0530
dynamic pay request timeout
---
packages/taler-integrationtests/src/harness.ts | 24 ++++++++++++++++++++++++
packages/taler-wallet-core/src/operations/pay.ts | 8 +++++---
packages/taler-wallet-core/src/util/time.ts | 7 +++++++
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/packages/taler-integrationtests/src/harness.ts
b/packages/taler-integrationtests/src/harness.ts
index 90a618e1..620b89e7 100644
--- a/packages/taler-integrationtests/src/harness.ts
+++ b/packages/taler-integrationtests/src/harness.ts
@@ -1215,6 +1215,30 @@ export namespace MerchantPrivateApi {
talerRefundUri: resp.data.taler_refund_uri,
};
}
+
+ export async function createTippingReserve(merchantService:
MerchantServiceInterface,
+
+ req: CreateMerchantTippingReserveRequest,
+ ): Promise<CreateMerchantTippingReserveConfirmation> {}
+}
+
+export interface CreateMerchantTippingReserveRequest {
+ // Amount that the merchant promises to put into the reserve
+ initial_balance: AmountString;
+
+ // Exchange the merchant intends to use for tipping
+ exchange_url: string;
+
+ // Desired wire method, for example "iban" or "x-taler-bank"
+ wire_method: string;
+}
+
+export interface CreateMerchantTippingReserveConfirmation {
+ // Public key identifying the reserve
+ reserve_pub: string;
+
+ // Wire account of the exchange where to transfer the funds
+ payto_url: string;
}
export class MerchantService implements MerchantServiceInterface {
diff --git a/packages/taler-wallet-core/src/operations/pay.ts
b/packages/taler-wallet-core/src/operations/pay.ts
index 6452a11a..50f863e4 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -68,6 +68,8 @@ import {
durationMax,
durationMin,
isTimestampExpired,
+ durationMul,
+ durationAdd,
} from "../util/time";
import { strcmp, canonicalJson } from "../util/helpers";
import {
@@ -614,8 +616,8 @@ function getProposalRequestTimeout(proposal:
ProposalRecord): Duration {
);
}
-function getPurchaseRequestTimeout(purchase: PurchaseRecord): Duration {
- return { d_ms: 5000 };
+function getPayRequestTimeout(purchase: PurchaseRecord): Duration {
+ return durationMul({ d_ms: 5000 }, 1 +
purchase.payCoinSelection.coinPubs.length / 20);
}
async function processDownloadProposalImpl(
@@ -936,7 +938,7 @@ export async function submitPay(
const resp = await ws.runSequentialized([EXCHANGE_COINS_LOCK], () =>
ws.http.postJson(payUrl, reqBody, {
- timeout: getPurchaseRequestTimeout(purchase),
+ timeout: getPayRequestTimeout(purchase),
}),
);
diff --git a/packages/taler-wallet-core/src/util/time.ts
b/packages/taler-wallet-core/src/util/time.ts
index 5a5e9c60..be63aef6 100644
--- a/packages/taler-wallet-core/src/util/time.ts
+++ b/packages/taler-wallet-core/src/util/time.ts
@@ -151,6 +151,13 @@ export function durationMul(d: Duration, n: number):
Duration {
return { d_ms: Math.round(d.d_ms * n) };
}
+export function durationAdd(d1: Duration, d2: Duration): Duration {
+ if (d1.d_ms === "forever" || d2.d_ms === "forever") {
+ return { d_ms: "forever" };
+ }
+ return { d_ms: d1.d_ms + d2.d_ms };
+}
+
export function timestampCmp(t1: Timestamp, t2: Timestamp): number {
if (t1.t_ms === "never") {
if (t2.t_ms === "never") {
--
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: dynamic pay request timeout,
gnunet <=