@delopay/sdk 0.409.0 → 0.413.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/dist/airwallexCard.cjs.map +1 -1
- package/dist/branding.cjs.map +1 -1
- package/dist/cardFormStyles.cjs.map +1 -1
- package/dist/checkoutSession.cjs +2 -2
- package/dist/checkoutSession.cjs.map +1 -1
- package/dist/checkoutSession.js +1 -1
- package/dist/chunk-244VZFFO.cjs.map +1 -1
- package/dist/chunk-2IJRBJXW.cjs.map +1 -1
- package/dist/chunk-34PC72O7.cjs.map +1 -1
- package/dist/chunk-3GBWQWTP.cjs.map +1 -1
- package/dist/chunk-3YBBJT3Y.cjs.map +1 -1
- package/dist/chunk-44QBWVRS.cjs.map +1 -1
- package/dist/chunk-4EKAWNYI.cjs.map +1 -1
- package/dist/chunk-4LN4BR2T.cjs.map +1 -1
- package/dist/chunk-4T4XHPYN.cjs.map +1 -1
- package/dist/{chunk-ZDYRYXY3.js → chunk-4YCQWMFF.js} +3 -3
- package/dist/chunk-5CITBN33.cjs.map +1 -1
- package/dist/chunk-5CNBINCX.cjs.map +1 -1
- package/dist/chunk-5HCKC4HF.cjs.map +1 -1
- package/dist/chunk-5O2JSQYA.cjs.map +1 -1
- package/dist/chunk-6EBY2KKL.cjs.map +1 -1
- package/dist/chunk-6LOWE2YI.cjs.map +1 -1
- package/dist/chunk-6LSG5Z4T.cjs.map +1 -1
- package/dist/chunk-6SU2MTN2.cjs.map +1 -1
- package/dist/chunk-6YCDLSIU.cjs.map +1 -1
- package/dist/chunk-75E5WNJG.cjs.map +1 -1
- package/dist/chunk-7ITPMVDB.cjs.map +1 -1
- package/dist/chunk-7JV6VVO7.cjs.map +1 -1
- package/dist/chunk-7QZCUXWB.cjs.map +1 -1
- package/dist/chunk-7VXF5D67.cjs.map +1 -1
- package/dist/chunk-ACZ2R47X.cjs.map +1 -1
- package/dist/chunk-AYUYJO3I.cjs.map +1 -1
- package/dist/chunk-B2TCNGC2.cjs.map +1 -1
- package/dist/chunk-BCA3TCGS.cjs.map +1 -1
- package/dist/chunk-BOU2TQ6U.cjs.map +1 -1
- package/dist/chunk-BP6KDQ6I.cjs.map +1 -1
- package/dist/chunk-BRY3W7N3.cjs.map +1 -1
- package/dist/chunk-CAMALM35.cjs.map +1 -1
- package/dist/chunk-CCN44NZJ.cjs.map +1 -1
- package/dist/chunk-CKKNFFKP.cjs.map +1 -1
- package/dist/chunk-CR3JBTP3.cjs.map +1 -1
- package/dist/chunk-DJASVBOJ.cjs.map +1 -1
- package/dist/{chunk-NXORFP3R.js → chunk-EGQKVHQB.js} +1 -1
- package/dist/chunk-EGQKVHQB.js.map +1 -0
- package/dist/chunk-ENPSUWTS.cjs.map +1 -1
- package/dist/chunk-EQ6P6ZND.cjs.map +1 -1
- package/dist/chunk-EXPWQBI3.cjs.map +1 -1
- package/dist/chunk-F3I5DOWV.cjs.map +1 -1
- package/dist/chunk-F6S3WCCB.cjs.map +1 -1
- package/dist/chunk-FQRC4NJG.cjs.map +1 -1
- package/dist/chunk-FYISDU2Y.cjs.map +1 -1
- package/dist/chunk-GA3KXPIF.cjs.map +1 -1
- package/dist/chunk-GG52SAHA.cjs.map +1 -1
- package/dist/chunk-GGYLU7YO.cjs.map +1 -1
- package/dist/chunk-GK5FWN4H.cjs.map +1 -1
- package/dist/chunk-GSQN5EOO.cjs.map +1 -1
- package/dist/chunk-GW7IHYXR.cjs.map +1 -1
- package/dist/chunk-H537KAYC.cjs.map +1 -1
- package/dist/chunk-HLKFUOAQ.cjs.map +1 -1
- package/dist/chunk-HLYGHP6F.cjs.map +1 -1
- package/dist/chunk-I2W7AO4B.cjs.map +1 -1
- package/dist/chunk-I2XGNALG.cjs.map +1 -1
- package/dist/chunk-I65QS3YQ.cjs.map +1 -1
- package/dist/chunk-IKXGA2Z5.cjs.map +1 -1
- package/dist/chunk-IR2LFKKA.cjs.map +1 -1
- package/dist/chunk-K5Q2H3VD.cjs.map +1 -1
- package/dist/chunk-KD5Y2YWK.cjs.map +1 -1
- package/dist/chunk-KJDMNF2T.cjs.map +1 -1
- package/dist/chunk-KLONGJCL.cjs.map +1 -1
- package/dist/chunk-KSJ7JLR3.cjs.map +1 -1
- package/dist/chunk-LJ2EG6JK.cjs.map +1 -1
- package/dist/chunk-LLYY4TCZ.cjs.map +1 -1
- package/dist/chunk-LYIBTVK6.cjs.map +1 -1
- package/dist/chunk-M3HWE7KT.cjs.map +1 -1
- package/dist/chunk-M3SJHFT4.cjs.map +1 -1
- package/dist/chunk-MCNDMK7F.cjs.map +1 -1
- package/dist/chunk-MLG6NXI6.cjs.map +1 -1
- package/dist/chunk-NFB3S2E6.cjs.map +1 -1
- package/dist/{chunk-RBN2H7QR.js → chunk-NPIVFYLK.js} +11 -7
- package/dist/{chunk-RBN2H7QR.js.map → chunk-NPIVFYLK.js.map} +1 -1
- package/dist/chunk-NYL3BNHR.cjs.map +1 -1
- package/dist/chunk-O4AYHLQX.cjs.map +1 -1
- package/dist/chunk-ODPNVNYE.cjs.map +1 -1
- package/dist/chunk-OG2KJAYD.cjs.map +1 -1
- package/dist/chunk-OWP7XBY2.cjs.map +1 -1
- package/dist/chunk-OYZP6NF6.cjs.map +1 -1
- package/dist/chunk-P6JLNQ6L.cjs.map +1 -1
- package/dist/chunk-P7DYLUUI.cjs.map +1 -1
- package/dist/chunk-PKAE6AQT.cjs.map +1 -1
- package/dist/{chunk-AQ5NYBU4.cjs → chunk-PWDY5D5S.cjs} +11 -7
- package/dist/chunk-PWDY5D5S.cjs.map +1 -0
- package/dist/chunk-Q7M7DO7M.cjs.map +1 -1
- package/dist/chunk-QMLU5DST.cjs.map +1 -1
- package/dist/chunk-QRSA72B3.cjs.map +1 -1
- package/dist/{chunk-TIMYWB2C.cjs → chunk-QT3HUTWI.cjs} +5 -5
- package/dist/chunk-QT3HUTWI.cjs.map +1 -0
- package/dist/chunk-QYNRNDIY.cjs.map +1 -1
- package/dist/chunk-R4FE6K43.cjs.map +1 -1
- package/dist/{chunk-X7UAYGQR.cjs → chunk-R4GA6BVP.cjs} +17 -1
- package/dist/chunk-R4GA6BVP.cjs.map +1 -0
- package/dist/chunk-R5VYSZ3Q.cjs.map +1 -1
- package/dist/chunk-RI42IDRR.cjs.map +1 -1
- package/dist/{chunk-DZM3UP7F.cjs → chunk-RSVLVW4L.cjs} +1 -1
- package/dist/chunk-RSVLVW4L.cjs.map +1 -0
- package/dist/chunk-S7SBNOGS.cjs.map +1 -1
- package/dist/chunk-SQELICSX.cjs.map +1 -1
- package/dist/{chunk-JTZ44ZLT.js → chunk-T326ZWR3.js} +55 -1
- package/dist/chunk-T326ZWR3.js.map +1 -0
- package/dist/chunk-TMAJE5P2.cjs.map +1 -1
- package/dist/chunk-TNIJ6OSH.cjs.map +1 -1
- package/dist/chunk-UGSM7RJ2.cjs.map +1 -1
- package/dist/chunk-UKLZAOLW.cjs.map +1 -1
- package/dist/chunk-V47G7P6L.cjs.map +1 -1
- package/dist/chunk-VH5A6SMU.cjs.map +1 -1
- package/dist/chunk-VOIELJLZ.cjs.map +1 -1
- package/dist/chunk-VYC7WUM5.cjs.map +1 -1
- package/dist/chunk-W457XUA6.cjs.map +1 -1
- package/dist/chunk-WHDI3TMP.cjs.map +1 -1
- package/dist/chunk-WITCPKNL.cjs.map +1 -1
- package/dist/chunk-WX6NP7UU.cjs.map +1 -1
- package/dist/{chunk-JSSDNDAG.cjs → chunk-XAUPBK6A.cjs} +3 -3
- package/dist/chunk-XAUPBK6A.cjs.map +1 -0
- package/dist/chunk-XQLRIBVR.cjs.map +1 -1
- package/dist/{chunk-NW37NQZB.cjs → chunk-Y6W2EJ2R.cjs} +55 -1
- package/dist/chunk-Y6W2EJ2R.cjs.map +1 -0
- package/dist/chunk-YJQPKT6W.cjs.map +1 -1
- package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
- package/dist/{chunk-YOFIOZJ5.js → chunk-ZJRQ2AKS.js} +2 -2
- package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
- package/dist/chunk-ZOD4J4XF.cjs.map +1 -1
- package/dist/{chunk-3GMGEP5I.js → chunk-ZTFYSSKD.js} +17 -1
- package/dist/chunk-ZTFYSSKD.js.map +1 -0
- package/dist/client.cjs +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/currencies.cjs.map +1 -1
- package/dist/enigmaCardForm.cjs.map +1 -1
- package/dist/error.cjs.map +1 -1
- package/dist/eventStream.cjs.map +1 -1
- package/dist/exportDownload.cjs.map +1 -1
- package/dist/feeProgram.cjs.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/internal/resources/admin.cjs.map +1 -1
- package/dist/internal/resources/admin.d.cts +1 -1
- package/dist/internal/resources/admin.d.ts +1 -1
- package/dist/internal/resources/adminBranding.cjs.map +1 -1
- package/dist/internal/resources/adminBranding.d.cts +1 -1
- package/dist/internal/resources/adminBranding.d.ts +1 -1
- package/dist/internal/resources/adminFileScans.cjs.map +1 -1
- package/dist/internal/resources/adminFileScans.d.cts +1 -1
- package/dist/internal/resources/adminFileScans.d.ts +1 -1
- package/dist/internal/resources/adminIndustries.cjs.map +1 -1
- package/dist/internal/resources/adminIndustries.d.cts +1 -1
- package/dist/internal/resources/adminIndustries.d.ts +1 -1
- package/dist/internal/resources/adminLive.cjs.map +1 -1
- package/dist/internal/resources/adminPortal.cjs +2 -2
- package/dist/internal/resources/adminPortal.cjs.map +1 -1
- package/dist/internal/resources/adminPortal.d.cts +37 -1
- package/dist/internal/resources/adminPortal.d.ts +37 -1
- package/dist/internal/resources/adminPortal.js +1 -1
- package/dist/internal/resources/adminSupport.cjs.map +1 -1
- package/dist/internal/resources/adminSupport.d.cts +1 -1
- package/dist/internal/resources/adminSupport.d.ts +1 -1
- package/dist/internal/resources/auditLogs.cjs +2 -2
- package/dist/internal/resources/auditLogs.cjs.map +1 -1
- package/dist/internal/resources/auditLogs.d.cts +12 -1
- package/dist/internal/resources/auditLogs.d.ts +12 -1
- package/dist/internal/resources/auditLogs.js +1 -1
- package/dist/internal/resources/cache.cjs.map +1 -1
- package/dist/internal/resources/cardIssuers.cjs.map +1 -1
- package/dist/internal/resources/cardIssuers.d.cts +1 -1
- package/dist/internal/resources/cardIssuers.d.ts +1 -1
- package/dist/internal/resources/configs.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictionRules.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictionRules.d.cts +1 -1
- package/dist/internal/resources/connectorRestrictionRules.d.ts +1 -1
- package/dist/internal/resources/connectorRestrictions.cjs.map +1 -1
- package/dist/internal/resources/connectorRestrictions.d.cts +1 -1
- package/dist/internal/resources/connectorRestrictions.d.ts +1 -1
- package/dist/internal/resources/diagnostic.cjs.map +1 -1
- package/dist/internal/resources/diagnostic.d.cts +1 -1
- package/dist/internal/resources/diagnostic.d.ts +1 -1
- package/dist/internal/resources/gsm.cjs.map +1 -1
- package/dist/internal/resources/gsm.d.cts +1 -1
- package/dist/internal/resources/gsm.d.ts +1 -1
- package/dist/internal/resources/nativeRenewals.cjs.map +1 -1
- package/dist/internal/resources/nativeRenewals.d.cts +1 -1
- package/dist/internal/resources/nativeRenewals.d.ts +1 -1
- package/dist/internal/resources/platformBilling.cjs.map +1 -1
- package/dist/internal/resources/platformBilling.d.cts +1 -1
- package/dist/internal/resources/platformBilling.d.ts +1 -1
- package/dist/internal/resources/platformFees.cjs.map +1 -1
- package/dist/internal/resources/platformMessageTemplates.cjs.map +1 -1
- package/dist/internal/resources/platformSettings.cjs.map +1 -1
- package/dist/internal.cjs +10 -10
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +6 -6
- package/dist/listQuery.cjs.map +1 -1
- package/dist/panes.cjs.map +1 -1
- package/dist/paymentPresentation.cjs.map +1 -1
- package/dist/recordCounter.cjs.map +1 -1
- package/dist/resources/analytics.cjs.map +1 -1
- package/dist/resources/analyticsDashboard.cjs.map +1 -1
- package/dist/resources/apiKeys.cjs.map +1 -1
- package/dist/resources/audit.cjs.map +1 -1
- package/dist/resources/authentication.cjs.map +1 -1
- package/dist/resources/availabilityOverrides.cjs.map +1 -1
- package/dist/resources/billing.cjs.map +1 -1
- package/dist/resources/buyerAccount.cjs.map +1 -1
- package/dist/resources/buyerBlocklist.cjs +2 -2
- package/dist/resources/buyerBlocklist.cjs.map +1 -1
- package/dist/resources/buyerBlocklist.d.cts +1 -1
- package/dist/resources/buyerBlocklist.d.ts +1 -1
- package/dist/resources/buyerBlocklist.js +1 -1
- package/dist/resources/buyerConversations.cjs.map +1 -1
- package/dist/resources/buyerEvidenceReviews.cjs.map +1 -1
- package/dist/resources/buyerPortal.cjs.map +1 -1
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/chargebackPrevention.cjs.map +1 -1
- package/dist/resources/checkoutMethods.cjs.map +1 -1
- package/dist/resources/checkoutRecovery.cjs.map +1 -1
- package/dist/resources/checkoutTemplates.cjs.map +1 -1
- package/dist/resources/connectors.cjs.map +1 -1
- package/dist/resources/costRules.cjs.map +1 -1
- package/dist/resources/customers.cjs.map +1 -1
- package/dist/resources/deploymentBranding.cjs.map +1 -1
- package/dist/resources/disputes.cjs.map +1 -1
- package/dist/resources/ephemeralKeys.cjs.map +1 -1
- package/dist/resources/events.cjs.map +1 -1
- package/dist/resources/export.cjs.map +1 -1
- package/dist/resources/externalRecords.cjs.map +1 -1
- package/dist/resources/featureMatrix.cjs.map +1 -1
- package/dist/resources/fees.cjs.map +1 -1
- package/dist/resources/files.cjs.map +1 -1
- package/dist/resources/forex.cjs.map +1 -1
- package/dist/resources/identityVerifications.cjs +2 -2
- package/dist/resources/identityVerifications.cjs.map +1 -1
- package/dist/resources/identityVerifications.d.cts +10 -6
- package/dist/resources/identityVerifications.d.ts +10 -6
- package/dist/resources/identityVerifications.js +1 -1
- package/dist/resources/industries.cjs.map +1 -1
- package/dist/resources/invoiceSettings.cjs.map +1 -1
- package/dist/resources/invoices.cjs.map +1 -1
- package/dist/resources/live.cjs.map +1 -1
- package/dist/resources/mandates.cjs.map +1 -1
- package/dist/resources/merchantAccounts.cjs.map +1 -1
- package/dist/resources/messageTemplates.cjs.map +1 -1
- package/dist/resources/operationLimits.cjs.map +1 -1
- package/dist/resources/paymentLinks.cjs.map +1 -1
- package/dist/resources/paymentMethods.cjs.map +1 -1
- package/dist/resources/payments.cjs.map +1 -1
- package/dist/resources/payoutDestinations.cjs.map +1 -1
- package/dist/resources/payouts.cjs.map +1 -1
- package/dist/resources/paypalDisputes.cjs.map +1 -1
- package/dist/resources/persons.cjs.map +1 -1
- package/dist/resources/poll.cjs.map +1 -1
- package/dist/resources/processorCosts.cjs.map +1 -1
- package/dist/resources/processorImports.cjs.map +1 -1
- package/dist/resources/products.cjs.map +1 -1
- package/dist/resources/profileAcquirers.cjs.map +1 -1
- package/dist/resources/profiles.cjs.map +1 -1
- package/dist/resources/projects.cjs.map +1 -1
- package/dist/resources/refunds.cjs.map +1 -1
- package/dist/resources/regions.cjs.map +1 -1
- package/dist/resources/relay.cjs.map +1 -1
- package/dist/resources/risk.cjs.map +1 -1
- package/dist/resources/routing.cjs.map +1 -1
- package/dist/resources/search.cjs.map +1 -1
- package/dist/resources/sellToRestrictions.cjs.map +1 -1
- package/dist/resources/settings.cjs.map +1 -1
- package/dist/resources/settlement.cjs.map +1 -1
- package/dist/resources/shopLabels.cjs.map +1 -1
- package/dist/resources/shops.cjs.map +1 -1
- package/dist/resources/stripeConnect.cjs.map +1 -1
- package/dist/resources/subscriptions.cjs.map +1 -1
- package/dist/resources/support.cjs.map +1 -1
- package/dist/resources/threeDsRules.cjs.map +1 -1
- package/dist/resources/users.cjs.map +1 -1
- package/dist/resources/vatRates.cjs.map +1 -1
- package/dist/resources/verification.cjs.map +1 -1
- package/dist/resources/webhooks.cjs.map +1 -1
- package/dist/resources/whopResolutionCases.cjs.map +1 -1
- package/dist/{types-ewLZOLPZ.d.ts → types-By5GGlvR.d.cts} +190 -2
- package/dist/{types-BEuEdvtX.d.cts → types-CZib7kHm.d.ts} +190 -2
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +130 -15
- package/dist/types.d.ts +130 -15
- package/package.json +17 -19
- package/dist/chunk-3GMGEP5I.js.map +0 -1
- package/dist/chunk-AQ5NYBU4.cjs.map +0 -1
- package/dist/chunk-DZM3UP7F.cjs.map +0 -1
- package/dist/chunk-JSSDNDAG.cjs.map +0 -1
- package/dist/chunk-JTZ44ZLT.js.map +0 -1
- package/dist/chunk-NW37NQZB.cjs.map +0 -1
- package/dist/chunk-NXORFP3R.js.map +0 -1
- package/dist/chunk-TIMYWB2C.cjs.map +0 -1
- package/dist/chunk-X7UAYGQR.cjs.map +0 -1
- /package/dist/{chunk-ZDYRYXY3.js.map → chunk-4YCQWMFF.js.map} +0 -0
- /package/dist/{chunk-YOFIOZJ5.js.map → chunk-ZJRQ2AKS.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-I65QS3YQ.cjs","../src/resources/payments.ts"],"names":[],"mappings":"AAAA;ACyCO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgDlD,MAAM,MAAA,CACJ,MAAA,EACA,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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBwC,EAAA;AACkB,IAAA;AAC1D,EAAA;AAAA;AAKkC,EAAA;AACwB,IAAA;AAC1D,EAAA;AAAA;AAAA;AAAA;AAAA;AAQkC,EAAA;AACuB,IAAA;AACzD,EAAA;AAAA;AAKoC,EAAA;AACkB,IAAA;AACtD,EAAA;AAAA;AAKoC,EAAA;AACP,IAAA;AAC7B,EAAA;AAAA;AAGiG,EAAA;AACvD,IAAA;AAChC,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAG6F,EAAA;AAClD,IAAA;AACjC,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAG4F,EAAA;AACjD,IAAA;AACjC,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAMoC,EAAA;AACO,IAAA;AACjC,MAAA;AACP,IAAA;AACH,EAAA;AACF;AD7K4D;AACA;AACA;AACA","file":"/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-I65QS3YQ.cjs","sourcesContent":[null,"import type {\n BuyerRiskEvaluationsResponse,\n BuyerRiskReleaseResponse,\n PaymentAgentSignalResponse,\n PaymentClientContextListResponse,\n PaymentCreateRequest,\n ProductPaymentCreateRequest,\n ProductsPaymentCreateRequest,\n PaymentListFilterConstraints,\n PaymentListFilteredResponse,\n ProfilePaymentListFilterConstraints,\n PaymentListResponse,\n PaymentResponse,\n PaymentProductLines,\n PaymentRetrieveOptions,\n PaymentUpdateRequest,\n PaymentConfirmRequest,\n PaymentCaptureRequest,\n PaymentCancelRequest,\n PaymentAbortRequest,\n PaymentIntegrationTestRequest,\n PaymentIntegrationTestResponse,\n PaymentListParams,\n PaymentAttemptsListResponse,\n PaymentConnectorSettlementResponse,\n PaymentsDeletePolicyResponse,\n PaymentsDeleteResponse,\n PaymentStatusHistoryResponse,\n PaymentLogsResponse,\n PaymentLogConnectorCallDetail,\n PaymentLogIncomingWebhookDetail,\n PaymentLogOutgoingWebhookDetail,\n PaymentRoutingDecisionsResponse,\n PaymentStatementDescriptorsResponse,\n ReplayPlaybackResponse,\n ReplaySliceResponse,\n PaymentListFiltersExt,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/** Manage payment intents — create, confirm, capture, cancel, and list payments. */\nexport class Payments {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a new payment intent.\n *\n * @param params - An explicit amount and currency, or a DeloPay one-time\n * product whose active price supplies both on the server.\n * @param options - Optional per-call extras: extra `headers` (e.g. an\n * `Idempotency-Key` to make the create safe to retry), a `timeout` override,\n * and an `AbortSignal`.\n * @returns The created payment intent.\n *\n * @example\n * ```typescript\n * const payment = await delopay.payments.create(\n * { amount: 5000, currency: 'EUR', customer_id: 'cus_123' },\n * { headers: { 'Idempotency-Key': 'order_1001' } },\n * );\n * ```\n *\n * @example Charge the active default price of a shop-owned product without\n * copying the product to the payment provider:\n * ```typescript\n * const payment = await delopay.payments.create({\n * product_id: 'prd_123',\n * profile_id: 'pro_123',\n * payment_link: true,\n * });\n * ```\n *\n * @example Send `test_mode` to pick the environment per payment, so a staging\n * deploy cannot charge real cards and a forgotten processor toggle cannot\n * swallow production traffic:\n * ```typescript\n * const payment = await delopay.payments.create({\n * amount: 5000,\n * currency: 'EUR',\n * test_mode: process.env.NODE_ENV !== 'production',\n * });\n * ```\n *\n * A payment that pins one connector through `routing` (the `single` form)\n * is now checked against `test_mode` here rather than at confirm: if that\n * connector has no credentials for the environment asked for, create fails\n * instead of handing back a payment whose checkout the buyer cannot\n * complete. `priority` and `volume_split` name several accounts and are\n * still resolved at confirm.\n */\n async create(\n params: PaymentCreateRequest | ProductPaymentCreateRequest | ProductsPaymentCreateRequest,\n options?: RequestExtras,\n ): Promise<PaymentResponse> {\n return this.request('POST', '/payments', { body: params, ...options });\n }\n\n /**\n * Retrieve a payment by its ID.\n *\n * @param paymentId - The unique payment intent ID.\n * @param options - Optional query flags. `force_sync` reconciles the\n * intent's state with the connector before returning (useful to recover\n * a stuck intent when a webhook was lost). `all_keys_required` forces a\n * connector sync even for intents in early states like\n * `requires_payment_method` that would otherwise return the local\n * snapshot. Both flags work with JWT and API-key authentication.\n * @returns The payment intent.\n *\n * @example\n * ```typescript\n * const payment = await delopay.payments.retrieve('pay_abc123');\n * const synced = await delopay.payments.retrieve('pay_abc123', {\n * force_sync: true,\n * all_keys_required: true,\n * });\n * ```\n */\n async retrieve(paymentId: string, options?: PaymentRetrieveOptions): Promise<PaymentResponse> {\n const path = `/payments/${encodeURIComponent(paymentId)}`;\n if (options === undefined) return this.request('GET', path);\n const query: Record<string, boolean> = {};\n if (options.force_sync !== undefined) query['force_sync'] = options.force_sync;\n if (options.all_keys_required !== undefined) {\n query['all_keys_required'] = options.all_keys_required;\n }\n if (Object.keys(query).length === 0) return this.request('GET', path);\n return this.request('GET', path, { query });\n }\n\n /**\n * The payment's buyer risk evaluations, newest first (at most 50): each\n * one's score from 0 to 100, its band, the action the merchant's model asks\n * for that band and the action that was taken, the signals that fired with\n * the points each added, and the model version it was scored with.\n *\n * A payment is scored at every confirm that is about to reach a processor;\n * a payment never scored answers an empty list. A caller scoped to one shop\n * reads only that shop's payments.\n *\n * `GET /payments/{paymentId}/buyer-risk`\n */\n async buyerRisk(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<BuyerRiskEvaluationsResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);\n }\n\n /**\n * Lift the holds put on an authorized payment when a chargeback prevention\n * alert or an AML hit on the same buyer arrived after it was scored and the\n * shop's `buyer_risk_source_changes` setting asked to hold it. Until then a\n * capture is refused with `IR_16`; after the release the payment can be\n * captured or cancelled as usual. A payment with no hold answers an empty\n * list. A caller scoped to one shop releases only that shop's payments.\n *\n * `POST /payments/{paymentId}/buyer-risk/release`\n */\n async releaseBuyerRiskHold(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<BuyerRiskReleaseResponse> {\n return this.request(\n 'POST',\n `/payments/${encodeURIComponent(paymentId)}/buyer-risk/release`,\n options,\n );\n }\n\n /**\n * What the payment's checkout client was, for AI shopping agents: a\n * verified agent (with its operator, protocol and key), an agent signature\n * that did not verify (with the reason), an automated client, or a browser.\n * The hosted checkout's render and the buyer's confirm are both judged, and\n * the strongest observation is kept.\n *\n * A payment never observed answers 404. A caller scoped to one shop reads\n * only that shop's payments.\n *\n * `GET /payments/{paymentId}/agent-signal`\n */\n async agentSignal(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentAgentSignalResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/agent-signal`, options);\n }\n\n /** Product names and prices as frozen when the payment was created. */\n async productLines(paymentId: string): Promise<PaymentProductLines> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/lines`);\n }\n\n /**\n * List every attempt made on a payment, each with its full failure detail\n * (`error_code` / `error_message`, the Delopay-unified `unified_code` and\n * `unified_message`, and structured `error_details`).\n *\n * Useful for surfacing retries across connectors — e.g. \"attempt 1 stripe →\n * insufficient_funds, attempt 2 adyen → success\".\n *\n * `GET /payments/{paymentId}/attempts`\n *\n * @param paymentId - The payment intent ID whose attempts to list.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n * @returns The attempt list — `size` plus a `data` array of attempts.\n * @throws If the payment does not exist or belongs to another merchant (404).\n *\n * @example\n * ```typescript\n * const { size, data } = await delopay.payments.listAttempts('pay_abc123');\n * for (const attempt of data) {\n * console.log(attempt.status, attempt.unified_message ?? attempt.error_message);\n * }\n * ```\n */\n async listAttempts(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentAttemptsListResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/attempts`, options);\n }\n\n /**\n * The status timeline of a payment: every recorded creation / status\n * transition of the intent and its attempts, refunds and disputes, oldest\n * first. `complete: false` marks timelines partially reconstructed from\n * current records (payments created before the status log existed).\n *\n * @param paymentId - The payment intent ID.\n * @returns The ordered status-history events.\n *\n * @example\n * ```typescript\n * const { events, complete } = await delopay.payments.listStatusHistory('pay_abc123');\n * for (const event of events) {\n * console.log(event.timestamp, event.entity_type, event.status);\n * }\n * ```\n */\n async listStatusHistory(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentStatusHistoryResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/status-history`,\n options,\n );\n }\n\n /**\n * The traffic of a payment, oldest first: the requests DeloPay sent to the\n * payment provider, the webhooks the provider sent, and the webhooks DeloPay\n * sent to the shop with every delivery attempt. No payloads; read an entry\n * with {@link getLogConnectorCall}, {@link getLogIncomingWebhook} or\n * {@link getLogOutgoingWebhook}. Dashboard (JWT) only.\n *\n * @param paymentId - The payment intent ID.\n *\n * @example\n * ```typescript\n * const logs = await delopay.payments.listLogs('pay_abc123');\n * if (!logs.psp_traffic_recorded) console.log('provider traffic is not recorded');\n * ```\n */\n async listLogs(paymentId: string, options?: RequestExtras): Promise<PaymentLogsResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/logs`, options);\n }\n\n /** One provider request of a payment, with its masked request, response and error. */\n async getLogConnectorCall(\n paymentId: string,\n callId: string,\n options?: RequestExtras,\n ): Promise<PaymentLogConnectorCallDetail> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/logs/connector-calls/${encodeURIComponent(callId)}`,\n options,\n );\n }\n\n /** One provider webhook of a payment, with its masked headers and body. */\n async getLogIncomingWebhook(\n paymentId: string,\n eventId: string,\n options?: RequestExtras,\n ): Promise<PaymentLogIncomingWebhookDetail> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/logs/incoming-webhooks/${encodeURIComponent(eventId)}`,\n options,\n );\n }\n\n /** Every delivery attempt of one shop webhook of a payment, with request and response. */\n async getLogOutgoingWebhook(\n paymentId: string,\n initialAttemptId: string,\n options?: RequestExtras,\n ): Promise<PaymentLogOutgoingWebhookDetail> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/logs/outgoing-webhooks/${encodeURIComponent(initialAttemptId)}`,\n options,\n );\n }\n\n /**\n * What the payment's rail says about settling each attempt: whether the\n * money is still `pending` in the rail's hands, `available` in its balance\n * (**not** paid out), `paid_out` to a bank — with the payout's date and\n * reference — or came back as `payout_failed`; and, for the rest, which\n * kind of not-knowing applies (`unavailable`, `unknown`, `not_recorded`).\n * See {@link ConnectorSettlementStatus} for the seven values. The same\n * status for the active attempt rides on every list row and retrieve as\n * `connector_settlement_status`, and the list filters on it.\n *\n * Not the hosted-shop settlement API under `settlement.*`, which is host →\n * shop owner and manual; this is acquirer → merchant bank, per payment.\n *\n * Each attempt also carries what the rail itself took for it —\n * `processor_cost_amount` with its own `processor_cost_currency` and\n * `processor_cost_exponent`, the `processor_cost_source` that says how the\n * figure was obtained, the `processor_cost_basis` behind an estimate, and\n * the `connector_method_code` it was priced under. Recorded for **every**\n * merchant, not only those that host shops. Never present an `estimated`\n * cost as an observation, and read an absent `processor_cost_source` as\n * \"nothing was ever written\", which is not the `unavailable` the rail\n * answers with.\n *\n * `GET /payments/{paymentId}/settlement`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n * @returns The attempts this caller may see, oldest first, each with its\n * settlement status.\n * @throws If the payment does not exist (404), or the caller is a\n * profile-scoped (shop) role, who is refused rather than shown a redacted\n * body (403).\n *\n * @example\n * ```typescript\n * const { attempts } = await delopay.payments.settlement('pay_abc123');\n * for (const attempt of attempts) {\n * if (attempt.status === 'paid_out') {\n * console.log(attempt.paid_out_at, attempt.payout_reference);\n * }\n * if (attempt.processor_cost_source === 'estimated') {\n * // Label it an estimate — it was derived from a cost schedule.\n * }\n * }\n * ```\n */\n async settlement(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentConnectorSettlementResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/settlement`, options);\n }\n\n /**\n * Update an existing payment intent before it is confirmed.\n *\n * @param paymentId - The payment intent ID to update.\n * @param params - Fields to update (amount, currency, metadata, etc.).\n * @returns The updated payment intent.\n */\n async update(paymentId: string, params: PaymentUpdateRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}`, { body: params });\n }\n\n /**\n * Confirm a payment intent, triggering authorisation with the selected gateway.\n *\n * @param paymentId - The payment intent ID to confirm.\n * @param params - Confirmation parameters (payment method data, return URL, etc.).\n * @returns The updated payment intent.\n *\n * A buyer the merchant's buyer risk model refuses fails before any processor\n * is called, with a `DelopayError` of code `DE_23` (`buyer_risk_refused`,\n * HTTP 422). The error does not say which signal fired; read the evaluation\n * with {@link Payments.buyerRisk}. A shop whose payments are switched off is\n * refused with `DE_21`.\n */\n async confirm(paymentId: string, params: PaymentConfirmRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/confirm`, {\n body: params,\n });\n }\n\n /**\n * Capture a previously authorised payment.\n *\n * @param paymentId - The payment intent ID to capture.\n * @param params - Optional capture parameters (partial capture amount, etc.).\n * @returns The updated payment intent.\n */\n async capture(paymentId: string, params?: PaymentCaptureRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/capture`, {\n body: params,\n });\n }\n\n /**\n * Cancel a payment intent that has not yet been captured.\n *\n * @param paymentId - The payment intent ID to cancel.\n * @param params - Optional cancellation reason.\n * @returns The updated payment intent.\n */\n async cancel(paymentId: string, params?: PaymentCancelRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/cancel`, {\n body: params,\n });\n }\n\n /**\n * Abort a payment nobody has paid. The payment becomes `aborted`: its hosted\n * checkout stops taking payments, a confirm is refused, and it can no longer\n * be reactivated. Every processor object a buyer could still pay is closed\n * where the processor allows it, and a `payment_aborted` webhook is sent.\n *\n * A success the processor confirms later still moves the payment to\n * `succeeded`, so the order can be fulfilled or refunded. Aborting an\n * aborted payment returns it unchanged. A payment that took money, holds an\n * authorisation or awaits a merchant decision is refused with `IR_16`\n * (HTTP 400).\n *\n * `POST /payments/{paymentId}/abort`\n *\n * @param paymentId - The payment intent ID to abort.\n * @param params - Optional `reason`, at most 255 characters, stored as the\n * attempt's cancellation reason (`merchant_aborted` when absent).\n * @returns The payment, with status `aborted`.\n *\n * @example\n * ```typescript\n * const payment = await delopay.payments.abort('pay_123', { reason: 'order_cancelled' });\n * ```\n */\n async abort(paymentId: string, params?: PaymentAbortRequest): Promise<PaymentResponse> {\n // The route requires a JSON body, even an empty one.\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/abort`, {\n body: params ?? {},\n });\n }\n\n /**\n * Mark a payment as an integration test, or remove the mark.\n *\n * A marked payment stays live or test as it was; only analytics leave it\n * out, from their next refresh on. Every change is recorded in the\n * payment's status history with the person who made it. Needs a dashboard\n * JWT with write access to transactions. Asking for the mark the payment\n * already carries changes nothing (`changed: false`).\n *\n * `POST /payments/{paymentId}/integration-test`\n *\n * @example\n * ```typescript\n * const { is_integration_test } = await delopay.payments.setIntegrationTest('pay_123', {\n * is_integration_test: true,\n * });\n * ```\n */\n async setIntegrationTest(\n paymentId: string,\n params: PaymentIntegrationTestRequest,\n ): Promise<PaymentIntegrationTestResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/integration-test`, {\n body: params,\n });\n }\n\n /**\n * List payment intents, optionally filtered by customer or date range.\n *\n * @param params - Optional filter and pagination parameters.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal` for cancellation.\n * @returns Paginated list of payment intents.\n *\n * @example\n * ```typescript\n * const { data } = await delopay.payments.list({ customer_id: 'cus_123', limit: 25 });\n * ```\n */\n async list(params?: PaymentListParams, options?: RequestExtras): Promise<PaymentListResponse> {\n return this.request('GET', '/payments/list', {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * The status timeline of client/device observations captured while the\n * buyer interacted with the payment (checkout opens, confirms, redirect\n * legs, reported client signals), oldest first.\n *\n * `GET /payments/{paymentId}/client-context`\n */\n async listClientContext(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentClientContextListResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/client-context`,\n options,\n );\n }\n\n /**\n * The routing decision recorded behind each attempt of a payment: which rule\n * matched, which candidates routing produced and which filter removed each,\n * which volume bucket was drawn and what the counters read, which\n * configuration version was live.\n *\n * This is the only truthful account of **how the connector was chosen**.\n * `routing_approach` on the payment is seeded on creation and several paths —\n * mandate, pre-routed and pinned-account among them — return before it is\n * overwritten, so it can still read `default_fallback` on a payment that was\n * routed by a rule. Read {@link RoutingDecision.decision_kind} instead.\n *\n * An attempt with `decision: null` simply has no record: the recorder is\n * best-effort, attempts that never reached routing have nothing to record,\n * and attempts predating the record exist in quantity. It is not an error.\n *\n * `GET /payments/{paymentId}/routing-decisions`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n * @returns Every attempt returned for this payment, with its decision.\n *\n * @example\n * ```typescript\n * const { attempts } = await delopay.payments.routingDecisions('pay_abc123');\n * for (const attempt of attempts) {\n * if (!attempt.decision) continue;\n * console.log(attempt.connector, attempt.decision.decision_kind);\n * }\n * ```\n */\n async routingDecisions(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentRoutingDecisionsResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/routing-decisions`,\n options,\n );\n }\n\n /**\n * The statement name and suffix each attempt of a payment asked for and was\n * sent to its provider with. A name the merchant, the shop or the connector\n * account configures replaces the payment's own: `name_ignored` /\n * `suffix_ignored` say the payment's value was not used, and a `null` sent\n * value leaves the provider account's own default.\n *\n * Only attempts with a record are listed: one that carried no name and was\n * sent none, or ran before the record existed, is absent.\n *\n * `GET /payments/{paymentId}/statement-descriptors`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n *\n * @example\n * ```typescript\n * const { attempts } = await delopay.payments.statementDescriptors('pay_abc123');\n * const last = attempts.at(-1);\n * if (last?.name_ignored) console.log(`Sent as ${last.sent_name}`);\n * ```\n */\n async statementDescriptors(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentStatementDescriptorsResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/statement-descriptors`,\n options,\n );\n }\n\n /**\n * Open a playback of the payment's stored checkout recording: the audited\n * act of watching. Answers the manifest — which slices exist, how long the\n * recording runs, whether a pause in it is expected — and the\n * `playback_id` every {@link Payments.replaySlice} call carries.\n *\n * A payment that was never recorded answers `200` with `slices: []` and\n * `session_id: null` — the ordinary case for every payment made before the\n * checkout started recording — not a `404`. `404` means the payment does not\n * exist. Fetch the slices in `sequence` order; a number missing from the\n * list is a gap, not the end.\n *\n * A `POST`, because it writes one audit row: the SDK retries `GET` on its\n * own, and a lost response must not open three playbacks. Calling this\n * again deliberately opens another playback.\n *\n * Requires the `PaymentReplay` permission on a dashboard session in addition\n * to payment read access.\n *\n * `POST /payments/{paymentId}/replay/playback`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n */\n async openReplayPlayback(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<ReplayPlaybackResponse> {\n return this.request(\n 'POST',\n `/payments/${encodeURIComponent(paymentId)}/replay/playback`,\n options,\n );\n }\n\n /**\n * One slice of the payment's stored checkout recording, read against an\n * open playback: the rrweb events the checkout recorded under that number.\n * `playbackId` and the numbers come from {@link Payments.openReplayPlayback};\n * a `playbackId` that names no playback of this payment opened by this\n * caller, and a number the manifest does not list, both answer `404`.\n * Not audited per slice — the playback was.\n *\n * `GET /payments/{paymentId}/replay/playback/{playbackId}/slices/{sequence}`\n *\n * @param paymentId - The payment intent ID.\n * @param playbackId - The playback, from `openReplayPlayback`.\n * @param sequence - The slice number, from the playback's manifest.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n */\n async replaySlice(\n paymentId: string,\n playbackId: string,\n sequence: number,\n options?: RequestExtras,\n ): Promise<ReplaySliceResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/replay/playback/${encodeURIComponent(playbackId)}/slices/${encodeURIComponent(String(sequence))}`,\n options,\n );\n }\n\n /**\n * Soft-delete a payment. Only payments whose status is in the merchant's\n * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;\n * anything else fails with a precondition error.\n *\n * `DELETE /payments/{paymentId}`\n */\n async delete(paymentId: string, options?: RequestExtras): Promise<PaymentsDeleteResponse> {\n return this.request('DELETE', `/payments/${encodeURIComponent(paymentId)}`, options);\n }\n\n /**\n * The effective deletable-status set for the calling merchant — lets a\n * dashboard show the delete action only where it is allowed.\n *\n * `GET /payments/delete-policy`\n */\n async getDeletePolicy(options?: RequestExtras): Promise<PaymentsDeletePolicyResponse> {\n return this.request('GET', '/payments/delete-policy', options);\n }\n\n // --- Advanced operations (Task 3.2) ---\n\n /** Generate session tokens. `POST /payments/session-tokens` */\n async sessionTokens(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payments/session-tokens', { body: params });\n }\n\n /** Retrieve payment with gateway credentials. `POST /payments/sync` */\n async sync(params: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('POST', '/payments/sync', { body: params });\n }\n\n /** Cancel after partial capture. `POST /payments/{paymentId}/cancel-post-capture` */\n async cancelPostCapture(\n paymentId: string,\n params?: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/cancel-post-capture`, {\n body: params,\n });\n }\n\n /** Incrementally authorize more funds. `POST /payments/{paymentId}/incremental-authorization` */\n async incrementalAuthorization(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request(\n 'POST',\n `/payments/${encodeURIComponent(paymentId)}/incremental-authorization`,\n {\n body: params,\n },\n );\n }\n\n /** Extend authorization window. `POST /payments/{paymentId}/extend-authorization` */\n async extendAuthorization(\n paymentId: string,\n params?: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/extend-authorization`, {\n body: params,\n });\n }\n\n /** Complete authorization. `POST /payments/{paymentId}/complete-authorize` */\n async completeAuthorize(\n paymentId: string,\n params?: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/complete-authorize`, {\n body: params,\n });\n }\n\n /** Dynamic tax calculation. `POST /payments/{paymentId}/calculate-tax` */\n async calculateTax(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/calculate-tax`, {\n body: params,\n });\n }\n\n /** Update payment metadata. `POST /payments/{paymentId}/update-metadata` */\n async updateMetadata(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/update-metadata`, {\n body: params,\n });\n }\n\n /** Retrieve extended card info. `GET /payments/{paymentId}/extended-card-info` */\n async extendedCardInfo(paymentId: string): Promise<Record<string, unknown>> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/extended-card-info`);\n }\n\n // --- OLAP extensions (Task 4.2) ---\n\n /** List payments (profile-scoped). `GET /payments/profile/list` */\n async listByProfile(params?: PaymentListParams): Promise<PaymentListResponse> {\n return this.request('GET', '/payments/profile/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /** List payments across all shops. `GET /payments/list-all-shops` */\n async listAllShops(params?: PaymentListParams): Promise<PaymentListResponse> {\n return this.request('GET', '/payments/list-all-shops', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /** List payments by filter (POST body). `POST /payments/list` */\n async listByFilter(params: PaymentListFilterConstraints): Promise<PaymentListFilteredResponse> {\n return this.request('POST', '/payments/list', { body: params });\n }\n\n /**\n * List payments by filter, scoped to the caller's profile (the shop-user\n * twin of `listByFilter`). The backend narrows to the profile from the\n * auth context, so `profile_id` / `project_id` must not be sent — and\n * neither may `connector_settlement_status`, which this route refuses\n * (403): a shop-scoped viewer is not shown the settlement state, and the\n * type leaves the key out so it cannot be probed through `total_count`.\n *\n * Not to be confused with {@link Payments.listByProfile}, which is the GET\n * cursor variant and rejects this body.\n *\n * `POST /payments/profile/list`\n */\n async listByProfileFilter(\n params: ProfilePaymentListFilterConstraints,\n options?: RequestExtras,\n ): Promise<PaymentListFilteredResponse> {\n return this.request('POST', '/payments/profile/list', { body: params, ...options });\n }\n\n /** Get payment filter options. `GET /payments/filter` */\n async getFilters(\n params?: Record<string, string | number | undefined>,\n ): Promise<PaymentListFiltersExt> {\n return this.request('GET', '/payments/filter', { query: params });\n }\n\n /**\n * Get payment filter options, scoped to the caller's profile.\n * `GET /payments/profile/filter`\n */\n async getFiltersByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<PaymentListFiltersExt> {\n return this.request('GET', '/payments/profile/filter', { query: params });\n }\n\n /** Get payment aggregates. `GET /payments/aggregate` */\n async aggregate(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/payments/aggregate', { query: params });\n }\n\n /** Get payment aggregates (profile-scoped). `GET /payments/profile/aggregate` */\n async aggregateByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/payments/profile/aggregate', { query: params });\n }\n\n /** Manually update payment status. `PUT /payments/{paymentId}/manual-update` */\n async manualUpdate(paymentId: string, params: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('PUT', `/payments/${encodeURIComponent(paymentId)}/manual-update`, {\n body: params,\n });\n }\n\n /** Approve a payment waiting for review. `POST /payments/{paymentId}/approve` */\n async approve(paymentId: string, params?: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/approve`, {\n body: params,\n });\n }\n\n /** Reject a payment waiting for review. `POST /payments/{paymentId}/reject` */\n async reject(paymentId: string, params?: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/reject`, {\n body: params,\n });\n }\n\n /** Initiate external 3DS authentication. `POST /payments/{paymentId}/3ds/authentication` */\n async threeDsAuthentication(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/3ds/authentication`, {\n body: params,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-I65QS3YQ.cjs","../src/resources/payments.ts"],"names":[],"mappings":"AAAA;ACyCO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgDlD,MAAM,MAAA,CACJ,MAAA,EACA,OAAA,EAC0B;AAC1B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,WAAA,EAAa,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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EAAA;AACP,IAAA;AAC7B,EAAA;AAAA;AAGiG,EAAA;AACvD,IAAA;AAChC,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAG6F,EAAA;AAClD,IAAA;AACjC,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAG4F,EAAA;AACjD,IAAA;AACjC,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAMoC,EAAA;AACO,IAAA;AACjC,MAAA;AACP,IAAA;AACH,EAAA;AACF;AD7K4D;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-I65QS3YQ.cjs","sourcesContent":[null,"import type {\n BuyerRiskEvaluationsResponse,\n BuyerRiskReleaseResponse,\n PaymentAgentSignalResponse,\n PaymentClientContextListResponse,\n PaymentCreateRequest,\n ProductPaymentCreateRequest,\n ProductsPaymentCreateRequest,\n PaymentListFilterConstraints,\n PaymentListFilteredResponse,\n ProfilePaymentListFilterConstraints,\n PaymentListResponse,\n PaymentResponse,\n PaymentProductLines,\n PaymentRetrieveOptions,\n PaymentUpdateRequest,\n PaymentConfirmRequest,\n PaymentCaptureRequest,\n PaymentCancelRequest,\n PaymentAbortRequest,\n PaymentIntegrationTestRequest,\n PaymentIntegrationTestResponse,\n PaymentListParams,\n PaymentAttemptsListResponse,\n PaymentConnectorSettlementResponse,\n PaymentsDeletePolicyResponse,\n PaymentsDeleteResponse,\n PaymentStatusHistoryResponse,\n PaymentLogsResponse,\n PaymentLogConnectorCallDetail,\n PaymentLogIncomingWebhookDetail,\n PaymentLogOutgoingWebhookDetail,\n PaymentRoutingDecisionsResponse,\n PaymentStatementDescriptorsResponse,\n ReplayPlaybackResponse,\n ReplaySliceResponse,\n PaymentListFiltersExt,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/** Manage payment intents — create, confirm, capture, cancel, and list payments. */\nexport class Payments {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a new payment intent.\n *\n * @param params - An explicit amount and currency, or a DeloPay one-time\n * product whose active price supplies both on the server.\n * @param options - Optional per-call extras: extra `headers` (e.g. an\n * `Idempotency-Key` to make the create safe to retry), a `timeout` override,\n * and an `AbortSignal`.\n * @returns The created payment intent.\n *\n * @example\n * ```typescript\n * const payment = await delopay.payments.create(\n * { amount: 5000, currency: 'EUR', customer_id: 'cus_123' },\n * { headers: { 'Idempotency-Key': 'order_1001' } },\n * );\n * ```\n *\n * @example Charge the active default price of a shop-owned product without\n * copying the product to the payment provider:\n * ```typescript\n * const payment = await delopay.payments.create({\n * product_id: 'prd_123',\n * profile_id: 'pro_123',\n * payment_link: true,\n * });\n * ```\n *\n * @example Send `test_mode` to pick the environment per payment, so a staging\n * deploy cannot charge real cards and a forgotten processor toggle cannot\n * swallow production traffic:\n * ```typescript\n * const payment = await delopay.payments.create({\n * amount: 5000,\n * currency: 'EUR',\n * test_mode: process.env.NODE_ENV !== 'production',\n * });\n * ```\n *\n * A payment that pins one connector through `routing` (the `single` form)\n * is now checked against `test_mode` here rather than at confirm: if that\n * connector has no credentials for the environment asked for, create fails\n * instead of handing back a payment whose checkout the buyer cannot\n * complete. `priority` and `volume_split` name several accounts and are\n * still resolved at confirm.\n */\n async create(\n params: PaymentCreateRequest | ProductPaymentCreateRequest | ProductsPaymentCreateRequest,\n options?: RequestExtras,\n ): Promise<PaymentResponse> {\n return this.request('POST', '/payments', { body: params, ...options });\n }\n\n /**\n * Retrieve a payment by its ID.\n *\n * @param paymentId - The unique payment intent ID.\n * @param options - Optional query flags. `force_sync` reconciles the\n * intent's state with the connector before returning (useful to recover\n * a stuck intent when a webhook was lost). `all_keys_required` forces a\n * connector sync even for intents in early states like\n * `requires_payment_method` that would otherwise return the local\n * snapshot. Both flags work with JWT and API-key authentication.\n * @returns The payment intent.\n *\n * @example\n * ```typescript\n * const payment = await delopay.payments.retrieve('pay_abc123');\n * const synced = await delopay.payments.retrieve('pay_abc123', {\n * force_sync: true,\n * all_keys_required: true,\n * });\n * ```\n */\n async retrieve(paymentId: string, options?: PaymentRetrieveOptions): Promise<PaymentResponse> {\n const path = `/payments/${encodeURIComponent(paymentId)}`;\n if (options === undefined) return this.request('GET', path);\n const query: Record<string, boolean> = {};\n if (options.force_sync !== undefined) query['force_sync'] = options.force_sync;\n if (options.all_keys_required !== undefined) {\n query['all_keys_required'] = options.all_keys_required;\n }\n if (Object.keys(query).length === 0) return this.request('GET', path);\n return this.request('GET', path, { query });\n }\n\n /**\n * The payment's buyer risk evaluations, newest first (at most 50): each\n * one's score from 0 to 100, its band, the action the merchant's model asks\n * for that band and the action that was taken, the signals that fired with\n * the points each added, and the model version it was scored with.\n *\n * A payment is scored at every confirm that is about to reach a processor;\n * a payment never scored answers an empty list. A caller scoped to one shop\n * reads only that shop's payments.\n *\n * `GET /payments/{paymentId}/buyer-risk`\n */\n async buyerRisk(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<BuyerRiskEvaluationsResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);\n }\n\n /**\n * Lift the holds put on an authorized payment when a chargeback prevention\n * alert or an AML hit on the same buyer arrived after it was scored and the\n * shop's `buyer_risk_source_changes` setting asked to hold it. Until then a\n * capture is refused with `IR_16`; after the release the payment can be\n * captured or cancelled as usual. A payment with no hold answers an empty\n * list. A caller scoped to one shop releases only that shop's payments.\n *\n * `POST /payments/{paymentId}/buyer-risk/release`\n */\n async releaseBuyerRiskHold(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<BuyerRiskReleaseResponse> {\n return this.request(\n 'POST',\n `/payments/${encodeURIComponent(paymentId)}/buyer-risk/release`,\n options,\n );\n }\n\n /**\n * What the payment's checkout client was, for AI shopping agents: a\n * verified agent (with its operator, protocol and key), an agent signature\n * that did not verify (with the reason), an automated client, or a browser.\n * The hosted checkout's render and the buyer's confirm are both judged, and\n * the strongest observation is kept.\n *\n * A payment never observed answers 404. A caller scoped to one shop reads\n * only that shop's payments.\n *\n * `GET /payments/{paymentId}/agent-signal`\n */\n async agentSignal(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentAgentSignalResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/agent-signal`, options);\n }\n\n /** Product names and prices as frozen when the payment was created. */\n async productLines(paymentId: string): Promise<PaymentProductLines> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/lines`);\n }\n\n /**\n * List every attempt made on a payment, each with its full failure detail\n * (`error_code` / `error_message`, the Delopay-unified `unified_code` and\n * `unified_message`, and structured `error_details`).\n *\n * Useful for surfacing retries across connectors — e.g. \"attempt 1 stripe →\n * insufficient_funds, attempt 2 adyen → success\".\n *\n * `GET /payments/{paymentId}/attempts`\n *\n * @param paymentId - The payment intent ID whose attempts to list.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n * @returns The attempt list — `size` plus a `data` array of attempts.\n * @throws If the payment does not exist or belongs to another merchant (404).\n *\n * @example\n * ```typescript\n * const { size, data } = await delopay.payments.listAttempts('pay_abc123');\n * for (const attempt of data) {\n * console.log(attempt.status, attempt.unified_message ?? attempt.error_message);\n * }\n * ```\n */\n async listAttempts(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentAttemptsListResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/attempts`, options);\n }\n\n /**\n * The status timeline of a payment: every recorded creation / status\n * transition of the intent and its attempts, refunds and disputes, oldest\n * first. `complete: false` marks timelines partially reconstructed from\n * current records (payments created before the status log existed).\n *\n * @param paymentId - The payment intent ID.\n * @returns The ordered status-history events.\n *\n * @example\n * ```typescript\n * const { events, complete } = await delopay.payments.listStatusHistory('pay_abc123');\n * for (const event of events) {\n * console.log(event.timestamp, event.entity_type, event.status);\n * }\n * ```\n */\n async listStatusHistory(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentStatusHistoryResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/status-history`,\n options,\n );\n }\n\n /**\n * The traffic of a payment, oldest first: the requests DeloPay sent to the\n * payment provider, the webhooks the provider sent, and the webhooks DeloPay\n * sent to the shop with every delivery attempt. No payloads; read an entry\n * with {@link getLogConnectorCall}, {@link getLogIncomingWebhook} or\n * {@link getLogOutgoingWebhook}. Dashboard (JWT) only.\n *\n * @param paymentId - The payment intent ID.\n *\n * @example\n * ```typescript\n * const logs = await delopay.payments.listLogs('pay_abc123');\n * if (!logs.psp_traffic_recorded) console.log('provider traffic is not recorded');\n * ```\n */\n async listLogs(paymentId: string, options?: RequestExtras): Promise<PaymentLogsResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/logs`, options);\n }\n\n /** One provider request of a payment, with its masked request, response and error. */\n async getLogConnectorCall(\n paymentId: string,\n callId: string,\n options?: RequestExtras,\n ): Promise<PaymentLogConnectorCallDetail> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/logs/connector-calls/${encodeURIComponent(callId)}`,\n options,\n );\n }\n\n /** One provider webhook of a payment, with its masked headers and body. */\n async getLogIncomingWebhook(\n paymentId: string,\n eventId: string,\n options?: RequestExtras,\n ): Promise<PaymentLogIncomingWebhookDetail> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/logs/incoming-webhooks/${encodeURIComponent(eventId)}`,\n options,\n );\n }\n\n /** Every delivery attempt of one shop webhook of a payment, with request and response. */\n async getLogOutgoingWebhook(\n paymentId: string,\n initialAttemptId: string,\n options?: RequestExtras,\n ): Promise<PaymentLogOutgoingWebhookDetail> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/logs/outgoing-webhooks/${encodeURIComponent(initialAttemptId)}`,\n options,\n );\n }\n\n /**\n * What the payment's rail says about settling each attempt: whether the\n * money is still `pending` in the rail's hands, `available` in its balance\n * (**not** paid out), `paid_out` to a bank — with the payout's date and\n * reference — or came back as `payout_failed`; and, for the rest, which\n * kind of not-knowing applies (`unavailable`, `unknown`, `not_recorded`).\n * See {@link ConnectorSettlementStatus} for the seven values. The same\n * status for the active attempt rides on every list row and retrieve as\n * `connector_settlement_status`, and the list filters on it.\n *\n * Not the hosted-shop settlement API under `settlement.*`, which is host →\n * shop owner and manual; this is acquirer → merchant bank, per payment.\n *\n * Each attempt also carries what the rail itself took for it —\n * `processor_cost_amount` with its own `processor_cost_currency` and\n * `processor_cost_exponent`, the `processor_cost_source` that says how the\n * figure was obtained, the `processor_cost_basis` behind an estimate, and\n * the `connector_method_code` it was priced under. Recorded for **every**\n * merchant, not only those that host shops. Never present an `estimated`\n * cost as an observation, and read an absent `processor_cost_source` as\n * \"nothing was ever written\", which is not the `unavailable` the rail\n * answers with.\n *\n * `GET /payments/{paymentId}/settlement`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n * @returns The attempts this caller may see, oldest first, each with its\n * settlement status.\n * @throws If the payment does not exist (404), or the caller is a\n * profile-scoped (shop) role, who is refused rather than shown a redacted\n * body (403).\n *\n * @example\n * ```typescript\n * const { attempts } = await delopay.payments.settlement('pay_abc123');\n * for (const attempt of attempts) {\n * if (attempt.status === 'paid_out') {\n * console.log(attempt.paid_out_at, attempt.payout_reference);\n * }\n * if (attempt.processor_cost_source === 'estimated') {\n * // Label it an estimate — it was derived from a cost schedule.\n * }\n * }\n * ```\n */\n async settlement(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentConnectorSettlementResponse> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/settlement`, options);\n }\n\n /**\n * Update an existing payment intent before it is confirmed.\n *\n * @param paymentId - The payment intent ID to update.\n * @param params - Fields to update (amount, currency, metadata, etc.).\n * @returns The updated payment intent.\n */\n async update(paymentId: string, params: PaymentUpdateRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}`, { body: params });\n }\n\n /**\n * Confirm a payment intent, triggering authorisation with the selected gateway.\n *\n * @param paymentId - The payment intent ID to confirm.\n * @param params - Confirmation parameters (payment method data, return URL, etc.).\n * @returns The updated payment intent.\n *\n * A buyer the merchant's buyer risk model refuses fails before any processor\n * is called, with a `DelopayError` of code `DE_23` (`buyer_risk_refused`,\n * HTTP 422). The error does not say which signal fired; read the evaluation\n * with {@link Payments.buyerRisk}. A shop whose payments are switched off is\n * refused with `DE_21`.\n */\n async confirm(paymentId: string, params: PaymentConfirmRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/confirm`, {\n body: params,\n });\n }\n\n /**\n * Capture a previously authorised payment.\n *\n * @param paymentId - The payment intent ID to capture.\n * @param params - Optional capture parameters (partial capture amount, etc.).\n * @returns The updated payment intent.\n */\n async capture(paymentId: string, params?: PaymentCaptureRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/capture`, {\n body: params,\n });\n }\n\n /**\n * Cancel a payment intent that has not yet been captured.\n *\n * @param paymentId - The payment intent ID to cancel.\n * @param params - Optional cancellation reason.\n * @returns The updated payment intent.\n */\n async cancel(paymentId: string, params?: PaymentCancelRequest): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/cancel`, {\n body: params,\n });\n }\n\n /**\n * Abort a payment nobody has paid. The payment becomes `aborted`: its hosted\n * checkout stops taking payments, a confirm is refused, and it can no longer\n * be reactivated. Every processor object a buyer could still pay is closed\n * where the processor allows it, and a `payment_aborted` webhook is sent.\n *\n * A success the processor confirms later still moves the payment to\n * `succeeded`, so the order can be fulfilled or refunded. Aborting an\n * aborted payment returns it unchanged. A payment that took money, holds an\n * authorisation or awaits a merchant decision is refused with `IR_16`\n * (HTTP 400).\n *\n * `POST /payments/{paymentId}/abort`\n *\n * @param paymentId - The payment intent ID to abort.\n * @param params - Optional `reason`, at most 255 characters, stored as the\n * attempt's cancellation reason (`merchant_aborted` when absent).\n * @returns The payment, with status `aborted`.\n *\n * @example\n * ```typescript\n * const payment = await delopay.payments.abort('pay_123', { reason: 'order_cancelled' });\n * ```\n */\n async abort(paymentId: string, params?: PaymentAbortRequest): Promise<PaymentResponse> {\n // The route requires a JSON body, even an empty one.\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/abort`, {\n body: params ?? {},\n });\n }\n\n /**\n * Mark a payment as an integration test, or remove the mark.\n *\n * A marked payment stays live or test as it was; only analytics leave it\n * out, from their next refresh on. Every change is recorded in the\n * payment's status history with the person who made it. Needs a dashboard\n * JWT with write access to transactions. Asking for the mark the payment\n * already carries changes nothing (`changed: false`).\n *\n * `POST /payments/{paymentId}/integration-test`\n *\n * @example\n * ```typescript\n * const { is_integration_test } = await delopay.payments.setIntegrationTest('pay_123', {\n * is_integration_test: true,\n * });\n * ```\n */\n async setIntegrationTest(\n paymentId: string,\n params: PaymentIntegrationTestRequest,\n ): Promise<PaymentIntegrationTestResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/integration-test`, {\n body: params,\n });\n }\n\n /**\n * List payment intents, optionally filtered by customer or date range.\n *\n * @param params - Optional filter and pagination parameters.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal` for cancellation.\n * @returns Paginated list of payment intents.\n *\n * @example\n * ```typescript\n * const { data } = await delopay.payments.list({ customer_id: 'cus_123', limit: 25 });\n * ```\n */\n async list(params?: PaymentListParams, options?: RequestExtras): Promise<PaymentListResponse> {\n return this.request('GET', '/payments/list', {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * The status timeline of client/device observations captured while the\n * buyer interacted with the payment (checkout opens, confirms, redirect\n * legs, reported client signals), oldest first.\n *\n * `GET /payments/{paymentId}/client-context`\n */\n async listClientContext(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentClientContextListResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/client-context`,\n options,\n );\n }\n\n /**\n * The routing decision recorded behind each attempt of a payment: which rule\n * matched, which candidates routing produced and which filter removed each,\n * which volume bucket was drawn and what the counters read, which\n * configuration version was live.\n *\n * This is the only truthful account of **how the connector was chosen**.\n * `routing_approach` on the payment is seeded on creation and several paths —\n * mandate, pre-routed and pinned-account among them — return before it is\n * overwritten, so it can still read `default_fallback` on a payment that was\n * routed by a rule. Read {@link RoutingDecision.decision_kind} instead.\n *\n * An attempt with `decision: null` simply has no record: the recorder is\n * best-effort, attempts that never reached routing have nothing to record,\n * and attempts predating the record exist in quantity. It is not an error.\n *\n * `GET /payments/{paymentId}/routing-decisions`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n * @returns Every attempt returned for this payment, with its decision.\n *\n * @example\n * ```typescript\n * const { attempts } = await delopay.payments.routingDecisions('pay_abc123');\n * for (const attempt of attempts) {\n * if (!attempt.decision) continue;\n * console.log(attempt.connector, attempt.decision.decision_kind);\n * }\n * ```\n */\n async routingDecisions(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentRoutingDecisionsResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/routing-decisions`,\n options,\n );\n }\n\n /**\n * The statement name and suffix each attempt of a payment asked for and was\n * sent to its provider with. A name the merchant, the shop or the connector\n * account configures replaces the payment's own: `name_ignored` /\n * `suffix_ignored` say the payment's value was not used, and a `null` sent\n * value leaves the provider account's own default.\n *\n * Only attempts with a record are listed: one that carried no name and was\n * sent none, or ran before the record existed, is absent.\n *\n * `GET /payments/{paymentId}/statement-descriptors`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n *\n * @example\n * ```typescript\n * const { attempts } = await delopay.payments.statementDescriptors('pay_abc123');\n * const last = attempts.at(-1);\n * if (last?.name_ignored) console.log(`Sent as ${last.sent_name}`);\n * ```\n */\n async statementDescriptors(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<PaymentStatementDescriptorsResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/statement-descriptors`,\n options,\n );\n }\n\n /**\n * Open a playback of the payment's stored checkout recording: the audited\n * act of watching. Answers the manifest — which slices exist, how long the\n * recording runs, whether a pause in it is expected — and the\n * `playback_id` every {@link Payments.replaySlice} call carries.\n *\n * A payment that was never recorded answers `200` with `slices: []` and\n * `session_id: null` — the ordinary case for every payment made before the\n * checkout started recording — not a `404`. `404` means the payment does not\n * exist. Fetch the slices in `sequence` order; a number missing from the\n * list is a gap, not the end.\n *\n * A `POST`, because it writes one audit row: the SDK retries `GET` on its\n * own, and a lost response must not open three playbacks. Calling this\n * again deliberately opens another playback.\n *\n * Requires the `PaymentReplay` permission on a dashboard session in addition\n * to payment read access.\n *\n * `POST /payments/{paymentId}/replay/playback`\n *\n * @param paymentId - The payment intent ID.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n */\n async openReplayPlayback(\n paymentId: string,\n options?: RequestExtras,\n ): Promise<ReplayPlaybackResponse> {\n return this.request(\n 'POST',\n `/payments/${encodeURIComponent(paymentId)}/replay/playback`,\n options,\n );\n }\n\n /**\n * One slice of the payment's stored checkout recording, read against an\n * open playback: the rrweb events the checkout recorded under that number.\n * `playbackId` and the numbers come from {@link Payments.openReplayPlayback};\n * a `playbackId` that names no playback of this payment opened by this\n * caller, and a number the manifest does not list, both answer `404`.\n * Not audited per slice — the playback was.\n *\n * `GET /payments/{paymentId}/replay/playback/{playbackId}/slices/{sequence}`\n *\n * @param paymentId - The payment intent ID.\n * @param playbackId - The playback, from `openReplayPlayback`.\n * @param sequence - The slice number, from the playback's manifest.\n * @param options - Optional per-call extras: extra `headers`, a `timeout`\n * override, and an `AbortSignal`.\n */\n async replaySlice(\n paymentId: string,\n playbackId: string,\n sequence: number,\n options?: RequestExtras,\n ): Promise<ReplaySliceResponse> {\n return this.request(\n 'GET',\n `/payments/${encodeURIComponent(paymentId)}/replay/playback/${encodeURIComponent(playbackId)}/slices/${encodeURIComponent(String(sequence))}`,\n options,\n );\n }\n\n /**\n * Soft-delete a payment. Only payments whose status is in the merchant's\n * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;\n * anything else fails with a precondition error.\n *\n * `DELETE /payments/{paymentId}`\n */\n async delete(paymentId: string, options?: RequestExtras): Promise<PaymentsDeleteResponse> {\n return this.request('DELETE', `/payments/${encodeURIComponent(paymentId)}`, options);\n }\n\n /**\n * The effective deletable-status set for the calling merchant — lets a\n * dashboard show the delete action only where it is allowed.\n *\n * `GET /payments/delete-policy`\n */\n async getDeletePolicy(options?: RequestExtras): Promise<PaymentsDeletePolicyResponse> {\n return this.request('GET', '/payments/delete-policy', options);\n }\n\n // --- Advanced operations (Task 3.2) ---\n\n /** Generate session tokens. `POST /payments/session-tokens` */\n async sessionTokens(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payments/session-tokens', { body: params });\n }\n\n /** Retrieve payment with gateway credentials. `POST /payments/sync` */\n async sync(params: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('POST', '/payments/sync', { body: params });\n }\n\n /** Cancel after partial capture. `POST /payments/{paymentId}/cancel-post-capture` */\n async cancelPostCapture(\n paymentId: string,\n params?: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/cancel-post-capture`, {\n body: params,\n });\n }\n\n /** Incrementally authorize more funds. `POST /payments/{paymentId}/incremental-authorization` */\n async incrementalAuthorization(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request(\n 'POST',\n `/payments/${encodeURIComponent(paymentId)}/incremental-authorization`,\n {\n body: params,\n },\n );\n }\n\n /** Extend authorization window. `POST /payments/{paymentId}/extend-authorization` */\n async extendAuthorization(\n paymentId: string,\n params?: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/extend-authorization`, {\n body: params,\n });\n }\n\n /** Complete authorization. `POST /payments/{paymentId}/complete-authorize` */\n async completeAuthorize(\n paymentId: string,\n params?: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/complete-authorize`, {\n body: params,\n });\n }\n\n /** Dynamic tax calculation. `POST /payments/{paymentId}/calculate-tax` */\n async calculateTax(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/calculate-tax`, {\n body: params,\n });\n }\n\n /** Update payment metadata. `POST /payments/{paymentId}/update-metadata` */\n async updateMetadata(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/update-metadata`, {\n body: params,\n });\n }\n\n /** Retrieve extended card info. `GET /payments/{paymentId}/extended-card-info` */\n async extendedCardInfo(paymentId: string): Promise<Record<string, unknown>> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/extended-card-info`);\n }\n\n // --- OLAP extensions (Task 4.2) ---\n\n /** List payments (profile-scoped). `GET /payments/profile/list` */\n async listByProfile(params?: PaymentListParams): Promise<PaymentListResponse> {\n return this.request('GET', '/payments/profile/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /** List payments across all shops. `GET /payments/list-all-shops` */\n async listAllShops(params?: PaymentListParams): Promise<PaymentListResponse> {\n return this.request('GET', '/payments/list-all-shops', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /** List payments by filter (POST body). `POST /payments/list` */\n async listByFilter(params: PaymentListFilterConstraints): Promise<PaymentListFilteredResponse> {\n return this.request('POST', '/payments/list', { body: params });\n }\n\n /**\n * List payments by filter, scoped to the caller's profile (the shop-user\n * twin of `listByFilter`). The backend narrows to the profile from the\n * auth context, so `profile_id` / `project_id` must not be sent — and\n * neither may `connector_settlement_status`, which this route refuses\n * (403): a shop-scoped viewer is not shown the settlement state, and the\n * type leaves the key out so it cannot be probed through `total_count`.\n *\n * Not to be confused with {@link Payments.listByProfile}, which is the GET\n * cursor variant and rejects this body.\n *\n * `POST /payments/profile/list`\n */\n async listByProfileFilter(\n params: ProfilePaymentListFilterConstraints,\n options?: RequestExtras,\n ): Promise<PaymentListFilteredResponse> {\n return this.request('POST', '/payments/profile/list', { body: params, ...options });\n }\n\n /** Get payment filter options. `GET /payments/filter` */\n async getFilters(\n params?: Record<string, string | number | undefined>,\n ): Promise<PaymentListFiltersExt> {\n return this.request('GET', '/payments/filter', { query: params });\n }\n\n /**\n * Get payment filter options, scoped to the caller's profile.\n * `GET /payments/profile/filter`\n */\n async getFiltersByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<PaymentListFiltersExt> {\n return this.request('GET', '/payments/profile/filter', { query: params });\n }\n\n /** Get payment aggregates. `GET /payments/aggregate` */\n async aggregate(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/payments/aggregate', { query: params });\n }\n\n /** Get payment aggregates (profile-scoped). `GET /payments/profile/aggregate` */\n async aggregateByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/payments/profile/aggregate', { query: params });\n }\n\n /** Manually update payment status. `PUT /payments/{paymentId}/manual-update` */\n async manualUpdate(paymentId: string, params: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('PUT', `/payments/${encodeURIComponent(paymentId)}/manual-update`, {\n body: params,\n });\n }\n\n /** Approve a payment waiting for review. `POST /payments/{paymentId}/approve` */\n async approve(paymentId: string, params?: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/approve`, {\n body: params,\n });\n }\n\n /** Reject a payment waiting for review. `POST /payments/{paymentId}/reject` */\n async reject(paymentId: string, params?: Record<string, unknown>): Promise<PaymentResponse> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/reject`, {\n body: params,\n });\n }\n\n /** Initiate external 3DS authentication. `POST /payments/{paymentId}/3ds/authentication` */\n async threeDsAuthentication(\n paymentId: string,\n params: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n return this.request('POST', `/payments/${encodeURIComponent(paymentId)}/3ds/authentication`, {\n body: params,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-IKXGA2Z5.cjs","../src/resources/featureMatrix.ts"],"names":[],"mappings":"AAAA;ACOO,IAAM,cAAA,EAAN,MAAoB;AAAA,EACzB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,QAAA,CAAA,EAA2C;AAC/C,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,iBAAiB,CAAA;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mBAAA,CAAoB,UAAA,EAAoD;AAC5E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,gBAAA,EAAmB,kBAAA,CAAmB,UAAU,CAAC,CAAA,CAAA;AAC9E,EAAA;AACF;ADLiF;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-IKXGA2Z5.cjs","sourcesContent":[null,"import type { FeatureMatrixResponse } from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * What each connector can do: payment methods, capture methods, webhook\n * flows, and whether an unverified webhook is acted on.\n */\nexport class FeatureMatrix {\n constructor(private readonly request: RequestFn) {}\n\n /** Retrieve the feature matrix. `GET /feature-matrix` */\n async retrieve(): Promise<FeatureMatrixResponse> {\n return this.request('GET', '/feature-matrix');\n }\n\n /**\n * Retrieve the feature matrix scoped to a merchant. Beta connectors\n * are filtered against the merchant's allowlist so the dashboard only\n * surfaces connectors the merchant can actually attach.\n * `GET /feature-matrix/{merchantId}`\n */\n async retrieveForMerchant(merchantId: string): Promise<FeatureMatrixResponse> {\n return this.request('GET', `/feature-matrix/${encodeURIComponent(merchantId)}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-IR2LFKKA.cjs","../src/internal/resources/admin.ts"],"names":[],"mappings":"AAAA;ACaO,IAAM,MAAA,EAAN,MAAY;AAAA,EACjB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA,EAElD,MAAM,MAAA,CAAO,MAAA,EAAmD;AAC9D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,eAAA,EAAiB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAC/D;AAAA,EAEA,MAAM,kBAAA,CAAmB,MAAA,EAA+D;AACtF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxE;AAAA,EAEA,MAAM,YAAA,CAAa,MAAA,EAA6D;AAC9E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,sBAAA,EAAwB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,oBAAA,CAAqB,MAAA,EAAiE;AAC1F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,gCAAA,EAAkC,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAChF;AAAA;AAAA,EAGA,MAAM,iBAAA,CAAkB,MAAA,EAA4D;AAClF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxE;AAAA;AAAA,EAGA,MAAM,iBAAA,CAAA,EAAmD;AACvD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAwB,CAAA;AAAA,EACrD;AAAA;AAAA,EAGA,MAAM,eAAA,CAAgB,MAAA,EAAkE;AACtF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,yBAAA,EAA2B,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACzE;AACF,CAAA;ADhBA;AACA;AACE;AACF,sBAAC","file":"/tmp/delopay-sdk-publish/dist/chunk-IR2LFKKA.cjs","sourcesContent":[null,"import type { AuthResponse, SignUpWithMerchantIdRequest } from '../../types';\nimport type {\n AdminSignInRequest,\n AuthorizeResponse,\n CreateInternalUserRequest,\n CreateTenantUserRequest,\n OnboardMerchantRequest,\n OnboardMerchantResponse,\n SignupToggleRequest,\n SignupToggleResponse,\n} from '../types';\nimport type { RequestFn } from '../../client';\n\nexport class Admin {\n constructor(private readonly request: RequestFn) {}\n\n async signIn(params: AdminSignInRequest): Promise<AuthResponse> {\n return this.request('POST', '/admin/signin', { body: params });\n }\n\n async createInternalUser(params: CreateInternalUserRequest): Promise<AuthorizeResponse> {\n return this.request('POST', '/admin/internal-signup', { body: params });\n }\n\n async createTenant(params: CreateTenantUserRequest): Promise<AuthorizeResponse> {\n return this.request('POST', '/admin/tenant-signup', { body: params });\n }\n\n /**\n * Create a new merchant admin user and merchant account atomically.\n *\n * This is the correct endpoint for bootstrapping the first admin user in a\n * fresh deployment — `internal-signup`/`tenant-signup` both require\n * pre-existing merchant records that don't exist on a clean database.\n *\n * `POST /admin/signup-with-merchant-id`\n */\n async signupWithMerchantId(params: SignUpWithMerchantIdRequest): Promise<AuthorizeResponse> {\n return this.request('POST', '/admin/signup-with-merchant-id', { body: params });\n }\n\n /** Toggle public signup on/off. `POST /admin/settings/signup` */\n async setSignupSettings(params: SignupToggleRequest): Promise<SignupToggleResponse> {\n return this.request('POST', '/admin/settings/signup', { body: params });\n }\n\n /** Read current public-signup status. `GET /admin/settings/signup` */\n async getSignupSettings(): Promise<SignupToggleResponse> {\n return this.request('GET', '/admin/settings/signup');\n }\n\n /** Full merchant bootstrap — user + merchant + project + profile + keys. `POST /admin/onboard-merchant` */\n async onboardMerchant(params: OnboardMerchantRequest): Promise<OnboardMerchantResponse> {\n return this.request('POST', '/admin/onboard-merchant', { body: params });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-K5Q2H3VD.cjs","../src/internal/resources/adminSupport.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACeA,IAAM,KAAA,EAAO,CAAC,EAAA,EAAA,GACZ,CAAA,oCAAA,EAAuC,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAA;AAGrC;AACyB,EAAA;AAApB,IAAA;AAAqB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO+B,EAAA;AACb,IAAA;AACX,MAAA;AACtD,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAM0F,EAAA;AACb,IAAA;AAC7E,EAAA;AAAA;AAAA;AAAA;AAAA;AAM+E,EAAA;AACA,IAAA;AAC/E,EAAA;AAAA;AAGkE,EAAA;AAC7B,IAAA;AACrC,EAAA;AAAA;AAG0F,EAAA;AACzC,IAAA;AACjD,EAAA;AAAA;AAGsF,EAAA;AACjC,IAAA;AACG,MAAA;AACrD,IAAA;AACH,EAAA;AAAA;AAGsF,EAAA;AACxB,IAAA;AAC9D,EAAA;AAAA;AAAA;AAAA;AAAA;AAWkC,EAAA;AACN,IAAA;AACoB,IAAA;AACM,IAAA;AACb,IAAA;AAC8B,IAAA;AACvE,EAAA;AAAA;AAAA;AAAA;AAAA;AAMoE,EAAA;AACO,IAAA;AACzD,MAAA;AACf,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAMkE,EAAA;AAClB,IAAA;AAChD,EAAA;AACF;AD7BiF;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-K5Q2H3VD.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type {\n SupportAttachmentView,\n SupportMessageList,\n SupportMessagesQuery,\n SupportMessageView,\n} from '../../types';\nimport type {\n SupportRecipientList,\n SupportRecipientsQuery,\n SupportStaffConversationCreate,\n SupportStaffConversationList,\n SupportStaffConversationView,\n SupportStaffListQuery,\n SupportStaffMessageCreate,\n SupportStaffUpdate,\n} from '../types';\nimport { csvQuery } from '../../listQuery';\n\nconst path = (id: string): string =>\n `/admin-portal/support/conversations/${encodeURIComponent(id)}`;\n\n/** DeloPay's support queue, across merchants. Answers 404 while support is not available. */\nexport class AdminSupport {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The queue, the latest message first unless `sort_by` says otherwise.\n * Several `kind`, `category` or `status` values match a conversation with\n * any of them. `GET /admin-portal/support/conversations`\n */\n async list(query?: SupportStaffListQuery): Promise<SupportStaffConversationList> {\n return this.request('GET', '/admin-portal/support/conversations', {\n query: csvQuery(query, ['kind', 'category', 'status']),\n });\n }\n\n /**\n * Open a conversation towards a merchant, one of its shops or one of its members,\n * with a first message from the support team. `POST /admin-portal/support/conversations`\n */\n async create(body: SupportStaffConversationCreate): Promise<SupportStaffConversationView> {\n return this.request('POST', '/admin-portal/support/conversations', { body });\n }\n\n /**\n * The members of a merchant a message can be addressed to, with whether their role\n * opens the support page. `GET /admin-portal/support/recipients`\n */\n async recipients(query: SupportRecipientsQuery): Promise<SupportRecipientList> {\n return this.request('GET', '/admin-portal/support/recipients', { query: { ...query } });\n }\n\n /** One conversation. `GET /admin-portal/support/conversations/{id}` */\n async retrieve(id: string): Promise<SupportStaffConversationView> {\n return this.request('GET', path(id));\n }\n\n /** Change status, kind, category or assignee. `PATCH /admin-portal/support/conversations/{id}` */\n async update(id: string, body: SupportStaffUpdate): Promise<SupportStaffConversationView> {\n return this.request('PATCH', path(id), { body });\n }\n\n /** Messages, notes included. `GET /admin-portal/support/conversations/{id}/messages` */\n async messages(id: string, query?: SupportMessagesQuery): Promise<SupportMessageList> {\n return this.request('GET', `${path(id)}/messages`, {\n query: query === undefined ? undefined : { ...query },\n });\n }\n\n /** Answer, or leave a note. `POST /admin-portal/support/conversations/{id}/messages` */\n async reply(id: string, body: SupportStaffMessageCreate): Promise<SupportMessageView> {\n return this.request('POST', `${path(id)}/messages`, { body });\n }\n\n /**\n * Upload a file for a message from staff, scanned like a merchant's.\n * `POST /admin-portal/support/conversations/{id}/attachments`\n */\n async uploadAttachment(\n id: string,\n file: Blob,\n clientUploadId: string,\n fileName?: string,\n ): Promise<SupportAttachmentView> {\n const form = new FormData();\n form.append('client_upload_id', clientUploadId);\n if (fileName === undefined) form.append('file', file);\n else form.append('file', file, fileName);\n return this.request('POST', `${path(id)}/attachments`, { body: form });\n }\n\n /**\n * Fetch a file once its scan is clean. A blocked file stays shut for staff too.\n * `GET /admin-portal/support/conversations/{id}/attachments/{fileId}`\n */\n async downloadAttachment(id: string, fileId: string): Promise<Blob> {\n return this.request('GET', `${path(id)}/attachments/${encodeURIComponent(fileId)}`, {\n responseType: 'blob',\n });\n }\n\n /**\n * Clear the staff unread mark and read the conversation as it is now.\n * `POST /admin-portal/support/conversations/{id}/read`\n */\n async markRead(id: string): Promise<SupportStaffConversationView> {\n return this.request('POST', `${path(id)}/read`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-KD5Y2YWK.cjs","../src/recordCounter.ts"],"names":[],"mappings":"AAAA;ACgBA,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,MAAA,EAAQ,EAAA;AACd,IAAM,UAAA,EAAY,EAAA;AAClB,IAAM,WAAA,EAAa,GAAA;AACnB,IAAM,YAAA,EAAc,GAAA;AACpB,IAAM,aAAA,EAAe,E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,CAAA,EAAoB;AACtB,IAAA,OAAO,IAAA,CAAK,MAAA,IAAU,MAAA;AAAA,EACxB;AAAA,EAEA,MAAA,CAAA,EAAiB;AACf,IAAA,OAAO,IAAA,CAAK,KAAA;AAAA,EACd;AACF,CAAA;AD/DA;AACA;AACE;AACA;AACF,qGAAC","file":"/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-KD5Y2YWK.cjs","sourcesContent":[null,"/**\n * Incremental record counters for streamed export bodies.\n *\n * An export streams its body and announces, in `X-Delopay-Record-Count`, how\n * many records that body will hold. These count the records actually received,\n * chunk by chunk, so a download can show `receivedRecords` of\n * `expectedRecords` while it runs and the finished file can be held to the\n * announced figure.\n *\n * They work on **bytes**, never on decoded text. Every character they look at —\n * `\"` `\\` `{` `}` `[` `]` and the line break — is ASCII, and no byte of a\n * multi-byte UTF-8 sequence falls in the ASCII range, so a chunk boundary can\n * land anywhere, the middle of a character included, without a decoder having\n * to carry a partial sequence across it.\n */\n\nconst LF = 0x0a;\nconst CR = 0x0d;\nconst QUOTE = 0x22;\nconst BACKSLASH = 0x5c;\nconst OPEN_BRACE = 0x7b;\nconst CLOSE_BRACE = 0x7d;\nconst OPEN_BRACKET = 0x5b;\nconst CLOSE_BRACKET = 0x5d;\n\n/** Counts the records in a body fed to it one chunk at a time. */\nexport interface RecordCounter {\n /** Feed the next chunk of the body, in order. */\n push(chunk: Uint8Array): void;\n /** Records complete in what has been fed so far. */\n readonly records: number;\n /**\n * Whether what has been fed ends where a whole export body ends. A body\n * that stops anywhere else was cut off, whatever its record count says.\n */\n readonly complete: boolean;\n /** Records in the body, once it has ended. Does not change the counter. */\n finish(): number;\n}\n\n/**\n * RFC 4180 CSV with a header line: one record per line, where a field holding\n * `,` `\"` or a line break is quoted and a quote inside it is doubled.\n *\n * A newline inside quotes is part of a field, not the end of a record, so every\n * `\"` toggles \"inside quotes\". A doubled `\"\"` toggles twice and leaves it as it\n * was, which is exactly its meaning. Records are the newlines outside quotes,\n * less one for the header.\n */\nexport class CsvRecordCounter implements RecordCounter {\n private inQuotes = false;\n private newlines = 0;\n /** Whether anything but a line break has arrived since the last newline. */\n private lineHasContent = false;\n\n push(chunk: Uint8Array): void {\n let inQuotes = this.inQuotes;\n let newlines = this.newlines;\n let lineHasContent = this.lineHasContent;\n for (const byte of chunk) {\n if (byte === QUOTE) {\n inQuotes = !inQuotes;\n lineHasContent = true;\n } else if (inQuotes) {\n lineHasContent = true;\n } else if (byte === LF) {\n newlines++;\n lineHasContent = false;\n } else if (byte !== CR) {\n lineHasContent = true;\n }\n }\n this.inQuotes = inQuotes;\n this.newlines = newlines;\n this.lineHasContent = lineHasContent;\n }\n\n get records(): number {\n return Math.max(0, this.newlines - 1);\n }\n\n /**\n * The export writer ends every line — the header and each record — with a\n * newline, so a whole body ends on one, outside quotes. RFC 4180 lets a\n * final line break be omitted, but these bodies never omit it, and without\n * that rule a file cut part-way through its last unquoted field\n * (`pay_1,12` of `pay_1,123`) would count as one more whole record and\n * match the figure it was announced with.\n */\n get complete(): boolean {\n return this.newlines >= 1 && !this.inQuotes && !this.lineHasContent;\n }\n\n /**\n * The records that ended. An unterminated tail is not one of them — see\n * {@link complete}.\n */\n finish(): number {\n return this.records;\n }\n}\n\n/** Before the rows array, inside it, and past its end. */\nconst SEEKING = 0;\nconst COUNTING = 1;\nconst CLOSED = 2;\ntype ArrayState = typeof SEEKING | typeof COUNTING | typeof CLOSED;\n\n/**\n * A JSON object whose rows are an array member — `{\"records\":[…],…}` or\n * `{\"data\":[…],…}`.\n *\n * Counts the elements of the **first** array that is a direct member of the\n * top-level object: each one is counted as it closes back to that array's\n * depth, so a record is counted once it has fully arrived, never on its first\n * byte. Counting stops when that array closes, so an array later in the\n * envelope (inside the echoed `filters`, say) is never mistaken for rows.\n *\n * Strings are tracked with their escapes, so a `}` `]` or `\"` inside a value\n * is text, not structure. Elements are counted when an object or array closes;\n * a bare scalar element is not a record and is not counted.\n */\nexport class JsonArrayRecordCounter implements RecordCounter {\n private depth = 0;\n private inString = false;\n private escaped = false;\n private topIsObject = false;\n private state: ArrayState = SEEKING;\n private count = 0;\n\n push(chunk: Uint8Array): void {\n if (this.state === CLOSED) return;\n let { depth, inString, escaped, topIsObject, count } = this;\n let state: ArrayState = this.state;\n for (const byte of chunk) {\n if (inString) {\n if (escaped) escaped = false;\n else if (byte === BACKSLASH) escaped = true;\n else if (byte === QUOTE) inString = false;\n continue;\n }\n if (byte === QUOTE) {\n inString = true;\n } else if (byte === OPEN_BRACE || byte === OPEN_BRACKET) {\n if (depth === 0 && byte === OPEN_BRACE) topIsObject = true;\n if (byte === OPEN_BRACKET && depth === 1 && topIsObject && state === SEEKING) {\n state = COUNTING;\n }\n depth++;\n } else if (byte === CLOSE_BRACE || byte === CLOSE_BRACKET) {\n depth--;\n if (state === COUNTING) {\n // Depth 2 is the rows array's own level: a value closing back to it\n // is one complete row. Closing to depth 1 is the array itself ending.\n if (depth === 2) count++;\n else if (depth === 1) {\n state = CLOSED;\n break;\n }\n }\n }\n }\n this.depth = depth;\n this.inString = inString;\n this.escaped = escaped;\n this.topIsObject = topIsObject;\n this.state = state;\n this.count = count;\n }\n\n get records(): number {\n return this.count;\n }\n\n /**\n * Whether the rows array has closed. What follows it is checked by parsing\n * the whole document, which a cut-off body fails.\n */\n get complete(): boolean {\n return this.state === CLOSED;\n }\n\n finish(): number {\n return this.count;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-KD5Y2YWK.cjs","../src/recordCounter.ts"],"names":[],"mappings":"AAAA;ACgBA,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,MAAA,EAAQ,EAAA;AACd,IAAM,UAAA,EAAY,EAAA;AAClB,IAAM,WAAA,EAAa,GAAA;AACnB,IAAM,YAAA,EAAc,GAAA;AACpB,IAAM,aAAA,EAAe,EAAA;AACrB,IAAM,cAAA,EAAgB,EAAA;AA0Bf,IAAM,iBAAA,EAAN,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AAA,EACxB;AAAA,EAEA,MAAA,CAAA,EAAiB;AACf,IAAA,OAAO,IAAA,CAAK,KAAA;AAAA,EACd;AACF,CAAA;AD/DA;AACA;AACE;AACA;AACF,qGAAC","file":"/tmp/delopay-sdk-publish/dist/chunk-KD5Y2YWK.cjs","sourcesContent":[null,"/**\n * Incremental record counters for streamed export bodies.\n *\n * An export streams its body and announces, in `X-Delopay-Record-Count`, how\n * many records that body will hold. These count the records actually received,\n * chunk by chunk, so a download can show `receivedRecords` of\n * `expectedRecords` while it runs and the finished file can be held to the\n * announced figure.\n *\n * They work on **bytes**, never on decoded text. Every character they look at —\n * `\"` `\\` `{` `}` `[` `]` and the line break — is ASCII, and no byte of a\n * multi-byte UTF-8 sequence falls in the ASCII range, so a chunk boundary can\n * land anywhere, the middle of a character included, without a decoder having\n * to carry a partial sequence across it.\n */\n\nconst LF = 0x0a;\nconst CR = 0x0d;\nconst QUOTE = 0x22;\nconst BACKSLASH = 0x5c;\nconst OPEN_BRACE = 0x7b;\nconst CLOSE_BRACE = 0x7d;\nconst OPEN_BRACKET = 0x5b;\nconst CLOSE_BRACKET = 0x5d;\n\n/** Counts the records in a body fed to it one chunk at a time. */\nexport interface RecordCounter {\n /** Feed the next chunk of the body, in order. */\n push(chunk: Uint8Array): void;\n /** Records complete in what has been fed so far. */\n readonly records: number;\n /**\n * Whether what has been fed ends where a whole export body ends. A body\n * that stops anywhere else was cut off, whatever its record count says.\n */\n readonly complete: boolean;\n /** Records in the body, once it has ended. Does not change the counter. */\n finish(): number;\n}\n\n/**\n * RFC 4180 CSV with a header line: one record per line, where a field holding\n * `,` `\"` or a line break is quoted and a quote inside it is doubled.\n *\n * A newline inside quotes is part of a field, not the end of a record, so every\n * `\"` toggles \"inside quotes\". A doubled `\"\"` toggles twice and leaves it as it\n * was, which is exactly its meaning. Records are the newlines outside quotes,\n * less one for the header.\n */\nexport class CsvRecordCounter implements RecordCounter {\n private inQuotes = false;\n private newlines = 0;\n /** Whether anything but a line break has arrived since the last newline. */\n private lineHasContent = false;\n\n push(chunk: Uint8Array): void {\n let inQuotes = this.inQuotes;\n let newlines = this.newlines;\n let lineHasContent = this.lineHasContent;\n for (const byte of chunk) {\n if (byte === QUOTE) {\n inQuotes = !inQuotes;\n lineHasContent = true;\n } else if (inQuotes) {\n lineHasContent = true;\n } else if (byte === LF) {\n newlines++;\n lineHasContent = false;\n } else if (byte !== CR) {\n lineHasContent = true;\n }\n }\n this.inQuotes = inQuotes;\n this.newlines = newlines;\n this.lineHasContent = lineHasContent;\n }\n\n get records(): number {\n return Math.max(0, this.newlines - 1);\n }\n\n /**\n * The export writer ends every line — the header and each record — with a\n * newline, so a whole body ends on one, outside quotes. RFC 4180 lets a\n * final line break be omitted, but these bodies never omit it, and without\n * that rule a file cut part-way through its last unquoted field\n * (`pay_1,12` of `pay_1,123`) would count as one more whole record and\n * match the figure it was announced with.\n */\n get complete(): boolean {\n return this.newlines >= 1 && !this.inQuotes && !this.lineHasContent;\n }\n\n /**\n * The records that ended. An unterminated tail is not one of them — see\n * {@link complete}.\n */\n finish(): number {\n return this.records;\n }\n}\n\n/** Before the rows array, inside it, and past its end. */\nconst SEEKING = 0;\nconst COUNTING = 1;\nconst CLOSED = 2;\ntype ArrayState = typeof SEEKING | typeof COUNTING | typeof CLOSED;\n\n/**\n * A JSON object whose rows are an array member — `{\"records\":[…],…}` or\n * `{\"data\":[…],…}`.\n *\n * Counts the elements of the **first** array that is a direct member of the\n * top-level object: each one is counted as it closes back to that array's\n * depth, so a record is counted once it has fully arrived, never on its first\n * byte. Counting stops when that array closes, so an array later in the\n * envelope (inside the echoed `filters`, say) is never mistaken for rows.\n *\n * Strings are tracked with their escapes, so a `}` `]` or `\"` inside a value\n * is text, not structure. Elements are counted when an object or array closes;\n * a bare scalar element is not a record and is not counted.\n */\nexport class JsonArrayRecordCounter implements RecordCounter {\n private depth = 0;\n private inString = false;\n private escaped = false;\n private topIsObject = false;\n private state: ArrayState = SEEKING;\n private count = 0;\n\n push(chunk: Uint8Array): void {\n if (this.state === CLOSED) return;\n let { depth, inString, escaped, topIsObject, count } = this;\n let state: ArrayState = this.state;\n for (const byte of chunk) {\n if (inString) {\n if (escaped) escaped = false;\n else if (byte === BACKSLASH) escaped = true;\n else if (byte === QUOTE) inString = false;\n continue;\n }\n if (byte === QUOTE) {\n inString = true;\n } else if (byte === OPEN_BRACE || byte === OPEN_BRACKET) {\n if (depth === 0 && byte === OPEN_BRACE) topIsObject = true;\n if (byte === OPEN_BRACKET && depth === 1 && topIsObject && state === SEEKING) {\n state = COUNTING;\n }\n depth++;\n } else if (byte === CLOSE_BRACE || byte === CLOSE_BRACKET) {\n depth--;\n if (state === COUNTING) {\n // Depth 2 is the rows array's own level: a value closing back to it\n // is one complete row. Closing to depth 1 is the array itself ending.\n if (depth === 2) count++;\n else if (depth === 1) {\n state = CLOSED;\n break;\n }\n }\n }\n }\n this.depth = depth;\n this.inString = inString;\n this.escaped = escaped;\n this.topIsObject = topIsObject;\n this.state = state;\n this.count = count;\n }\n\n get records(): number {\n return this.count;\n }\n\n /**\n * Whether the rows array has closed. What follows it is checked by parsing\n * the whole document, which a cut-off body fails.\n */\n get complete(): boolean {\n return this.state === CLOSED;\n }\n\n finish(): number {\n return this.count;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-KJDMNF2T.cjs","../src/exportDownload.ts"],"names":["received"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACKA,IAAM,oBAAA,EAAsB,wBAAA;AAGrB,IAAM,oBAAA,EAAsB,+BAAA;AAO5B,IAAM,wBAAA,EAA0B,EAAA,EAAI,IAAA;AAOpC,SAAS,kBAAA,CAAmB,YAAA,EAA0C;AAC3E,EAAA,MAAM,MAAA,EAAQ,IAAI,WAAA,CAAY,CAAA,CAAE,MAAA,CAAO,IAAA,CAAK,SAAA,C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;AACA","file":"/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-KJDMNF2T.cjs","sourcesContent":[null,"import { DelopayError } from './error';\nimport type { DownloadProgressEvent, RequestFn, RequestOptions } from './client';\nimport type {\n ExportFormat,\n ExportOptions,\n ExportPresentation,\n ExportProgress,\n ExportTransferOptions,\n} from './types';\nimport { CsvRecordCounter, JsonArrayRecordCounter } from './recordCounter';\nimport type { RecordCounter } from './recordCounter';\n\n/** The header a streamed export announces its record count in. */\nconst RECORD_COUNT_HEADER = 'x-delopay-record-count';\n\n/** The header a PDF export's words travel in. */\nexport const PRESENTATION_HEADER = 'X-Delopay-Export-Presentation';\n\n/**\n * Longest encoded presentation the server reads. A longer one is refused\n * there with `IR_06`; checked here first, so the caller hears it before a\n * request is sent and without a proxy's opinion of a long header in between.\n */\nexport const MAX_PRESENTATION_HEADER = 6 * 1024;\n\n/**\n * `presentation` as the header carries it: base64url, unpadded, of its UTF-8\n * JSON. Rejects with `EXPORT_PRESENTATION_TOO_LARGE` past\n * {@link MAX_PRESENTATION_HEADER}.\n */\nexport function encodePresentation(presentation: ExportPresentation): string {\n const bytes = new TextEncoder().encode(JSON.stringify(presentation));\n let binary = '';\n for (const byte of bytes) binary += String.fromCharCode(byte);\n const encoded = btoa(binary).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n if (encoded.length > MAX_PRESENTATION_HEADER) {\n throw new DelopayError(\n `Export presentation is ${encoded.length} bytes encoded; the server reads at most ${MAX_PRESENTATION_HEADER}`,\n {\n status: 0,\n code: 'EXPORT_PRESENTATION_TOO_LARGE',\n type: 'invalid_request',\n data: { encoded_length: encoded.length, max_length: MAX_PRESENTATION_HEADER },\n },\n );\n }\n return encoded;\n}\n\n/**\n * Where a `json` export keeps its rows, and its own count of them.\n *\n * Every list export answers `{\"records\":[…],\"record_count\":N,\"filters\":{…}}`;\n * the disputes workspace answers `{\"data\":[…],\"total_count\":N}`.\n */\nexport interface ExportEnvelopeShape {\n rows: string;\n count: string;\n}\n\n/** `{\"records\":[…],\"record_count\":N,\"filters\":{…}}` — every list export. */\nexport const LIST_ENVELOPE: ExportEnvelopeShape = { rows: 'records', count: 'record_count' };\n\n/** `{\"data\":[…],\"total_count\":N}` — the disputes workspace export. */\nexport const WORKSPACE_ENVELOPE: ExportEnvelopeShape = { rows: 'data', count: 'total_count' };\n\n/** One export request, as the resource method built it. */\nexport interface ExportCall {\n method: string;\n path: string;\n /**\n * The request without its transfer options: filters, headers (`Accept`\n * included) and `responseType`.\n */\n request: RequestOptions;\n format: ExportFormat;\n /** The `json` envelope. Defaults to {@link LIST_ENVELOPE}. */\n envelope?: ExportEnvelopeShape;\n}\n\n/**\n * `X-Delopay-Record-Count` as a count, or `null` when there is none.\n *\n * Only a plain run of digits is a count. Anything else — a value a proxy\n * mangled, two values folded into one — is treated as no announcement rather\n * than guessed at.\n */\nfunction parseRecordCount(header: string | null): number | null {\n if (header === null) return null;\n const trimmed = header.trim();\n if (!/^\\d+$/.test(trimmed)) return null;\n const value = Number(trimmed);\n return Number.isSafeInteger(value) ? value : null;\n}\n\nfunction counterFor(format: ExportFormat): RecordCounter | null {\n if (format === 'csv') return new CsvRecordCounter();\n if (format === 'json') return new JsonArrayRecordCounter();\n return null;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** `\" of the N announced\"`, or nothing when the server announced no count. */\nfunction announced(expected: number | null): string {\n return expected === null ? '' : ` of the ${expected} announced`;\n}\n\nfunction incomplete(\n message: string,\n expected: number | null,\n received: number,\n requestId: string | undefined,\n): DelopayError {\n return new DelopayError(message, {\n status: 0,\n code: 'EXPORT_INCOMPLETE',\n type: 'export_incomplete',\n ...(requestId !== undefined ? { requestId } : {}),\n data: { expected_records: expected, received_records: received },\n });\n}\n\n/**\n * Run one export: send it, report its progress, and hold the finished body to\n * the size the server announced before handing it back.\n *\n * The check is the point. These are finance files, and a body that ends short\n * of `X-Delopay-Record-Count` is a file missing rows that would otherwise open,\n * sum and reconcile without a word. It is refused with `EXPORT_INCOMPLETE`\n * rather than returned. For `json` the envelope's own count is held to its\n * rows as well, and a body that is not a whole JSON document is incomplete by\n * definition.\n *\n * `onProgress` hears `preparing` synchronously, before anything is sent — the\n * caller's `async` method runs this far on the call itself.\n */\nexport async function downloadExport<T>(\n request: RequestFn,\n call: ExportCall,\n options: ExportTransferOptions | undefined,\n): Promise<T> {\n const { format } = call;\n const envelope = call.envelope ?? LIST_ENVELOPE;\n const onProgress = options?.onProgress;\n\n let latest: ExportProgress = {\n phase: 'preparing',\n receivedBytes: 0,\n totalBytes: null,\n receivedRecords: 0,\n expectedRecords: null,\n };\n // What the current attempt's headers announced, what its body has\n // delivered, and whether the caller's own listener threw. Kept on an object\n // because the listeners below write it.\n const seen: {\n attempt: number;\n counter: RecordCounter | null;\n expected: number | null;\n requestId: string | undefined;\n listenerError: { error: unknown } | null;\n } = { attempt: -1, counter: null, expected: null, requestId: undefined, listenerError: null };\n\n // A copy each time, so a listener that keeps the snapshots it is given\n // keeps what it was told. What it throws is remembered so it reaches the\n // caller as itself: a `SyntaxError` in a progress bar is not a body that\n // failed to parse.\n const report = (progress: ExportProgress) => {\n latest = progress;\n if (!onProgress) return;\n try {\n onProgress({ ...progress });\n } catch (error) {\n seen.listenerError = { error };\n throw error;\n }\n };\n report(latest);\n\n const onDownloadProgress = (event: DownloadProgressEvent) => {\n if (event.attempt !== seen.attempt) {\n // The headers of a new attempt: a retry starts the body over, so the\n // count does too.\n seen.attempt = event.attempt;\n seen.counter = counterFor(format);\n // A PDF is not counted, so an announced count could only ever fail it.\n seen.expected =\n format === 'pdf' ? null : parseRecordCount(event.headers.get(RECORD_COUNT_HEADER));\n seen.requestId =\n event.headers.get('x-request-id') ?? event.headers.get('x-trace-id') ?? undefined;\n }\n if (event.chunk.byteLength > 0) seen.counter?.push(event.chunk);\n report({\n phase: 'receiving',\n receivedBytes: event.loaded,\n totalBytes: event.total,\n receivedRecords: seen.counter?.records ?? 0,\n expectedRecords: seen.expected,\n });\n };\n\n let result: unknown;\n try {\n result = await request<unknown>(call.method, call.path, {\n ...call.request,\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n ...(options?.timeout !== undefined ? { timeout: options.timeout } : {}),\n onDownloadProgress,\n });\n } catch (err) {\n if (seen.listenerError !== null && err === seen.listenerError.error) throw err;\n // The body arrived whole as far as the connection could tell, but it does\n // not parse: it stopped part-way through the document.\n if (format === 'json' && seen.attempt >= 0 && err instanceof SyntaxError) {\n const received = seen.counter?.records ?? 0;\n throw incomplete(\n seen.expected === null\n ? `Export incomplete: the body ended part-way through the JSON document, after ${received} records`\n : `Export incomplete: the server announced ${seen.expected} records, and the body ended part-way through the JSON document after ${received}`,\n seen.expected,\n received,\n seen.requestId,\n );\n }\n throw err;\n }\n\n const { expected, requestId } = seen;\n let received = 0;\n if (format === 'json') {\n // Only the export's own envelope is a JSON export. Anything else — an\n // empty 200, which parses to nothing — delivered no file, and a count of\n // zero records must not be read as a complete empty one.\n const rows = isRecord(result) ? result[envelope.rows] : undefined;\n if (!Array.isArray(rows)) {\n throw incomplete(\n `Export incomplete: the body is not an export envelope with a \"${envelope.rows}\" array, so it carries 0 records${announced(expected)}`,\n expected,\n 0,\n requestId,\n );\n }\n received = rows.length;\n const declared = isRecord(result) ? result[envelope.count] : undefined;\n if (typeof declared === 'number' && declared !== rows.length) {\n throw incomplete(\n `Export incomplete: the file's ${envelope.count} is ${declared}, but it carries ${rows.length} records`,\n declared,\n rows.length,\n requestId,\n );\n }\n } else if (format === 'csv') {\n const counter = seen.counter;\n received = counter?.finish() ?? 0;\n // Checked whether or not a count was announced: every line of an export\n // body ends in a newline, so one that ends anywhere else was cut off.\n if (!counter?.complete) {\n throw incomplete(\n `Export incomplete: the CSV body ended part-way through a line, after ${received} complete records${announced(expected)}`,\n expected,\n received,\n requestId,\n );\n }\n }\n\n if (expected !== null && received !== expected) {\n throw incomplete(\n `Export incomplete: the server announced ${expected} records, and the body carried ${received}`,\n expected,\n received,\n requestId,\n );\n }\n\n report({\n phase: 'done',\n receivedBytes: latest.receivedBytes,\n totalBytes: latest.totalBytes,\n receivedRecords: received,\n expectedRecords: expected,\n });\n return result as T;\n}\n\n/** The media type each format is asked for by name. */\nconst ACCEPT: Record<ExportFormat, string> = {\n csv: 'text/csv',\n json: 'application/json',\n pdf: 'application/pdf',\n};\n\n/**\n * Headers and response handling for one export.\n *\n * The format is negotiated with `Accept`, never a request field. The API's\n * reason is that an export reuses its list's filter model as literally the same\n * type, and several of those are `deny_unknown_fields` — so a `format` key in\n * the query or body is a 400, not an option. That holds for the transactions\n * export too, whose body is the payments list filter.\n *\n * `csv` and `pdf` are not JSON, and the client parses a body as JSON unless it\n * is told otherwise, so a missing `responseType` would be a `SyntaxError` on\n * the first comma rather than a wrong type.\n */\nexport function negotiated(\n options: RequestOptions,\n format: ExportFormat,\n presentation?: ExportPresentation,\n): RequestOptions {\n const headers: Record<string, string> = { ...options.headers, Accept: ACCEPT[format] };\n // Only a PDF prints words; a CSV or JSON file is sent none.\n if (format === 'pdf' && presentation !== undefined) {\n headers[PRESENTATION_HEADER] = encodePresentation(presentation);\n }\n return format === 'json'\n ? { ...options, headers }\n : { ...options, headers, responseType: 'blob' };\n}\n\n/**\n * Send one list export in the format `options` asks for — `json` unless told\n * otherwise — with its progress and its record-count check.\n *\n * `base` is the request as the list would send it: its filters in `body` or\n * `query`, and any header of its own. The format's `Accept` and\n * `responseType` are added here.\n */\nexport function runExport<T>(\n request: RequestFn,\n method: string,\n path: string,\n base: RequestOptions,\n options: ExportOptions | undefined,\n): Promise<T> {\n const format = options?.format ?? 'json';\n return downloadExport<T>(\n request,\n { method, path, request: negotiated(base, format, options?.presentation), format },\n options,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-KJDMNF2T.cjs","../src/exportDownload.ts"],"names":["received"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;A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,EAAA;AACM,EAAA;AACT;AAG6C;AACtC,EAAA;AACC,EAAA;AACD,EAAA;AACP;AAmBkB;AACqE,EAAA;AAEjC,EAAA;AACY,IAAA;AAChE,EAAA;AAGgD,EAAA;AAClD;AAgBc;AACsB,EAAA;AAC3B,EAAA;AACL,IAAA;AACiF,IAAA;AACjF,IAAA;AACF,EAAA;AACF;AD3JkH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-KJDMNF2T.cjs","sourcesContent":[null,"import { DelopayError } from './error';\nimport type { DownloadProgressEvent, RequestFn, RequestOptions } from './client';\nimport type {\n ExportFormat,\n ExportOptions,\n ExportPresentation,\n ExportProgress,\n ExportTransferOptions,\n} from './types';\nimport { CsvRecordCounter, JsonArrayRecordCounter } from './recordCounter';\nimport type { RecordCounter } from './recordCounter';\n\n/** The header a streamed export announces its record count in. */\nconst RECORD_COUNT_HEADER = 'x-delopay-record-count';\n\n/** The header a PDF export's words travel in. */\nexport const PRESENTATION_HEADER = 'X-Delopay-Export-Presentation';\n\n/**\n * Longest encoded presentation the server reads. A longer one is refused\n * there with `IR_06`; checked here first, so the caller hears it before a\n * request is sent and without a proxy's opinion of a long header in between.\n */\nexport const MAX_PRESENTATION_HEADER = 6 * 1024;\n\n/**\n * `presentation` as the header carries it: base64url, unpadded, of its UTF-8\n * JSON. Rejects with `EXPORT_PRESENTATION_TOO_LARGE` past\n * {@link MAX_PRESENTATION_HEADER}.\n */\nexport function encodePresentation(presentation: ExportPresentation): string {\n const bytes = new TextEncoder().encode(JSON.stringify(presentation));\n let binary = '';\n for (const byte of bytes) binary += String.fromCharCode(byte);\n const encoded = btoa(binary).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n if (encoded.length > MAX_PRESENTATION_HEADER) {\n throw new DelopayError(\n `Export presentation is ${encoded.length} bytes encoded; the server reads at most ${MAX_PRESENTATION_HEADER}`,\n {\n status: 0,\n code: 'EXPORT_PRESENTATION_TOO_LARGE',\n type: 'invalid_request',\n data: { encoded_length: encoded.length, max_length: MAX_PRESENTATION_HEADER },\n },\n );\n }\n return encoded;\n}\n\n/**\n * Where a `json` export keeps its rows, and its own count of them.\n *\n * Every list export answers `{\"records\":[…],\"record_count\":N,\"filters\":{…}}`;\n * the disputes workspace answers `{\"data\":[…],\"total_count\":N}`.\n */\nexport interface ExportEnvelopeShape {\n rows: string;\n count: string;\n}\n\n/** `{\"records\":[…],\"record_count\":N,\"filters\":{…}}` — every list export. */\nexport const LIST_ENVELOPE: ExportEnvelopeShape = { rows: 'records', count: 'record_count' };\n\n/** `{\"data\":[…],\"total_count\":N}` — the disputes workspace export. */\nexport const WORKSPACE_ENVELOPE: ExportEnvelopeShape = { rows: 'data', count: 'total_count' };\n\n/** One export request, as the resource method built it. */\nexport interface ExportCall {\n method: string;\n path: string;\n /**\n * The request without its transfer options: filters, headers (`Accept`\n * included) and `responseType`.\n */\n request: RequestOptions;\n format: ExportFormat;\n /** The `json` envelope. Defaults to {@link LIST_ENVELOPE}. */\n envelope?: ExportEnvelopeShape;\n}\n\n/**\n * `X-Delopay-Record-Count` as a count, or `null` when there is none.\n *\n * Only a plain run of digits is a count. Anything else — a value a proxy\n * mangled, two values folded into one — is treated as no announcement rather\n * than guessed at.\n */\nfunction parseRecordCount(header: string | null): number | null {\n if (header === null) return null;\n const trimmed = header.trim();\n if (!/^\\d+$/.test(trimmed)) return null;\n const value = Number(trimmed);\n return Number.isSafeInteger(value) ? value : null;\n}\n\nfunction counterFor(format: ExportFormat): RecordCounter | null {\n if (format === 'csv') return new CsvRecordCounter();\n if (format === 'json') return new JsonArrayRecordCounter();\n return null;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** `\" of the N announced\"`, or nothing when the server announced no count. */\nfunction announced(expected: number | null): string {\n return expected === null ? '' : ` of the ${expected} announced`;\n}\n\nfunction incomplete(\n message: string,\n expected: number | null,\n received: number,\n requestId: string | undefined,\n): DelopayError {\n return new DelopayError(message, {\n status: 0,\n code: 'EXPORT_INCOMPLETE',\n type: 'export_incomplete',\n ...(requestId !== undefined ? { requestId } : {}),\n data: { expected_records: expected, received_records: received },\n });\n}\n\n/**\n * Run one export: send it, report its progress, and hold the finished body to\n * the size the server announced before handing it back.\n *\n * The check is the point. These are finance files, and a body that ends short\n * of `X-Delopay-Record-Count` is a file missing rows that would otherwise open,\n * sum and reconcile without a word. It is refused with `EXPORT_INCOMPLETE`\n * rather than returned. For `json` the envelope's own count is held to its\n * rows as well, and a body that is not a whole JSON document is incomplete by\n * definition.\n *\n * `onProgress` hears `preparing` synchronously, before anything is sent — the\n * caller's `async` method runs this far on the call itself.\n */\nexport async function downloadExport<T>(\n request: RequestFn,\n call: ExportCall,\n options: ExportTransferOptions | undefined,\n): Promise<T> {\n const { format } = call;\n const envelope = call.envelope ?? LIST_ENVELOPE;\n const onProgress = options?.onProgress;\n\n let latest: ExportProgress = {\n phase: 'preparing',\n receivedBytes: 0,\n totalBytes: null,\n receivedRecords: 0,\n expectedRecords: null,\n };\n // What the current attempt's headers announced, what its body has\n // delivered, and whether the caller's own listener threw. Kept on an object\n // because the listeners below write it.\n const seen: {\n attempt: number;\n counter: RecordCounter | null;\n expected: number | null;\n requestId: string | undefined;\n listenerError: { error: unknown } | null;\n } = { attempt: -1, counter: null, expected: null, requestId: undefined, listenerError: null };\n\n // A copy each time, so a listener that keeps the snapshots it is given\n // keeps what it was told. What it throws is remembered so it reaches the\n // caller as itself: a `SyntaxError` in a progress bar is not a body that\n // failed to parse.\n const report = (progress: ExportProgress) => {\n latest = progress;\n if (!onProgress) return;\n try {\n onProgress({ ...progress });\n } catch (error) {\n seen.listenerError = { error };\n throw error;\n }\n };\n report(latest);\n\n const onDownloadProgress = (event: DownloadProgressEvent) => {\n if (event.attempt !== seen.attempt) {\n // The headers of a new attempt: a retry starts the body over, so the\n // count does too.\n seen.attempt = event.attempt;\n seen.counter = counterFor(format);\n // A PDF is not counted, so an announced count could only ever fail it.\n seen.expected =\n format === 'pdf' ? null : parseRecordCount(event.headers.get(RECORD_COUNT_HEADER));\n seen.requestId =\n event.headers.get('x-request-id') ?? event.headers.get('x-trace-id') ?? undefined;\n }\n if (event.chunk.byteLength > 0) seen.counter?.push(event.chunk);\n report({\n phase: 'receiving',\n receivedBytes: event.loaded,\n totalBytes: event.total,\n receivedRecords: seen.counter?.records ?? 0,\n expectedRecords: seen.expected,\n });\n };\n\n let result: unknown;\n try {\n result = await request<unknown>(call.method, call.path, {\n ...call.request,\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n ...(options?.timeout !== undefined ? { timeout: options.timeout } : {}),\n onDownloadProgress,\n });\n } catch (err) {\n if (seen.listenerError !== null && err === seen.listenerError.error) throw err;\n // The body arrived whole as far as the connection could tell, but it does\n // not parse: it stopped part-way through the document.\n if (format === 'json' && seen.attempt >= 0 && err instanceof SyntaxError) {\n const received = seen.counter?.records ?? 0;\n throw incomplete(\n seen.expected === null\n ? `Export incomplete: the body ended part-way through the JSON document, after ${received} records`\n : `Export incomplete: the server announced ${seen.expected} records, and the body ended part-way through the JSON document after ${received}`,\n seen.expected,\n received,\n seen.requestId,\n );\n }\n throw err;\n }\n\n const { expected, requestId } = seen;\n let received = 0;\n if (format === 'json') {\n // Only the export's own envelope is a JSON export. Anything else — an\n // empty 200, which parses to nothing — delivered no file, and a count of\n // zero records must not be read as a complete empty one.\n const rows = isRecord(result) ? result[envelope.rows] : undefined;\n if (!Array.isArray(rows)) {\n throw incomplete(\n `Export incomplete: the body is not an export envelope with a \"${envelope.rows}\" array, so it carries 0 records${announced(expected)}`,\n expected,\n 0,\n requestId,\n );\n }\n received = rows.length;\n const declared = isRecord(result) ? result[envelope.count] : undefined;\n if (typeof declared === 'number' && declared !== rows.length) {\n throw incomplete(\n `Export incomplete: the file's ${envelope.count} is ${declared}, but it carries ${rows.length} records`,\n declared,\n rows.length,\n requestId,\n );\n }\n } else if (format === 'csv') {\n const counter = seen.counter;\n received = counter?.finish() ?? 0;\n // Checked whether or not a count was announced: every line of an export\n // body ends in a newline, so one that ends anywhere else was cut off.\n if (!counter?.complete) {\n throw incomplete(\n `Export incomplete: the CSV body ended part-way through a line, after ${received} complete records${announced(expected)}`,\n expected,\n received,\n requestId,\n );\n }\n }\n\n if (expected !== null && received !== expected) {\n throw incomplete(\n `Export incomplete: the server announced ${expected} records, and the body carried ${received}`,\n expected,\n received,\n requestId,\n );\n }\n\n report({\n phase: 'done',\n receivedBytes: latest.receivedBytes,\n totalBytes: latest.totalBytes,\n receivedRecords: received,\n expectedRecords: expected,\n });\n return result as T;\n}\n\n/** The media type each format is asked for by name. */\nconst ACCEPT: Record<ExportFormat, string> = {\n csv: 'text/csv',\n json: 'application/json',\n pdf: 'application/pdf',\n};\n\n/**\n * Headers and response handling for one export.\n *\n * The format is negotiated with `Accept`, never a request field. The API's\n * reason is that an export reuses its list's filter model as literally the same\n * type, and several of those are `deny_unknown_fields` — so a `format` key in\n * the query or body is a 400, not an option. That holds for the transactions\n * export too, whose body is the payments list filter.\n *\n * `csv` and `pdf` are not JSON, and the client parses a body as JSON unless it\n * is told otherwise, so a missing `responseType` would be a `SyntaxError` on\n * the first comma rather than a wrong type.\n */\nexport function negotiated(\n options: RequestOptions,\n format: ExportFormat,\n presentation?: ExportPresentation,\n): RequestOptions {\n const headers: Record<string, string> = { ...options.headers, Accept: ACCEPT[format] };\n // Only a PDF prints words; a CSV or JSON file is sent none.\n if (format === 'pdf' && presentation !== undefined) {\n headers[PRESENTATION_HEADER] = encodePresentation(presentation);\n }\n return format === 'json'\n ? { ...options, headers }\n : { ...options, headers, responseType: 'blob' };\n}\n\n/**\n * Send one list export in the format `options` asks for — `json` unless told\n * otherwise — with its progress and its record-count check.\n *\n * `base` is the request as the list would send it: its filters in `body` or\n * `query`, and any header of its own. The format's `Accept` and\n * `responseType` are added here.\n */\nexport function runExport<T>(\n request: RequestFn,\n method: string,\n path: string,\n base: RequestOptions,\n options: ExportOptions | undefined,\n): Promise<T> {\n const format = options?.format ?? 'json';\n return downloadExport<T>(\n request,\n { method, path, request: negotiated(base, format, options?.presentation), format },\n options,\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-KLONGJCL.cjs","../src/resources/costRules.ts"],"names":[],"mappings":"AAAA;ACqBO,IAAM,UAAA,EAAN,MAAgB;AAAA,EACrB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,IAAA,CAAK,UAAA,EAAyD;AAClE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,aAAA,EAAe,EAAE,KAAA,EAAO,EAAE,WAAA,EAAa,WAAW,EAAE,CAAC,CAAA;AAAA,EAClF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,MAAA,CACJ,MAAA,EACA,UAAA,EACmC;AACnC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,aAAA,EAAe;AAAA,MACzC,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,EAAE,WAAA,EAAa,WAAW;AAAA,IACnC,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAA,CACJ,MAAA,EACA,MAAA,EACA,UAAA,EACmC;AACnC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,YAAA,EAAe,kBAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AAC5D,MAAA;AAC2B,MAAA;AAClC,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS0F,EAAA;AACxB,IAAA;AAC7B,MAAA;AAClC,IAAA;AACH,EAAA;AACF;AD5ByE;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-KLONGJCL.cjs","sourcesContent":[null,"import type {\n CreateMerchantCostRuleRequest,\n MerchantCostRuleDeleteResponse,\n MerchantCostRuleResponse,\n UpdateMerchantCostRuleRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * Merchant cost rules: what a merchant's own goods and partners' shares cost\n * it, as a percentage, a flat amount or both, merchant-wide or for one shop,\n * over a validity window.\n *\n * A rule is a record, not an instruction. It writes no billing ledger entry and\n * moves no money. Its rate, category and scope cannot be edited; a price change\n * is a new rule with a new window.\n *\n * Every route needs a dashboard session for the merchant: listing needs the\n * merchant account read permission, every change the write permission. A\n * shop-scoped session reaches nothing here.\n */\nexport class CostRules {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Every cost rule of the merchant.\n * `GET /cost-rules`\n *\n * @param merchantId - The merchant account ID.\n */\n async list(merchantId: string): Promise<MerchantCostRuleResponse[]> {\n return this.request('GET', '/cost-rules', { query: { merchant_id: merchantId } });\n }\n\n /**\n * Record a cost rule.\n * `POST /cost-rules`\n *\n * @param params - The rule.\n * @param merchantId - The merchant account ID.\n */\n async create(\n params: CreateMerchantCostRuleRequest,\n merchantId: string,\n ): Promise<MerchantCostRuleResponse> {\n return this.request('POST', '/cost-rules', {\n body: params,\n query: { merchant_id: merchantId },\n });\n }\n\n /**\n * Close, deactivate or rename a cost rule.\n * `PUT /cost-rules/{rule_id}`\n *\n * @param ruleId - The rule ID.\n * @param params - What to change.\n * @param merchantId - The merchant account ID.\n */\n async update(\n ruleId: string,\n params: UpdateMerchantCostRuleRequest,\n merchantId: string,\n ): Promise<MerchantCostRuleResponse> {\n return this.request('PUT', `/cost-rules/${encodeURIComponent(ruleId)}`, {\n body: params,\n query: { merchant_id: merchantId },\n });\n }\n\n /**\n * Delete a cost rule.\n * `DELETE /cost-rules/{rule_id}`\n *\n * @param ruleId - The rule ID.\n * @param merchantId - The merchant account ID.\n */\n async delete(ruleId: string, merchantId: string): Promise<MerchantCostRuleDeleteResponse> {\n return this.request('DELETE', `/cost-rules/${encodeURIComponent(ruleId)}`, {\n query: { merchant_id: merchantId },\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-KSJ7JLR3.cjs","../src/resources/disputes.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACuBA,SAAS,cAAA,CAAe,MAAA,EAA2D;AACjF,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,OAAO,KAAA,CAAA;AACpB,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,cAAA,EAAgB,aAAA,EAAe,GAAG,MAAM,EAAA,EAAI,MAAA;AACzE,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,mBAAI,SAAA,2BAAW,SAAA,EAAS,EAAE,SAAA,EAAW,SAAA,CAAU,IAAA,CAAK,GAAG,EAAE,EAAA,EAAI,CAAC,CAAA;AAAA,IAC9D,mBAAI,QAAA,6BAAU,SAAA,EAAS,EAAE,QAAA,EAAU,QAAA,CAAS,IAAA,CAAK,GAAG,EAAE,EAAA,EAAI,CAAC,CAAA;AAAA,IAC3D,mBAAI,cAAA,6BAAgB,SAAA,EAAS,EAAE,cAAA,EAAgB,cAAA,CAAe,IAAA,CAAK,GAAG,EAAE,EAAA,EAAI,CAAC,CAAA;AAAA,IAC7E,mBAAI,aAAA,6BAAe,SAAA,EAAS,EAAE,aAAA,EAAe,aAAA,CAAc,IAAA,CAAK,GAAG,EAAE,EAAA,EAAI,CAAC;AAAA,EAC5E,CAAA;AACF;AAGO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EA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AAAA;AAAA;AAAA;AAAA;AAAA;AAQ+E,EAAA;AACX,IAAA;AACpE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO+E,EAAA;AACZ,IAAA;AACnE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY2E,EAAA;AACL,IAAA;AACtE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ8E,EAAA;AACR,IAAA;AACtE,EAAA;AAAA;AAAA;AAK4E,EAAA;AACrB,IAAA;AAC5C,MAAA;AACR,IAAA;AACH,EAAA;AAAA;AAKoC,EAAA;AAC8B,IAAA;AAClE,EAAA;AAAA;AAKoC,EAAA;AAC8B,IAAA;AAClE,EAAA;AAAA;AAKoC,EAAA;AACiC,IAAA;AACrE,EAAA;AAAA;AAKoC,EAAA;AACiC,IAAA;AACrE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAesE,EAAA;AACC,IAAA;AACvC,MAAA;AAC7B,IAAA;AACH,EAAA;AACF;ADxF0E;AACA;AACA;AACA","file":"/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-KSJ7JLR3.cjs","sourcesContent":[null,"import type {\n DisputeReconcileRequest,\n DisputeResponse,\n DisputeListParams,\n DisputeEvidenceRequest,\n DeleteEvidenceRequest,\n DisputeEvidenceBlock,\n DisputeRefundDeclaration,\n DisputeRefundAssociationRequest,\n DisputeRefundAssociationsResponse,\n DisputeWorkspaceRequest,\n DisputeWorkspaceResponse,\n DisputeWorkspaceFilters,\n DisputeWorkspaceAggregate,\n DisputeWorkspaceExport,\n DisputeBulkAcceptRequest,\n DisputeBulkAcceptResponse,\n DisputeBulkBlockBuyerRequest,\n DisputeBulkBlockBuyerResponse,\n DisputeBulkPreviewRequest,\n DisputeBulkPreviewResponse,\n DynamicWorkspaceExportOptions,\n JsonExportOptions,\n PdfExportOptions,\n} from '../types';\nimport type { RequestFn, RequestOptions } from '../client';\nimport { WORKSPACE_ENVELOPE, downloadExport, negotiated } from '../exportDownload';\n\n/** Workspace filters use CSV values, unlike the transport's repeated-key arrays. */\nfunction workspaceQuery(params?: DisputeWorkspaceRequest): RequestOptions['query'] {\n if (!params) return undefined;\n const { connector, currency, dispute_status, dispute_stage, ...query } = params;\n return {\n ...query,\n ...(connector?.length ? { connector: connector.join(',') } : {}),\n ...(currency?.length ? { currency: currency.join(',') } : {}),\n ...(dispute_status?.length ? { dispute_status: dispute_status.join(',') } : {}),\n ...(dispute_stage?.length ? { dispute_stage: dispute_stage.join(',') } : {}),\n };\n}\n\n/** View and respond to payment disputes and chargebacks. */\nexport class Disputes {\n constructor(private readonly request: RequestFn) {}\n\n /** Read native disputes and provider-only cases once, after shared authorization and filters. */\n async workspace(params?: DisputeWorkspaceRequest): Promise<DisputeWorkspaceResponse> {\n return this.request('GET', '/disputes/workspace', { query: workspaceQuery(params) });\n }\n\n /** Read filter options over the same scoped case set; pagination is ignored. */\n async workspaceFilters(params?: DisputeWorkspaceRequest): Promise<DisputeWorkspaceFilters> {\n return this.request('GET', '/disputes/workspace/filters', { query: workspaceQuery(params) });\n }\n\n /** Count the filtered case set, including unknown outcomes; pagination is ignored. */\n async workspaceAggregate(params?: DisputeWorkspaceRequest): Promise<DisputeWorkspaceAggregate> {\n return this.request('GET', '/disputes/workspace/aggregate', { query: workspaceQuery(params) });\n }\n\n /**\n * Export the complete filtered set, or throw on the server's explicit\n * export-limit refusal. `GET /disputes/workspace/export`\n *\n * The body is streamed, and held to the `X-Delopay-Record-Count` the server\n * announces and to its own `total_count`: a set that arrives short rejects\n * with `EXPORT_INCOMPLETE` rather than resolving. `options` reports the\n * download's progress and takes a signal and an idle timeout — see\n * {@link ExportTransferOptions}.\n *\n * `format: 'pdf'` resolves to the same set laid out as a document (a\n * `Blob`), with the words in `options.presentation` — see\n * {@link ExportPresentation}. This route offers no CSV.\n */\n async workspaceExport(\n params?: DisputeWorkspaceRequest,\n options?: JsonExportOptions,\n ): Promise<DisputeWorkspaceExport>;\n async workspaceExport(\n params: DisputeWorkspaceRequest | undefined,\n options: PdfExportOptions,\n ): Promise<Blob>;\n async workspaceExport(\n params: DisputeWorkspaceRequest | undefined,\n options: DynamicWorkspaceExportOptions,\n ): Promise<DisputeWorkspaceExport | Blob>;\n async workspaceExport(\n params?: DisputeWorkspaceRequest,\n options?: JsonExportOptions | PdfExportOptions | DynamicWorkspaceExportOptions,\n ): Promise<DisputeWorkspaceExport | Blob> {\n const format = options?.format ?? 'json';\n return downloadExport(\n this.request,\n {\n method: 'GET',\n path: '/disputes/workspace/export',\n request: negotiated({ query: workspaceQuery(params) }, format, options?.presentation),\n format,\n envelope: WORKSPACE_ENVELOPE,\n },\n options,\n );\n }\n\n /**\n * What a bulk action would do to the selected cases, changing nothing:\n * each case as eligible or skipped with a reason, and what the eligible ones\n * add up to per currency. Name the cases by `ids` or by the list's\n * `filters`, exactly one of the two; at most `max_cases` are read.\n *\n * `POST /disputes/workspace/bulk/preview`. Needs a dashboard JWT.\n */\n async bulkPreview(request: DisputeBulkPreviewRequest): Promise<DisputeBulkPreviewResponse> {\n // The body's filters take CSV values, as the list's query does.\n const { filters, ...rest } = request;\n return this.request('POST', '/disputes/workspace/bulk/preview', {\n body: filters ? { ...rest, filters: workspaceQuery(filters) } : rest,\n });\n }\n\n /**\n * Accept the listed cases at their processors, at most the preview's\n * `max_run_cases` per call; send a larger set in parts under one\n * `request_id`. Eligibility is decided again at run time, and every case\n * gets its own result. An `unknown` result means the processor may have\n * acted: read the case before acting on it again.\n *\n * `POST /disputes/workspace/bulk/accept`. Needs a dashboard JWT.\n */\n async bulkAccept(request: DisputeBulkAcceptRequest): Promise<DisputeBulkAcceptResponse> {\n return this.request('POST', '/disputes/workspace/bulk/accept', { body: request });\n }\n\n /**\n * Add the buyer of each listed case's payment to the buyer blocklist: the\n * payment's email and customer id, and the device ids and IP address of the\n * browser that paid, when DeloPay can tie them to it. Identifiers already\n * blocked are not added again, and `unattributed` names those it could not\n * tie to the buyer.\n *\n * `POST /disputes/workspace/bulk/block-buyer`. Needs a dashboard JWT.\n */\n async bulkBlockBuyer(\n request: DisputeBulkBlockBuyerRequest,\n ): Promise<DisputeBulkBlockBuyerResponse> {\n return this.request('POST', '/disputes/workspace/bulk/block-buyer', { body: request });\n }\n\n /**\n * Retrieve a dispute by its ID.\n *\n * @param disputeId - The unique dispute ID.\n * @returns The dispute.\n */\n async retrieve(disputeId: string): Promise<DisputeResponse> {\n return this.request('GET', `/disputes/${encodeURIComponent(disputeId)}`);\n }\n\n /** Read declared links and provider-reported refund references. Empty means unknown. */\n async listRefundAssociations(disputeId: string): Promise<DisputeRefundAssociationsResponse> {\n return this.request('GET', `/disputes/${encodeURIComponent(disputeId)}/refund-associations`);\n }\n\n /** Declare or clear an allocation against a successful refund of this payment. */\n async setRefundAssociation(\n disputeId: string,\n params: DisputeRefundAssociationRequest,\n ): Promise<DisputeRefundDeclaration> {\n return this.request('PUT', `/disputes/${encodeURIComponent(disputeId)}/refund-associations`, {\n body: params,\n });\n }\n\n /**\n * List disputes, optionally filtered by status, stage, or date range.\n *\n * @param params - Optional filter and pagination parameters.\n * @returns Array of disputes.\n */\n async list(params?: DisputeListParams): Promise<DisputeResponse[]> {\n return this.request('GET', '/disputes/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /**\n * Accept a dispute, conceding the chargeback to the customer.\n *\n * @param disputeId - The dispute ID to accept.\n * @returns The updated dispute.\n */\n async accept(disputeId: string): Promise<DisputeResponse> {\n return this.request('POST', `/disputes/accept/${encodeURIComponent(disputeId)}`);\n }\n\n /**\n * Correct the exchange rate of a dispute the processor reported in another\n * currency, or record its final settled amount. Until it is settled, the\n * reserved amount is an estimate and no other dispute on the same payment\n * attempt can take a new reservation. Signed-in users with the\n * external-record permission only.\n *\n * @param disputeId - The dispute to reconcile.\n * @param request - `correct_rate` with the processor's rate, or `settle`\n * with the final amount and a reason.\n * @returns The updated dispute.\n */\n async reconcile(disputeId: string, request: DisputeReconcileRequest): Promise<DisputeResponse> {\n return this.request('POST', `/disputes/${encodeURIComponent(disputeId)}/reconcile`, {\n body: request,\n });\n }\n\n /**\n * Submit evidence to challenge a dispute.\n *\n * @param params - Evidence details and the dispute ID to contest.\n * @returns The updated dispute.\n */\n async submitEvidence(params: DisputeEvidenceRequest): Promise<DisputeResponse> {\n return this.request('POST', '/disputes/evidence', { body: params });\n }\n\n /**\n * Attach evidence (e.g. file upload metadata) to a dispute.\n *\n * Uses `PUT /disputes/evidence`.\n */\n async attachEvidence(params: DisputeEvidenceRequest): Promise<DisputeResponse> {\n return this.request('PUT', '/disputes/evidence', { body: params });\n }\n\n /**\n * Retrieve previously stored evidence for a dispute.\n *\n * Returns an ARRAY of file-evidence blocks (this was previously mistyped\n * as the flat submit-request shape). Only file evidence is reported —\n * text evidence is not retrievable once submitted.\n *\n * @param disputeId - The dispute ID.\n * @returns The stored file-evidence blocks.\n */\n async retrieveEvidence(disputeId: string): Promise<DisputeEvidenceBlock[]> {\n return this.request('GET', `/disputes/evidence/${encodeURIComponent(disputeId)}`);\n }\n\n /**\n * Delete submitted evidence for a dispute.\n *\n * @param params - Evidence request body identifying what to delete.\n * @returns The updated dispute.\n */\n async deleteEvidence(params: DeleteEvidenceRequest): Promise<DisputeResponse> {\n return this.request('DELETE', '/disputes/evidence', { body: params });\n }\n\n // --- OLAP extensions (Task 4.4) ---\n\n /** List disputes (profile-scoped). `GET /disputes/profile/list` */\n async listByProfile(params?: DisputeListParams): Promise<DisputeResponse[]> {\n return this.request('GET', '/disputes/profile/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /** Get dispute filter options. `GET /disputes/filter` */\n async getFilters(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/filter', { query: params });\n }\n\n /** Get dispute filters (profile-scoped). `GET /disputes/profile/filter` */\n async getFiltersByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/profile/filter', { query: params });\n }\n\n /** Get dispute aggregates. `GET /disputes/aggregate` */\n async aggregate(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/aggregate', { query: params });\n }\n\n /** Get dispute aggregates (profile-scoped). `GET /disputes/profile/aggregate` */\n async aggregateByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/profile/aggregate', { query: params });\n }\n\n /**\n * Fetch the latest dispute state from the connector (gateway) and persist it.\n * `GET /disputes/{disputeId}?force_sync=true`\n *\n * The path parameter is the **Delopay dispute id** (`dp_…`). Force-sync asks the\n * backend to pull the dispute from the connector (supported where the connector\n * implements the dispute-sync flow, e.g. Stripe) and update the stored record\n * before returning it.\n *\n * Note: this method previously called `GET /disputes/{id}/fetch`, which is a\n * different backend route — a bulk import keyed by **merchant connector account\n * id** with a required date range — so every call with a dispute id failed.\n */\n async fetchFromConnector(disputeId: string): Promise<DisputeResponse> {\n return this.request('GET', `/disputes/${encodeURIComponent(disputeId)}`, {\n query: { force_sync: 'true' },\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-KSJ7JLR3.cjs","../src/resources/disputes.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACuBA,SAAS,cAAA,CAAe,MAAA,EAA2D;AACjF,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,OAAO,KAAA,CAAA;AACpB,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,cAAA,EAAgB,aAAA,EAAe,GAAG,MAAM,EAAA,EAAI,MAAA;AACzE,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,mBAAI,SAAA,2BAAW,SAAA,EAAS,EAAE,SAAA,EAAW,SAAA,CAAU,IAAA,CAAK,GAAG,EAAE,EAAA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;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-KSJ7JLR3.cjs","sourcesContent":[null,"import type {\n DisputeReconcileRequest,\n DisputeResponse,\n DisputeListParams,\n DisputeEvidenceRequest,\n DeleteEvidenceRequest,\n DisputeEvidenceBlock,\n DisputeRefundDeclaration,\n DisputeRefundAssociationRequest,\n DisputeRefundAssociationsResponse,\n DisputeWorkspaceRequest,\n DisputeWorkspaceResponse,\n DisputeWorkspaceFilters,\n DisputeWorkspaceAggregate,\n DisputeWorkspaceExport,\n DisputeBulkAcceptRequest,\n DisputeBulkAcceptResponse,\n DisputeBulkBlockBuyerRequest,\n DisputeBulkBlockBuyerResponse,\n DisputeBulkPreviewRequest,\n DisputeBulkPreviewResponse,\n DynamicWorkspaceExportOptions,\n JsonExportOptions,\n PdfExportOptions,\n} from '../types';\nimport type { RequestFn, RequestOptions } from '../client';\nimport { WORKSPACE_ENVELOPE, downloadExport, negotiated } from '../exportDownload';\n\n/** Workspace filters use CSV values, unlike the transport's repeated-key arrays. */\nfunction workspaceQuery(params?: DisputeWorkspaceRequest): RequestOptions['query'] {\n if (!params) return undefined;\n const { connector, currency, dispute_status, dispute_stage, ...query } = params;\n return {\n ...query,\n ...(connector?.length ? { connector: connector.join(',') } : {}),\n ...(currency?.length ? { currency: currency.join(',') } : {}),\n ...(dispute_status?.length ? { dispute_status: dispute_status.join(',') } : {}),\n ...(dispute_stage?.length ? { dispute_stage: dispute_stage.join(',') } : {}),\n };\n}\n\n/** View and respond to payment disputes and chargebacks. */\nexport class Disputes {\n constructor(private readonly request: RequestFn) {}\n\n /** Read native disputes and provider-only cases once, after shared authorization and filters. */\n async workspace(params?: DisputeWorkspaceRequest): Promise<DisputeWorkspaceResponse> {\n return this.request('GET', '/disputes/workspace', { query: workspaceQuery(params) });\n }\n\n /** Read filter options over the same scoped case set; pagination is ignored. */\n async workspaceFilters(params?: DisputeWorkspaceRequest): Promise<DisputeWorkspaceFilters> {\n return this.request('GET', '/disputes/workspace/filters', { query: workspaceQuery(params) });\n }\n\n /** Count the filtered case set, including unknown outcomes; pagination is ignored. */\n async workspaceAggregate(params?: DisputeWorkspaceRequest): Promise<DisputeWorkspaceAggregate> {\n return this.request('GET', '/disputes/workspace/aggregate', { query: workspaceQuery(params) });\n }\n\n /**\n * Export the complete filtered set, or throw on the server's explicit\n * export-limit refusal. `GET /disputes/workspace/export`\n *\n * The body is streamed, and held to the `X-Delopay-Record-Count` the server\n * announces and to its own `total_count`: a set that arrives short rejects\n * with `EXPORT_INCOMPLETE` rather than resolving. `options` reports the\n * download's progress and takes a signal and an idle timeout — see\n * {@link ExportTransferOptions}.\n *\n * `format: 'pdf'` resolves to the same set laid out as a document (a\n * `Blob`), with the words in `options.presentation` — see\n * {@link ExportPresentation}. This route offers no CSV.\n */\n async workspaceExport(\n params?: DisputeWorkspaceRequest,\n options?: JsonExportOptions,\n ): Promise<DisputeWorkspaceExport>;\n async workspaceExport(\n params: DisputeWorkspaceRequest | undefined,\n options: PdfExportOptions,\n ): Promise<Blob>;\n async workspaceExport(\n params: DisputeWorkspaceRequest | undefined,\n options: DynamicWorkspaceExportOptions,\n ): Promise<DisputeWorkspaceExport | Blob>;\n async workspaceExport(\n params?: DisputeWorkspaceRequest,\n options?: JsonExportOptions | PdfExportOptions | DynamicWorkspaceExportOptions,\n ): Promise<DisputeWorkspaceExport | Blob> {\n const format = options?.format ?? 'json';\n return downloadExport(\n this.request,\n {\n method: 'GET',\n path: '/disputes/workspace/export',\n request: negotiated({ query: workspaceQuery(params) }, format, options?.presentation),\n format,\n envelope: WORKSPACE_ENVELOPE,\n },\n options,\n );\n }\n\n /**\n * What a bulk action would do to the selected cases, changing nothing:\n * each case as eligible or skipped with a reason, and what the eligible ones\n * add up to per currency. Name the cases by `ids` or by the list's\n * `filters`, exactly one of the two; at most `max_cases` are read.\n *\n * `POST /disputes/workspace/bulk/preview`. Needs a dashboard JWT.\n */\n async bulkPreview(request: DisputeBulkPreviewRequest): Promise<DisputeBulkPreviewResponse> {\n // The body's filters take CSV values, as the list's query does.\n const { filters, ...rest } = request;\n return this.request('POST', '/disputes/workspace/bulk/preview', {\n body: filters ? { ...rest, filters: workspaceQuery(filters) } : rest,\n });\n }\n\n /**\n * Accept the listed cases at their processors, at most the preview's\n * `max_run_cases` per call; send a larger set in parts under one\n * `request_id`. Eligibility is decided again at run time, and every case\n * gets its own result. An `unknown` result means the processor may have\n * acted: read the case before acting on it again.\n *\n * `POST /disputes/workspace/bulk/accept`. Needs a dashboard JWT.\n */\n async bulkAccept(request: DisputeBulkAcceptRequest): Promise<DisputeBulkAcceptResponse> {\n return this.request('POST', '/disputes/workspace/bulk/accept', { body: request });\n }\n\n /**\n * Add the buyer of each listed case's payment to the buyer blocklist: the\n * payment's email and customer id, and the device ids and IP address of the\n * browser that paid, when DeloPay can tie them to it. Identifiers already\n * blocked are not added again, and `unattributed` names those it could not\n * tie to the buyer.\n *\n * `POST /disputes/workspace/bulk/block-buyer`. Needs a dashboard JWT.\n */\n async bulkBlockBuyer(\n request: DisputeBulkBlockBuyerRequest,\n ): Promise<DisputeBulkBlockBuyerResponse> {\n return this.request('POST', '/disputes/workspace/bulk/block-buyer', { body: request });\n }\n\n /**\n * Retrieve a dispute by its ID.\n *\n * @param disputeId - The unique dispute ID.\n * @returns The dispute.\n */\n async retrieve(disputeId: string): Promise<DisputeResponse> {\n return this.request('GET', `/disputes/${encodeURIComponent(disputeId)}`);\n }\n\n /** Read declared links and provider-reported refund references. Empty means unknown. */\n async listRefundAssociations(disputeId: string): Promise<DisputeRefundAssociationsResponse> {\n return this.request('GET', `/disputes/${encodeURIComponent(disputeId)}/refund-associations`);\n }\n\n /** Declare or clear an allocation against a successful refund of this payment. */\n async setRefundAssociation(\n disputeId: string,\n params: DisputeRefundAssociationRequest,\n ): Promise<DisputeRefundDeclaration> {\n return this.request('PUT', `/disputes/${encodeURIComponent(disputeId)}/refund-associations`, {\n body: params,\n });\n }\n\n /**\n * List disputes, optionally filtered by status, stage, or date range.\n *\n * @param params - Optional filter and pagination parameters.\n * @returns Array of disputes.\n */\n async list(params?: DisputeListParams): Promise<DisputeResponse[]> {\n return this.request('GET', '/disputes/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /**\n * Accept a dispute, conceding the chargeback to the customer.\n *\n * @param disputeId - The dispute ID to accept.\n * @returns The updated dispute.\n */\n async accept(disputeId: string): Promise<DisputeResponse> {\n return this.request('POST', `/disputes/accept/${encodeURIComponent(disputeId)}`);\n }\n\n /**\n * Correct the exchange rate of a dispute the processor reported in another\n * currency, or record its final settled amount. Until it is settled, the\n * reserved amount is an estimate and no other dispute on the same payment\n * attempt can take a new reservation. Signed-in users with the\n * external-record permission only.\n *\n * @param disputeId - The dispute to reconcile.\n * @param request - `correct_rate` with the processor's rate, or `settle`\n * with the final amount and a reason.\n * @returns The updated dispute.\n */\n async reconcile(disputeId: string, request: DisputeReconcileRequest): Promise<DisputeResponse> {\n return this.request('POST', `/disputes/${encodeURIComponent(disputeId)}/reconcile`, {\n body: request,\n });\n }\n\n /**\n * Submit evidence to challenge a dispute.\n *\n * @param params - Evidence details and the dispute ID to contest.\n * @returns The updated dispute.\n */\n async submitEvidence(params: DisputeEvidenceRequest): Promise<DisputeResponse> {\n return this.request('POST', '/disputes/evidence', { body: params });\n }\n\n /**\n * Attach evidence (e.g. file upload metadata) to a dispute.\n *\n * Uses `PUT /disputes/evidence`.\n */\n async attachEvidence(params: DisputeEvidenceRequest): Promise<DisputeResponse> {\n return this.request('PUT', '/disputes/evidence', { body: params });\n }\n\n /**\n * Retrieve previously stored evidence for a dispute.\n *\n * Returns an ARRAY of file-evidence blocks (this was previously mistyped\n * as the flat submit-request shape). Only file evidence is reported —\n * text evidence is not retrievable once submitted.\n *\n * @param disputeId - The dispute ID.\n * @returns The stored file-evidence blocks.\n */\n async retrieveEvidence(disputeId: string): Promise<DisputeEvidenceBlock[]> {\n return this.request('GET', `/disputes/evidence/${encodeURIComponent(disputeId)}`);\n }\n\n /**\n * Delete submitted evidence for a dispute.\n *\n * @param params - Evidence request body identifying what to delete.\n * @returns The updated dispute.\n */\n async deleteEvidence(params: DeleteEvidenceRequest): Promise<DisputeResponse> {\n return this.request('DELETE', '/disputes/evidence', { body: params });\n }\n\n // --- OLAP extensions (Task 4.4) ---\n\n /** List disputes (profile-scoped). `GET /disputes/profile/list` */\n async listByProfile(params?: DisputeListParams): Promise<DisputeResponse[]> {\n return this.request('GET', '/disputes/profile/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /** Get dispute filter options. `GET /disputes/filter` */\n async getFilters(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/filter', { query: params });\n }\n\n /** Get dispute filters (profile-scoped). `GET /disputes/profile/filter` */\n async getFiltersByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/profile/filter', { query: params });\n }\n\n /** Get dispute aggregates. `GET /disputes/aggregate` */\n async aggregate(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/aggregate', { query: params });\n }\n\n /** Get dispute aggregates (profile-scoped). `GET /disputes/profile/aggregate` */\n async aggregateByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/disputes/profile/aggregate', { query: params });\n }\n\n /**\n * Fetch the latest dispute state from the connector (gateway) and persist it.\n * `GET /disputes/{disputeId}?force_sync=true`\n *\n * The path parameter is the **Delopay dispute id** (`dp_…`). Force-sync asks the\n * backend to pull the dispute from the connector (supported where the connector\n * implements the dispute-sync flow, e.g. Stripe) and update the stored record\n * before returning it.\n *\n * Note: this method previously called `GET /disputes/{id}/fetch`, which is a\n * different backend route — a bulk import keyed by **merchant connector account\n * id** with a required date range — so every call with a dispute id failed.\n */\n async fetchFromConnector(disputeId: string): Promise<DisputeResponse> {\n return this.request('GET', `/disputes/${encodeURIComponent(disputeId)}`, {\n query: { force_sync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AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqC8C,EAAA;AACwB,IAAA;AAC3D,MAAA;AACJ,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqB+C,EAAA;AAC0B,IAAA;AAC9D,MAAA;AAIR,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASuF,EAAA;AACzE,IAAA;AACV,MAAA;AACgE,MAAA;AAClE,IAAA;AACF,EAAA;AAAA;AAAA;AAK+E,EAAA;AACL,IAAA;AAC1E,EAAA;AAAA;AAGwF,EAAA;AAChB,IAAA;AACxE,EAAA;AAAA;AAGuF,EAAA;AACT,IAAA;AAC9E,EAAA;AAAA;AAKoC,EAAA;AACoC,IAAA;AACxE,EAAA;AAAA;AAGsF,EAAA;AACd,IAAA;AACxE,EAAA;AAAA;AAG6F,EAAA;AACf,IAAA;AAC9E,EAAA;AAAA;AAGiF,EAAA;AACP,IAAA;AAC1E,EAAA;AAAA;AAG+F,EAAA;AACjB,IAAA;AACpE,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAGwF,EAAA;AACZ,IAAA;AAC5E,EAAA;AAAA;AAG2F,EAAA;AACnB,IAAA;AACxE,EAAA;AAAA;AAMoC,EAAA;AAC0C,IAAA;AACpE,MAAA;AACP,IAAA;AACH,EAAA;AACF;ADhDgF;AACA;AACA;AACA","file":"/home/anes/delo-payment/_worktrees/ts-publish-w3/dist/chunk-LJ2EG6JK.cjs","sourcesContent":[null,"import type {\n PaymentMethodCreateRequest,\n PaymentMethodResponse,\n PaymentMethodUpdateRequest,\n PaymentMethodListParams,\n PaymentMethodListResponse,\n PaymentMethodDeleteResponse,\n PaymentMethodPresentationParams,\n PaymentMethodPresentationResponse,\n CustomerPaymentMethodsListParams,\n CustomerPaymentMethodsListResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/** Create and manage saved payment methods for customers. */\nexport class PaymentMethods {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Save a new payment method (card, bank account, wallet, etc.).\n *\n * @param params - Payment method data including type and card/bank details.\n * @returns The saved payment method.\n *\n * @example\n * ```typescript\n * const pm = await delopay.paymentMethods.create({\n * payment_method: 'card',\n * customer_id: 'cus_123',\n * client_secret: 'cs_...',\n * });\n * ```\n */\n async create(params: PaymentMethodCreateRequest): Promise<PaymentMethodResponse> {\n return this.request('POST', '/payment-methods', { body: params });\n }\n\n /**\n * Retrieve a saved payment method by its ID.\n *\n * @param methodId - The payment method ID.\n * @returns The payment method.\n */\n async retrieve(methodId: string): Promise<PaymentMethodResponse> {\n return this.request('GET', `/payment-methods/${encodeURIComponent(methodId)}`);\n }\n\n /**\n * Update an existing payment method (e.g. update card expiry).\n *\n * @param methodId - The payment method ID to update.\n * @param params - Fields to update (card expiry, holder name, etc.).\n * @returns The updated payment method.\n */\n async update(\n methodId: string,\n params: PaymentMethodUpdateRequest,\n ): Promise<PaymentMethodResponse> {\n return this.request('POST', `/payment-methods/${encodeURIComponent(methodId)}/update`, {\n body: params,\n });\n }\n\n /**\n * Delete a saved payment method.\n *\n * @param methodId - The payment method ID to delete.\n * @returns Deletion confirmation.\n */\n async delete(methodId: string): Promise<PaymentMethodDeleteResponse> {\n return this.request('DELETE', `/payment-methods/${encodeURIComponent(methodId)}`);\n }\n\n /**\n * List the payment methods available for a payment — the discovery endpoint a\n * custom checkout renders its tiles from.\n *\n * Callable with a publishable key plus the payment's `client_secret`, so it\n * runs from the browser. The returned set is already filtered by country,\n * order value and the merchant's availability rules, and each entry carries\n * `display` (name + icon slug) and `amount_limits` (the order values it stays\n * available for) so you do not have to maintain either alongside.\n *\n * This is *not* the customer's saved methods — see {@link listForCustomer}.\n *\n * @param params - `client_secret`, plus optional `country`, `amount` and filters.\n * @returns The methods available for the payment, grouped by payment method.\n *\n * @example\n * ```typescript\n * const { payment_methods } = await delopay.paymentMethods.list({\n * client_secret: 'pay_abc_secret_xyz',\n * country: 'DE',\n * amount: 25000,\n * });\n *\n * for (const group of payment_methods) {\n * for (const method of group.payment_method_types) {\n * // Re-check availability yourself as the cart total changes, instead of\n * // re-listing on every keystroke.\n * const limits = method.amount_limits;\n * const available =\n * !limits ||\n * ((limits.min_amount == null || cartTotal >= limits.min_amount) &&\n * (limits.max_amount == null || cartTotal <= limits.max_amount) &&\n * !limits.excluded_ranges.some(\n * (band) => cartTotal >= band.min_amount && cartTotal <= band.max_amount,\n * ));\n *\n * if (available) render(method.display?.display_name, method.display?.icon_slug);\n * }\n * }\n * ```\n */\n async list(params?: PaymentMethodListParams): Promise<PaymentMethodListResponse> {\n return this.request('GET', '/payment-methods', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /**\n * The shop's payment buttons as the hosted checkout draws them: order,\n * labels in the shop's or caller's language, artwork, and what selecting\n * each one does. For rendering payment buttons on your own site without a\n * local table of provider names and icons.\n *\n * With a secret key, name the shop (`profile_id`) and optionally the\n * environment and a buyer context; the answer may be reused for\n * `cache.max_age_seconds` — {@link PresentationCache} does that. With a\n * publishable key, pass the payment's `client_secret` (or use\n * `CheckoutSession.paymentMethodPresentation`); that answer is never reused.\n *\n * A displayed entry is not a promise: the payment is confirmed against the\n * current configuration.\n *\n * `GET /account/payment-methods/presentation`\n *\n * @example\n * ```typescript\n * const buttons = await delopay.paymentMethods.presentation({\n * profile_id: 'pro_123',\n * country: 'DE',\n * currency: 'EUR',\n * amount: 4999,\n * locale: 'de',\n * });\n * for (const entry of buttons.entries) {\n * if (entry.kind === 'heading') renderHeading(entry.label);\n * else renderButton(entry.label, entry.sublabel, presentationIconSrc(entry));\n * }\n * ```\n */\n async presentation(\n params?: PaymentMethodPresentationParams,\n options?: RequestExtras,\n ): Promise<PaymentMethodPresentationResponse> {\n return this.request('GET', '/account/payment-methods/presentation', {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * List all saved payment methods for a customer, optionally filtered.\n *\n * @param customerId - The customer ID.\n * @param params - Optional filters: `client_secret`, `accepted_countries`, `accepted_currencies`,\n * `amount`, `recurring_enabled`, `installment_payment_enabled`, `limit`, `card_networks`.\n * @returns Customer's saved payment methods.\n *\n * @example\n * ```typescript\n * const { customer_payment_methods } = await delopay.paymentMethods.listForCustomer(\n * 'cus_123',\n * { accepted_currencies: ['EUR'], amount: 5000 },\n * );\n * ```\n */\n async listForCustomer(\n customerId: string,\n params?: CustomerPaymentMethodsListParams,\n ): Promise<CustomerPaymentMethodsListResponse> {\n return this.request('GET', `/customers/${encodeURIComponent(customerId)}/payment-methods`, {\n query: params as Record<\n string,\n string | number | boolean | (string | number | boolean)[] | null | undefined\n >,\n });\n }\n\n /**\n * Set a payment method as the default for a customer.\n *\n * @param customerId - The customer ID.\n * @param methodId - The payment method ID to set as default.\n * @returns The updated payment method.\n */\n async setDefault(customerId: string, methodId: string): Promise<PaymentMethodResponse> {\n return this.request(\n 'POST',\n `/customers/${encodeURIComponent(customerId)}/payment-methods/${encodeURIComponent(methodId)}/default`,\n );\n }\n\n // --- Advanced operations (Task 3.3) ---\n\n /** Migrate a payment method. `POST /payment-methods/migrate` */\n async migrate(params: Record<string, unknown>): Promise<PaymentMethodResponse> {\n return this.request('POST', '/payment-methods/migrate', { body: params });\n }\n\n /** Batch migrate payment methods. `POST /payment-methods/migrate-batch` */\n async migrateBatch(params: Record<string, unknown>[]): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/migrate-batch', { body: params });\n }\n\n /** Batch update payment methods. `POST /payment-methods/update-batch` */\n async updateBatch(params: Record<string, unknown>[]): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/update-batch', { body: params });\n }\n\n /** Batch retrieve payment methods. `GET /payment-methods/batch` */\n async batchRetrieve(\n params?: Record<string, string | number | undefined>,\n ): Promise<PaymentMethodResponse[]> {\n return this.request('GET', '/payment-methods/batch', { query: params });\n }\n\n /** Tokenize a card. `POST /payment-methods/tokenize-card` */\n async tokenizeCard(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/tokenize-card', { body: params });\n }\n\n /** Batch tokenize cards. `POST /payment-methods/tokenize-card-batch` */\n async tokenizeCardBatch(params: Record<string, unknown>[]): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/tokenize-card-batch', { body: params });\n }\n\n /** Initiate payment method collect link flow. `POST /payment-methods/collect` */\n async collect(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/collect', { body: params });\n }\n\n /** Save a payment method. `POST /payment-methods/{methodId}/save` */\n async save(methodId: string, params?: Record<string, unknown>): Promise<PaymentMethodResponse> {\n return this.request('POST', `/payment-methods/${encodeURIComponent(methodId)}/save`, {\n body: params,\n });\n }\n\n /** Create payment method auth link token. `POST /payment-methods/auth/link` */\n async createAuthLink(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/auth/link', { body: params });\n }\n\n /** Exchange payment method auth token. `POST /payment-methods/auth/exchange` */\n async exchangeAuthToken(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/auth/exchange', { body: params });\n }\n\n /** Tokenize card using existing PM. `POST /payment-methods/{methodId}/tokenize-card` */\n async tokenizeCardForMethod(\n methodId: string,\n params: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n return this.request('POST', `/payment-methods/${encodeURIComponent(methodId)}/tokenize-card`, {\n body: params,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/delopay-sdk-publish/dist/chunk-LJ2EG6JK.cjs","../src/resources/paymentMethods.ts"],"names":[],"mappings":"AAAA;ACeO,IAAM,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AA;AAAA;AAAA;AAAA;AAqC8C,EAAA;AACwB,IAAA;AAC3D,MAAA;AACJ,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqB+C,EAAA;AAC0B,IAAA;AAC9D,MAAA;AAIR,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASuF,EAAA;AACzE,IAAA;AACV,MAAA;AACgE,MAAA;AAClE,IAAA;AACF,EAAA;AAAA;AAAA;AAK+E,EAAA;AACL,IAAA;AAC1E,EAAA;AAAA;AAGwF,EAAA;AAChB,IAAA;AACxE,EAAA;AAAA;AAGuF,EAAA;AACT,IAAA;AAC9E,EAAA;AAAA;AAKoC,EAAA;AACoC,IAAA;AACxE,EAAA;AAAA;AAGsF,EAAA;AACd,IAAA;AACxE,EAAA;AAAA;AAG6F,EAAA;AACf,IAAA;AAC9E,EAAA;AAAA;AAGiF,EAAA;AACP,IAAA;AAC1E,EAAA;AAAA;AAG+F,EAAA;AACjB,IAAA;AACpE,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAGwF,EAAA;AACZ,IAAA;AAC5E,EAAA;AAAA;AAG2F,EAAA;AACnB,IAAA;AACxE,EAAA;AAAA;AAMoC,EAAA;AAC0C,IAAA;AACpE,MAAA;AACP,IAAA;AACH,EAAA;AACF;ADhDgF;AACA;AACA;AACA","file":"/tmp/delopay-sdk-publish/dist/chunk-LJ2EG6JK.cjs","sourcesContent":[null,"import type {\n PaymentMethodCreateRequest,\n PaymentMethodResponse,\n PaymentMethodUpdateRequest,\n PaymentMethodListParams,\n PaymentMethodListResponse,\n PaymentMethodDeleteResponse,\n PaymentMethodPresentationParams,\n PaymentMethodPresentationResponse,\n CustomerPaymentMethodsListParams,\n CustomerPaymentMethodsListResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/** Create and manage saved payment methods for customers. */\nexport class PaymentMethods {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Save a new payment method (card, bank account, wallet, etc.).\n *\n * @param params - Payment method data including type and card/bank details.\n * @returns The saved payment method.\n *\n * @example\n * ```typescript\n * const pm = await delopay.paymentMethods.create({\n * payment_method: 'card',\n * customer_id: 'cus_123',\n * client_secret: 'cs_...',\n * });\n * ```\n */\n async create(params: PaymentMethodCreateRequest): Promise<PaymentMethodResponse> {\n return this.request('POST', '/payment-methods', { body: params });\n }\n\n /**\n * Retrieve a saved payment method by its ID.\n *\n * @param methodId - The payment method ID.\n * @returns The payment method.\n */\n async retrieve(methodId: string): Promise<PaymentMethodResponse> {\n return this.request('GET', `/payment-methods/${encodeURIComponent(methodId)}`);\n }\n\n /**\n * Update an existing payment method (e.g. update card expiry).\n *\n * @param methodId - The payment method ID to update.\n * @param params - Fields to update (card expiry, holder name, etc.).\n * @returns The updated payment method.\n */\n async update(\n methodId: string,\n params: PaymentMethodUpdateRequest,\n ): Promise<PaymentMethodResponse> {\n return this.request('POST', `/payment-methods/${encodeURIComponent(methodId)}/update`, {\n body: params,\n });\n }\n\n /**\n * Delete a saved payment method.\n *\n * @param methodId - The payment method ID to delete.\n * @returns Deletion confirmation.\n */\n async delete(methodId: string): Promise<PaymentMethodDeleteResponse> {\n return this.request('DELETE', `/payment-methods/${encodeURIComponent(methodId)}`);\n }\n\n /**\n * List the payment methods available for a payment — the discovery endpoint a\n * custom checkout renders its tiles from.\n *\n * Callable with a publishable key plus the payment's `client_secret`, so it\n * runs from the browser. The returned set is already filtered by country,\n * order value and the merchant's availability rules, and each entry carries\n * `display` (name + icon slug) and `amount_limits` (the order values it stays\n * available for) so you do not have to maintain either alongside.\n *\n * This is *not* the customer's saved methods — see {@link listForCustomer}.\n *\n * @param params - `client_secret`, plus optional `country`, `amount` and filters.\n * @returns The methods available for the payment, grouped by payment method.\n *\n * @example\n * ```typescript\n * const { payment_methods } = await delopay.paymentMethods.list({\n * client_secret: 'pay_abc_secret_xyz',\n * country: 'DE',\n * amount: 25000,\n * });\n *\n * for (const group of payment_methods) {\n * for (const method of group.payment_method_types) {\n * // Re-check availability yourself as the cart total changes, instead of\n * // re-listing on every keystroke.\n * const limits = method.amount_limits;\n * const available =\n * !limits ||\n * ((limits.min_amount == null || cartTotal >= limits.min_amount) &&\n * (limits.max_amount == null || cartTotal <= limits.max_amount) &&\n * !limits.excluded_ranges.some(\n * (band) => cartTotal >= band.min_amount && cartTotal <= band.max_amount,\n * ));\n *\n * if (available) render(method.display?.display_name, method.display?.icon_slug);\n * }\n * }\n * ```\n */\n async list(params?: PaymentMethodListParams): Promise<PaymentMethodListResponse> {\n return this.request('GET', '/payment-methods', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /**\n * The shop's payment buttons as the hosted checkout draws them: order,\n * labels in the shop's or caller's language, artwork, and what selecting\n * each one does. For rendering payment buttons on your own site without a\n * local table of provider names and icons.\n *\n * With a secret key, name the shop (`profile_id`) and optionally the\n * environment and a buyer context; the answer may be reused for\n * `cache.max_age_seconds` — {@link PresentationCache} does that. With a\n * publishable key, pass the payment's `client_secret` (or use\n * `CheckoutSession.paymentMethodPresentation`); that answer is never reused.\n *\n * A displayed entry is not a promise: the payment is confirmed against the\n * current configuration.\n *\n * `GET /account/payment-methods/presentation`\n *\n * @example\n * ```typescript\n * const buttons = await delopay.paymentMethods.presentation({\n * profile_id: 'pro_123',\n * country: 'DE',\n * currency: 'EUR',\n * amount: 4999,\n * locale: 'de',\n * });\n * for (const entry of buttons.entries) {\n * if (entry.kind === 'heading') renderHeading(entry.label);\n * else renderButton(entry.label, entry.sublabel, presentationIconSrc(entry));\n * }\n * ```\n */\n async presentation(\n params?: PaymentMethodPresentationParams,\n options?: RequestExtras,\n ): Promise<PaymentMethodPresentationResponse> {\n return this.request('GET', '/account/payment-methods/presentation', {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * List all saved payment methods for a customer, optionally filtered.\n *\n * @param customerId - The customer ID.\n * @param params - Optional filters: `client_secret`, `accepted_countries`, `accepted_currencies`,\n * `amount`, `recurring_enabled`, `installment_payment_enabled`, `limit`, `card_networks`.\n * @returns Customer's saved payment methods.\n *\n * @example\n * ```typescript\n * const { customer_payment_methods } = await delopay.paymentMethods.listForCustomer(\n * 'cus_123',\n * { accepted_currencies: ['EUR'], amount: 5000 },\n * );\n * ```\n */\n async listForCustomer(\n customerId: string,\n params?: CustomerPaymentMethodsListParams,\n ): Promise<CustomerPaymentMethodsListResponse> {\n return this.request('GET', `/customers/${encodeURIComponent(customerId)}/payment-methods`, {\n query: params as Record<\n string,\n string | number | boolean | (string | number | boolean)[] | null | undefined\n >,\n });\n }\n\n /**\n * Set a payment method as the default for a customer.\n *\n * @param customerId - The customer ID.\n * @param methodId - The payment method ID to set as default.\n * @returns The updated payment method.\n */\n async setDefault(customerId: string, methodId: string): Promise<PaymentMethodResponse> {\n return this.request(\n 'POST',\n `/customers/${encodeURIComponent(customerId)}/payment-methods/${encodeURIComponent(methodId)}/default`,\n );\n }\n\n // --- Advanced operations (Task 3.3) ---\n\n /** Migrate a payment method. `POST /payment-methods/migrate` */\n async migrate(params: Record<string, unknown>): Promise<PaymentMethodResponse> {\n return this.request('POST', '/payment-methods/migrate', { body: params });\n }\n\n /** Batch migrate payment methods. `POST /payment-methods/migrate-batch` */\n async migrateBatch(params: Record<string, unknown>[]): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/migrate-batch', { body: params });\n }\n\n /** Batch update payment methods. `POST /payment-methods/update-batch` */\n async updateBatch(params: Record<string, unknown>[]): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/update-batch', { body: params });\n }\n\n /** Batch retrieve payment methods. `GET /payment-methods/batch` */\n async batchRetrieve(\n params?: Record<string, string | number | undefined>,\n ): Promise<PaymentMethodResponse[]> {\n return this.request('GET', '/payment-methods/batch', { query: params });\n }\n\n /** Tokenize a card. `POST /payment-methods/tokenize-card` */\n async tokenizeCard(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/tokenize-card', { body: params });\n }\n\n /** Batch tokenize cards. `POST /payment-methods/tokenize-card-batch` */\n async tokenizeCardBatch(params: Record<string, unknown>[]): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/tokenize-card-batch', { body: params });\n }\n\n /** Initiate payment method collect link flow. `POST /payment-methods/collect` */\n async collect(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/collect', { body: params });\n }\n\n /** Save a payment method. `POST /payment-methods/{methodId}/save` */\n async save(methodId: string, params?: Record<string, unknown>): Promise<PaymentMethodResponse> {\n return this.request('POST', `/payment-methods/${encodeURIComponent(methodId)}/save`, {\n body: params,\n });\n }\n\n /** Create payment method auth link token. `POST /payment-methods/auth/link` */\n async createAuthLink(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/auth/link', { body: params });\n }\n\n /** Exchange payment method auth token. `POST /payment-methods/auth/exchange` */\n async exchangeAuthToken(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/payment-methods/auth/exchange', { body: params });\n }\n\n /** Tokenize card using existing PM. `POST /payment-methods/{methodId}/tokenize-card` */\n async tokenizeCardForMethod(\n methodId: string,\n params: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n return this.request('POST', `/payment-methods/${encodeURIComponent(methodId)}/tokenize-card`, {\n body: params,\n });\n }\n}\n"]}
|