@hectasquare/medusa-payment-paypal 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/dist/service.js +17 -2
  2. package/package.json +1 -1
package/dist/service.js CHANGED
@@ -97,7 +97,19 @@ class PayPalProviderService extends utils_1.AbstractPaymentProvider {
97
97
  prefer: "return=representation",
98
98
  });
99
99
  // Return CAPTURED status
100
- return this.getStatus(response.result);
100
+ const result = response.result;
101
+ // Extract and store capture_id for refunds (per Medusa docs)
102
+ const captureId = result?.purchase_units?.[0]?.payments?.captures?.[0]?.id;
103
+ console.log("[PayPal] ========== AUTHORIZE PAYMENT ==========");
104
+ console.log("[PayPal] Order ID:", result?.id);
105
+ console.log("[PayPal] Order Status:", result?.status);
106
+ console.log("[PayPal] Capture ID:", captureId);
107
+ console.log("[PayPal] ========================================");
108
+ const statusResult = this.getStatus(result);
109
+ return {
110
+ ...statusResult,
111
+ data: { ...statusResult.data, capture_id: captureId }
112
+ };
101
113
  }
102
114
  catch (error) {
103
115
  // If already captured (422 error), get status
@@ -402,4 +414,7 @@ class PayPalProviderService extends utils_1.AbstractPaymentProvider {
402
414
  }
403
415
  PayPalProviderService.identifier = "paypal";
404
416
  exports.default = PayPalProviderService;
405
- //# sourceMappingURL=service.js.map
417
+ //# sourceMappingURL=service.js.map
418
+
419
+
420
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hectasquare/medusa-payment-paypal",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "PayPal Payment Provider for Medusa v2.10+ using the latest PayPal Server SDK with full Vault API support - Hecta Square Edition",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",