@aglyn/plugins-commerce 1.21.0 → 1.22.1
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/package.json +16 -16
- package/src/lib/components/cart-fulfillment.js +19 -8
- package/src/lib/components/cart-fulfillment.js.map +1 -1
- package/src/lib/components/console/catalog-organization-card.component.js +28 -9
- package/src/lib/components/console/catalog-organization-card.component.js.map +1 -1
- package/src/lib/components/console/discounts-card.component.js +13 -4
- package/src/lib/components/console/discounts-card.component.js.map +1 -1
- package/src/lib/components/console/local-delivery-settings-card.component.js +13 -4
- package/src/lib/components/console/local-delivery-settings-card.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +13 -4
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +13 -4
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/quote-settings-card.component.js +13 -4
- package/src/lib/components/console/quote-settings-card.component.js.map +1 -1
- package/src/lib/components/console/reservations-card.component.js +13 -4
- package/src/lib/components/console/reservations-card.component.js.map +1 -1
- package/src/lib/components/console/return-settings-card.component.js +13 -4
- package/src/lib/components/console/return-settings-card.component.js.map +1 -1
- package/src/lib/components/console/shipping-settings-card.component.js +13 -4
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
- package/src/lib/components/console/store-settings-card.component.js +13 -4
- package/src/lib/components/console/store-settings-card.component.js.map +1 -1
- package/src/lib/components/console/suppliers-card.component.js +13 -4
- package/src/lib/components/console/suppliers-card.component.js.map +1 -1
- package/src/lib/components/console/tax-settings-card.component.js +13 -4
- package/src/lib/components/console/tax-settings-card.component.js.map +1 -1
- package/src/lib/model/commerce-pos-offline.d.ts +21 -3
- package/src/lib/model/commerce-pos-offline.js +17 -5
- package/src/lib/model/commerce-pos-offline.js.map +1 -1
- package/src/lib/server/pos-offline-card-order.d.ts +2 -0
- package/src/lib/server/pos-offline-card-order.js +6 -2
- package/src/lib/server/pos-offline-card-order.js.map +1 -1
- package/src/lib/server/pos-offline-card-reconcile.d.ts +5 -1
- package/src/lib/server/pos-offline-card-reconcile.js +42 -10
- package/src/lib/server/pos-offline-card-reconcile.js.map +1 -1
- package/src/lib/server/pos-offline-sync.d.ts +48 -6
- package/src/lib/server/pos-offline-sync.js +142 -31
- package/src/lib/server/pos-offline-sync.js.map +1 -1
- package/src/lib/server/pos-stripe.d.ts +11 -0
- package/src/lib/server/pos-stripe.js +14 -0
- package/src/lib/server/pos-stripe.js.map +1 -1
- package/src/lib/server/pos-terminal.d.ts +21 -1
- package/src/lib/server/pos-terminal.js +39 -5
- package/src/lib/server/pos-terminal.js.map +1 -1
|
@@ -1498,16 +1498,26 @@ function offlineCardIntent(body) {
|
|
|
1498
1498
|
]
|
|
1499
1499
|
}
|
|
1500
1500
|
}, onAccount(account)));
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1501
|
+
// The status tells the sync whether Stripe definitely has no such intent on that account (AGL-4219).
|
|
1502
|
+
if (!fetched.ok) {
|
|
1503
|
+
return {
|
|
1504
|
+
ok: false,
|
|
1505
|
+
status: fetched.status,
|
|
1506
|
+
error: posStripeErrorMessage(fetched.body, 'The card payment could not be read.')
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1505
1509
|
return {
|
|
1506
1510
|
ok: true,
|
|
1507
1511
|
intent: offlineCardIntent(fetched.body)
|
|
1508
1512
|
};
|
|
1509
1513
|
}
|
|
1510
|
-
/**
|
|
1514
|
+
/**
|
|
1515
|
+
* Captures one authorized offline card with the platform's fee, on `account`
|
|
1516
|
+
* (a direct-charge store's own, where its app's SDK made it, AGL-4219) or the
|
|
1517
|
+
* platform; a repeat finds the first capture. Stripe takes the application
|
|
1518
|
+
* fee at capture on a direct charge too, from the store's account to the
|
|
1519
|
+
* platform, which is how an online direct reader payment is captured.
|
|
1520
|
+
*/ export async function capturePosOfflineCardIntent(paymentIntentId, applicationFeeCents, idempotencyKey, account = null) {
|
|
1511
1521
|
const captured = await posStripe('POST', `payment_intents/${encodeURIComponent(paymentIntentId)}/capture`, _extends({
|
|
1512
1522
|
idempotencyKey
|
|
1513
1523
|
}, onAccount(account), {
|
|
@@ -1532,6 +1542,30 @@ function offlineCardIntent(body) {
|
|
|
1532
1542
|
intent: offlineCardIntent(captured.body)
|
|
1533
1543
|
};
|
|
1534
1544
|
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Cancels one offline card's authorization on `account` (a direct-charge
|
|
1547
|
+
* store's own, or another the device recorded) or the platform, so the
|
|
1548
|
+
* customer's hold is released (AGL-4219). The sync asks only for an intent
|
|
1549
|
+
* it read as `requires_capture`; Stripe refuses to cancel a captured one.
|
|
1550
|
+
*/ export async function cancelPosOfflineCardIntent(paymentIntentId, account, idempotencyKey) {
|
|
1551
|
+
const cancelled = await posStripe('POST', `payment_intents/${encodeURIComponent(paymentIntentId)}/cancel`, _extends({
|
|
1552
|
+
idempotencyKey
|
|
1553
|
+
}, onAccount(account), {
|
|
1554
|
+
params: {
|
|
1555
|
+
cancellation_reason: 'abandoned'
|
|
1556
|
+
}
|
|
1557
|
+
}));
|
|
1558
|
+
if (!cancelled.ok) {
|
|
1559
|
+
return {
|
|
1560
|
+
ok: false,
|
|
1561
|
+
status: cancelled.status,
|
|
1562
|
+
error: posStripeErrorMessage(cancelled.body, 'The card payment could not be cancelled.')
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
return {
|
|
1566
|
+
ok: true
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1535
1569
|
/**
|
|
1536
1570
|
* Turns Stripe's offline mode on for the site's readers, on the site's ONE
|
|
1537
1571
|
* Terminal Configuration through {@link savePosReaderConfiguration}, like
|