@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,259 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react"
|
|
2
|
+
import PayPalTabs from "../_components/Tabs"
|
|
3
|
+
|
|
4
|
+
type Dispute = {
|
|
5
|
+
id: string
|
|
6
|
+
dispute_id: string
|
|
7
|
+
status?: string | null
|
|
8
|
+
reason?: string | null
|
|
9
|
+
stage?: string | null
|
|
10
|
+
amount?: string | null
|
|
11
|
+
currency_code?: string | null
|
|
12
|
+
transaction_id?: string | null
|
|
13
|
+
seller_transaction_id?: string | null
|
|
14
|
+
order_id?: string | null
|
|
15
|
+
cart_id?: string | null
|
|
16
|
+
created_at?: string
|
|
17
|
+
updated_at?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type Filters = {
|
|
21
|
+
dispute_id: string
|
|
22
|
+
status: string
|
|
23
|
+
order_id: string
|
|
24
|
+
cart_id: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const EMPTY_FILTERS: Filters = {
|
|
28
|
+
dispute_id: "",
|
|
29
|
+
status: "",
|
|
30
|
+
order_id: "",
|
|
31
|
+
cart_id: "",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function formatDate(value?: string) {
|
|
35
|
+
if (!value) {
|
|
36
|
+
return ""
|
|
37
|
+
}
|
|
38
|
+
const parsed = new Date(value)
|
|
39
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
40
|
+
return value
|
|
41
|
+
}
|
|
42
|
+
return parsed.toLocaleString()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default function PayPalDisputesPage() {
|
|
46
|
+
const [filters, setFilters] = useState<Filters>({ ...EMPTY_FILTERS })
|
|
47
|
+
const [disputes, setDisputes] = useState<Dispute[]>([])
|
|
48
|
+
const [loading, setLoading] = useState(false)
|
|
49
|
+
const [error, setError] = useState<string | null>(null)
|
|
50
|
+
|
|
51
|
+
const queryString = useMemo(() => {
|
|
52
|
+
const params = new URLSearchParams()
|
|
53
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
54
|
+
if (value.trim()) {
|
|
55
|
+
params.set(key, value.trim())
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
const qs = params.toString()
|
|
59
|
+
return qs ? `?${qs}` : ""
|
|
60
|
+
}, [filters])
|
|
61
|
+
|
|
62
|
+
const fetchDisputes = useCallback(async (source: Filters) => {
|
|
63
|
+
try {
|
|
64
|
+
setLoading(true)
|
|
65
|
+
setError(null)
|
|
66
|
+
const params = new URLSearchParams()
|
|
67
|
+
Object.entries(source).forEach(([key, value]) => {
|
|
68
|
+
if (value.trim()) {
|
|
69
|
+
params.set(key, value.trim())
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const qs = params.toString()
|
|
74
|
+
const resp = await fetch(`/admin/paypal/disputes${qs ? `?${qs}` : ""}`, {
|
|
75
|
+
credentials: "include",
|
|
76
|
+
headers: {
|
|
77
|
+
Accept: "application/json",
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
if (!resp.ok) {
|
|
82
|
+
const message = await resp.text().catch(() => "")
|
|
83
|
+
throw new Error(message || "Failed to load disputes")
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const json = await resp.json().catch(() => ({}))
|
|
87
|
+
setDisputes((json?.disputes as Dispute[]) || [])
|
|
88
|
+
} catch (fetchError: any) {
|
|
89
|
+
setError(fetchError?.message || "Failed to load disputes")
|
|
90
|
+
setDisputes([])
|
|
91
|
+
} finally {
|
|
92
|
+
setLoading(false)
|
|
93
|
+
}
|
|
94
|
+
}, [])
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
fetchDisputes(EMPTY_FILTERS)
|
|
98
|
+
}, [fetchDisputes])
|
|
99
|
+
|
|
100
|
+
const onSubmit = (event: React.FormEvent) => {
|
|
101
|
+
event.preventDefault()
|
|
102
|
+
fetchDisputes(filters)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const onReset = () => {
|
|
106
|
+
setFilters({ ...EMPTY_FILTERS })
|
|
107
|
+
fetchDisputes(EMPTY_FILTERS)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div className="p-6">
|
|
112
|
+
<div className="flex flex-col gap-6">
|
|
113
|
+
<div>
|
|
114
|
+
<h1 className="text-xl font-semibold text-ui-fg-base">PayPal Disputes</h1>
|
|
115
|
+
<p className="mt-1 text-sm text-ui-fg-subtle">
|
|
116
|
+
Review PayPal dispute activity tied to your Medusa orders. This view is read-only.
|
|
117
|
+
</p>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<PayPalTabs />
|
|
121
|
+
|
|
122
|
+
<div className="rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm">
|
|
123
|
+
<div className="border-b border-ui-border-base p-4">
|
|
124
|
+
<div className="text-base font-semibold text-ui-fg-base">Filters</div>
|
|
125
|
+
</div>
|
|
126
|
+
<div className="p-4">
|
|
127
|
+
<form onSubmit={onSubmit} className="flex flex-col gap-4">
|
|
128
|
+
<div className="grid grid-cols-1 gap-4 md:grid-cols-4">
|
|
129
|
+
<label className="flex flex-col gap-1 text-sm text-ui-fg-subtle">
|
|
130
|
+
Dispute ID
|
|
131
|
+
<input
|
|
132
|
+
className="rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base"
|
|
133
|
+
value={filters.dispute_id}
|
|
134
|
+
onChange={(event) =>
|
|
135
|
+
setFilters((prev) => ({ ...prev, dispute_id: event.target.value }))
|
|
136
|
+
}
|
|
137
|
+
placeholder="PP-D-123"
|
|
138
|
+
/>
|
|
139
|
+
</label>
|
|
140
|
+
<label className="flex flex-col gap-1 text-sm text-ui-fg-subtle">
|
|
141
|
+
Status
|
|
142
|
+
<input
|
|
143
|
+
className="rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base"
|
|
144
|
+
value={filters.status}
|
|
145
|
+
onChange={(event) =>
|
|
146
|
+
setFilters((prev) => ({ ...prev, status: event.target.value }))
|
|
147
|
+
}
|
|
148
|
+
placeholder="OPEN"
|
|
149
|
+
/>
|
|
150
|
+
</label>
|
|
151
|
+
<label className="flex flex-col gap-1 text-sm text-ui-fg-subtle">
|
|
152
|
+
Order ID
|
|
153
|
+
<input
|
|
154
|
+
className="rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base"
|
|
155
|
+
value={filters.order_id}
|
|
156
|
+
onChange={(event) =>
|
|
157
|
+
setFilters((prev) => ({ ...prev, order_id: event.target.value }))
|
|
158
|
+
}
|
|
159
|
+
placeholder="order_..."
|
|
160
|
+
/>
|
|
161
|
+
</label>
|
|
162
|
+
<label className="flex flex-col gap-1 text-sm text-ui-fg-subtle">
|
|
163
|
+
Cart ID
|
|
164
|
+
<input
|
|
165
|
+
className="rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base"
|
|
166
|
+
value={filters.cart_id}
|
|
167
|
+
onChange={(event) =>
|
|
168
|
+
setFilters((prev) => ({ ...prev, cart_id: event.target.value }))
|
|
169
|
+
}
|
|
170
|
+
placeholder="cart_..."
|
|
171
|
+
/>
|
|
172
|
+
</label>
|
|
173
|
+
</div>
|
|
174
|
+
<div className="flex flex-wrap gap-3">
|
|
175
|
+
<button
|
|
176
|
+
type="submit"
|
|
177
|
+
className="rounded-md bg-ui-fg-base px-4 py-2 text-sm font-medium text-ui-bg-base"
|
|
178
|
+
disabled={loading}
|
|
179
|
+
>
|
|
180
|
+
{loading ? "Loading..." : "Apply filters"}
|
|
181
|
+
</button>
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
className="rounded-md border border-ui-border-base px-4 py-2 text-sm text-ui-fg-base"
|
|
185
|
+
onClick={onReset}
|
|
186
|
+
disabled={loading}
|
|
187
|
+
>
|
|
188
|
+
Reset
|
|
189
|
+
</button>
|
|
190
|
+
<span className="text-sm text-ui-fg-subtle">
|
|
191
|
+
Showing {disputes.length} dispute{disputes.length === 1 ? "" : "s"}
|
|
192
|
+
{queryString ? " (filtered)" : ""}
|
|
193
|
+
</span>
|
|
194
|
+
</div>
|
|
195
|
+
</form>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div className="rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm">
|
|
200
|
+
<div className="border-b border-ui-border-base p-4">
|
|
201
|
+
<div className="text-base font-semibold text-ui-fg-base">Dispute Records</div>
|
|
202
|
+
</div>
|
|
203
|
+
<div className="overflow-x-auto">
|
|
204
|
+
<table className="min-w-full divide-y divide-ui-border-base text-sm">
|
|
205
|
+
<thead className="bg-ui-bg-subtle">
|
|
206
|
+
<tr className="text-left text-ui-fg-subtle">
|
|
207
|
+
<th className="px-4 py-3 font-medium">Dispute</th>
|
|
208
|
+
<th className="px-4 py-3 font-medium">Status</th>
|
|
209
|
+
<th className="px-4 py-3 font-medium">Reason</th>
|
|
210
|
+
<th className="px-4 py-3 font-medium">Stage</th>
|
|
211
|
+
<th className="px-4 py-3 font-medium">Amount</th>
|
|
212
|
+
<th className="px-4 py-3 font-medium">Order</th>
|
|
213
|
+
<th className="px-4 py-3 font-medium">Cart</th>
|
|
214
|
+
<th className="px-4 py-3 font-medium">Updated</th>
|
|
215
|
+
</tr>
|
|
216
|
+
</thead>
|
|
217
|
+
<tbody className="divide-y divide-ui-border-base text-ui-fg-base">
|
|
218
|
+
{disputes.length === 0 ? (
|
|
219
|
+
<tr>
|
|
220
|
+
<td className="px-4 py-6 text-center text-ui-fg-subtle" colSpan={8}>
|
|
221
|
+
{loading ? "Loading disputes..." : "No disputes found."}
|
|
222
|
+
</td>
|
|
223
|
+
</tr>
|
|
224
|
+
) : (
|
|
225
|
+
disputes.map((dispute) => (
|
|
226
|
+
<tr key={dispute.id}>
|
|
227
|
+
<td className="px-4 py-3">
|
|
228
|
+
<div className="font-medium text-ui-fg-base">{dispute.dispute_id}</div>
|
|
229
|
+
<div className="text-xs text-ui-fg-subtle">
|
|
230
|
+
{dispute.transaction_id || "No transaction"}
|
|
231
|
+
</div>
|
|
232
|
+
</td>
|
|
233
|
+
<td className="px-4 py-3">{dispute.status || "Unknown"}</td>
|
|
234
|
+
<td className="px-4 py-3">{dispute.reason || "-"}</td>
|
|
235
|
+
<td className="px-4 py-3">{dispute.stage || "-"}</td>
|
|
236
|
+
<td className="px-4 py-3">
|
|
237
|
+
{dispute.amount ? `${dispute.amount} ${dispute.currency_code || ""}` : "-"}
|
|
238
|
+
</td>
|
|
239
|
+
<td className="px-4 py-3">{dispute.order_id || "-"}</td>
|
|
240
|
+
<td className="px-4 py-3">{dispute.cart_id || "-"}</td>
|
|
241
|
+
<td className="px-4 py-3 text-ui-fg-subtle">
|
|
242
|
+
{formatDate(dispute.updated_at || dispute.created_at)}
|
|
243
|
+
</td>
|
|
244
|
+
</tr>
|
|
245
|
+
))
|
|
246
|
+
)}
|
|
247
|
+
</tbody>
|
|
248
|
+
</table>
|
|
249
|
+
</div>
|
|
250
|
+
{error ? (
|
|
251
|
+
<div className="border-t border-ui-border-base px-4 py-3 text-sm text-ui-fg-error">
|
|
252
|
+
{error}
|
|
253
|
+
</div>
|
|
254
|
+
) : null}
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
)
|
|
259
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { defineRouteConfig } from "@medusajs/admin-sdk"
|
|
3
|
+
import { Navigate } from "react-router-dom"
|
|
4
|
+
|
|
5
|
+
export const config = defineRouteConfig({
|
|
6
|
+
label: "PayPal",
|
|
7
|
+
icon: "Coins",
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Keep the left-side "PayPal" menu entry stable.
|
|
12
|
+
* Default tab -> PayPal Connection.
|
|
13
|
+
*/
|
|
14
|
+
export default function PayPalSettingsIndexRoute() {
|
|
15
|
+
return <Navigate to="connection" replace />
|
|
16
|
+
}
|