@curless/sinocare-demo 0.67.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -245,12 +245,24 @@ var productsView = (products) => ({
|
|
|
245
245
|
count: products.length,
|
|
246
246
|
products: [...products]
|
|
247
247
|
});
|
|
248
|
+
var TERMINAL = /* @__PURE__ */ new Set(["captured", "settled", "reconciled", "refunded", "failed", "canceled"]);
|
|
248
249
|
var ordersView = (orders) => ({
|
|
249
250
|
view: "orders",
|
|
250
251
|
orders: orders.map(
|
|
251
252
|
(o) => ({
|
|
252
253
|
orderId: o.id,
|
|
253
|
-
status: o.refundRequest ? o.refundRequest.status === "approved" ? "refund approved" : "refund requested" :
|
|
254
|
+
status: o.refundRequest ? o.refundRequest.status === "approved" ? "refund approved" : "refund requested" : (
|
|
255
|
+
// ⚠️ A UnionPay order is the one case where a still-uncaptured order
|
|
256
|
+
// is not "nothing happened yet". The cardholder confirmed and a
|
|
257
|
+
// one-time credential exists; the charge belongs to the merchant's
|
|
258
|
+
// own acquirer, which is why the PI — and so `o.status` — never
|
|
259
|
+
// moves. Left as the bare pending status, the person sees an unpaid
|
|
260
|
+
// order and no reason, having just confirmed a payment.
|
|
261
|
+
//
|
|
262
|
+
// ⚠️ Not "paid", and never will be from here. The wording carries
|
|
263
|
+
// both halves, which is the same rule the tool descriptions follow.
|
|
264
|
+
o.metadata?.uaag?.credentialAt && !TERMINAL.has(o.status) ? "credential issued \xB7 merchant to charge" : o.status
|
|
265
|
+
),
|
|
254
266
|
refundPending: Boolean(o.refundRequest),
|
|
255
267
|
product: o.lineItems?.map((li) => `${li.name} \xD7${li.quantity}`).join(", ") ?? "",
|
|
256
268
|
total: formatMinor(Number(o.amount ?? 0), String(o.currency ?? "EUR")),
|