[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fix :long polling request par
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fix :long polling request parameter |
Date: |
Tue, 19 Dec 2023 14:14:57 +0100 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new f7dbd4459 fix :long polling request parameter
f7dbd4459 is described below
commit f7dbd4459a177e9614dbfbad4d1e18e028c8ef08
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Tue Dec 19 10:14:36 2023 -0300
fix :long polling request parameter
---
packages/merchant-backend-ui/src/declaration.d.ts | 4 +++-
packages/merchant-backend-ui/src/pages/OfferRefund.tsx | 4 +++-
packages/merchant-backend-ui/src/pages/OfferTip.tsx | 4 +++-
.../merchant-backend-ui/src/pages/RequestPayment.tsx | 9 +++++----
.../src/pages/ShowOrderDetails.examples.ts | 16 ++++++++--------
5 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/packages/merchant-backend-ui/src/declaration.d.ts
b/packages/merchant-backend-ui/src/declaration.d.ts
index 0e7a18eb5..bb71f61cd 100644
--- a/packages/merchant-backend-ui/src/declaration.d.ts
+++ b/packages/merchant-backend-ui/src/declaration.d.ts
@@ -50,7 +50,9 @@ interface WithId {
type Amount = string;
type UUID = string;
type Integer = number;
-
+type TalerProtocolTimestamp = {
+ t_s: number | "never"
+}
export namespace ExchangeBackend {
interface WireResponse {
diff --git a/packages/merchant-backend-ui/src/pages/OfferRefund.tsx
b/packages/merchant-backend-ui/src/pages/OfferRefund.tsx
index 5fdc51c61..ffd657e7e 100644
--- a/packages/merchant-backend-ui/src/pages/OfferRefund.tsx
+++ b/packages/merchant-backend-ui/src/pages/OfferRefund.tsx
@@ -61,6 +61,8 @@ function Head({ order_summary }: { order_summary?: string }):
VNode {
export function OfferRefund({ refundURI, qr_code, order_status_url }: Props):
VNode {
useEffect(() => {
+ const longpollDelayMs = 60 * 1000;
+ const delayMs = 500;
let checkUrl: URL;
try {
checkUrl = new URL(order_status_url ? order_status_url : "{{&
order_status_url }}");
@@ -68,7 +70,7 @@ export function OfferRefund({ refundURI, qr_code,
order_status_url }: Props): VN
return;
}
checkUrl.searchParams.set("await_refund_obtained", "yes");
- const delayMs = 500;
+ checkUrl.searchParams.set("timeout_ms", longpollDelayMs.toString());
function check() {
let retried = false;
function retryOnce() {
diff --git a/packages/merchant-backend-ui/src/pages/OfferTip.tsx
b/packages/merchant-backend-ui/src/pages/OfferTip.tsx
index d32072282..cb3ce33fd 100644
--- a/packages/merchant-backend-ui/src/pages/OfferTip.tsx
+++ b/packages/merchant-backend-ui/src/pages/OfferTip.tsx
@@ -62,14 +62,16 @@ export function Head(): VNode {
export function OfferTip({ tipURI, qr_code, tip_status_url }: Props): VNode {
useEffect(() => {
+ const longpollDelayMs = 60 * 1000;
+ const delayMs = 500;
let checkUrl: URL;
try {
checkUrl = new URL(tip_status_url ? tip_status_url : "{{& tip_status_url
}}");
} catch (e) {
return;
}
+ checkUrl.searchParams.set("timeout_ms", longpollDelayMs.toString());
- const delayMs = 500;
function check() {
let retried = false;
function retryOnce() {
diff --git a/packages/merchant-backend-ui/src/pages/RequestPayment.tsx
b/packages/merchant-backend-ui/src/pages/RequestPayment.tsx
index d0ac3d604..86c7e6f60 100644
--- a/packages/merchant-backend-ui/src/pages/RequestPayment.tsx
+++ b/packages/merchant-backend-ui/src/pages/RequestPayment.tsx
@@ -82,6 +82,7 @@ export function RequestPayment({
return;
}
checkUrl.searchParams.set("timeout_s", longpollDelayMs.toString());
+ const delayMs = 500;
function check() {
let retried = false;
function retryOnce() {
@@ -123,20 +124,20 @@ export function RequestPayment({
console.error("could not parse response:", e);
}
}
- setTimeout(retryOnce, 500);
+ setTimeout(retryOnce, delayMs);
}
};
req.onerror = function () {
- setTimeout(retryOnce, 500);
+ setTimeout(retryOnce, delayMs);
};
req.ontimeout = function () {
- setTimeout(retryOnce, 500);
+ setTimeout(retryOnce, delayMs);
};
req.timeout = longpollDelayMs;
req.open("GET", checkUrl.href);
req.send();
}
- setTimeout(check, 500);
+ setTimeout(check, delayMs);
});
return (
<Page>
diff --git
a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
index 22cfd1e17..d80401129 100644
--- a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
+++ b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
@@ -28,7 +28,7 @@ const defaultContractTerms: MerchantBackend.ContractTerms = {
amount: 'USD:10',
summary: 'this is a short summary',
pay_deadline: {
- t_s: new Date().getTime() + 6 * 24 * 60 * 60 * 1000
+ t_s: Math.round(new Date().getTime() / 1000) + 6 * 24 * 60 * 60
},
merchant: {
name: 'the merchant (inc)',
@@ -48,7 +48,7 @@ const defaultContractTerms: MerchantBackend.ContractTerms = {
wire_fee_amortization: 1,
products: [],
timestamp: {
- t_s: new Date().getTime()
+ t_s: Math.round(new Date().getTime() / 1000)
},
auditors: [],
exchanges: [],
@@ -57,18 +57,18 @@ const defaultContractTerms: MerchantBackend.ContractTerms =
{
merchant_pub: 'QWEASDQWEASD',
nonce: 'NONCE',
refund_deadline: {
- t_s: new Date().getTime() + 6 * 24 * 60 * 60 * 1000
+ t_s: Math.round(new Date().getTime() / 1000) + 6 * 24 * 60 * 60
},
wire_method: 'x-taler-bank',
wire_transfer_deadline: {
- t_s: new Date().getTime() + 3 * 24 * 60 * 60 * 1000
+ t_s: Math.round(new Date().getTime() / 1000) + 3 * 24 * 60 * 60
},
};
-const inSixDays = new Date().getTime() + 6 * 24 * 60 * 60 * 1000
-const in10Minutes = new Date().getTime() + 10 * 60 * 1000
-const in15Minutes = new Date().getTime() + 15 * 60 * 1000
-const in20Minutes = new Date().getTime() + 20 * 60 * 1000
+const inSixDays = Math.round(new Date().getTime() / 1000) + 6 * 24 * 60 * 60
+const in10Minutes = Math.round(new Date().getTime() / 1000) + 10 * 60
+const in15Minutes = Math.round(new Date().getTime() / 1000) + 15 * 60
+const in20Minutes = Math.round(new Date().getTime() / 1000) + 20 * 60
export const exampleData: { [name: string]: Props } = {
Simplest: {
--
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: fix :long polling request parameter,
gnunet <=