@porulle/plugin-channel-connector 0.70.0 → 0.70.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/dist/service.js +10 -1
- package/package.json +2 -2
- package/src/service.ts +10 -1
package/dist/service.js
CHANGED
|
@@ -2285,6 +2285,7 @@ export class ChannelConnectorService {
|
|
|
2285
2285
|
"orders/fulfilled",
|
|
2286
2286
|
"orders/partially_fulfilled",
|
|
2287
2287
|
"orders/cancelled",
|
|
2288
|
+
"refunds/create",
|
|
2288
2289
|
"app/uninstalled",
|
|
2289
2290
|
], callbackUrl);
|
|
2290
2291
|
if (!registration.ok) {
|
|
@@ -4186,7 +4187,15 @@ export class ChannelConnectorService {
|
|
|
4186
4187
|
const existing = await this.db.select().from(channelRefundRequests).where(and(eq(channelRefundRequests.storeId, store.id), eq(channelRefundRequests.remoteRefundId, remoteRefundId)));
|
|
4187
4188
|
if (existing[0])
|
|
4188
4189
|
return Ok(existing[0]);
|
|
4189
|
-
|
|
4190
|
+
// Shopify names the refunded lines in `refund_line_items`, each with its order line under
|
|
4191
|
+
// `line_item`; other providers send a flat `line_items`. Both reduce to { variant_id, quantity }.
|
|
4192
|
+
const lineData = Array.isArray(data.refund_line_items)
|
|
4193
|
+
? data.refund_line_items.map((raw) => {
|
|
4194
|
+
const entry = (raw ?? {});
|
|
4195
|
+
const orderLine = (entry.line_item ?? {});
|
|
4196
|
+
return { variant_id: orderLine.variant_id, product_id: orderLine.product_id, quantity: entry.quantity };
|
|
4197
|
+
})
|
|
4198
|
+
: Array.isArray(data.line_items) ? data.line_items : Array.isArray(data.lineItems) ? data.lineItems : [];
|
|
4190
4199
|
const orderLines = await this.db.select().from(orderLineItems).where(eq(orderLineItems.orderId, orderId));
|
|
4191
4200
|
const mappings = await this.db.select().from(channelEntityMap).where(and(eq(channelEntityMap.organizationId, orgId), eq(channelEntityMap.storeId, store.id)));
|
|
4192
4201
|
const refundLines = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/plugin-channel-connector",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.1",
|
|
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.70.
|
|
25
|
+
"@porulle/core": "0.70.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^24.5.2",
|
package/src/service.ts
CHANGED
|
@@ -3203,6 +3203,7 @@ export class ChannelConnectorService {
|
|
|
3203
3203
|
"orders/fulfilled",
|
|
3204
3204
|
"orders/partially_fulfilled",
|
|
3205
3205
|
"orders/cancelled",
|
|
3206
|
+
"refunds/create",
|
|
3206
3207
|
"app/uninstalled",
|
|
3207
3208
|
], callbackUrl);
|
|
3208
3209
|
if (!registration.ok) {
|
|
@@ -5313,7 +5314,15 @@ export class ChannelConnectorService {
|
|
|
5313
5314
|
if (!remoteRefundId || !orderId) return PluginErr("Refund webhook is missing a mapped order or refund id.", "REFUND_MAPPING_MISSING");
|
|
5314
5315
|
const existing = await this.db.select().from(channelRefundRequests).where(and(eq(channelRefundRequests.storeId, store.id), eq(channelRefundRequests.remoteRefundId, remoteRefundId)));
|
|
5315
5316
|
if (existing[0]) return Ok(existing[0] as ChannelRefundRequest);
|
|
5316
|
-
|
|
5317
|
+
// Shopify names the refunded lines in `refund_line_items`, each with its order line under
|
|
5318
|
+
// `line_item`; other providers send a flat `line_items`. Both reduce to { variant_id, quantity }.
|
|
5319
|
+
const lineData = Array.isArray(data.refund_line_items)
|
|
5320
|
+
? data.refund_line_items.map((raw) => {
|
|
5321
|
+
const entry = (raw ?? {}) as Record<string, unknown>;
|
|
5322
|
+
const orderLine = (entry.line_item ?? {}) as Record<string, unknown>;
|
|
5323
|
+
return { variant_id: orderLine.variant_id, product_id: orderLine.product_id, quantity: entry.quantity };
|
|
5324
|
+
})
|
|
5325
|
+
: Array.isArray(data.line_items) ? data.line_items : Array.isArray(data.lineItems) ? data.lineItems : [];
|
|
5317
5326
|
const orderLines = await this.db.select().from(orderLineItems).where(eq(orderLineItems.orderId, orderId));
|
|
5318
5327
|
const mappings = await this.db.select().from(channelEntityMap).where(and(eq(channelEntityMap.organizationId, orgId), eq(channelEntityMap.storeId, store.id)));
|
|
5319
5328
|
const refundLines: Array<{ lineItemId: string; quantity: number }> = [];
|