@easypayment/medusa-payment-paypal 0.7.4
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 +1267 -0
- package/.medusa/server/src/admin/index.mjs +1268 -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 +18 -0
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/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/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 +4 -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 +31 -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 +19 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/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 +17 -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/middlewares.d.ts +3 -0
- package/.medusa/server/src/api/middlewares.d.ts.map +1 -0
- package/.medusa/server/src/api/middlewares.js +16 -0
- package/.medusa/server/src/api/middlewares.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 +204 -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 +77 -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 +361 -0
- package/.medusa/server/src/api/store/paypal/create-order/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 +20 -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 +250 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts +3 -0
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts.map +1 -0
- package/.medusa/server/src/api/store/paypal-complete/route.js +76 -0
- package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -0
- package/.medusa/server/src/index.d.ts +2 -0
- package/.medusa/server/src/index.d.ts.map +1 -0
- package/.medusa/server/src/index.js +9 -0
- package/.medusa/server/src/index.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 +132 -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 +15 -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 +67 -0
- package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.js.map +1 -0
- package/.medusa/server/src/modules/paypal/index.d.ts +64 -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/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/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/migrations/20261101090000_remove_paypal_reconciliation_status.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.js +28 -0
- package/.medusa/server/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.js +29 -0
- package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js +14 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js +14 -0
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js +14 -0
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.js +20 -0
- package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.js.map +1 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts +16 -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 +19 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.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 +32 -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 +625 -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 +6 -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 +18 -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 +39 -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 +869 -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 +266 -0
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/service.js +1149 -0
- package/.medusa/server/src/modules/paypal/service.js.map +1 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts +12 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/types/config.js +24 -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/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/paypal-auth.d.ts +10 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.js +30 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +5 -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 +16 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +29 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.js +267 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -0
- package/.medusa/server/src/providers/paypal/index.d.ts +5 -0
- package/.medusa/server/src/providers/paypal/index.d.ts.map +1 -0
- package/.medusa/server/src/providers/paypal/index.js +10 -0
- package/.medusa/server/src/providers/paypal/index.js.map +1 -0
- package/.medusa/server/src/providers/paypal_card/index.d.ts +5 -0
- package/.medusa/server/src/providers/paypal_card/index.d.ts.map +1 -0
- package/.medusa/server/src/providers/paypal_card/index.js +10 -0
- package/.medusa/server/src/providers/paypal_card/index.js.map +1 -0
- package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts +6 -0
- package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts.map +1 -0
- package/.medusa/server/src/subscribers/paypal-order-invoice.js +124 -0
- package/.medusa/server/src/subscribers/paypal-order-invoice.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/package.json +80 -0
- package/src/admin/index.ts +7 -0
- package/src/admin/routes/settings/paypal/_components/Tabs.tsx +48 -0
- package/src/admin/routes/settings/paypal/_components/Toast.tsx +51 -0
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +199 -0
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +183 -0
- package/src/admin/routes/settings/paypal/apple-pay/page.tsx +5 -0
- package/src/admin/routes/settings/paypal/connection/page.tsx +699 -0
- package/src/admin/routes/settings/paypal/google-pay/page.tsx +5 -0
- package/src/admin/routes/settings/paypal/page.tsx +13 -0
- package/src/admin/routes/settings/paypal/pay-later-messaging/page.tsx +5 -0
- package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +351 -0
- package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +24 -0
- package/src/api/admin/paypal/disconnect/route.ts +8 -0
- package/src/api/admin/paypal/environment/route.ts +25 -0
- package/src/api/admin/paypal/onboard-complete/route.ts +34 -0
- package/src/api/admin/paypal/onboarding-link/route.ts +45 -0
- package/src/api/admin/paypal/onboarding-status/route.ts +17 -0
- package/src/api/admin/paypal/save-credentials/route.ts +22 -0
- package/src/api/admin/paypal/settings/route.ts +14 -0
- package/src/api/admin/paypal/status/route.ts +12 -0
- package/src/api/middlewares.ts +14 -0
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +56 -0
- package/src/api/store/paypal/capture-order/route.ts +265 -0
- package/src/api/store/paypal/config/route.ts +100 -0
- package/src/api/store/paypal/create-order/route.ts +449 -0
- package/src/api/store/paypal/settings/route.ts +19 -0
- package/src/api/store/paypal/webhook/route.ts +325 -0
- package/src/api/store/paypal-complete/route.ts +95 -0
- package/src/index.ts +1 -0
- package/src/jobs/paypal-webhook-retry.ts +149 -0
- package/src/modules/paypal/clients/paypal-seller.client.ts +62 -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/20260401090000_create_paypal_metric.ts +27 -0
- package/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.ts +31 -0
- package/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.ts +25 -0
- package/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.ts +26 -0
- package/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.ts +11 -0
- package/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.ts +11 -0
- package/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.ts +11 -0
- package/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.ts +17 -0
- package/src/modules/paypal/models/paypal_connection.ts +23 -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 +767 -0
- package/src/modules/paypal/payment-provider/index.ts +15 -0
- package/src/modules/paypal/payment-provider/service.ts +1039 -0
- package/src/modules/paypal/payment-provider/webhook-utils.ts +88 -0
- package/src/modules/paypal/service.ts +1416 -0
- package/src/modules/paypal/types/config.ts +33 -0
- package/src/modules/paypal/utils/amounts.ts +41 -0
- package/src/modules/paypal/utils/currencies.ts +84 -0
- package/src/modules/paypal/utils/paypal-auth.ts +31 -0
- package/src/modules/paypal/utils/provider-ids.ts +15 -0
- package/src/modules/paypal/webhook-processor.ts +363 -0
- package/src/providers/paypal/index.ts +8 -0
- package/src/providers/paypal_card/index.ts +8 -0
- package/src/subscribers/paypal-order-invoice.ts +171 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,250 @@
|
|
|
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 v = Number(process.env.PAYPAL_WEBHOOK_REPLAY_WINDOW_MINUTES);
|
|
7
|
+
return Number.isFinite(v) && v > 0 ? v : 60;
|
|
8
|
+
})();
|
|
9
|
+
function getHeader(headers, name) {
|
|
10
|
+
const direct = headers[name];
|
|
11
|
+
if (Array.isArray(direct))
|
|
12
|
+
return direct[0];
|
|
13
|
+
if (typeof direct === "string")
|
|
14
|
+
return direct;
|
|
15
|
+
const lower = name.toLowerCase();
|
|
16
|
+
const key = Object.keys(headers).find((h) => h.toLowerCase() === lower);
|
|
17
|
+
if (!key)
|
|
18
|
+
return undefined;
|
|
19
|
+
const val = headers[key];
|
|
20
|
+
return Array.isArray(val) ? val[0] : val;
|
|
21
|
+
}
|
|
22
|
+
function validateRequest(req) {
|
|
23
|
+
const payload = (req.body || {});
|
|
24
|
+
const eventId = String(payload?.id || payload?.event_id || "").trim();
|
|
25
|
+
const eventType = String(payload?.event_type || payload?.eventType || "").trim();
|
|
26
|
+
if (!eventId || !eventType) {
|
|
27
|
+
return { ok: false, status: 400, message: "Missing required fields: id and event_type" };
|
|
28
|
+
}
|
|
29
|
+
const transmissionTimeHeader = getHeader(req.headers, "paypal-transmission-time");
|
|
30
|
+
if (!transmissionTimeHeader) {
|
|
31
|
+
return {
|
|
32
|
+
ok: false,
|
|
33
|
+
status: 400,
|
|
34
|
+
message: "Missing required header: paypal-transmission-time",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const transmissionMs = Date.parse(transmissionTimeHeader);
|
|
38
|
+
if (!Number.isFinite(transmissionMs)) {
|
|
39
|
+
return {
|
|
40
|
+
ok: false,
|
|
41
|
+
status: 400,
|
|
42
|
+
message: "Invalid paypal-transmission-time header value",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const ageMs = Math.abs(Date.now() - transmissionMs);
|
|
46
|
+
if (ageMs > REPLAY_WINDOW_MINUTES * 60 * 1000) {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
status: 400,
|
|
50
|
+
message: `Webhook rejected: outside ${REPLAY_WINDOW_MINUTES}-minute replay window`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
ok: true,
|
|
55
|
+
eventId,
|
|
56
|
+
eventType,
|
|
57
|
+
transmissionId: getHeader(req.headers, "paypal-transmission-id") || null,
|
|
58
|
+
transmissionTime: new Date(transmissionMs),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function resolveWebhookId(environment, settings) {
|
|
62
|
+
const ids = (settings?.webhook_ids || {});
|
|
63
|
+
if (environment === "live") {
|
|
64
|
+
return (ids.live ||
|
|
65
|
+
settings?.webhook_id_live ||
|
|
66
|
+
process.env.PAYPAL_WEBHOOK_ID_LIVE);
|
|
67
|
+
}
|
|
68
|
+
return (ids.sandbox ||
|
|
69
|
+
settings?.webhook_id_sandbox ||
|
|
70
|
+
process.env.PAYPAL_WEBHOOK_ID_SANDBOX);
|
|
71
|
+
}
|
|
72
|
+
async function verifyWebhookSignature(paypal, environment, body, headers) {
|
|
73
|
+
const settings = await paypal.getSettings().catch(() => ({ data: {} }));
|
|
74
|
+
const webhookId = resolveWebhookId(environment, settings?.data || {});
|
|
75
|
+
if (!webhookId) {
|
|
76
|
+
throw new Error(`PayPal webhook ID not configured for environment "${environment}". Set PAYPAL_WEBHOOK_ID_${environment.toUpperCase()} or configure it in admin settings.`);
|
|
77
|
+
}
|
|
78
|
+
const base = environment === "live"
|
|
79
|
+
? "https://api-m.paypal.com"
|
|
80
|
+
: "https://api-m.sandbox.paypal.com";
|
|
81
|
+
const accessToken = await paypal.getAppAccessToken();
|
|
82
|
+
const verifyPayload = {
|
|
83
|
+
auth_algo: getHeader(headers, "paypal-auth-algo"),
|
|
84
|
+
cert_url: getHeader(headers, "paypal-cert-url"),
|
|
85
|
+
transmission_id: getHeader(headers, "paypal-transmission-id"),
|
|
86
|
+
transmission_sig: getHeader(headers, "paypal-transmission-sig"),
|
|
87
|
+
transmission_time: getHeader(headers, "paypal-transmission-time"),
|
|
88
|
+
webhook_id: webhookId,
|
|
89
|
+
webhook_event: body,
|
|
90
|
+
};
|
|
91
|
+
const missing = Object.entries(verifyPayload)
|
|
92
|
+
.filter(([k, v]) => k !== "webhook_id" && k !== "webhook_event" && !v)
|
|
93
|
+
.map(([k]) => k);
|
|
94
|
+
if (missing.length > 0) {
|
|
95
|
+
throw new Error(`Missing required PayPal webhook headers: ${missing.join(", ")}`);
|
|
96
|
+
}
|
|
97
|
+
const resp = await fetch(`${base}/v1/notifications/verify-webhook-signature`, {
|
|
98
|
+
method: "POST",
|
|
99
|
+
headers: {
|
|
100
|
+
Authorization: `Bearer ${accessToken}`,
|
|
101
|
+
"Content-Type": "application/json",
|
|
102
|
+
},
|
|
103
|
+
body: JSON.stringify(verifyPayload),
|
|
104
|
+
});
|
|
105
|
+
const json = await resp.json().catch(() => ({}));
|
|
106
|
+
const debugId = resp.headers.get("paypal-debug-id") || json?.debug_id;
|
|
107
|
+
if (!resp.ok) {
|
|
108
|
+
throw new Error(`PayPal signature verification API error (${resp.status}): ${JSON.stringify(json)}` +
|
|
109
|
+
(debugId ? ` debug_id=${debugId}` : ""));
|
|
110
|
+
}
|
|
111
|
+
if (json?.verification_status !== "VERIFIED") {
|
|
112
|
+
throw new Error(`PayPal webhook signature not verified. Status: ${json?.verification_status}` +
|
|
113
|
+
(debugId ? ` debug_id=${debugId}` : ""));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function POST(req, res) {
|
|
117
|
+
const paypal = req.scope.resolve("paypal_onboarding");
|
|
118
|
+
const validation = validateRequest(req);
|
|
119
|
+
if (!validation.ok) {
|
|
120
|
+
console.warn("[PayPal] webhook: validation failed:", validation.message);
|
|
121
|
+
return res.status(validation.status).json({ message: validation.message });
|
|
122
|
+
}
|
|
123
|
+
const { eventId, eventType, transmissionId, transmissionTime } = validation;
|
|
124
|
+
const payload = (req.body || {});
|
|
125
|
+
if (transmissionId) {
|
|
126
|
+
try {
|
|
127
|
+
const existing = await paypal.listPayPalWebhookEvents({ transmission_id: transmissionId });
|
|
128
|
+
if ((existing || []).length > 0) {
|
|
129
|
+
console.info("[PayPal] webhook: duplicate transmission_id", {
|
|
130
|
+
transmissionId,
|
|
131
|
+
eventId,
|
|
132
|
+
});
|
|
133
|
+
return res.json({ ok: true, duplicate: true });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (e) {
|
|
137
|
+
console.warn("[PayPal] webhook: transmission_id dedup check failed:", e?.message);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const creds = await paypal.getActiveCredentials();
|
|
142
|
+
await verifyWebhookSignature(paypal, creds.environment, payload, req.headers);
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
console.error("[PayPal] webhook: signature verification failed:", e?.message);
|
|
146
|
+
return res
|
|
147
|
+
.status(401)
|
|
148
|
+
.json({ message: e?.message || "Webhook signature verification failed" });
|
|
149
|
+
}
|
|
150
|
+
const eventVersion = (0, webhook_processor_1.normalizeEventVersion)(payload);
|
|
151
|
+
let recordId = null;
|
|
152
|
+
try {
|
|
153
|
+
const recordResult = await paypal.createWebhookEventRecord({
|
|
154
|
+
event_id: eventId,
|
|
155
|
+
event_type: eventType,
|
|
156
|
+
payload,
|
|
157
|
+
event_version: eventVersion,
|
|
158
|
+
transmission_id: transmissionId,
|
|
159
|
+
transmission_time: transmissionTime,
|
|
160
|
+
status: "processing",
|
|
161
|
+
attempt_count: 1,
|
|
162
|
+
});
|
|
163
|
+
if (!recordResult.created) {
|
|
164
|
+
console.info("[PayPal] webhook: duplicate event_id", { eventId, eventType });
|
|
165
|
+
return res.json({ ok: true, duplicate: true });
|
|
166
|
+
}
|
|
167
|
+
recordId = recordResult.event?.id ?? null;
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
console.error("[PayPal] webhook: failed to create DB record:", e?.message);
|
|
171
|
+
return res.status(500).json({ message: "Failed to record webhook event" });
|
|
172
|
+
}
|
|
173
|
+
if (!(0, webhook_processor_1.isAllowedEventType)(eventType)) {
|
|
174
|
+
console.info("[PayPal] webhook: unsupported event type, ignoring", { eventType });
|
|
175
|
+
await paypal.recordAuditEvent("webhook_unsupported_event", {
|
|
176
|
+
event_id: eventId,
|
|
177
|
+
event_type: eventType,
|
|
178
|
+
});
|
|
179
|
+
if (recordId) {
|
|
180
|
+
await paypal
|
|
181
|
+
.updateWebhookEventRecord({
|
|
182
|
+
id: recordId,
|
|
183
|
+
status: "ignored",
|
|
184
|
+
processed_at: new Date(),
|
|
185
|
+
})
|
|
186
|
+
.catch(() => { });
|
|
187
|
+
}
|
|
188
|
+
return res.json({ ok: true, ignored: true });
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
const processed = await (0, webhook_processor_1.processPayPalWebhookEvent)(req.scope, { eventType, payload });
|
|
192
|
+
if (recordId) {
|
|
193
|
+
await paypal
|
|
194
|
+
.updateWebhookEventRecord({
|
|
195
|
+
id: recordId,
|
|
196
|
+
status: "processed",
|
|
197
|
+
processed_at: new Date(),
|
|
198
|
+
resource_id: processed.refundId || processed.captureId || processed.orderId || null,
|
|
199
|
+
})
|
|
200
|
+
.catch(() => { });
|
|
201
|
+
}
|
|
202
|
+
console.info("[PayPal] webhook: processed", {
|
|
203
|
+
event_id: eventId,
|
|
204
|
+
event_type: eventType,
|
|
205
|
+
order_id: processed.orderId,
|
|
206
|
+
capture_id: processed.captureId,
|
|
207
|
+
refund_id: processed.refundId,
|
|
208
|
+
cart_id: processed.cartId,
|
|
209
|
+
session_updated: processed.sessionUpdated,
|
|
210
|
+
});
|
|
211
|
+
await paypal.recordMetric("webhook_success").catch(() => { });
|
|
212
|
+
return res.json({ ok: true });
|
|
213
|
+
}
|
|
214
|
+
catch (e) {
|
|
215
|
+
console.error("[PayPal] webhook: processing failed", {
|
|
216
|
+
event_id: eventId,
|
|
217
|
+
event_type: eventType,
|
|
218
|
+
error: e?.message,
|
|
219
|
+
});
|
|
220
|
+
const retryable = (0, webhook_processor_1.isRetryableError)(e);
|
|
221
|
+
const nextStatus = retryable ? "failed" : "dead_letter";
|
|
222
|
+
if (recordId) {
|
|
223
|
+
await paypal
|
|
224
|
+
.updateWebhookEventRecord({
|
|
225
|
+
id: recordId,
|
|
226
|
+
status: nextStatus,
|
|
227
|
+
attempt_count: 1,
|
|
228
|
+
next_retry_at: retryable ? (0, webhook_processor_1.computeNextRetryAt)(1) : null,
|
|
229
|
+
last_error: e?.message || String(e),
|
|
230
|
+
})
|
|
231
|
+
.catch(() => { });
|
|
232
|
+
}
|
|
233
|
+
await paypal
|
|
234
|
+
.recordAuditEvent("webhook_processing_failed", {
|
|
235
|
+
event_id: eventId,
|
|
236
|
+
event_type: eventType,
|
|
237
|
+
retryable,
|
|
238
|
+
message: e?.message || String(e),
|
|
239
|
+
})
|
|
240
|
+
.catch(() => { });
|
|
241
|
+
await paypal.recordMetric("webhook_failed").catch(() => { });
|
|
242
|
+
if (!retryable) {
|
|
243
|
+
return res.status(200).json({ ok: false, message: e?.message });
|
|
244
|
+
}
|
|
245
|
+
return res
|
|
246
|
+
.status(500)
|
|
247
|
+
.json({ message: e?.message || "PayPal webhook processing error" });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/webhook/route.ts"],"names":[],"mappings":";;AAgLA,oBAoJC;AAlUD,oFAMqD;AAErD,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE;IAClC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;IAClE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC7C,CAAC,CAAC,EAAE,CAAA;AAEJ,SAAS,SAAS,CAChB,OAAsD,EACtD,IAAY;IAEZ,MAAM,MAAM,GAAG,O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AAQ,EAAE,OAAO;YACjB,UAAU,EAAE,SAAS;YACrB,SAAS;YACT,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;SACjC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAElB,MAAM,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAE3D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QACjE,CAAC;QACD,OAAO,GAAG;aACP,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,iCAAiC,EAAE,CAAC,CAAA;IACvE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/store/paypal-complete/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAK7E,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BAyFjE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = POST;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
async function POST(req, res) {
|
|
6
|
+
const { cart_id } = req.body;
|
|
7
|
+
if (!cart_id) {
|
|
8
|
+
return res.status(400).json({ error: "cart_id is required" });
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const query = req.scope.resolve("query");
|
|
12
|
+
const { data: carts } = await query.graph({
|
|
13
|
+
entity: "cart",
|
|
14
|
+
fields: [
|
|
15
|
+
"id",
|
|
16
|
+
"payment_collection.payment_sessions.id",
|
|
17
|
+
"payment_collection.payment_sessions.data",
|
|
18
|
+
"payment_collection.payment_sessions.status",
|
|
19
|
+
"payment_collection.payment_sessions.provider_id",
|
|
20
|
+
"payment_collection.payment_sessions.created_at",
|
|
21
|
+
"payment_collection.payment_sessions.amount",
|
|
22
|
+
"payment_collection.payment_sessions.currency_code",
|
|
23
|
+
],
|
|
24
|
+
filters: { id: cart_id },
|
|
25
|
+
});
|
|
26
|
+
const sessions = carts?.[0]?.payment_collection?.payment_sessions || [];
|
|
27
|
+
const session = sessions
|
|
28
|
+
.filter((s) => String(s.provider_id || "").includes("paypal"))
|
|
29
|
+
.sort((a, b) => new Date(b.created_at || 0).getTime() - new Date(a.created_at || 0).getTime())[0];
|
|
30
|
+
if (!session) {
|
|
31
|
+
return res.status(400).json({ error: "No PayPal payment session found for cart" });
|
|
32
|
+
}
|
|
33
|
+
const currentStatus = String(session.status || "");
|
|
34
|
+
if (currentStatus === "authorized" || currentStatus === "captured") {
|
|
35
|
+
console.info("[paypal-complete] session already in terminal status:", currentStatus);
|
|
36
|
+
return res.json({ success: true, session_id: session.id, status: currentStatus });
|
|
37
|
+
}
|
|
38
|
+
const paymentModule = req.scope.resolve(utils_1.Modules.PAYMENT);
|
|
39
|
+
const [liveSession] = await paymentModule.listPaymentSessions({ id: [session.id] }, { take: 1 });
|
|
40
|
+
const liveData = (liveSession?.data || {});
|
|
41
|
+
const paypal = req.scope.resolve("paypal_onboarding");
|
|
42
|
+
const settings = await paypal.getSettings().catch(() => ({}));
|
|
43
|
+
const settingsData = settings && typeof settings === "object" && "data" in settings
|
|
44
|
+
? (settings.data ?? {})
|
|
45
|
+
: {};
|
|
46
|
+
const additionalSettings = (settingsData.additional_settings || {});
|
|
47
|
+
const paymentAction = typeof additionalSettings.paymentAction === "string"
|
|
48
|
+
? additionalSettings.paymentAction
|
|
49
|
+
: "capture";
|
|
50
|
+
const timestampKey = paymentAction === "authorize" ? "authorized_at" : "captured_at";
|
|
51
|
+
if (!liveData[timestampKey]) {
|
|
52
|
+
await paymentModule.updatePaymentSession({
|
|
53
|
+
id: session.id,
|
|
54
|
+
data: {
|
|
55
|
+
...liveData,
|
|
56
|
+
[timestampKey]: new Date().toISOString(),
|
|
57
|
+
},
|
|
58
|
+
amount: liveSession?.amount ?? session.amount,
|
|
59
|
+
currency_code: liveSession?.currency_code ?? session.currency_code,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
await paymentModule.authorizePaymentSession(session.id, {});
|
|
64
|
+
console.info("[paypal-complete] authorizePaymentSession succeeded for session", session.id);
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
console.warn("[paypal-complete] authorizePaymentSession non-fatal:", e?.message);
|
|
68
|
+
}
|
|
69
|
+
return res.json({ success: true, session_id: session.id });
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
console.error("[paypal-complete] error:", e?.message || e);
|
|
73
|
+
return res.status(500).json({ error: e?.message || "Internal error" });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../src/api/store/paypal-complete/route.ts"],"names":[],"mappings":";;AAKA,oBAyFC;AA5FD,qDAAmD;AAG5C,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,IAA2B,CAAA;IAEnD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,IAAI,CAAC;QACH,M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}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var paypal_1 = require("./modules/paypal");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(paypal_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA0C;AAAjC,kHAAA,OAAO,OAAA"}
|
|
@@ -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,iBAqI1E;AAED,eAAO,MAAM,MAAM;;;CAGlB,CAAA"}
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
async function paypalWebhookRetry(container) {
|
|
7
|
+
const paypal = container.resolve("paypal_onboarding");
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
const candidates = await paypal.listPayPalWebhookEvents({ status: "failed" });
|
|
10
|
+
if (!candidates?.length)
|
|
11
|
+
return;
|
|
12
|
+
console.info(`[PayPal] webhook-retry: evaluating ${candidates.length} failed event(s)`);
|
|
13
|
+
for (const event of candidates) {
|
|
14
|
+
const nextRetryAt = event?.next_retry_at
|
|
15
|
+
? new Date(event.next_retry_at).getTime()
|
|
16
|
+
: null;
|
|
17
|
+
if (!nextRetryAt || nextRetryAt > now)
|
|
18
|
+
continue;
|
|
19
|
+
const attemptCount = Number(event.attempt_count || 0);
|
|
20
|
+
if (attemptCount >= webhook_processor_1.MAX_WEBHOOK_ATTEMPTS) {
|
|
21
|
+
await paypal
|
|
22
|
+
.updateWebhookEventRecord({
|
|
23
|
+
id: event.id,
|
|
24
|
+
status: "dead_letter",
|
|
25
|
+
next_retry_at: null,
|
|
26
|
+
last_error: `Exceeded max attempts (${webhook_processor_1.MAX_WEBHOOK_ATTEMPTS})`,
|
|
27
|
+
})
|
|
28
|
+
.catch(() => { });
|
|
29
|
+
console.warn("[PayPal] webhook-retry: dead-lettered (max attempts)", {
|
|
30
|
+
id: event.id,
|
|
31
|
+
event_type: event.event_type,
|
|
32
|
+
attempts: attemptCount,
|
|
33
|
+
});
|
|
34
|
+
await paypal.recordMetric("webhook_dead_letter").catch(() => { });
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
await paypal
|
|
38
|
+
.updateWebhookEventRecord({
|
|
39
|
+
id: event.id,
|
|
40
|
+
status: "processing",
|
|
41
|
+
attempt_count: attemptCount + 1,
|
|
42
|
+
next_retry_at: null,
|
|
43
|
+
last_error: null,
|
|
44
|
+
})
|
|
45
|
+
.catch(() => { });
|
|
46
|
+
const eventType = String(event.event_type || "");
|
|
47
|
+
if (!(0, webhook_processor_1.isAllowedEventType)(eventType)) {
|
|
48
|
+
await paypal
|
|
49
|
+
.updateWebhookEventRecord({
|
|
50
|
+
id: event.id,
|
|
51
|
+
status: "ignored",
|
|
52
|
+
processed_at: new Date(),
|
|
53
|
+
})
|
|
54
|
+
.catch(() => { });
|
|
55
|
+
console.info("[PayPal] webhook-retry: ignored unsupported event type", {
|
|
56
|
+
id: event.id,
|
|
57
|
+
event_type: eventType,
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const payload = (event.payload || {});
|
|
63
|
+
const processed = await (0, webhook_processor_1.processPayPalWebhookEvent)(container, { eventType, payload });
|
|
64
|
+
await paypal
|
|
65
|
+
.updateWebhookEventRecord({
|
|
66
|
+
id: event.id,
|
|
67
|
+
status: "processed",
|
|
68
|
+
processed_at: new Date(),
|
|
69
|
+
resource_id: processed.refundId || processed.captureId || processed.orderId || null,
|
|
70
|
+
})
|
|
71
|
+
.catch(() => { });
|
|
72
|
+
console.info("[PayPal] webhook-retry: processed successfully", {
|
|
73
|
+
id: event.id,
|
|
74
|
+
event_type: eventType,
|
|
75
|
+
attempt: attemptCount + 1,
|
|
76
|
+
order_id: processed.orderId,
|
|
77
|
+
capture_id: processed.captureId,
|
|
78
|
+
cart_id: processed.cartId,
|
|
79
|
+
session_updated: processed.sessionUpdated,
|
|
80
|
+
});
|
|
81
|
+
await paypal.recordMetric("webhook_retry_success").catch(() => { });
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const retryable = (0, webhook_processor_1.isRetryableError)(error);
|
|
85
|
+
const nextAttempt = attemptCount + 1;
|
|
86
|
+
if (!retryable || nextAttempt >= webhook_processor_1.MAX_WEBHOOK_ATTEMPTS) {
|
|
87
|
+
await paypal
|
|
88
|
+
.updateWebhookEventRecord({
|
|
89
|
+
id: event.id,
|
|
90
|
+
status: "dead_letter",
|
|
91
|
+
attempt_count: nextAttempt,
|
|
92
|
+
next_retry_at: null,
|
|
93
|
+
last_error: error?.message || String(error),
|
|
94
|
+
})
|
|
95
|
+
.catch(() => { });
|
|
96
|
+
console.error("[PayPal] webhook-retry: dead-lettered after error", {
|
|
97
|
+
id: event.id,
|
|
98
|
+
event_type: eventType,
|
|
99
|
+
attempt: nextAttempt,
|
|
100
|
+
retryable,
|
|
101
|
+
error: error?.message,
|
|
102
|
+
});
|
|
103
|
+
await paypal.recordMetric("webhook_dead_letter").catch(() => { });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const nextRetry = (0, webhook_processor_1.computeNextRetryAt)(nextAttempt);
|
|
107
|
+
await paypal
|
|
108
|
+
.updateWebhookEventRecord({
|
|
109
|
+
id: event.id,
|
|
110
|
+
status: "failed",
|
|
111
|
+
attempt_count: nextAttempt,
|
|
112
|
+
next_retry_at: nextRetry,
|
|
113
|
+
last_error: error?.message || String(error),
|
|
114
|
+
})
|
|
115
|
+
.catch(() => { });
|
|
116
|
+
console.warn("[PayPal] webhook-retry: scheduled retry", {
|
|
117
|
+
id: event.id,
|
|
118
|
+
event_type: eventType,
|
|
119
|
+
attempt: nextAttempt,
|
|
120
|
+
next_retry_at: nextRetry?.toISOString(),
|
|
121
|
+
error: error?.message,
|
|
122
|
+
});
|
|
123
|
+
await paypal.recordMetric("webhook_retry_failed").catch(() => { });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.config = {
|
|
129
|
+
name: "paypal-webhook-retry",
|
|
130
|
+
schedule: "*/10 * * * *",
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=paypal-webhook-retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal-webhook-retry.js","sourceRoot":"","sources":["../../../../src/jobs/paypal-webhook-retry.ts"],"names":[],"mappings":";;;AAUA,qCAqIC;AA7ID,2EAM4C;AAE7B,KAAK,UAAU,kBAAkB,CAAC,SAA0B;IACzE,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAC1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MAAM,SAAS,GAAG,IAAA,sCAAkB,EAAC,WAAW,CAAC,CAAA;gBACjD,MAAM,MAAM;qBACT,wBAAwB,CAAC;oBACxB,EAAE,EAAE,KAAK,CAAC,EAAE;oBACZ,MAAM,EAAE,QAAQ;oBAChB,aAAa,EAAE,WAAW;oBAC1B,aAAa,EAAE,SAAS;oBACxB,UAAU,EAAE,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC;iBAC5C,CAAC;qBACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;gBAClB,OAAO,CAAC,IAAI,CAAC,yCAAyC,EAAE;oBACtD,EAAE,EAAE,KAAK,CAAC,EAAE;oBACZ,UAAU,EAAE,SAAS;oBACrB,OAAO,EAAE,WAAW;oBACpB,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE;oBACvC,KAAK,EAAE,KAAK,EAAE,OAAO;iBACtB,CAAC,CAAA;gBACF,MAAM,MAAM,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YACnE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,sBAAsB;IAC5B,QAAQ,EAAE,cAAc;CACzB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class PayPalSellerClient {
|
|
2
|
+
private opts;
|
|
3
|
+
private static readonly BN_CODE;
|
|
4
|
+
constructor(opts: {
|
|
5
|
+
environment: "sandbox" | "live";
|
|
6
|
+
accessToken: string;
|
|
7
|
+
});
|
|
8
|
+
private baseUrl;
|
|
9
|
+
private headers;
|
|
10
|
+
createOrder(body: any): Promise<any>;
|
|
11
|
+
getOrder(orderId: string): Promise<any>;
|
|
12
|
+
captureOrder(orderId: string): Promise<any>;
|
|
13
|
+
refundCapture(captureId: string, body?: any): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
//# 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;IAGjB,OAAO,CAAC,IAAI;IAFxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAEpC,IAAI,EAAE;QAAE,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE;IAElF,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,OAAO;IAST,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,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayPalSellerClient = void 0;
|
|
4
|
+
class PayPalSellerClient {
|
|
5
|
+
opts;
|
|
6
|
+
static BN_CODE = "MBJTechnolabs_SI_SPB";
|
|
7
|
+
constructor(opts) {
|
|
8
|
+
this.opts = opts;
|
|
9
|
+
}
|
|
10
|
+
baseUrl() {
|
|
11
|
+
return this.opts.environment === "live"
|
|
12
|
+
? "https://api-m.paypal.com"
|
|
13
|
+
: "https://api-m.sandbox.paypal.com";
|
|
14
|
+
}
|
|
15
|
+
headers(extra) {
|
|
16
|
+
return {
|
|
17
|
+
"Content-Type": "application/json",
|
|
18
|
+
Authorization: `Bearer ${this.opts.accessToken}`,
|
|
19
|
+
"PayPal-Partner-Attribution-Id": PayPalSellerClient.BN_CODE,
|
|
20
|
+
...(extra ?? {}),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async createOrder(body) {
|
|
24
|
+
const res = await fetch(`${this.baseUrl()}/v2/checkout/orders`, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: this.headers(),
|
|
27
|
+
body: JSON.stringify(body),
|
|
28
|
+
});
|
|
29
|
+
const json = await res.json().catch(() => ({}));
|
|
30
|
+
if (!res.ok)
|
|
31
|
+
throw new Error(`PayPal createOrder failed (${res.status}): ${JSON.stringify(json)}`);
|
|
32
|
+
return json;
|
|
33
|
+
}
|
|
34
|
+
async getOrder(orderId) {
|
|
35
|
+
const res = await fetch(`${this.baseUrl()}/v2/checkout/orders/${orderId}`, {
|
|
36
|
+
method: "GET",
|
|
37
|
+
headers: this.headers(),
|
|
38
|
+
});
|
|
39
|
+
const json = await res.json().catch(() => ({}));
|
|
40
|
+
if (!res.ok)
|
|
41
|
+
throw new Error(`PayPal getOrder failed (${res.status}): ${JSON.stringify(json)}`);
|
|
42
|
+
return json;
|
|
43
|
+
}
|
|
44
|
+
async captureOrder(orderId) {
|
|
45
|
+
const res = await fetch(`${this.baseUrl()}/v2/checkout/orders/${orderId}/capture`, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: this.headers(),
|
|
48
|
+
});
|
|
49
|
+
const json = await res.json().catch(() => ({}));
|
|
50
|
+
if (!res.ok)
|
|
51
|
+
throw new Error(`PayPal captureOrder failed (${res.status}): ${JSON.stringify(json)}`);
|
|
52
|
+
return json;
|
|
53
|
+
}
|
|
54
|
+
async refundCapture(captureId, body) {
|
|
55
|
+
const res = await fetch(`${this.baseUrl()}/v2/payments/captures/${captureId}/refund`, {
|
|
56
|
+
method: "POST",
|
|
57
|
+
headers: this.headers(),
|
|
58
|
+
body: body ? JSON.stringify(body) : "{}",
|
|
59
|
+
});
|
|
60
|
+
const json = await res.json().catch(() => ({}));
|
|
61
|
+
if (!res.ok)
|
|
62
|
+
throw new Error(`PayPal refund failed (${res.status}): ${JSON.stringify(json)}`);
|
|
63
|
+
return json;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.PayPalSellerClient = PayPalSellerClient;
|
|
67
|
+
//# 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;IAGT;IAFZ,MAAM,CAAU,OAAO,GAAG,sBAAsB,CAAA;IAExD,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,+BAA+B,EAAE,kBAAkB,CAAC,OAAO;YAC3D,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,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAA;QACF,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC/C,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,MAAM,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EA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