@easypayment/medusa-paypal 0.1.0
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/.medusa/server/src/admin/index.js +2127 -0
- package/.medusa/server/src/admin/index.mjs +2128 -0
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +25 -0
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/audit-logs/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/audit-logs/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/audit-logs/route.js +12 -0
- package/.medusa/server/src/api/admin/paypal/audit-logs/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.js +9 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.js +17 -0
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disputes/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/disputes/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disputes/route.js +27 -0
- package/.medusa/server/src/api/admin/paypal/disputes/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.js +17 -0
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.js +23 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts +8 -0
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js +41 -0
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js +35 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js +20 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/reconciliation-status/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/reconciliation-status/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/reconciliation-status/route.js +8 -0
- package/.medusa/server/src/api/admin/paypal/reconciliation-status/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/rotate-credentials/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/rotate-credentials/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/rotate-credentials/route.js +9 -0
- package/.medusa/server/src/api/admin/paypal/rotate-credentials/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.js +13 -0
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/settings/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/paypal/settings/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/settings/route.js +14 -0
- package/.medusa/server/src/api/admin/paypal/settings/route.js.map +1 -0
- package/.medusa/server/src/api/admin/paypal/status/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/paypal/status/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/status/route.js +11 -0
- package/.medusa/server/src/api/admin/paypal/status/route.js.map +1 -0
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts +3 -0
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +43 -0
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal/capture-order/route.js +215 -0
- package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/config/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal/config/route.js +45 -0
- package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.js +305 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/disputes/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal/disputes/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal/disputes/route.js +46 -0
- package/.medusa/server/src/api/store/paypal/disputes/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/settings/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal/settings/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal/settings/route.js +14 -0
- package/.medusa/server/src/api/store/paypal/settings/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.js +203 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -0
- package/.medusa/server/src/jobs/paypal-reconcile.d.ts +7 -0
- package/.medusa/server/src/jobs/paypal-reconcile.d.ts.map +1 -0
- package/.medusa/server/src/jobs/paypal-reconcile.js +131 -0
- package/.medusa/server/src/jobs/paypal-reconcile.js.map +1 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts +7 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts.map +1 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.js +78 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.js.map +1 -0
- package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.d.ts +14 -0
- package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.js +65 -0
- package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.js.map +1 -0
- package/.medusa/server/src/modules/paypal/index.d.ts +92 -0
- package/.medusa/server/src/modules/paypal/index.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/index.js +13 -0
- package/.medusa/server/src/modules/paypal/index.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.js +36 -0
- package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.js +25 -0
- package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.js +32 -0
- package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260301090000_create_paypal_audit_log.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260301090000_create_paypal_audit_log.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260301090000_create_paypal_audit_log.js +29 -0
- package/.medusa/server/src/modules/paypal/migrations/20260301090000_create_paypal_audit_log.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.js +30 -0
- package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.js +43 -0
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.js +34 -0
- package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_audit_log.d.ts +7 -0
- package/.medusa/server/src/modules/paypal/models/paypal_audit_log.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_audit_log.js +10 -0
- package/.medusa/server/src/modules/paypal/models/paypal_audit_log.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts +14 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.js +17 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.d.ts +16 -0
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.js +19 -0
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts +7 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.js +10 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.js +9 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts +17 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js +20 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts +35 -0
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +569 -0
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts +10 -0
- package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/index.js +22 -0
- package/.medusa/server/src/modules/paypal/payment-provider/index.js.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts +44 -0
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +825 -0
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.d.ts +3 -0
- package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.js +74 -0
- package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.js.map +1 -0
- package/.medusa/server/src/modules/paypal/service.d.ts +362 -0
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/service.js +1180 -0
- package/.medusa/server/src/modules/paypal/service.js.map +1 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts +14 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/types/config.js +33 -0
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts +3 -0
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/amounts.js +40 -0
- package/.medusa/server/src/modules/paypal/utils/amounts.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/crypto.d.ts +4 -0
- package/.medusa/server/src/modules/paypal/utils/crypto.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/crypto.js +47 -0
- package/.medusa/server/src/modules/paypal/utils/crypto.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.d.ts +19 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.js +69 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +9 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js +50 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +38 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.js +265 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/package.json +61 -0
- package/postcss.config.cjs +3 -0
- package/src/admin/index.ts +7 -0
- package/src/admin/routes/settings/paypal/_components/Tabs.tsx +55 -0
- package/src/admin/routes/settings/paypal/_components/Toast.tsx +51 -0
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +346 -0
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +381 -0
- package/src/admin/routes/settings/paypal/apple-pay/page.tsx +5 -0
- package/src/admin/routes/settings/paypal/audit-logs/page.tsx +131 -0
- package/src/admin/routes/settings/paypal/connection/page.tsx +750 -0
- package/src/admin/routes/settings/paypal/disputes/page.tsx +259 -0
- package/src/admin/routes/settings/paypal/google-pay/page.tsx +5 -0
- package/src/admin/routes/settings/paypal/page.tsx +16 -0
- package/src/admin/routes/settings/paypal/pay-later-messaging/page.tsx +5 -0
- package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +557 -0
- package/src/admin/routes/settings/paypal/reconciliation-status/page.tsx +165 -0
- package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +32 -0
- package/src/api/admin/paypal/audit-logs/route.ts +13 -0
- package/src/api/admin/paypal/disconnect/route.ts +8 -0
- package/src/api/admin/paypal/disputes/[id]/route.ts +19 -0
- package/src/api/admin/paypal/disputes/route.ts +30 -0
- package/src/api/admin/paypal/disputes/summary/route.ts +18 -0
- package/src/api/admin/paypal/environment/route.ts +25 -0
- package/src/api/admin/paypal/onboard-complete/route.ts +44 -0
- package/src/api/admin/paypal/onboarding-link/route.ts +45 -0
- package/src/api/admin/paypal/onboarding-status/route.ts +18 -0
- package/src/api/admin/paypal/reconciliation-status/route.ts +7 -0
- package/src/api/admin/paypal/rotate-credentials/route.ts +8 -0
- package/src/api/admin/paypal/save-credentials/route.ts +14 -0
- package/src/api/admin/paypal/settings/route.ts +14 -0
- package/src/api/admin/paypal/status/route.ts +12 -0
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +51 -0
- package/src/api/store/paypal/capture-order/route.ts +270 -0
- package/src/api/store/paypal/config/route.ts +59 -0
- package/src/api/store/paypal/create-order/route.ts +374 -0
- package/src/api/store/paypal/disputes/route.ts +67 -0
- package/src/api/store/paypal/settings/route.ts +12 -0
- package/src/api/store/paypal/webhook/route.ts +247 -0
- package/src/jobs/paypal-reconcile.ts +135 -0
- package/src/jobs/paypal-webhook-retry.ts +86 -0
- package/src/modules/paypal/clients/paypal-seller.client.ts +59 -0
- package/src/modules/paypal/index.ts +8 -0
- package/src/modules/paypal/migrations/20260115120000_create_paypal_connection.ts +33 -0
- package/src/modules/paypal/migrations/20260123090000_create_paypal_settings.ts +22 -0
- package/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.ts +29 -0
- package/src/modules/paypal/migrations/20260301090000_create_paypal_audit_log.ts +26 -0
- package/src/modules/paypal/migrations/20260401090000_create_paypal_metric.ts +27 -0
- package/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.ts +40 -0
- package/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.ts +31 -0
- package/src/modules/paypal/models/paypal_audit_log.ts +9 -0
- package/src/modules/paypal/models/paypal_connection.ts +21 -0
- package/src/modules/paypal/models/paypal_dispute.ts +18 -0
- package/src/modules/paypal/models/paypal_metric.ts +9 -0
- package/src/modules/paypal/models/paypal_settings.ts +8 -0
- package/src/modules/paypal/models/paypal_webhook_event.ts +19 -0
- package/src/modules/paypal/payment-provider/README.md +22 -0
- package/src/modules/paypal/payment-provider/card-service.ts +710 -0
- package/src/modules/paypal/payment-provider/index.ts +19 -0
- package/src/modules/paypal/payment-provider/service.ts +1035 -0
- package/src/modules/paypal/payment-provider/webhook-utils.ts +88 -0
- package/src/modules/paypal/service.ts +1422 -0
- package/src/modules/paypal/types/config.ts +47 -0
- package/src/modules/paypal/utils/amounts.ts +41 -0
- package/src/modules/paypal/utils/crypto.ts +51 -0
- package/src/modules/paypal/utils/currencies.ts +84 -0
- package/src/modules/paypal/utils/provider-ids.ts +53 -0
- package/src/modules/paypal/webhook-processor.ts +313 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET = GET;
|
|
4
|
+
function toPublicDispute(dispute) {
|
|
5
|
+
return {
|
|
6
|
+
id: dispute.id,
|
|
7
|
+
dispute_id: dispute.dispute_id,
|
|
8
|
+
status: dispute.status ?? null,
|
|
9
|
+
reason: dispute.reason ?? null,
|
|
10
|
+
stage: dispute.stage ?? null,
|
|
11
|
+
amount: dispute.amount ?? null,
|
|
12
|
+
currency_code: dispute.currency_code ?? null,
|
|
13
|
+
transaction_id: dispute.transaction_id ?? null,
|
|
14
|
+
seller_transaction_id: dispute.seller_transaction_id ?? null,
|
|
15
|
+
order_id: dispute.order_id ?? null,
|
|
16
|
+
cart_id: dispute.cart_id ?? null,
|
|
17
|
+
created_at: dispute.created_at ?? null,
|
|
18
|
+
updated_at: dispute.updated_at ?? null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async function GET(req, res) {
|
|
22
|
+
const paypal = req.scope.resolve("paypal_onboarding");
|
|
23
|
+
const query = (req.query || {});
|
|
24
|
+
const filters = {};
|
|
25
|
+
const addFilter = (key) => {
|
|
26
|
+
const value = query[key];
|
|
27
|
+
if (Array.isArray(value)) {
|
|
28
|
+
if (value[0]) {
|
|
29
|
+
filters[key] = value[0];
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (typeof value === "string" && value.trim()) {
|
|
34
|
+
filters[key] = value.trim();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
addFilter("order_id");
|
|
38
|
+
addFilter("cart_id");
|
|
39
|
+
addFilter("dispute_id");
|
|
40
|
+
if (Object.keys(filters).length === 0) {
|
|
41
|
+
return res.status(400).json({ message: "order_id, cart_id, or dispute_id is required" });
|
|
42
|
+
}
|
|
43
|
+
const disputes = await paypal.listPayPalDisputes(filters);
|
|
44
|
+
return res.json({ disputes: (disputes || []).map(toPublicDispute) });
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/disputes/route.ts"],"names":[],"mappings":";;AAqCA,kBA6BC;AA/CD,SAAS,eAAe,CAAC,OAAY;IACnC,OAAO;QACL,EAAE,E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CAAC,IAAI,EAAE,EAAE,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;QAC7B,CAAC;IACH,CAAC,CAAA;IAED,SAAS,CAAC,UAAU,CAAC,CAAA;IACrB,SAAS,CAAC,SAAS,CAAC,CAAA;IACpB,SAAS,CAAC,YAAY,CAAC,CAAA;IAEvB,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;IACzD,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;AACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/settings/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAG7E,wBAAsB,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BAQhE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET = GET;
|
|
4
|
+
async function GET(req, res) {
|
|
5
|
+
const paypal = req.scope.resolve("paypal_onboarding");
|
|
6
|
+
try {
|
|
7
|
+
const settings = await paypal.getSettings();
|
|
8
|
+
return res.json(settings);
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
return res.status(500).json({ message: e?.message || "Failed to load PayPal settings" });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/settings/route.ts"],"names":[],"mappings":";;AAGA,kBAQC;AARM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAC1E,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAA;QAC3C,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,gCAAgC,EAAE,CAAC,CAAA;IAC1F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/webhook/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AA+H7E,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BAuHjE"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = POST;
|
|
4
|
+
const webhook_processor_1 = require("../../../../modules/paypal/webhook-processor");
|
|
5
|
+
const REPLAY_WINDOW_MINUTES = (() => {
|
|
6
|
+
const configured = Number(process.env.PAYPAL_WEBHOOK_REPLAY_WINDOW_MINUTES);
|
|
7
|
+
return Number.isFinite(configured) ? configured : 60;
|
|
8
|
+
})();
|
|
9
|
+
function getHeader(headers, name) {
|
|
10
|
+
const direct = headers[name];
|
|
11
|
+
if (Array.isArray(direct)) {
|
|
12
|
+
return direct[0];
|
|
13
|
+
}
|
|
14
|
+
if (typeof direct === "string") {
|
|
15
|
+
return direct;
|
|
16
|
+
}
|
|
17
|
+
const needle = name.toLowerCase();
|
|
18
|
+
const key = Object.keys(headers).find((header) => header.toLowerCase() === needle);
|
|
19
|
+
const value = key ? headers[key] : undefined;
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
return value[0];
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function isReplay(headers) {
|
|
26
|
+
const transmissionTime = getHeader(headers, "paypal-transmission-time");
|
|
27
|
+
if (!transmissionTime) {
|
|
28
|
+
throw new Error("Missing PayPal transmission time header");
|
|
29
|
+
}
|
|
30
|
+
const parsed = Date.parse(transmissionTime);
|
|
31
|
+
if (!Number.isFinite(parsed)) {
|
|
32
|
+
throw new Error("Invalid PayPal transmission time header");
|
|
33
|
+
}
|
|
34
|
+
const deltaMs = Math.abs(Date.now() - parsed);
|
|
35
|
+
return deltaMs > REPLAY_WINDOW_MINUTES * 60 * 1000;
|
|
36
|
+
}
|
|
37
|
+
function resolveWebhookId(environment, settings) {
|
|
38
|
+
const ids = (settings?.webhook_ids || {});
|
|
39
|
+
const legacyLive = settings?.webhook_id_live;
|
|
40
|
+
const legacySandbox = settings?.webhook_id_sandbox;
|
|
41
|
+
if (environment === "live") {
|
|
42
|
+
return ids.live || legacyLive || process.env.PAYPAL_WEBHOOK_ID_LIVE;
|
|
43
|
+
}
|
|
44
|
+
return ids.sandbox || legacySandbox || process.env.PAYPAL_WEBHOOK_ID_SANDBOX;
|
|
45
|
+
}
|
|
46
|
+
async function verifyWebhookSignature(paypal, environment, body, headers) {
|
|
47
|
+
if (isReplay(headers)) {
|
|
48
|
+
throw new Error("PayPal webhook replay protection triggered");
|
|
49
|
+
}
|
|
50
|
+
const settings = await paypal.getSettings().catch(() => ({ data: {} }));
|
|
51
|
+
const webhookId = resolveWebhookId(environment, settings?.data || {});
|
|
52
|
+
if (!webhookId) {
|
|
53
|
+
throw new Error(`Missing PayPal webhook ID for environment "${environment}"`);
|
|
54
|
+
}
|
|
55
|
+
const base = environment === "live"
|
|
56
|
+
? "https://api-m.paypal.com"
|
|
57
|
+
: "https://api-m.sandbox.paypal.com";
|
|
58
|
+
const accessToken = await paypal.getAppAccessToken();
|
|
59
|
+
const verifyPayload = {
|
|
60
|
+
auth_algo: getHeader(headers, "paypal-auth-algo"),
|
|
61
|
+
cert_url: getHeader(headers, "paypal-cert-url"),
|
|
62
|
+
transmission_id: getHeader(headers, "paypal-transmission-id"),
|
|
63
|
+
transmission_sig: getHeader(headers, "paypal-transmission-sig"),
|
|
64
|
+
transmission_time: getHeader(headers, "paypal-transmission-time"),
|
|
65
|
+
webhook_id: webhookId,
|
|
66
|
+
webhook_event: body,
|
|
67
|
+
};
|
|
68
|
+
const requiredHeaders = [
|
|
69
|
+
verifyPayload.auth_algo,
|
|
70
|
+
verifyPayload.cert_url,
|
|
71
|
+
verifyPayload.transmission_id,
|
|
72
|
+
verifyPayload.transmission_sig,
|
|
73
|
+
verifyPayload.transmission_time,
|
|
74
|
+
];
|
|
75
|
+
if (requiredHeaders.some((value) => !value)) {
|
|
76
|
+
throw new Error("Missing required PayPal webhook signature headers");
|
|
77
|
+
}
|
|
78
|
+
const resp = await fetch(`${base}/v1/notifications/verify-webhook-signature`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: {
|
|
81
|
+
Authorization: `Bearer ${accessToken}`,
|
|
82
|
+
"Content-Type": "application/json",
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify(verifyPayload),
|
|
85
|
+
});
|
|
86
|
+
const json = await resp.json().catch(() => ({}));
|
|
87
|
+
if (!resp.ok || json?.verification_status !== "VERIFIED") {
|
|
88
|
+
const debugId = resp.headers.get("paypal-debug-id") || json?.debug_id;
|
|
89
|
+
throw new Error(`PayPal webhook verification failed (${resp.status}): ${JSON.stringify(json)}${debugId ? ` debug_id=${debugId}` : ""}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function POST(req, res) {
|
|
93
|
+
const paypal = req.scope.resolve("paypal_onboarding");
|
|
94
|
+
try {
|
|
95
|
+
const payload = (req.body || {});
|
|
96
|
+
const eventId = String(payload?.id || payload?.event_id || "");
|
|
97
|
+
const eventType = String(payload?.event_type || payload?.eventType || "");
|
|
98
|
+
if (!eventId || !eventType) {
|
|
99
|
+
return res.status(400).json({ message: "Missing PayPal event id or type" });
|
|
100
|
+
}
|
|
101
|
+
const creds = await paypal.getActiveCredentials();
|
|
102
|
+
await verifyWebhookSignature(paypal, creds.environment, payload, req.headers);
|
|
103
|
+
const transmissionId = getHeader(req.headers, "paypal-transmission-id") || null;
|
|
104
|
+
const transmissionTimeHeader = getHeader(req.headers, "paypal-transmission-time");
|
|
105
|
+
const transmissionTime = transmissionTimeHeader ? new Date(transmissionTimeHeader) : null;
|
|
106
|
+
const eventVersion = (0, webhook_processor_1.normalizeEventVersion)(payload);
|
|
107
|
+
if (transmissionId) {
|
|
108
|
+
const existingByTransmission = await paypal.listPayPalWebhookEvents({
|
|
109
|
+
transmission_id: transmissionId,
|
|
110
|
+
});
|
|
111
|
+
if ((existingByTransmission || []).length > 0) {
|
|
112
|
+
return res.json({ ok: true, duplicate: true });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const recordResult = await paypal.createWebhookEventRecord({
|
|
116
|
+
event_id: eventId,
|
|
117
|
+
event_type: eventType,
|
|
118
|
+
payload,
|
|
119
|
+
event_version: eventVersion,
|
|
120
|
+
transmission_id: transmissionId,
|
|
121
|
+
transmission_time: transmissionTime,
|
|
122
|
+
status: "processing",
|
|
123
|
+
attempt_count: 1,
|
|
124
|
+
});
|
|
125
|
+
if (!recordResult.created) {
|
|
126
|
+
return res.json({ ok: true, duplicate: true });
|
|
127
|
+
}
|
|
128
|
+
if (!(0, webhook_processor_1.isAllowedEventType)(eventType)) {
|
|
129
|
+
await paypal.recordAuditEvent("webhook_unsupported_event", {
|
|
130
|
+
event_id: eventId,
|
|
131
|
+
event_type: eventType,
|
|
132
|
+
});
|
|
133
|
+
if (recordResult.event?.id) {
|
|
134
|
+
await paypal.updateWebhookEventRecord({
|
|
135
|
+
id: recordResult.event.id,
|
|
136
|
+
status: "ignored",
|
|
137
|
+
processed_at: new Date(),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return res.json({ ok: true, ignored: true });
|
|
141
|
+
}
|
|
142
|
+
const processed = await (0, webhook_processor_1.processPayPalWebhookEvent)(req.scope, {
|
|
143
|
+
eventType,
|
|
144
|
+
payload,
|
|
145
|
+
});
|
|
146
|
+
if (recordResult.event?.id) {
|
|
147
|
+
await paypal.updateWebhookEventRecord({
|
|
148
|
+
id: recordResult.event.id,
|
|
149
|
+
status: "processed",
|
|
150
|
+
processed_at: new Date(),
|
|
151
|
+
resource_id: processed.disputeId || processed.refundId || processed.captureId || processed.orderId || null,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
console.info("[PayPal] webhook", {
|
|
155
|
+
event_id: eventId,
|
|
156
|
+
event_type: eventType,
|
|
157
|
+
order_id: processed.orderId,
|
|
158
|
+
capture_id: processed.captureId,
|
|
159
|
+
refund_id: processed.refundId,
|
|
160
|
+
cart_id: processed.cartId,
|
|
161
|
+
});
|
|
162
|
+
try {
|
|
163
|
+
await paypal.recordMetric("webhook_success");
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// ignore metrics failures
|
|
167
|
+
}
|
|
168
|
+
return res.json({ ok: true });
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
try {
|
|
172
|
+
const payload = (req.body || {});
|
|
173
|
+
const eventId = String(payload?.id || payload?.event_id || "");
|
|
174
|
+
const eventType = String(payload?.event_type || payload?.eventType || "");
|
|
175
|
+
if (eventId) {
|
|
176
|
+
const existing = await paypal.listPayPalWebhookEvents({ event_id: eventId });
|
|
177
|
+
const record = existing?.[0];
|
|
178
|
+
if (record?.id) {
|
|
179
|
+
const attemptCount = Number(record.attempt_count || 0) + 1;
|
|
180
|
+
await paypal.updateWebhookEventRecord({
|
|
181
|
+
id: record.id,
|
|
182
|
+
status: "failed",
|
|
183
|
+
attempt_count: attemptCount,
|
|
184
|
+
next_retry_at: (0, webhook_processor_1.computeNextRetryAt)(attemptCount),
|
|
185
|
+
last_error: e?.message || String(e),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
await paypal.recordAuditEvent("webhook_failed", {
|
|
190
|
+
event_id: payload?.id || payload?.event_id,
|
|
191
|
+
event_type: payload?.event_type || payload?.eventType,
|
|
192
|
+
message: e?.message || String(e),
|
|
193
|
+
});
|
|
194
|
+
await paypal.recordMetric("webhook_failed");
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// ignore audit logging failures
|
|
198
|
+
}
|
|
199
|
+
console.error("[PayPal] webhook error", e?.message || e);
|
|
200
|
+
return res.status(500).json({ message: e?.message || "PayPal webhook error" });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/webhook/route.ts"],"names":[],"mappings":";;AA+HA,oBAuHC;AApPD,oFAKqD;AAErD,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE;IAClC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;IAC3E,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;AACtD,CAAC,CAAC,EAAE,CAAA;AAEJ,SAAS,SAA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7C,CAAC;QAAC,MAAM,CAAC;YACP,gCAAgC;QAClC,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,CAAA;QACxD,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,sBAAsB,EAAE,CAAC,CAAA;IAChF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MedusaContainer } from "@medusajs/framework/types";
|
|
2
|
+
export default function paypalReconcile(container: MedusaContainer): Promise<void>;
|
|
3
|
+
export declare const config: {
|
|
4
|
+
name: string;
|
|
5
|
+
schedule: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=paypal-reconcile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-reconcile.d.ts","sourceRoot":"","sources":["../../../../src/jobs/paypal-reconcile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAWhE,wBAA8B,eAAe,CAAC,SAAS,EAAE,eAAe,iBAsHvE;AAED,eAAO,MAAM,MAAM;;;CAGlB,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
exports.default = paypalReconcile;
|
|
5
|
+
const STATUS_MAP = {
|
|
6
|
+
CREATED: "pending",
|
|
7
|
+
APPROVED: "authorized",
|
|
8
|
+
COMPLETED: "captured",
|
|
9
|
+
VOIDED: "canceled",
|
|
10
|
+
CANCELLED: "canceled",
|
|
11
|
+
};
|
|
12
|
+
async function paypalReconcile(container) {
|
|
13
|
+
const paymentSessionService = container.resolve("payment_session");
|
|
14
|
+
const paypal = container.resolve("paypal_onboarding");
|
|
15
|
+
const sessions = await paymentSessionService.list({
|
|
16
|
+
provider_id: ["paypal", "paypal_card"],
|
|
17
|
+
status: ["pending", "authorized"],
|
|
18
|
+
});
|
|
19
|
+
let sessionsChecked = 0;
|
|
20
|
+
let sessionsUpdated = 0;
|
|
21
|
+
let driftCount = 0;
|
|
22
|
+
let lastDriftAt = null;
|
|
23
|
+
let lastDriftOrderId = null;
|
|
24
|
+
let hadFailure = false;
|
|
25
|
+
let lastErrorMessage = null;
|
|
26
|
+
for (const session of sessions || []) {
|
|
27
|
+
const data = (session?.data || {});
|
|
28
|
+
const paypalData = (data.paypal || {});
|
|
29
|
+
const orderId = String(paypalData.order_id || data.order_id || "");
|
|
30
|
+
if (!orderId) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
sessionsChecked += 1;
|
|
34
|
+
try {
|
|
35
|
+
const order = await paypal.getOrderDetails(orderId);
|
|
36
|
+
const status = STATUS_MAP[String(order?.status || "").toUpperCase()];
|
|
37
|
+
if (!status) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const previousStatus = session?.status;
|
|
41
|
+
if (previousStatus && previousStatus !== status) {
|
|
42
|
+
driftCount += 1;
|
|
43
|
+
lastDriftAt = new Date().toISOString();
|
|
44
|
+
lastDriftOrderId = orderId;
|
|
45
|
+
await paypal.recordPaymentLog("reconcile_drift", {
|
|
46
|
+
session_id: session.id,
|
|
47
|
+
order_id: orderId,
|
|
48
|
+
previous_status: previousStatus,
|
|
49
|
+
next_status: status,
|
|
50
|
+
});
|
|
51
|
+
await paypal.recordMetric("reconcile_drift");
|
|
52
|
+
await paypal.sendAlert({
|
|
53
|
+
type: "reconcile_drift",
|
|
54
|
+
message: `PayPal reconciliation drift detected for order ${orderId}.`,
|
|
55
|
+
metadata: {
|
|
56
|
+
session_id: session.id,
|
|
57
|
+
previous_status: previousStatus,
|
|
58
|
+
next_status: status,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
await paymentSessionService.update(session.id, {
|
|
63
|
+
status,
|
|
64
|
+
data: {
|
|
65
|
+
...(session.data || {}),
|
|
66
|
+
paypal: {
|
|
67
|
+
...((session.data || {}).paypal || {}),
|
|
68
|
+
order,
|
|
69
|
+
reconciliation: {
|
|
70
|
+
last_reconciled_at: new Date().toISOString(),
|
|
71
|
+
last_status: status,
|
|
72
|
+
order_status: order?.status,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
sessionsUpdated += 1;
|
|
78
|
+
try {
|
|
79
|
+
await paypal.recordMetric("reconcile_success");
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// ignore metrics failures
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
hadFailure = true;
|
|
87
|
+
lastErrorMessage = error instanceof Error ? error.message : String(error);
|
|
88
|
+
try {
|
|
89
|
+
await paypal.recordMetric("reconcile_failed");
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// ignore metrics failures
|
|
93
|
+
}
|
|
94
|
+
await paypal.sendAlert({
|
|
95
|
+
type: "reconcile_failed",
|
|
96
|
+
message: `PayPal reconciliation failed for order ${orderId}.`,
|
|
97
|
+
metadata: {
|
|
98
|
+
session_id: session.id,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
console.error("[PayPal] reconcile error", error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
await paypal.updateReconciliationStatus({
|
|
106
|
+
status: hadFailure ? "failed" : "success",
|
|
107
|
+
sessions_checked: sessionsChecked,
|
|
108
|
+
sessions_updated: sessionsUpdated,
|
|
109
|
+
drift_count: driftCount,
|
|
110
|
+
last_drift_at: lastDriftAt,
|
|
111
|
+
last_drift_order_id: lastDriftOrderId,
|
|
112
|
+
error_message: hadFailure ? lastErrorMessage : null,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
await paypal.updateReconciliationStatus({
|
|
117
|
+
status: "failed",
|
|
118
|
+
sessions_checked: sessionsChecked,
|
|
119
|
+
sessions_updated: sessionsUpdated,
|
|
120
|
+
drift_count: driftCount,
|
|
121
|
+
last_drift_at: lastDriftAt,
|
|
122
|
+
last_drift_order_id: lastDriftOrderId,
|
|
123
|
+
error_message: error?.message,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.config = {
|
|
128
|
+
name: "paypal-reconcile",
|
|
129
|
+
schedule: "*/15 * * * *",
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=paypal-reconcile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-reconcile.js","sourceRoot":"","sources":["../../../../src/jobs/paypal-reconcile.ts"],"names":[],"mappings":";;;AAWA,kCAsHC;AA9HD,MAAM,UAAU,GAAuE;IACrF,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,UAAU;CACtB,CAAA;AAEc,KAAK,UAAU,eAAe,CAAC,SAA0B;IACtE,MAAM,qBAAqB,GAAG,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAQ,CAAA;IACzE,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAE1E,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,IAAI,CAAC;QAChD,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;QACtC,MAAM,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC;KAClC,CAAC,CAAA;IAEF,IAAI,eAAe,GAAG,CAAC,CAAA;IACvB,IAAI,eAAe,GAAG,CAAC,CAAA;IACvB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,IAAI,WAAW,GAAkB,IAAI,CAAA;IACrC,IAAI,gBAAgB,GAAkB,IA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EAAE,kBAAkB;gBACxB,OAAO,EAAE,0CAA0C,OAAO,GAAG;gBAC7D,QAAQ,EAAE;oBACR,UAAU,EAAE,OAAO,CAAC,EAAE;iBACvB;aACF,CAAC,CAAA;YACF,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,0BAA0B,CAAC;YACtC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzC,gBAAgB,EAAE,eAAe;YACjC,gBAAgB,EAAE,eAAe;YACjC,WAAW,EAAE,UAAU;YACvB,aAAa,EAAE,WAAW;YAC1B,mBAAmB,EAAE,gBAAgB;YACrC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI;SACpD,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,0BAA0B,CAAC;YACtC,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,eAAe;YACjC,gBAAgB,EAAE,eAAe;YACjC,WAAW,EAAE,UAAU;YACvB,aAAa,EAAE,WAAW;YAC1B,mBAAmB,EAAE,gBAAgB;YACrC,aAAa,EAAE,KAAK,EAAE,OAAO;SAC9B,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,cAAc;CACzB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MedusaContainer } from "@medusajs/framework/types";
|
|
2
|
+
export default function paypalWebhookRetry(container: MedusaContainer): Promise<void>;
|
|
3
|
+
export declare const config: {
|
|
4
|
+
name: string;
|
|
5
|
+
schedule: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=paypal-webhook-retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-webhook-retry.d.ts","sourceRoot":"","sources":["../../../../src/jobs/paypal-webhook-retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAUhE,wBAA8B,kBAAkB,CAAC,SAAS,EAAE,eAAe,iBAsE1E;AAED,eAAO,MAAM,MAAM;;;CAGlB,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
exports.default = paypalWebhookRetry;
|
|
5
|
+
const webhook_processor_1 = require("../modules/paypal/webhook-processor");
|
|
6
|
+
const MAX_WEBHOOK_ATTEMPTS = 5;
|
|
7
|
+
async function paypalWebhookRetry(container) {
|
|
8
|
+
const paypal = container.resolve("paypal_onboarding");
|
|
9
|
+
const now = Date.now();
|
|
10
|
+
const candidates = await paypal.listPayPalWebhookEvents({ status: "failed" });
|
|
11
|
+
for (const event of candidates || []) {
|
|
12
|
+
const nextRetryAt = event?.next_retry_at ? new Date(event.next_retry_at).getTime() : null;
|
|
13
|
+
if (!nextRetryAt || nextRetryAt > now) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const attemptCount = Number(event.attempt_count || 0) + 1;
|
|
17
|
+
if (attemptCount > MAX_WEBHOOK_ATTEMPTS) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
await paypal.updateWebhookEventRecord({
|
|
21
|
+
id: event.id,
|
|
22
|
+
status: "processing",
|
|
23
|
+
attempt_count: attemptCount,
|
|
24
|
+
next_retry_at: null,
|
|
25
|
+
last_error: null,
|
|
26
|
+
});
|
|
27
|
+
try {
|
|
28
|
+
const eventType = String(event.event_type || "");
|
|
29
|
+
if (!(0, webhook_processor_1.isAllowedEventType)(eventType)) {
|
|
30
|
+
await paypal.updateWebhookEventRecord({
|
|
31
|
+
id: event.id,
|
|
32
|
+
status: "ignored",
|
|
33
|
+
processed_at: new Date(),
|
|
34
|
+
});
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const payload = (event.payload || {});
|
|
38
|
+
const processed = await (0, webhook_processor_1.processPayPalWebhookEvent)(container, {
|
|
39
|
+
eventType,
|
|
40
|
+
payload,
|
|
41
|
+
});
|
|
42
|
+
await paypal.updateWebhookEventRecord({
|
|
43
|
+
id: event.id,
|
|
44
|
+
status: "processed",
|
|
45
|
+
processed_at: new Date(),
|
|
46
|
+
resource_id: processed.disputeId || processed.refundId || processed.captureId || processed.orderId || null,
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
await paypal.recordMetric("webhook_retry_success");
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// ignore metrics failures
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const nextRetry = attemptCount >= MAX_WEBHOOK_ATTEMPTS ? null : (0, webhook_processor_1.computeNextRetryAt)(attemptCount);
|
|
57
|
+
await paypal.updateWebhookEventRecord({
|
|
58
|
+
id: event.id,
|
|
59
|
+
status: "failed",
|
|
60
|
+
attempt_count: attemptCount,
|
|
61
|
+
next_retry_at: nextRetry,
|
|
62
|
+
last_error: error?.message || String(error),
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
await paypal.recordMetric("webhook_retry_failed");
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// ignore metrics failures
|
|
69
|
+
}
|
|
70
|
+
console.error("[PayPal] webhook retry error", error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.config = {
|
|
75
|
+
name: "paypal-webhook-retry",
|
|
76
|
+
schedule: "*/10 * * * *",
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=paypal-webhook-retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-webhook-retry.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AC,MAAM,CAAC;gBACP,0BAA0B;YAC5B,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAA;QACtD,CAAC;IACH,CAAC;AACH,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,sBAAsB;IAC5B,QAAQ,EAAE,cAAc;CACzB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class PayPalSellerClient {
|
|
2
|
+
private opts;
|
|
3
|
+
constructor(opts: {
|
|
4
|
+
environment: "sandbox" | "live";
|
|
5
|
+
accessToken: string;
|
|
6
|
+
});
|
|
7
|
+
private baseUrl;
|
|
8
|
+
private headers;
|
|
9
|
+
createOrder(body: any): Promise<any>;
|
|
10
|
+
getOrder(orderId: string): Promise<any>;
|
|
11
|
+
captureOrder(orderId: string): Promise<any>;
|
|
12
|
+
refundCapture(captureId: string, body?: any): Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=paypal-seller.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-seller.client.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/clients/paypal-seller.client.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IACjB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE;QAAE,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE;IAElF,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,OAAO;IAQT,WAAW,CAAC,IAAI,EAAE,GAAG;IAWrB,QAAQ,CAAC,OAAO,EAAE,MAAM;IAUxB,YAAY,CAAC,OAAO,EAAE,MAAM;IAU5B,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;CAUlD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayPalSellerClient = void 0;
|
|
4
|
+
class PayPalSellerClient {
|
|
5
|
+
opts;
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
this.opts = opts;
|
|
8
|
+
}
|
|
9
|
+
baseUrl() {
|
|
10
|
+
return this.opts.environment === "live"
|
|
11
|
+
? "https://api-m.paypal.com"
|
|
12
|
+
: "https://api-m.sandbox.paypal.com";
|
|
13
|
+
}
|
|
14
|
+
headers(extra) {
|
|
15
|
+
return {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
Authorization: `Bearer ${this.opts.accessToken}`,
|
|
18
|
+
...(extra ?? {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async createOrder(body) {
|
|
22
|
+
const res = await fetch(`${this.baseUrl()}/v2/checkout/orders`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: this.headers(),
|
|
25
|
+
body: JSON.stringify(body),
|
|
26
|
+
});
|
|
27
|
+
const json = await res.json().catch(() => ({}));
|
|
28
|
+
if (!res.ok)
|
|
29
|
+
throw new Error(`PayPal createOrder failed (${res.status}): ${JSON.stringify(json)}`);
|
|
30
|
+
return json;
|
|
31
|
+
}
|
|
32
|
+
async getOrder(orderId) {
|
|
33
|
+
const res = await fetch(`${this.baseUrl()}/v2/checkout/orders/${orderId}`, {
|
|
34
|
+
method: "GET",
|
|
35
|
+
headers: this.headers(),
|
|
36
|
+
});
|
|
37
|
+
const json = await res.json().catch(() => ({}));
|
|
38
|
+
if (!res.ok)
|
|
39
|
+
throw new Error(`PayPal getOrder failed (${res.status}): ${JSON.stringify(json)}`);
|
|
40
|
+
return json;
|
|
41
|
+
}
|
|
42
|
+
async captureOrder(orderId) {
|
|
43
|
+
const res = await fetch(`${this.baseUrl()}/v2/checkout/orders/${orderId}/capture`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: this.headers(),
|
|
46
|
+
});
|
|
47
|
+
const json = await res.json().catch(() => ({}));
|
|
48
|
+
if (!res.ok)
|
|
49
|
+
throw new Error(`PayPal captureOrder failed (${res.status}): ${JSON.stringify(json)}`);
|
|
50
|
+
return json;
|
|
51
|
+
}
|
|
52
|
+
async refundCapture(captureId, body) {
|
|
53
|
+
const res = await fetch(`${this.baseUrl()}/v2/payments/captures/${captureId}/refund`, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: this.headers(),
|
|
56
|
+
body: body ? JSON.stringify(body) : "{}",
|
|
57
|
+
});
|
|
58
|
+
const json = await res.json().catch(() => ({}));
|
|
59
|
+
if (!res.ok)
|
|
60
|
+
throw new Error(`PayPal refund failed (${res.status}): ${JSON.stringify(json)}`);
|
|
61
|
+
return json;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.PayPalSellerClient = PayPalSellerClient;
|
|
65
|
+
//# sourceMappingURL=paypal-seller.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-seller.client.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/clients/paypal-seller.client.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IACT;IAApB,YAAoB,IAA8D;QAA9D,SAAI,GAAJ,IAAI,CAA0D;IAAG,CAAC;IAE9E,OAAO;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,MAAM;YACrC,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,kCAAkC,CAAA;IACxC,CAAC;IAEO,OAAO,CAAC,KAA8B;QAC5C,OAAO;YACL,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YAChD,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAS;QACzB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,qBAAqB,EAAE;YAC9D,MAAM,EAAE,MAAM;YACd,O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