@aglyn/plugins-commerce 1.0.0-beta.220 → 1.0.0-beta.222
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/README.md +4 -2
- package/package.json +14 -13
- package/src/lib/components/console/catalog-organization-card.component.js +9 -0
- package/src/lib/components/console/catalog-organization-card.component.js.map +1 -1
- package/src/lib/components/console/discounts-card.component.js +8 -0
- package/src/lib/components/console/discounts-card.component.js.map +1 -1
- package/src/lib/components/console/gift-cards-card.component.js +8 -0
- package/src/lib/components/console/gift-cards-card.component.js.map +1 -1
- package/src/lib/components/console/host-coupons-card.component.js +8 -0
- package/src/lib/components/console/host-coupons-card.component.js.map +1 -1
- package/src/lib/components/console/host-orders-card.component.js +34 -70
- package/src/lib/components/console/host-orders-card.component.js.map +1 -1
- package/src/lib/components/console/product-zones.d.ts +7 -6
- package/src/lib/components/console/product-zones.js +5 -4
- package/src/lib/components/console/product-zones.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +86 -284
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/declarations.console-server.d.ts +38 -0
- package/src/lib/declarations.console-server.js +67 -0
- package/src/lib/declarations.console-server.js.map +1 -0
- package/src/lib/model/commerce-gift-cards.d.ts +26 -0
- package/src/lib/model/commerce-gift-cards.js +42 -0
- package/src/lib/model/commerce-gift-cards.js.map +1 -1
- package/src/lib/model/commerce-orders.d.ts +0 -57
- package/src/lib/model/commerce-orders.js +0 -80
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/index.d.ts +0 -1
- package/src/lib/model/index.js +0 -1
- package/src/lib/model/index.js.map +1 -1
- package/src/lib/plugin.js +5 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/api-v1/openapi.d.ts +27 -0
- package/src/lib/server/api-v1/openapi.js +219 -0
- package/src/lib/server/api-v1/openapi.js.map +1 -0
- package/src/lib/server/api-v1/orders-and-products.d.ts +19 -0
- package/src/lib/server/api-v1/orders-and-products.js +419 -0
- package/src/lib/server/api-v1/orders-and-products.js.map +1 -0
- package/src/lib/server/billing-webhook.js +83 -56
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/download.js +4 -1
- package/src/lib/server/download.js.map +1 -1
- package/src/lib/server/fulfill-order.d.ts +52 -11
- package/src/lib/server/fulfill-order.js +6 -9
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/gift-card-issue.d.ts +57 -0
- package/src/lib/server/gift-card-issue.js +155 -0
- package/src/lib/server/gift-card-issue.js.map +1 -0
- package/src/lib/server/gift-cards.js +25 -84
- package/src/lib/server/gift-cards.js.map +1 -1
- package/src/lib/server/membership-register.js +9 -8
- package/src/lib/server/membership-register.js.map +1 -1
- package/src/lib/server/newsletter.js +7 -5
- package/src/lib/server/newsletter.js.map +1 -1
- package/src/lib/server/paid-media-delivery.d.ts +21 -0
- package/src/lib/server/paid-media-delivery.js +23 -5
- package/src/lib/server/paid-media-delivery.js.map +1 -1
- package/src/lib/server/paid-media-serve-count.d.ts +28 -0
- package/src/lib/server/paid-media-serve-count.js +46 -0
- package/src/lib/server/paid-media-serve-count.js.map +1 -0
- package/src/lib/server/person-eraser.d.ts +45 -0
- package/src/lib/server/person-eraser.js +57 -0
- package/src/lib/server/person-eraser.js.map +1 -0
- package/src/lib/server/pos-order.js +17 -9
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/refund.js +15 -15
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/restock-flag.d.ts +2 -2
- package/src/lib/server/restock-flag.js +1 -1
- package/src/lib/server/restock-flag.js.map +1 -1
- package/src/lib/server/stream.js +4 -1
- package/src/lib/server/stream.js.map +1 -1
- package/src/lib/server.js +5 -21
- package/src/lib/server.js.map +1 -1
- package/src/lib/testing/stand-in-person-records.d.ts +43 -0
- package/src/lib/testing/stand-in-person-records.js +63 -0
- package/src/lib/testing/stand-in-person-records.js.map +1 -0
- package/src/lib/testing/stand-in-record-system.d.ts +11 -2
- package/src/lib/testing/stand-in-record-system.js +5 -3
- package/src/lib/testing/stand-in-record-system.js.map +1 -1
- package/src/lib/transfer/gift-card-confirm-step.component.d.ts +22 -0
- package/src/lib/transfer/gift-card-confirm-step.component.js +259 -0
- package/src/lib/transfer/gift-card-confirm-step.component.js.map +1 -0
- package/src/lib/transfer/gift-cards-plan.d.ts +29 -0
- package/src/lib/transfer/gift-cards-plan.js +40 -0
- package/src/lib/transfer/gift-cards-plan.js.map +1 -0
- package/src/lib/transfer/gift-cards.server.d.ts +34 -0
- package/src/lib/transfer/gift-cards.server.js +296 -0
- package/src/lib/transfer/gift-cards.server.js.map +1 -0
- package/src/lib/transfer/list-filter.d.ts +29 -0
- package/src/lib/transfer/list-filter.js +112 -0
- package/src/lib/transfer/list-filter.js.map +1 -0
- package/src/lib/transfer/product-import-results.d.ts +29 -0
- package/src/lib/transfer/product-import-results.js +49 -0
- package/src/lib/transfer/product-import-results.js.map +1 -0
- package/src/lib/transfer/product-import-step.component.d.ts +30 -0
- package/src/lib/transfer/product-import-step.component.js +99 -0
- package/src/lib/transfer/product-import-step.component.js.map +1 -0
- package/src/lib/transfer/product-transfer.d.ts +211 -0
- package/src/lib/transfer/product-transfer.js +1594 -0
- package/src/lib/transfer/product-transfer.js.map +1 -0
- package/src/lib/transfer/products.server.d.ts +44 -0
- package/src/lib/transfer/products.server.js +550 -0
- package/src/lib/transfer/products.server.js.map +1 -0
- package/src/lib/transfer/records-transfer.d.ts +182 -0
- package/src/lib/transfer/records-transfer.js +1153 -0
- package/src/lib/transfer/records-transfer.js.map +1 -0
- package/src/lib/transfer/records.server.d.ts +68 -0
- package/src/lib/transfer/records.server.js +455 -0
- package/src/lib/transfer/records.server.js.map +1 -0
- package/src/lib/transfer/register-transfer-resources.d.ts +17 -0
- package/src/lib/transfer/register-transfer-resources.js +171 -0
- package/src/lib/transfer/register-transfer-resources.js.map +1 -0
- package/src/lib/transfer/register-transfer-ui.d.ts +23 -0
- package/src/lib/transfer/register-transfer-ui.js +78 -0
- package/src/lib/transfer/register-transfer-ui.js.map +1 -0
- package/src/lib/transfer/server-common.d.ts +76 -0
- package/src/lib/transfer/server-common.js +165 -0
- package/src/lib/transfer/server-common.js.map +1 -0
- package/src/lib/transfer/transfer-header-actions.component.d.ts +39 -0
- package/src/lib/transfer/transfer-header-actions.component.js +79 -0
- package/src/lib/transfer/transfer-header-actions.component.js.map +1 -0
- package/src/lib/transfer/transfer-keys.d.ts +31 -0
- package/src/lib/transfer/transfer-keys.js +56 -0
- package/src/lib/transfer/transfer-keys.js.map +1 -0
- package/src/lib/model/commerce-io.d.ts +0 -36
- package/src/lib/model/commerce-io.js +0 -245
- package/src/lib/model/commerce-io.js.map +0 -1
- package/src/lib/server/contact-refund.d.ts +0 -117
- package/src/lib/server/contact-refund.js +0 -196
- package/src/lib/server/contact-refund.js.map +0 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import * as Aglyn from "@aglyn/aglyn/server";
|
|
18
18
|
import { findUserByUidAcrossPools, firebaseAdmin, getOrgForHost, meterHostEmail, notifyHostManagers, notifyRiskEvent, raiseOperatorAlert, renderHostEmailWithTokens, updateExisting, hostSendingIdentity } from "@aglyn/tenant-data-admin";
|
|
19
19
|
import { paymentProvider } from "@aglyn/tenant-data-admin/server/payment-provider";
|
|
20
|
-
import
|
|
20
|
+
import recordCapturedContact from "@aglyn/aglyn/plugin-manager/record-captured-contact";
|
|
21
21
|
import { formatOperatorAlertAmount } from "@aglyn/aglyn/app-utils/operator-alerts";
|
|
22
22
|
import { resolveSiteTimeZone } from "@aglyn/aglyn/app-utils/collection-entry-date";
|
|
23
23
|
import { resolveHostToken } from "@aglyn/aglyn/app-utils/host-tokens";
|
|
@@ -25,11 +25,8 @@ import { COMMERCE_CHARGEBACK_UNROUTABLE, COMMERCE_FEE_REPRICE_REFUSED, COMMERCE_
|
|
|
25
25
|
import { createHmac } from "crypto";
|
|
26
26
|
import { isEmailConfigured, sendEmail } from "@aglyn/shared-util-email";
|
|
27
27
|
import * as CommerceModel from "../model/index.js";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
// specs in this library mock `@aglyn/tenant-data-admin` wholesale, and a
|
|
31
|
-
// permissive stub would turn a reversal that never happened green.
|
|
32
|
-
import { reverseEmailAttributedRevenue } from "@aglyn/tenant-data-admin/server/email-revenue-attribution";
|
|
28
|
+
import { recordPluginPersonRefund } from "@aglyn/aglyn/plugin-manager/plugin-person-records";
|
|
29
|
+
import { reverseOrderConversion } from "@aglyn/aglyn/plugin-manager/plugin-conversion-credit";
|
|
33
30
|
import { paymentRiskEventFrom } from "@aglyn/aglyn/app-utils/payment-risk";
|
|
34
31
|
import { recordPaymentRiskOnRecord } from "@aglyn/tenant-data-admin/server/payment-risk-record";
|
|
35
32
|
import { isTransientStripeStatus, reverseDestinationTransfer } from "@aglyn/tenant-data-admin/server/stripe-transfer-reversal";
|
|
@@ -418,7 +415,7 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
418
415
|
* `charge.dispute.created`: FLAG the order, reverse nothing (AGL-1787).
|
|
419
416
|
*
|
|
420
417
|
* A dispute can be WON, and this is the whole reason the reversal waits for
|
|
421
|
-
* `closed`. Nothing here un-writes:
|
|
418
|
+
* `closed`. Nothing here un-writes: a person's refunds are monotonic by
|
|
422
419
|
* construction (AGL-1754 chose counters over decrements precisely so a reader
|
|
423
420
|
* can never be handed a number that went backwards), so a reversal written on
|
|
424
421
|
* `created` and reversed again on a win would need a decrement the contact
|
|
@@ -1870,9 +1867,9 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
1870
1867
|
const subscriptionRef = hostRef.collection('subscriptions').doc(String(object.subscription));
|
|
1871
1868
|
// Redelivery guard (AGL-1732, the AGL-498 shape). Stripe delivers at
|
|
1872
1869
|
// least once, and the effects below this write are NOT idempotent —
|
|
1873
|
-
//
|
|
1874
|
-
// a replay would inflate the subscriber's lifetime value and
|
|
1875
|
-
// order count on every retry.
|
|
1870
|
+
// the capture's `purchaseCents` is added to the person's lifetime
|
|
1871
|
+
// value, so a replay would inflate the subscriber's lifetime value and
|
|
1872
|
+
// their order count on every retry.
|
|
1876
1873
|
//
|
|
1877
1874
|
// Keyed on `checkoutSessionId` rather than on the document existing:
|
|
1878
1875
|
// `customer.subscription.created` writes the SAME doc path (status and
|
|
@@ -1955,24 +1952,35 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
1955
1952
|
link: `/${hostId}/products`
|
|
1956
1953
|
});
|
|
1957
1954
|
// AWAITED SINCE AGL-2473, here and at the five sibling call sites in
|
|
1958
|
-
// this file.
|
|
1959
|
-
//
|
|
1960
|
-
// customer quietly missing from the
|
|
1961
|
-
// touches only our own Firestore,
|
|
1962
|
-
// drew: Aglyn's own storage is
|
|
1963
|
-
// `refund.ts` already awaited
|
|
1964
|
-
|
|
1955
|
+
// this file. The capture carries `purchaseCents`, which is what the
|
|
1956
|
+
// record system adds to a person's lifetime value and the RFM ranking
|
|
1957
|
+
// — a `void`ed one is a paying customer quietly missing from the
|
|
1958
|
+
// segment the merchant emails. It touches only our own Firestore,
|
|
1959
|
+
// which is the whole line AGL-2473 drew: Aglyn's own storage is
|
|
1960
|
+
// awaited, a stranger's server is queued. `refund.ts` already awaited
|
|
1961
|
+
// its sibling for exactly this reason.
|
|
1962
|
+
//
|
|
1963
|
+
// Through the contact-capture contract (AGL-3080), like every other
|
|
1964
|
+
// door commerce owns: the plugin that keeps people decides what a
|
|
1965
|
+
// purchase makes of them, and commerce imports none of it.
|
|
1966
|
+
await recordCapturedContact(_extends({
|
|
1967
|
+
orgId: '',
|
|
1965
1968
|
hostId: String(hostId),
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
+
identity: {
|
|
1970
|
+
email: object == null ? void 0 : (_object_customer_details1 = object.customer_details) == null ? void 0 : _object_customer_details1.email,
|
|
1971
|
+
name: (_ref10 = object == null ? void 0 : (_object_customer_details2 = object.customer_details) == null ? void 0 : _object_customer_details2.name) != null ? _ref10 : null
|
|
1972
|
+
},
|
|
1973
|
+
// A purchase makes the person a relationship (AGL-3232): a contact,
|
|
1974
|
+
// with an open lead for the address closed onto it.
|
|
1975
|
+
surface: 'relationship',
|
|
1969
1976
|
// Every order door names `customer` (AGL-2612): a floor, so the
|
|
1970
1977
|
// stage fills or advances and never moves anybody back.
|
|
1971
|
-
|
|
1978
|
+
lifecycleFloor: 'customer'
|
|
1972
1979
|
}, subscriptionCents > 0 ? {
|
|
1973
1980
|
purchaseCents: subscriptionCents
|
|
1974
1981
|
} : {}, {
|
|
1975
1982
|
interaction: {
|
|
1983
|
+
source: 'order',
|
|
1976
1984
|
refId: String(object.subscription),
|
|
1977
1985
|
summary: `Started a subscription ($${(subscriptionCents / 100).toFixed(2)})`
|
|
1978
1986
|
}
|
|
@@ -2513,20 +2521,23 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
2513
2521
|
// counting only the first charge ranks them as a one-purchase
|
|
2514
2522
|
// customer forever. Keyed to the invoice so the guard above is what
|
|
2515
2523
|
// stops a redelivery inflating it.
|
|
2516
|
-
await
|
|
2524
|
+
await recordCapturedContact({
|
|
2525
|
+
orgId: '',
|
|
2517
2526
|
hostId: invoiceHostId,
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2527
|
+
identity: _extends({
|
|
2528
|
+
email: renewalEmail
|
|
2529
|
+
}, soldSnapshot.get('customerName') ? {
|
|
2530
|
+
name: String(soldSnapshot.get('customerName'))
|
|
2531
|
+
} : {}),
|
|
2532
|
+
surface: 'relationship',
|
|
2533
|
+
lifecycleFloor: 'customer',
|
|
2524
2534
|
purchaseCents: paidCents,
|
|
2525
2535
|
interaction: {
|
|
2536
|
+
source: 'order',
|
|
2526
2537
|
refId: invoiceId,
|
|
2527
2538
|
summary: `Subscription renewed ($${(paidCents / 100).toFixed(2)})`
|
|
2528
2539
|
}
|
|
2529
|
-
})
|
|
2540
|
+
});
|
|
2530
2541
|
}
|
|
2531
2542
|
}
|
|
2532
2543
|
}
|
|
@@ -2704,18 +2715,22 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
2704
2715
|
if (guestContactEmail) {
|
|
2705
2716
|
var _ref37, _ref38;
|
|
2706
2717
|
var _object_customer_details6;
|
|
2707
|
-
await
|
|
2718
|
+
await recordCapturedContact(_extends({
|
|
2719
|
+
orgId: '',
|
|
2708
2720
|
hostId: String(hostId),
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2721
|
+
identity: {
|
|
2722
|
+
email: guestContactEmail,
|
|
2723
|
+
name: (_ref37 = (_ref38 = object == null ? void 0 : (_object_customer_details6 = object.customer_details) == null ? void 0 : _object_customer_details6.name) != null ? _ref38 : reservation['guestName']) != null ? _ref37 : null
|
|
2724
|
+
},
|
|
2725
|
+
surface: 'relationship',
|
|
2712
2726
|
// A paid stay is a sale (AGL-2612), whatever the source says
|
|
2713
2727
|
// about the kind of thing that was bought.
|
|
2714
|
-
|
|
2728
|
+
lifecycleFloor: 'customer'
|
|
2715
2729
|
}, paidCents > 0 ? {
|
|
2716
2730
|
purchaseCents: paidCents
|
|
2717
2731
|
} : {}, {
|
|
2718
2732
|
interaction: {
|
|
2733
|
+
source: 'booking',
|
|
2719
2734
|
refId: String(reservationId),
|
|
2720
2735
|
summary: `Reserved a stay ($${(paidCents / 100).toFixed(2)})`
|
|
2721
2736
|
}
|
|
@@ -3117,17 +3132,21 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
3117
3132
|
body: `Order ${cartOrderLabel} came in on {site}: ${cartUnits} ` + `item${cartUnits === 1 ? '' : 's'}, ${cartOrderTotal}` + ((object == null ? void 0 : (_object_customer_details8 = object.customer_details) == null ? void 0 : _object_customer_details8.email) ? `, from ${object.customer_details.email}.` : '.'),
|
|
3118
3133
|
link: `/${hostId}/products`
|
|
3119
3134
|
});
|
|
3120
|
-
await
|
|
3135
|
+
await recordCapturedContact(_extends({
|
|
3136
|
+
orgId: '',
|
|
3121
3137
|
hostId: String(hostId),
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3138
|
+
identity: {
|
|
3139
|
+
email: object == null ? void 0 : (_object_customer_details9 = object.customer_details) == null ? void 0 : _object_customer_details9.email,
|
|
3140
|
+
name: (_ref43 = object == null ? void 0 : (_object_customer_details10 = object.customer_details) == null ? void 0 : _object_customer_details10.name) != null ? _ref43 : null
|
|
3141
|
+
},
|
|
3142
|
+
surface: 'relationship',
|
|
3143
|
+
lifecycleFloor: 'customer'
|
|
3126
3144
|
}, marketingOptIn ? {
|
|
3127
3145
|
marketingConsent: true
|
|
3128
3146
|
} : {}, {
|
|
3129
3147
|
purchaseCents: Number((_ref44 = object == null ? void 0 : object.amount_total) != null ? _ref44 : 0),
|
|
3130
3148
|
interaction: {
|
|
3149
|
+
source: 'order',
|
|
3131
3150
|
refId: String(object.id),
|
|
3132
3151
|
summary: `Placed an order ($${(Number((_ref45 = object == null ? void 0 : object.amount_total) != null ? _ref45 : 0) / 100).toFixed(2)})`
|
|
3133
3152
|
}
|
|
@@ -3559,16 +3578,20 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
3559
3578
|
var _ref68, _ref69, _ref70;
|
|
3560
3579
|
var _order_totals1, _object_customer_details17;
|
|
3561
3580
|
const chargedCents = Number((_ref68 = object == null ? void 0 : object.amount_total) != null ? _ref68 : 0) || Number((_ref69 = (_order_totals1 = order.totals) == null ? void 0 : _order_totals1.totalCents) != null ? _ref69 : 0);
|
|
3562
|
-
await
|
|
3581
|
+
await recordCapturedContact(_extends({
|
|
3582
|
+
orgId: '',
|
|
3563
3583
|
hostId: String(hostId),
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3584
|
+
identity: {
|
|
3585
|
+
email: draftEmail,
|
|
3586
|
+
name: (_ref70 = object == null ? void 0 : (_object_customer_details17 = object.customer_details) == null ? void 0 : _object_customer_details17.name) != null ? _ref70 : null
|
|
3587
|
+
},
|
|
3588
|
+
surface: 'relationship',
|
|
3589
|
+
lifecycleFloor: 'customer'
|
|
3568
3590
|
}, chargedCents > 0 ? {
|
|
3569
3591
|
purchaseCents: chargedCents
|
|
3570
3592
|
} : {}, {
|
|
3571
3593
|
interaction: {
|
|
3594
|
+
source: 'order',
|
|
3572
3595
|
refId: String(orderId),
|
|
3573
3596
|
summary: `Paid ${CommerceModel.formatOrderNumber(order, String(orderId))} ($${(chargedCents / 100).toFixed(2)})`
|
|
3574
3597
|
}
|
|
@@ -3943,14 +3966,18 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
3943
3966
|
}
|
|
3944
3967
|
})();
|
|
3945
3968
|
// Contacts ingestion (AGL-197): buyers become contacts.
|
|
3946
|
-
await
|
|
3969
|
+
await recordCapturedContact({
|
|
3970
|
+
orgId: '',
|
|
3947
3971
|
hostId: String(hostId),
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3972
|
+
identity: {
|
|
3973
|
+
email: object == null ? void 0 : (_object_customer_details19 = object.customer_details) == null ? void 0 : _object_customer_details19.email,
|
|
3974
|
+
name: (_ref79 = object == null ? void 0 : (_object_customer_details20 = object.customer_details) == null ? void 0 : _object_customer_details20.name) != null ? _ref79 : null
|
|
3975
|
+
},
|
|
3976
|
+
surface: 'relationship',
|
|
3977
|
+
lifecycleFloor: 'customer',
|
|
3952
3978
|
purchaseCents: Number((_ref80 = object == null ? void 0 : object.amount_total) != null ? _ref80 : 0),
|
|
3953
3979
|
interaction: {
|
|
3980
|
+
source: 'order',
|
|
3954
3981
|
refId: String(object.id),
|
|
3955
3982
|
summary: `Placed an order ($${(Number((_ref81 = object == null ? void 0 : object.amount_total) != null ? _ref81 : 0) / 100).toFixed(2)})`
|
|
3956
3983
|
}
|
|
@@ -4341,18 +4368,18 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
4341
4368
|
link: `/${hostId}/orders`
|
|
4342
4369
|
});
|
|
4343
4370
|
// The customer's side of the ledger (AGL-1754), through the same
|
|
4344
|
-
//
|
|
4345
|
-
// says "charged back". Skipped when nothing was reversed: a won
|
|
4371
|
+
// seam a refund uses and with the reason set so the person's
|
|
4372
|
+
// timeline says "charged back". Skipped when nothing was reversed: a won
|
|
4346
4373
|
// dispute moved no money, and a lost one that found nothing left to
|
|
4347
4374
|
// reverse would otherwise record a $0 entry against the buyer.
|
|
4348
4375
|
if (settled.reversedCents > 0) {
|
|
4349
|
-
await
|
|
4376
|
+
await recordPluginPersonRefund({
|
|
4350
4377
|
hostId,
|
|
4351
|
-
|
|
4378
|
+
refId: snapshot.id,
|
|
4352
4379
|
email: settled.customerEmail,
|
|
4353
4380
|
amountCents: settled.reversedCents,
|
|
4354
|
-
|
|
4355
|
-
|
|
4381
|
+
closedTheSale: settled.closedTheOrder,
|
|
4382
|
+
reason: 'chargeback'
|
|
4356
4383
|
});
|
|
4357
4384
|
// The shelf's side (AGL-1797), the SAME door the admin-initiated
|
|
4358
4385
|
// refund writes so the two cannot diverge the way the contact
|
|
@@ -4374,7 +4401,7 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
4374
4401
|
// for it — and the reversal is recorded beside the credit rather
|
|
4375
4402
|
// than subtracted from it, exactly as the contact ledger above
|
|
4376
4403
|
// records `refundedCents` beside `ltvCents`.
|
|
4377
|
-
await
|
|
4404
|
+
await reverseOrderConversion({
|
|
4378
4405
|
hostId,
|
|
4379
4406
|
orderId: snapshot.id,
|
|
4380
4407
|
amountCents: settled.reversedCents,
|