[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated (68f3c3b44 -> 7bb81a008)
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated (68f3c3b44 -> 7bb81a008) |
Date: |
Mon, 20 Feb 2023 17:24:35 +0100 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a change to branch master
in repository wallet-core.
from 68f3c3b44 pretty
new 26aca142f fix: protocol min was returning never
new 5ad96b178 refund awating is empty when puchase is paid, returning last
refund id
new 7bb81a008 tell the user that refund is pending
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
packages/taler-util/src/time.ts | 11 ++++++-
.../src/operations/pay-merchant.ts | 20 ++++++++++--
.../src/wallet/Transaction.tsx | 38 +++++++++++++---------
3 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts
index 6ffabd495..21963ee6b 100644
--- a/packages/taler-util/src/time.ts
+++ b/packages/taler-util/src/time.ts
@@ -64,10 +64,19 @@ export namespace TalerProtocolTimestamp {
return { t_s: t2.t_s };
}
if (t2.t_s === "never") {
- return { t_s: t2.t_s };
+ return { t_s: t1.t_s };
}
return { t_s: Math.min(t1.t_s, t2.t_s) };
}
+ export function max(
+ t1: TalerProtocolTimestamp,
+ t2: TalerProtocolTimestamp,
+ ): TalerProtocolTimestamp {
+ if (t1.t_s === "never" || t2.t_s === "never") {
+ return { t_s: "never" };
+ }
+ return { t_s: Math.max(t1.t_s, t2.t_s) };
+ }
}
export interface Duration {
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 19cd9c9e8..19eb40f3a 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -2321,7 +2321,6 @@ async function acceptRefunds(
}
const refreshCoinsMap: Record<string, CoinRefreshRequest> = {};
-
for (const refundStatus of refunds) {
const refundKey = getRefundKey(refundStatus);
const existingRefundInfo = p.refunds[refundKey];
@@ -2412,6 +2411,7 @@ async function acceptRefunds(
}
} else if (p.purchaseStatus === PurchaseStatus.QueryingRefund) {
p.purchaseStatus = PurchaseStatus.Paid;
+ p.refundAmountAwaiting = undefined;
}
logger.trace("refund query done");
ws.notify({
@@ -2572,10 +2572,26 @@ export async function applyRefundFromPurchaseId(
const summary = await calculateRefundSummary(ws, purchase);
const download = await expectProposalDownload(ws, purchase);
+ const lastExec = Object.values(purchase.refunds).reduce(
+ (prev, cur) => {
+ return TalerProtocolTimestamp.max(cur.executionTime, prev);
+ },
+ { t_s: 0 } as TalerProtocolTimestamp,
+ );
+
+ const transactionId =
+ lastExec.t_s === "never" || lastExec.t_s === 0
+ ? makeTransactionId(TransactionType.Payment, proposalId)
+ : makeTransactionId(
+ TransactionType.Refund,
+ proposalId,
+ String(lastExec.t_s),
+ );
+
return {
contractTermsHash: download.contractData.contractTermsHash,
proposalId: purchase.proposalId,
- transactionId: makeTransactionId(TransactionType.Payment, proposalId),
//FIXME: can we have the tx id of the refund
+ transactionId,
amountEffectivePaid: Amounts.stringify(summary.amountEffectivePaid),
amountRefundGone: Amounts.stringify(summary.amountRefundGone),
amountRefundGranted: Amounts.stringify(summary.amountRefundGranted),
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 5fabfcd20..b9b1aa198 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -607,29 +607,35 @@ export function TransactionView({
) : undefined}
{pendingRefund !== undefined && Amounts.isNonZero(pendingRefund) && (
<InfoBox>
- <i18n.Translate>
- Merchant created a refund for this order but was not
automatically
- picked up.
- </i18n.Translate>
+ {transaction.refundQueryActive ? (
+ <i18n.Translate>Refund is in progress.</i18n.Translate>
+ ) : (
+ <i18n.Translate>
+ Merchant created a refund for this order but was not
+ automatically picked up.
+ </i18n.Translate>
+ )}
<Part
title={i18n.str`Offer`}
text={<Amount value={pendingRefund} />}
kind="positive"
/>
- <div>
- <div />
+ {transaction.refundQueryActive ? undefined : (
<div>
- <Button
- variant="contained"
- onClick={safely(
- () => onRefund(transaction.proposalId),
- i18n.str`Could not refund`,
- )}
- >
- <i18n.Translate>Accept</i18n.Translate>
- </Button>
+ <div />
+ <div>
+ <Button
+ variant="contained"
+ onClick={safely(
+ () => onRefund(transaction.proposalId),
+ i18n.str`Could not refund`,
+ )}
+ >
+ <i18n.Translate>Accept</i18n.Translate>
+ </Button>
+ </div>
</div>
- </div>
+ )}
</InfoBox>
)}
<Part
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-wallet-core] branch master updated (68f3c3b44 -> 7bb81a008),
gnunet <=