commit 3bff7fe6b0a13ff29c798b8f1ecea762fa1df120
parent ed9cefef1457f5fb9f5646bdc014c4efc1f23514
Author: Sebastian <sebasjm@taler-systems.com>
Date: Tue, 9 Dec 2025 15:01:24 -0300
different icon for confirmed wire transfer and unconfirmed
Diffstat:
2 files changed, 53 insertions(+), 60 deletions(-)
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx
@@ -473,13 +473,6 @@ function PaidPage({
type: "deadline",
});
}
- if (order.contract_terms.wire_transfer_deadline.t_s !== "never") {
- events.push({
- when: new Date(order.contract_terms.wire_transfer_deadline.t_s * 1000),
- description: "wire deadline",
- type: "deadline",
- });
- }
if (
order.contract_terms.delivery_date &&
order.contract_terms.delivery_date.t_s !== "never"
@@ -495,7 +488,9 @@ function PaidPage({
if (e.timestamp.t_s !== "never") {
events.push({
when: new Date(e.timestamp.t_s * 1000),
- description: `refund: ${e.amount}: ${e.reason}`,
+ description: !e.reason
+ ? `refund: ${e.amount}`
+ : `refund: ${e.amount}: ${e.reason}`,
type: e.pending ? "refund" : "refund-taken",
});
}
@@ -517,59 +512,57 @@ function PaidPage({
);
}
const { amount, wireFee } = orderAmounts;
- const ra = !order.refunded ? undefined : Amounts.parse(order.refund_amount);
-
- if (ra && Amounts.cmp(ra, amount) === 1) {
- if (order.wire_details && order.wire_details.length) {
- if (order.wire_details.length > 1) {
- let last: TalerMerchantApi.TransactionWireTransfer | null = null;
- let first: TalerMerchantApi.TransactionWireTransfer | null = null;
- let total: AmountJson | null = null;
-
- order.wire_details.forEach((w) => {
- if (last === null || last.execution_time.t_s < w.execution_time.t_s) {
- last = w;
- }
- if (
- first === null ||
- first.execution_time.t_s > w.execution_time.t_s
- ) {
- first = w;
- }
- total =
- total === null
- ? Amounts.parseOrThrow(w.amount)
- : Amounts.add(total, Amounts.parseOrThrow(w.amount)).amount;
- });
- const last_time = last!.execution_time.t_s;
- if (last_time !== "never") {
- events.push({
- when: new Date(last_time * 1000),
- description: `wired ${Amounts.stringify(total!)}`,
- type: "wired-range",
- });
- }
- const first_time = first!.execution_time.t_s;
- if (first_time !== "never") {
- events.push({
- when: new Date(first_time * 1000),
- description: `wire transfer started...`,
- type: "wired-range",
- });
- }
+
+ const wireMap: Record<
+ string,
+ {
+ time: number;
+ amount: AmountJson;
+ confirmed: boolean;
+ }
+ > = {};
+
+ if (order.wire_details && order.wire_details.length) {
+ order.wire_details.forEach((w) => {
+ if (!wireMap[w.wtid]) {
+ const info = {
+ time:
+ w.execution_time.t_s === "never" ? 0 : w.execution_time.t_s * 1000,
+ amount: Amounts.parseOrThrow(w.amount),
+ confirmed: w.confirmed,
+ };
+ wireMap[w.wtid] = info;
} else {
- order.wire_details.forEach((e) => {
- if (e.execution_time.t_s !== "never") {
- events.push({
- when: new Date(e.execution_time.t_s * 1000),
- description: `wired ${e.amount}`,
- type: "wired",
- });
- }
- });
+ const info = {
+ time: wireMap[w.wtid].time, // keep the first time
+ confirmed: wireMap[w.wtid].confirmed && w.confirmed, // both should be confirmed
+ amount: Amounts.add(
+ Amounts.parseOrThrow(w.amount),
+ wireMap[w.wtid].amount,
+ ).amount,
+ };
+ wireMap[w.wtid] = info;
}
+ });
+ Object.values(wireMap).forEach((info) => {
+ events.push({
+ when: new Date(info.time),
+ description: `wired ${Amounts.stringify(info.amount)}`,
+ type: info.confirmed ? "wired-confirmed" : "wired",
+ });
+ });
+ } else {
+ if (order.contract_terms.wire_transfer_deadline.t_s !== "never") {
+ events.push({
+ when: new Date(order.contract_terms.wire_transfer_deadline.t_s * 1000),
+ description: "wire deadline",
+ type: "deadline",
+ });
}
}
+ events.sort((a, b) => {
+ return b.when.getTime() - a.when.getTime();
+ });
const nextEvent = events.find((e) => {
return e.when.getTime() > now.getTime();
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Timeline.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/Timeline.tsx
@@ -74,11 +74,11 @@ export function Timeline({ events: e }: Props) {
);
case "wired":
return (
- <div class="timeline-marker is-icon is-success">
+ <div class="timeline-marker is-icon">
<i class="mdi mdi-cash" />
</div>
);
- case "wired-range":
+ case "wired-confirmed":
return (
<div class="timeline-marker is-icon is-success">
<i class="mdi mdi-cash" />
@@ -122,7 +122,7 @@ export interface Event {
| "refund"
| "refund-taken"
| "wired"
- | "wired-range"
+ | "wired-confirmed"
| "deadline"
| "delivery"
| "now";