@porulle/plugin-channel-connector 0.71.0 → 0.72.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/service.js +4 -1
- package/package.json +2 -2
- package/src/service.ts +4 -1
package/dist/service.js
CHANGED
|
@@ -4542,7 +4542,10 @@ export class ChannelConnectorService {
|
|
|
4542
4542
|
const linesTotal = lines.reduce((sum, line) => sum + line.totalPrice, 0);
|
|
4543
4543
|
// ponytail: a multi-store order sends no shipping to any store; apportion it when such orders exist.
|
|
4544
4544
|
const shipping = selected.length === lineItems.length && order.shippingTotal > 0 ? { title: "Shipping", amount: order.shippingTotal } : null;
|
|
4545
|
-
|
|
4545
|
+
// ponytail: like delivery, a discount is sent only with the whole order; apportion it when multi-store orders exist.
|
|
4546
|
+
const discountCode = typeof metadata.promotionCode === "string" && metadata.promotionCode.trim() !== "" ? metadata.promotionCode.trim() : "DISCOUNT";
|
|
4547
|
+
const discount = selected.length === lineItems.length && order.discountTotal > 0 ? { code: discountCode, amount: order.discountTotal } : null;
|
|
4548
|
+
return Ok({ orderId, currency: order.currency, grandTotal: linesTotal + (shipping?.amount ?? 0) - (discount?.amount ?? 0), lines, ...(shipping ? { shipping } : {}), ...(discount ? { discount } : {}), customer: { name, email, shippingAddress } });
|
|
4546
4549
|
}
|
|
4547
4550
|
async reapExports(input) {
|
|
4548
4551
|
const now = Date.now();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/plugin-channel-connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@hono/zod-openapi": "^1.2.2",
|
|
24
24
|
"hono": "^4.12.5",
|
|
25
|
-
"@porulle/core": "0.
|
|
25
|
+
"@porulle/core": "0.72.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^24.5.2",
|
package/src/service.ts
CHANGED
|
@@ -5741,7 +5741,10 @@ export class ChannelConnectorService {
|
|
|
5741
5741
|
const linesTotal = lines.reduce((sum, line) => sum + line.totalPrice, 0);
|
|
5742
5742
|
// ponytail: a multi-store order sends no shipping to any store; apportion it when such orders exist.
|
|
5743
5743
|
const shipping = selected.length === lineItems.length && order.shippingTotal > 0 ? { title: "Shipping", amount: order.shippingTotal } : null;
|
|
5744
|
-
|
|
5744
|
+
// ponytail: like delivery, a discount is sent only with the whole order; apportion it when multi-store orders exist.
|
|
5745
|
+
const discountCode = typeof metadata.promotionCode === "string" && metadata.promotionCode.trim() !== "" ? metadata.promotionCode.trim() : "DISCOUNT";
|
|
5746
|
+
const discount = selected.length === lineItems.length && order.discountTotal > 0 ? { code: discountCode, amount: order.discountTotal } : null;
|
|
5747
|
+
return Ok({ orderId, currency: order.currency, grandTotal: linesTotal + (shipping?.amount ?? 0) - (discount?.amount ?? 0), lines, ...(shipping ? { shipping } : {}), ...(discount ? { discount } : {}), customer: { name, email, shippingAddress } });
|
|
5745
5748
|
}
|
|
5746
5749
|
|
|
5747
5750
|
async reapExports(input: { definitiveMs: number; transientMs: number }): Promise<{ abandonedCount: number; refundedOrderIds: string[] }> {
|