@reactionary/medusa 0.10.5 → 0.10.7
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.
|
@@ -79,7 +79,7 @@ class MedusaCheckoutFactory {
|
|
|
79
79
|
if (!shippingInstruction) return false;
|
|
80
80
|
if (!shippingAddress && !shippingInstruction.pickupPoint) return false;
|
|
81
81
|
if (paymentInstructions.length === 0) return false;
|
|
82
|
-
const authorizedPayments = paymentInstructions.filter((paymentInstruction) => paymentInstruction.status === "authorized").map((paymentInstruction) => paymentInstruction.amount.value).reduce((sum, value) => sum + value, 0);
|
|
82
|
+
const authorizedPayments = paymentInstructions.filter((paymentInstruction) => paymentInstruction.status === "authorized" || paymentInstruction.status === "captured").map((paymentInstruction) => paymentInstruction.amount.value).reduce((sum, value) => sum + value, 0);
|
|
83
83
|
if (price.grandTotal.value !== authorizedPayments) return false;
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
@@ -230,9 +230,16 @@ class MedusaCheckoutFactory {
|
|
|
230
230
|
status = "canceled";
|
|
231
231
|
break;
|
|
232
232
|
case "completed":
|
|
233
|
-
status = "
|
|
233
|
+
status = "captured";
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
|
+
if (remotePayment.refunded_amount && remotePayment.refunded_amount > 0) {
|
|
237
|
+
if (remotePayment.refunded_amount === remotePayment.captured_amount) {
|
|
238
|
+
status = "refunded";
|
|
239
|
+
} else {
|
|
240
|
+
status = "partial_refunded";
|
|
241
|
+
}
|
|
242
|
+
}
|
|
236
243
|
const paymentData = mainSession.data || {};
|
|
237
244
|
const pi = {
|
|
238
245
|
identifier: {
|
|
@@ -118,9 +118,16 @@ class MedusaOrderFactory {
|
|
|
118
118
|
status = "canceled";
|
|
119
119
|
break;
|
|
120
120
|
case "completed":
|
|
121
|
-
status = "
|
|
121
|
+
status = "captured";
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
|
+
if (remotePayment.refunded_amount && remotePayment.refunded_amount > 0) {
|
|
125
|
+
if (remotePayment.refunded_amount === remotePayment.captured_amount) {
|
|
126
|
+
status = "refunded";
|
|
127
|
+
} else {
|
|
128
|
+
status = "partial_refunded";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
124
131
|
const paymentData = mainSession.data || {};
|
|
125
132
|
const pi = {
|
|
126
133
|
identifier: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@medusajs/js-sdk": "^2.13.3",
|
|
13
|
-
"@reactionary/core": "0.10.
|
|
13
|
+
"@reactionary/core": "0.10.7",
|
|
14
14
|
"debug": "^4.4.3",
|
|
15
15
|
"@medusajs/types": "^2.13.3",
|
|
16
16
|
"zod": "4.1.9"
|
|
@@ -50,7 +50,7 @@ export declare class MedusaCheckoutFactory<TCheckoutSchema extends AnyCheckoutSc
|
|
|
50
50
|
key: string;
|
|
51
51
|
value: string;
|
|
52
52
|
}[];
|
|
53
|
-
status: "pending" | "authorized" | "canceled" | "
|
|
53
|
+
status: "pending" | "authorized" | "canceled" | "captured" | "refunded" | "partial_refunded";
|
|
54
54
|
} | undefined;
|
|
55
55
|
parsePaymentMethod(_context: RequestContext, data: StorePaymentProvider): z.output<TPaymentMethodSchema>;
|
|
56
56
|
}
|
|
@@ -38,6 +38,6 @@ export declare class MedusaOrderFactory<TOrderSchema extends AnyOrderSchema = ty
|
|
|
38
38
|
key: string;
|
|
39
39
|
value: string;
|
|
40
40
|
}[];
|
|
41
|
-
status: "pending" | "authorized" | "canceled" | "
|
|
41
|
+
status: "pending" | "authorized" | "canceled" | "captured" | "refunded" | "partial_refunded";
|
|
42
42
|
} | undefined;
|
|
43
43
|
}
|