rerobe-js-orm 4.9.15 → 4.9.17
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.
|
@@ -36,8 +36,9 @@ exports.SALES_CHANNELS = {
|
|
|
36
36
|
};
|
|
37
37
|
// Point-of-sale / in-person channels: the customer is handed the goods at the
|
|
38
38
|
// moment of sale, so every item is fulfilled at sale time (there is no separate
|
|
39
|
-
// fulfillment step, and no per-item fulfillment record is created).
|
|
40
|
-
|
|
39
|
+
// fulfillment step, and no per-item fulfillment record is created). `store` is a
|
|
40
|
+
// legacy in-person store-sale channel, treated the same.
|
|
41
|
+
exports.POS_SALES_CHANNELS = [exports.SALES_CHANNELS.ribbnWebPOS, exports.SALES_CHANNELS.ribbnMobilePOS, exports.SALES_CHANNELS.store];
|
|
41
42
|
exports.FULFILLMENT_TYPES = {
|
|
42
43
|
fulfilled: 'FULFILLED',
|
|
43
44
|
partiallyFulfilled: 'PARTIALLY_FULFILLED',
|
|
@@ -828,10 +828,28 @@ class OrderHelpers {
|
|
|
828
828
|
const timeBucket = this.generateTimeBucket(order.createdAtTimestamp || Date.now(), timeBucketMinutes);
|
|
829
829
|
// Create a hash of line items - what is being ordered
|
|
830
830
|
const lineItemsHash = this.generateLineItemsHash(order.lineItems || []);
|
|
831
|
+
// Payment anchor - the Stripe-issued PaymentIntent id, present once the order
|
|
832
|
+
// is paid. Including it gives two genuinely-distinct sales of an IDENTICAL
|
|
833
|
+
// cart different keys (different PaymentIntents), so a rapid, legitimate
|
|
834
|
+
// re-sale of the same stocked SKU is not mistaken for a duplicate — while
|
|
835
|
+
// retries of the SAME payment still collapse to one key. Omitted (filtered out
|
|
836
|
+
// below) when absent, so unpaid / offline orders keep the pure content + time
|
|
837
|
+
// fingerprint and behave exactly as before. Unlike id / shopifyId /
|
|
838
|
+
// orderNumber, the PaymentIntent id is Stripe-issued (not a client-forgeable
|
|
839
|
+
// arbitrary value), so it cannot be used to bypass idempotency.
|
|
840
|
+
const paymentIntentId = order.paymentIntentId || '';
|
|
831
841
|
// Combine all fields into a consistent string
|
|
832
842
|
// Note: We explicitly exclude client-generated IDs (id, shopifyId, orderNumber)
|
|
833
843
|
// since clients control these and could bypass idempotency protection
|
|
834
|
-
const keyComponents = [
|
|
844
|
+
const keyComponents = [
|
|
845
|
+
customerEmail,
|
|
846
|
+
totalAmount,
|
|
847
|
+
currencyCode,
|
|
848
|
+
merchantId,
|
|
849
|
+
timeBucket,
|
|
850
|
+
lineItemsHash,
|
|
851
|
+
paymentIntentId,
|
|
852
|
+
];
|
|
835
853
|
// Filter out empty values and join
|
|
836
854
|
const keyString = keyComponents.filter((component) => component && String(component).trim().length > 0).join('|');
|
|
837
855
|
// Generate SHA-256 hash for consistent length and uniqueness
|