@porulle/plugin-channel-connector 0.68.2 → 0.68.4

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 CHANGED
@@ -4387,7 +4387,10 @@ export class ChannelConnectorService {
4387
4387
  }
4388
4388
  if (!email || !shippingAddress)
4389
4389
  return PluginErr("Customer email and shipping address are required for channel order export.", "CUSTOMER_DATA_MISSING");
4390
- return Ok({ orderId, currency: order.currency, grandTotal: lines.reduce((sum, line) => sum + line.totalPrice, 0), lines, customer: { name, email, shippingAddress } });
4390
+ const linesTotal = lines.reduce((sum, line) => sum + line.totalPrice, 0);
4391
+ // ponytail: a multi-store order sends no shipping to any store; apportion it when such orders exist.
4392
+ const shipping = selected.length === lineItems.length && order.shippingTotal > 0 ? { title: "Shipping", amount: order.shippingTotal } : null;
4393
+ return Ok({ orderId, currency: order.currency, grandTotal: linesTotal + (shipping?.amount ?? 0), lines, ...(shipping ? { shipping } : {}), customer: { name, email, shippingAddress } });
4391
4394
  }
4392
4395
  async reapExports(input) {
4393
4396
  const now = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porulle/plugin-channel-connector",
3
- "version": "0.68.2",
3
+ "version": "0.68.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,15 +22,15 @@
22
22
  "dependencies": {
23
23
  "@hono/zod-openapi": "^1.2.2",
24
24
  "hono": "^4.12.5",
25
- "@porulle/core": "0.68.2"
25
+ "@porulle/core": "0.68.4"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^24.5.2",
29
29
  "eslint": "^9.39.1",
30
30
  "typescript": "5.9.2",
31
31
  "vitest": "^3.2.4",
32
- "@porulle/eslint-config": "0.1.0",
33
- "@porulle/typescript-config": "0.1.0"
32
+ "@porulle/typescript-config": "0.1.0",
33
+ "@porulle/eslint-config": "0.1.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
package/src/service.ts CHANGED
@@ -5583,7 +5583,10 @@ export class ChannelConnectorService {
5583
5583
  shippingAddress = withoutUndefined(parsed.data);
5584
5584
  }
5585
5585
  if (!email || !shippingAddress) return PluginErr("Customer email and shipping address are required for channel order export.", "CUSTOMER_DATA_MISSING");
5586
- return Ok({ orderId, currency: order.currency, grandTotal: lines.reduce((sum, line) => sum + line.totalPrice, 0), lines, customer: { name, email, shippingAddress } });
5586
+ const linesTotal = lines.reduce((sum, line) => sum + line.totalPrice, 0);
5587
+ // ponytail: a multi-store order sends no shipping to any store; apportion it when such orders exist.
5588
+ const shipping = selected.length === lineItems.length && order.shippingTotal > 0 ? { title: "Shipping", amount: order.shippingTotal } : null;
5589
+ return Ok({ orderId, currency: order.currency, grandTotal: linesTotal + (shipping?.amount ?? 0), lines, ...(shipping ? { shipping } : {}), customer: { name, email, shippingAddress } });
5587
5590
  }
5588
5591
 
5589
5592
  async reapExports(input: { definitiveMs: number; transientMs: number }): Promise<{ abandonedCount: number; refundedOrderIds: string[] }> {