rerobe-js-orm 4.9.16 → 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.
@@ -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 = [customerEmail, totalAmount, currencyCode, merchantId, timeBucket, lineItemsHash];
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "4.9.16",
3
+ "version": "4.9.17",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",