hookwright 2.3.4 → 2.3.6
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/cli.js +5 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ var init_package = __esm({
|
|
|
24
24
|
"package.json"() {
|
|
25
25
|
package_default = {
|
|
26
26
|
name: "hookwright",
|
|
27
|
-
version: "2.3.
|
|
27
|
+
version: "2.3.6",
|
|
28
28
|
description: "Build real, signed e-commerce webhooks from a live Shopify catalogue \u2014 interactive terminal UI, no backend",
|
|
29
29
|
keywords: [
|
|
30
30
|
"webhook",
|
|
@@ -1847,7 +1847,7 @@ var COMMON_FIELDS3 = [
|
|
|
1847
1847
|
{ source: "request.created_at", target: "createdAt" }
|
|
1848
1848
|
];
|
|
1849
1849
|
var EXCHANGE_FIELDS = [
|
|
1850
|
-
{ source: "request.line_items[].exchange_product.title", target: "exchangeProduct.
|
|
1850
|
+
{ source: "request.line_items[].exchange_product.title", target: "exchangeProduct.details", note: "exchanges only \u2014 returns never carry it" },
|
|
1851
1851
|
{ source: "request.line_items[].exchange_product.price", target: "exchangeProduct.totalPrice + pricing.priceDifference", note: "both summed across the lines, times quantity; the difference is signed, positive means the shopper owes more" },
|
|
1852
1852
|
{ source: "request.line_items[].exchange_product.image.src", target: "exchangeProduct.image" },
|
|
1853
1853
|
{ source: "request.line_items[].exchange_product.sku", target: "exchangeProduct.sku" },
|
|
@@ -1900,6 +1900,7 @@ function buildPayload6(ctx) {
|
|
|
1900
1900
|
const qty = def.requestType === "exchange" ? repl?.quantity ?? sel?.quantity ?? 1 : sel?.quantity ?? 1;
|
|
1901
1901
|
const originalPrice = money2(sel?.variant?.price ?? 0);
|
|
1902
1902
|
const exchangePrice = money2(repl?.variant?.price ?? 0);
|
|
1903
|
+
const lineTotal = money2(originalPrice * qty);
|
|
1903
1904
|
const refundedAmount = def.requestType === "exchange" ? Math.max(money2((originalPrice - exchangePrice) * qty), 0) : money2(originalPrice * qty);
|
|
1904
1905
|
return {
|
|
1905
1906
|
id: Number(sel?.variant?.id ?? sel?.product?.id ?? 0),
|
|
@@ -1967,7 +1968,7 @@ function buildPayload6(ctx) {
|
|
|
1967
1968
|
quantity: qty,
|
|
1968
1969
|
reason: ctx.reason ?? "Size of Fit Issues",
|
|
1969
1970
|
shop_price: {
|
|
1970
|
-
actual_amount:
|
|
1971
|
+
actual_amount: lineTotal,
|
|
1971
1972
|
total_tax: 0,
|
|
1972
1973
|
return_quantity: qty,
|
|
1973
1974
|
total_discount: 0,
|
|
@@ -1977,7 +1978,7 @@ function buildPayload6(ctx) {
|
|
|
1977
1978
|
do_not_carry_forward_discount: true
|
|
1978
1979
|
},
|
|
1979
1980
|
presentment_price: {
|
|
1980
|
-
actual_amount:
|
|
1981
|
+
actual_amount: lineTotal,
|
|
1981
1982
|
total_tax: 0,
|
|
1982
1983
|
return_quantity: qty,
|
|
1983
1984
|
total_discount: 0,
|