@delopay/sdk 0.497.0 → 0.501.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-I5KOMBQ3.js → chunk-2OJJ3KGP.js} +25 -1
- package/dist/chunk-2OJJ3KGP.js.map +1 -0
- 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-2NVGA4G5.cjs → chunk-575SNLIT.cjs} +35 -1
- package/dist/chunk-575SNLIT.cjs.map +1 -0
- package/dist/chunk-5CITBN33.cjs.map +1 -1
- package/dist/chunk-5HCKC4HF.cjs.map +1 -1
- package/dist/chunk-5O2JSQYA.cjs.map +1 -1
- package/dist/chunk-5QS67SBO.cjs.map +1 -1
- package/dist/chunk-6EBY2KKL.cjs.map +1 -1
- package/dist/chunk-6LFOM6HV.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-7JV6VVO7.cjs.map +1 -1
- package/dist/chunk-7NKJD5ST.cjs.map +1 -1
- package/dist/chunk-7QZCUXWB.cjs.map +1 -1
- package/dist/chunk-7VXF5D67.cjs.map +1 -1
- package/dist/chunk-ABWAYMN5.cjs.map +1 -1
- package/dist/chunk-ACZ2R47X.cjs.map +1 -1
- package/dist/chunk-AYUYJO3I.cjs.map +1 -1
- package/dist/chunk-BCA3TCGS.cjs.map +1 -1
- package/dist/chunk-BP6KDQ6I.cjs.map +1 -1
- package/dist/chunk-BRY3W7N3.cjs.map +1 -1
- package/dist/chunk-BT3UAUEV.cjs.map +1 -1
- package/dist/chunk-CCN44NZJ.cjs.map +1 -1
- package/dist/chunk-CR3JBTP3.cjs.map +1 -1
- package/dist/chunk-DJASVBOJ.cjs.map +1 -1
- package/dist/chunk-EEB2HDYL.cjs.map +1 -1
- 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-EYHSXJMJ.cjs.map +1 -1
- package/dist/chunk-F3I5DOWV.cjs.map +1 -1
- package/dist/chunk-F46K5H3U.cjs.map +1 -1
- package/dist/chunk-F6QJB4XP.cjs.map +1 -1
- package/dist/chunk-F6S3WCCB.cjs.map +1 -1
- package/dist/chunk-FQRC4NJG.cjs.map +1 -1
- package/dist/chunk-FTWGI7UZ.cjs.map +1 -1
- package/dist/chunk-FYISDU2Y.cjs.map +1 -1
- package/dist/chunk-GG52SAHA.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-GWSVQXEY.cjs.map +1 -1
- package/dist/chunk-HLKFUOAQ.cjs.map +1 -1
- package/dist/chunk-HLYGHP6F.cjs.map +1 -1
- package/dist/chunk-HSJABE7X.cjs.map +1 -1
- package/dist/chunk-I2W7AO4B.cjs.map +1 -1
- package/dist/chunk-I2XGNALG.cjs.map +1 -1
- package/dist/{chunk-K3XXGAOR.cjs → chunk-IDY2LP4Q.cjs} +3 -3
- package/dist/chunk-IDY2LP4Q.cjs.map +1 -0
- package/dist/chunk-IKXGA2Z5.cjs.map +1 -1
- package/dist/{chunk-7H2VFIPS.js → chunk-IPN7D5PP.js} +4 -4
- package/dist/chunk-IR2LFKKA.cjs.map +1 -1
- package/dist/{chunk-ZMJT2YPZ.cjs → chunk-IUXCU3DW.cjs} +7 -7
- package/dist/chunk-IUXCU3DW.cjs.map +1 -0
- package/dist/chunk-J4ZB7MU4.cjs.map +1 -1
- package/dist/chunk-J5RPSRBQ.cjs.map +1 -1
- package/dist/chunk-JPPRDMTJ.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-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-MLG6NXI6.cjs.map +1 -1
- package/dist/chunk-MYAXAWBQ.cjs.map +1 -1
- package/dist/chunk-NFB3S2E6.cjs.map +1 -1
- package/dist/chunk-NULOAF7W.cjs.map +1 -1
- package/dist/chunk-NX36HDXE.cjs.map +1 -1
- package/dist/chunk-NYL3BNHR.cjs.map +1 -1
- package/dist/chunk-O4AYHLQX.cjs.map +1 -1
- package/dist/{chunk-YFRAI34Y.cjs → chunk-O53VOQK7.cjs} +67 -1
- package/dist/chunk-O53VOQK7.cjs.map +1 -0
- package/dist/chunk-OAEKP665.cjs.map +1 -1
- package/dist/chunk-ODPNVNYE.cjs.map +1 -1
- package/dist/chunk-OG2KJAYD.cjs.map +1 -1
- package/dist/chunk-OYZP6NF6.cjs.map +1 -1
- package/dist/chunk-P4UILJVU.cjs.map +1 -1
- package/dist/chunk-P7DYLUUI.cjs.map +1 -1
- package/dist/chunk-PKAE6AQT.cjs.map +1 -1
- package/dist/{chunk-F6LZ2YNM.js → chunk-Q5S7YKB3.js} +35 -1
- package/dist/chunk-Q5S7YKB3.js.map +1 -0
- package/dist/chunk-Q7M7DO7M.cjs.map +1 -1
- package/dist/chunk-QKUWFMZP.cjs.map +1 -1
- package/dist/chunk-QRSA72B3.cjs.map +1 -1
- package/dist/chunk-QYNRNDIY.cjs.map +1 -1
- package/dist/chunk-R4GA6BVP.cjs.map +1 -1
- package/dist/chunk-R5VYSZ3Q.cjs.map +1 -1
- package/dist/chunk-RHFUXHQN.cjs.map +1 -1
- package/dist/{chunk-CAMALM35.cjs → chunk-RHT27R27.cjs} +25 -1
- package/dist/chunk-RHT27R27.cjs.map +1 -0
- package/dist/chunk-RI42IDRR.cjs.map +1 -1
- package/dist/chunk-S77LQWYC.cjs.map +1 -1
- package/dist/chunk-S7SBNOGS.cjs.map +1 -1
- package/dist/{chunk-CQQW5JU7.js → chunk-SAXTZZQL.js} +2 -2
- package/dist/{chunk-OEREK6NU.js → chunk-TDCB2FQI.js} +67 -1
- package/dist/chunk-TDCB2FQI.js.map +1 -0
- package/dist/chunk-TMAJE5P2.cjs.map +1 -1
- package/dist/chunk-TNIJ6OSH.cjs.map +1 -1
- package/dist/chunk-U3JK7NBG.cjs.map +1 -1
- package/dist/chunk-UGSM7RJ2.cjs.map +1 -1
- package/dist/chunk-UKLZAOLW.cjs.map +1 -1
- package/dist/chunk-UTCXNBID.cjs.map +1 -1
- package/dist/chunk-V47G7P6L.cjs.map +1 -1
- package/dist/chunk-VH5A6SMU.cjs.map +1 -1
- package/dist/chunk-VHMH4QMY.cjs.map +1 -1
- package/dist/chunk-VYC7WUM5.cjs.map +1 -1
- package/dist/chunk-W457XUA6.cjs.map +1 -1
- package/dist/{chunk-DDXERBGG.js → chunk-W7KJTMAF.js} +12 -1
- package/dist/chunk-W7KJTMAF.js.map +1 -0
- 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-XQLRIBVR.cjs.map +1 -1
- package/dist/chunk-Y7LSSRNJ.cjs.map +1 -1
- package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
- package/dist/chunk-YW4DVKNT.cjs.map +1 -1
- package/dist/{chunk-PYNHK6AP.cjs → chunk-Z7AVB6VI.cjs} +12 -1
- package/dist/chunk-Z7AVB6VI.cjs.map +1 -0
- package/dist/chunk-ZGMIHHGL.cjs.map +1 -1
- package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
- package/dist/chunk-ZUULK36E.cjs.map +1 -1
- 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 +6 -6
- 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 +5 -5
- 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/adminCheckoutDomains.cjs.map +1 -1
- package/dist/internal/resources/adminCheckoutDomains.d.cts +1 -1
- package/dist/internal/resources/adminCheckoutDomains.d.ts +1 -1
- package/dist/internal/resources/adminFeePlans.cjs.map +1 -1
- package/dist/internal/resources/adminFeePlans.d.cts +1 -1
- package/dist/internal/resources/adminFeePlans.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/adminNotices.cjs.map +1 -1
- package/dist/internal/resources/adminNotices.d.cts +1 -1
- package/dist/internal/resources/adminNotices.d.ts +1 -1
- package/dist/internal/resources/adminPortal.cjs.map +1 -1
- package/dist/internal/resources/adminPortal.d.cts +1 -1
- package/dist/internal/resources/adminPortal.d.ts +1 -1
- package/dist/internal/resources/adminPricing.cjs +2 -2
- package/dist/internal/resources/adminPricing.cjs.map +1 -1
- package/dist/internal/resources/adminPricing.d.cts +19 -1
- package/dist/internal/resources/adminPricing.d.ts +19 -1
- package/dist/internal/resources/adminPricing.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.map +1 -1
- package/dist/internal/resources/auditLogs.d.cts +1 -1
- package/dist/internal/resources/auditLogs.d.ts +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/resources/platformSettings.d.cts +1 -1
- package/dist/internal/resources/platformSettings.d.ts +1 -1
- package/dist/internal.cjs +9 -9
- 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/aiTools.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.map +1 -1
- package/dist/resources/buyerConversations.cjs.map +1 -1
- package/dist/resources/buyerEvidenceReviews.cjs.map +1 -1
- package/dist/resources/buyerPortal.cjs +2 -2
- package/dist/resources/buyerPortal.cjs.map +1 -1
- package/dist/resources/buyerPortal.d.cts +7 -1
- package/dist/resources/buyerPortal.d.ts +7 -1
- package/dist/resources/buyerPortal.js +1 -1
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/chargebackPrevention.cjs.map +1 -1
- package/dist/resources/checkoutDomains.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/contentEncryption.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.map +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/notices.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/shareLinks.cjs.map +1 -1
- package/dist/resources/shopLabels.cjs.map +1 -1
- package/dist/resources/shopify.cjs +2 -2
- package/dist/resources/shopify.cjs.map +1 -1
- package/dist/resources/shopify.d.cts +41 -4
- package/dist/resources/shopify.d.ts +41 -4
- package/dist/resources/shopify.js +1 -1
- package/dist/resources/shops.cjs.map +1 -1
- package/dist/resources/stripeConnect.cjs.map +1 -1
- package/dist/resources/subscriptions.cjs +2 -2
- package/dist/resources/subscriptions.cjs.map +1 -1
- package/dist/resources/subscriptions.d.cts +6 -1
- package/dist/resources/subscriptions.d.ts +6 -1
- package/dist/resources/subscriptions.js +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/trustedOrigins.cjs.map +1 -1
- package/dist/{types-D_Y2A9ny.d.cts → types-FHqOLCyI.d.cts} +181 -1
- package/dist/{types-BxgOWS55.d.ts → types-SEJjet2B.d.ts} +181 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +282 -6
- package/dist/types.d.ts +282 -6
- package/package.json +1 -1
- package/dist/chunk-2NVGA4G5.cjs.map +0 -1
- package/dist/chunk-CAMALM35.cjs.map +0 -1
- package/dist/chunk-DDXERBGG.js.map +0 -1
- package/dist/chunk-F6LZ2YNM.js.map +0 -1
- package/dist/chunk-I5KOMBQ3.js.map +0 -1
- package/dist/chunk-K3XXGAOR.cjs.map +0 -1
- package/dist/chunk-OEREK6NU.js.map +0 -1
- package/dist/chunk-PYNHK6AP.cjs.map +0 -1
- package/dist/chunk-YFRAI34Y.cjs.map +0 -1
- package/dist/chunk-ZMJT2YPZ.cjs.map +0 -1
- /package/dist/{chunk-7H2VFIPS.js.map → chunk-IPN7D5PP.js.map} +0 -0
- /package/dist/{chunk-CQQW5JU7.js.map → chunk-SAXTZZQL.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/dist/chunk-2NVGA4G5.cjs","../src/internal/resources/adminPricing.ts"],"names":[],"mappings":"AAAA;AC8BA,IAAM,KAAA,EAAO,uBAAA;AACb,IAAM,UAAA,EAAY,CAAC,KAAA,EAAqB,OAAA,EAAA,GACtC,CAAA,EAAA;AACwB;AAEmB;AAED;AAEH;AAGT;AAED;AACR,EAAA;AACvB;AAEoC;AACJ,EAAA;AACrB,IAAA;AACT,EAAA;AACgB,EAAA;AACF,EAAA;AACF,IAAA;AACR,MAAA;AACF,IAAA;AACF,EAAA;AACO,EAAA;AACT;AAE6E;AACtC,EAAA;AAC5B,IAAA;AACT,EAAA;AACiB,EAAA;AACU,EAAA;AAC7B;AAEuE;AAChD,EAAA;AACd,IAAA;AACe,MAAA;AACI,QAAA;AACtB,MAAA;AAC4B,MAAA;AACzB,IAAA;AACqB,MAAA;AACF,QAAA;AACtB,MAAA;AAC4B,MAAA;AACzB,IAAA;AACwB,MAAA;AACL,QAAA;AAC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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AASyF,EAAA;AAC/D,IAAA;AACO,IAAA;AACvB,MAAA;AACD,QAAA;AACH,QAAA;AACF,MAAA;AACD,IAAA;AACH,EAAA;AAAA;AAK2C,EAAA;AACX,IAAA;AACrB,MAAA;AACR,IAAA;AACH,EAAA;AACF;ADrIqC;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-2NVGA4G5.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type { MerchantPricingViewResponse, PricingFeeType } from '../../types';\nimport type {\n AdminEventFeeListQuery,\n AdminEventFeeListResponse,\n AdminEventFeeRecord,\n AdminServiceUsageListQuery,\n AdminServiceUsageListResponse,\n AdminServiceUsageRecord,\n EffectivePricingQuery,\n EffectivePricingResponse,\n EventFeePreviewRequest,\n EventFeePreviewResponse,\n EventFeeRecordRequest,\n MerchantPricingBrandResponse,\n PricingBrand,\n PricingOverview,\n PricingOverviewQuery,\n PricingSaveRequest,\n PricingScope,\n PricingScopeView,\n RecurringFeeChargeListQuery,\n RecurringFeeChargeListResponse,\n RecurringFeeRunRequest,\n RecurringFeeRunResponse,\n ServiceUsagePreviewRequest,\n ServiceUsagePreviewResponse,\n ServiceUsageRecordRequest,\n} from '../types';\n\nconst BASE = '/admin-portal/pricing';\nconst brandPath = (brand: PricingBrand, feeType: PricingFeeType): string =>\n `${BASE}/brands/${encodeURIComponent(brand)}/${encodeURIComponent(feeType)}`;\nconst merchantBasePath = (merchantId: string): string =>\n `${BASE}/merchants/${encodeURIComponent(merchantId)}`;\nconst merchantFeePath = (merchantId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/${encodeURIComponent(feeType)}`;\nconst projectFeePath = (merchantId: string, projectId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/projects/${encodeURIComponent(projectId)}/${encodeURIComponent(feeType)}`;\nconst shopFeePath = (merchantId: string, profileId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/shops/${encodeURIComponent(profileId)}/${encodeURIComponent(feeType)}`;\n\nconst UNICODE_EDGE_WHITESPACE = /^\\p{White_Space}+|\\p{White_Space}+$/gu;\n\nfunction trimUnicodeWhitespace(value: string): string {\n return value.replace(UNICODE_EDGE_WHITESPACE, '');\n}\n\nfunction assertOptionalProviderSlug(provider: string | null | undefined): string | undefined {\n if (provider === undefined || provider === null) {\n return undefined;\n }\n const trimmed = trimUnicodeWhitespace(provider);\n if (!trimmed) {\n throw new TypeError(\n 'Provider slug cannot be empty or whitespace; omit provider (or pass null when saving) for a service-wide rule.',\n );\n }\n return trimmed;\n}\n\nfunction validateSaveRequest(params: PricingSaveRequest): PricingSaveRequest {\n if (params.provider === undefined || params.provider === null) {\n return params;\n }\n const provider = assertOptionalProviderSlug(params.provider);\n return provider === params.provider ? params : { ...params, provider };\n}\n\nfunction scopeCancelQuery(scope: PricingScope): Record<string, string> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n return { brand: scope.brand };\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return { merchant_id: scope.merchant_id };\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return { merchant_id: scope.merchant_id, project_id: scope.project_id };\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return { merchant_id: scope.merchant_id, profile_id: scope.profile_id };\n }\n}\n\n/**\n * Unified platform pricing hierarchy across every fee type: brand default\n * (`delopay` / `spicepay`), merchant, project, and shop, plus the Effective\n * Price View showing where every price comes from.\n *\n * Every write carries the scope's optimistic `expected_revision` token; a write\n * against an older revision is refused with `412 Precondition Failed`.\n */\nexport class AdminPricing {\n constructor(private readonly request: RequestFn) {}\n\n /** Brand defaults, active/scheduled exceptions, and older setups. `GET /admin-portal/pricing` */\n async overview(params?: PricingOverviewQuery): Promise<PricingOverview> {\n return this.request('GET', BASE, {\n query: {\n merchant_id: params?.merchant_id,\n fee_type: params?.fee_type,\n provider: params?.provider,\n },\n });\n }\n\n /** Effective price view naming the exact source of every fee type. `GET /admin-portal/pricing/effective` */\n async effective(params: EffectivePricingQuery): Promise<EffectivePricingResponse> {\n return this.request('GET', `${BASE}/effective`, {\n query: {\n merchant_id: params.merchant_id,\n project_id: params.project_id,\n profile_id: params.profile_id,\n provider: params.provider,\n at: params.at,\n },\n });\n }\n\n /** Save a brand default price (service-wide or for one provider). `PUT /admin-portal/pricing/brands/{brand}/{fee_type}` */\n async saveBrand(\n brand: PricingBrand,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', brandPath(brand, feeType), { body: validateSaveRequest(params) });\n }\n\n /** Remove a provider-specific brand default override. Service-wide brand defaults cannot be removed. `DELETE /admin-portal/pricing/brands/{brand}/{fee_type}` */\n async removeBrand(\n brand: PricingBrand,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider: string,\n ): Promise<PricingScopeView> {\n const trimmed = trimUnicodeWhitespace(provider);\n if (!trimmed) {\n throw new TypeError(\n 'Removing a brand pricing rule requires a provider slug; service-wide brand defaults cannot be removed.',\n );\n }\n return this.request('DELETE', brandPath(brand, feeType), {\n query: { expected_revision: expectedRevision, provider: trimmed },\n });\n }\n\n /** Save a merchant exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */\n async saveMerchant(\n merchantId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', merchantFeePath(merchantId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a merchant exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */\n async removeMerchant(\n merchantId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', merchantFeePath(merchantId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a project exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */\n async saveProject(\n merchantId: string,\n projectId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', projectFeePath(merchantId, projectId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a project exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */\n async removeProject(\n merchantId: string,\n projectId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', projectFeePath(merchantId, projectId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a shop exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */\n async saveShop(\n merchantId: string,\n profileId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', shopFeePath(merchantId, profileId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a shop exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */\n async removeShop(\n merchantId: string,\n profileId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', shopFeePath(merchantId, profileId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a price at any scope in the hierarchy (brand default, merchant, project, or shop). */\n async save(\n scope: PricingScope,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n return this.saveBrand(scope.brand, feeType, params);\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return this.saveMerchant(scope.merchant_id, feeType, params);\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return this.saveProject(scope.merchant_id, scope.project_id, feeType, params);\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return this.saveShop(scope.merchant_id, scope.profile_id, feeType, params);\n }\n }\n\n /** Remove an exception scope or a provider-specific brand override; service-wide brand defaults cannot be removed. */\n async remove(\n scope: PricingScope,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n if (!provider || !trimUnicodeWhitespace(provider)) {\n throw new TypeError('A brand default price cannot be removed without a provider.');\n }\n return this.removeBrand(scope.brand, feeType, expectedRevision, provider);\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return this.removeMerchant(scope.merchant_id, feeType, expectedRevision, provider);\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return this.removeProject(\n scope.merchant_id,\n scope.project_id,\n feeType,\n expectedRevision,\n provider,\n );\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return this.removeShop(\n scope.merchant_id,\n scope.profile_id,\n feeType,\n expectedRevision,\n provider,\n );\n }\n }\n\n /** Cancel a future scheduled version. `DELETE /admin-portal/pricing/versions/{version_id}` */\n async cancelVersion(\n versionId: string,\n feeType: PricingFeeType,\n scope: PricingScope,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const scopeQuery = scopeCancelQuery(scope);\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', `${BASE}/versions/${encodeURIComponent(versionId)}`, {\n query: {\n fee_type: feeType,\n provider: validatedProvider,\n ...scopeQuery,\n expected_revision: expectedRevision,\n },\n });\n }\n\n /** Read a merchant's effective and explicit pricing brand. `GET /admin-portal/pricing/merchants/{merchant_id}/brand` */\n async getMerchantBrand(merchantId: string): Promise<MerchantPricingBrandResponse> {\n return this.request('GET', `${merchantBasePath(merchantId)}/brand`);\n }\n\n /** Read the exact Pricing page view a merchant sees (read-only staff mirror). `GET /admin-portal/pricing/merchants/{merchant_id}/view` */\n async getMerchantView(merchantId: string): Promise<MerchantPricingViewResponse> {\n return this.request('GET', `${merchantBasePath(merchantId)}/view`);\n }\n\n /** Assign a merchant's pricing brand (`'delopay'` / `'spicepay'`), or `null` to inherit the deployment brand. `PUT /admin-portal/pricing/merchants/{merchant_id}/brand` */\n async setMerchantBrand(\n merchantId: string,\n brand: PricingBrand | null,\n ): Promise<MerchantPricingBrandResponse> {\n return this.request('PUT', `${merchantBasePath(merchantId)}/brand`, {\n body: { brand },\n });\n }\n\n /** List recorded third-party service uses across merchants with separate provider cost and markup. `GET /admin-portal/pricing/service-usages` */\n async listServiceUsages(\n params?: AdminServiceUsageListQuery,\n ): Promise<AdminServiceUsageListResponse> {\n return this.request('GET', `${BASE}/service-usages`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** Dry-run calculate the provider cost, platform markup, and total charge for a third-party service use. `POST /admin-portal/pricing/service-usages/preview` */\n async previewServiceUsage(\n params: ServiceUsagePreviewRequest,\n ): Promise<ServiceUsagePreviewResponse> {\n return this.request('POST', `${BASE}/service-usages/preview`, {\n body: params,\n });\n }\n\n /** Record and settle one third-party service use idempotently by `reference_id`. `POST /admin-portal/pricing/service-usages` */\n async recordServiceUsage(params: ServiceUsageRecordRequest): Promise<AdminServiceUsageRecord> {\n return this.request('POST', `${BASE}/service-usages`, {\n body: params,\n });\n }\n\n /** List recorded platform event fees across merchants. `GET /admin-portal/pricing/event-fees` */\n async listEventFees(params?: AdminEventFeeListQuery): Promise<AdminEventFeeListResponse> {\n return this.request('GET', `${BASE}/event-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** Dry-run calculate the platform event fee and effective FX rate for a hypothetical event. `POST /admin-portal/pricing/event-fees/preview` */\n async previewEventFee(params: EventFeePreviewRequest): Promise<EventFeePreviewResponse> {\n return this.request('POST', `${BASE}/event-fees/preview`, {\n body: params,\n });\n }\n\n /**\n * Record and settle one operator-recorded platform event fee. `POST /admin-portal/pricing/event-fees`\n *\n * Deduplicated by `(merchant_id, fee_type, reference_id)` (trimmed `reference_id`, without a\n * `test_mode` dimension). Retrying with a different `fee_type` bypasses deduplication and can\n * create a separate debit depending on `charge_status`; callers must use distinct `reference_id`\n * values for test and live records so a completed test write is never replayed as a live charge.\n */\n async recordEventFee(params: EventFeeRecordRequest): Promise<AdminEventFeeRecord> {\n return this.request('POST', `${BASE}/event-fees`, {\n body: params,\n });\n }\n\n /**\n * Preview (`dry_run: true`) or execute (`dry_run: false`) monthly recurring,\n * setup, and monthly-minimum fee charging. Only an explicit `dry_run: false`\n * posts live charges; omitted arguments or an omitted `dry_run` field default\n * to preview mode (`dry_run: true`).\n * `POST /admin-portal/pricing/recurring-fees/run`\n */\n async runRecurringFees(params: RecurringFeeRunRequest): Promise<RecurringFeeRunResponse> {\n const dry_run = params?.dry_run === false ? false : true;\n return this.request('POST', `${BASE}/recurring-fees/run`, {\n body: {\n ...params,\n dry_run,\n },\n });\n }\n\n /** List recorded monthly recurring, setup, and monthly-minimum fee charges. `GET /admin-portal/pricing/recurring-fees` */\n async listRecurringFees(\n params?: RecurringFeeChargeListQuery,\n ): Promise<RecurringFeeChargeListResponse> {\n return this.request('GET', `${BASE}/recurring-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n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MAAA;AACiE,MAAA;AACQ,MAAA;AAC3E,IAAA;AACF,EAAA;AAMoC,EAAA;AACtB,IAAA;AACV,MAAA;AACiE,MAAA;AACtC,MAAA;AAC7B,IAAA;AACF,EAAA;AAMgC,EAAA;AAClB,IAAA;AACV,MAAA;AACyE,MAAA;AACA,MAAA;AAC3E,IAAA;AACF,EAAA;AAAA;AAMqC,EAAA;AACsC,IAAA;AACjE,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAMqC,EAAA;AACvB,IAAA;AACV,MAAA;AAC+E,MAAA;AACxB,MAAA;AACzD,IAAA;AACF,EAAA;AAM4C,EAAA;AAC9B,IAAA;AACV,MAAA;AAC+E,MAAA;AACxB,MAAA;AACzD,IAAA;AACF,EAAA;AACF;AD3JqG;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-CAMALM35.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type {\n BuyerCaseList,\n BuyerConversationAttachment,\n BuyerPortalAttachmentQuery,\n BuyerPortalContactEmailCommand,\n BuyerPortalContactEmailOutcome,\n BuyerPortalConversationList,\n BuyerPortalConversationQuery,\n BuyerPortalMessage,\n BuyerPortalMessageCreate,\n BuyerPortalMessagePage,\n BuyerInvoiceListQuery,\n BuyerPortalInvoice,\n BuyerPortalInvoicePage,\n BuyerPortalPageQuery,\n BuyerPortalProfile,\n BuyerPortalProfileUpdate,\n BuyerPortalPurchasePage,\n BuyerPortalRefundRequest,\n BuyerPortalRefundRequestCreate,\n BuyerPortalSession,\n BuyerPortalSubscriptionPage,\n BuyerPortalSubscription,\n BuyerPortalSubscriptionActionRequest,\n BuyerPortalPlanPage,\n BuyerPortalPlanChangeRequest,\n NativeCreateSubscriptionRequest,\n NativeEnrollmentResponse,\n NativeEnrollmentStatusQuery,\n NativeEnrollmentAbandonResponse,\n BuyerEvidence,\n BuyerEvidenceEntry,\n BuyerEvidenceExtensionRequest,\n BuyerEvidenceFile,\n BuyerEvidenceSubmit,\n} from '../types';\n\n/**\n * Buyer access using a customer portal grant, sent in the api-key header.\n * Use a separate client constructed with the portal token, not a merchant secret\n * key or dashboard JWT. The grant determines buyer identity and permitted shops.\n */\nexport class BuyerPortal {\n constructor(private readonly request: RequestFn) {}\n\n async getSession(options?: RequestExtras): Promise<BuyerPortalSession> {\n return this.request('GET', '/buyer-portal/session', { ...options });\n }\n\n /**\n * The buyer's cases at the shop: the refund requests they sent and the\n * disputes about their purchases, newest first, with where each stands, who\n * acts next, the outcome and the recorded steps.\n */\n async listCases(options?: RequestExtras): Promise<BuyerCaseList> {\n return this.request('GET', '/buyer-portal/cases', { ...options });\n }\n\n /**\n * A case's evidence: what may be handed in and by when, the files saved\n * and handed in, and what the reviewer said. Opened on the first read\n * while the case still waits.\n */\n async caseEvidence(caseId: string, options?: RequestExtras): Promise<BuyerEvidence> {\n return this.request('GET', `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence`, {\n ...options,\n });\n }\n\n /**\n * Upload a file for a case. It is saved, not handed in, until a\n * submission takes it. Uploading again with the same `clientUploadId`\n * returns the file the first upload stored, also after the cut-off.\n */\n async uploadEvidenceFile(\n caseId: string,\n file: Blob,\n clientUploadId: string,\n options?: RequestExtras & { fileName?: string },\n ): Promise<BuyerEvidenceFile> {\n const { fileName, ...extras } = options ?? {};\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(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files`,\n { body: form, ...extras },\n );\n }\n\n /** Download a file of the case's evidence. */\n async downloadEvidenceFile(\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,\n {\n responseType: 'blob',\n ...options,\n },\n );\n }\n\n /** Remove a saved file. A file a submission took stays. */\n async removeEvidenceFile(caseId: string, fileId: string, options?: RequestExtras): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,\n {\n ...options,\n },\n );\n }\n\n /**\n * Hand in an explanation, saved files or both, while the buyer's window\n * is open. Sending again with the same `client_submission_id` returns the\n * submission the first send stored.\n */\n async submitEvidence(\n caseId: string,\n params: BuyerEvidenceSubmit,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/submissions`,\n { body: params, ...options },\n );\n }\n\n /** Ask for more time, once until the cut-off is next set. */\n async requestEvidenceExtension(\n caseId: string,\n params: BuyerEvidenceExtensionRequest,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,\n { body: params, ...options },\n );\n }\n\n /**\n * The buyer's conversations with the shop, the latest message first. A\n * portal link for the whole merchant lists one per shop and mode.\n */\n async listConversations(options?: RequestExtras): Promise<BuyerPortalConversationList> {\n return this.request('GET', '/buyer-portal/conversations', { ...options });\n }\n\n /**\n * The conversation with one shop and its newest messages, oldest first;\n * `before` pages back. A link issued for one shop may leave `shop` out.\n */\n async listMessages(\n query?: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessagePage> {\n return this.request('GET', '/buyer-portal/messages', {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * A message to the shop. A message to a closed conversation reopens it.\n * Sending again with the same `client_message_id` returns the message the\n * first send stored.\n */\n async sendMessage(\n message: BuyerPortalMessageCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessage> {\n return this.request('POST', '/buyer-portal/messages', { body: message, ...options });\n }\n\n /**\n * The buyer has read the conversation with the shop up to its last accepted\n * message. Answers with the buyer's conversations as they now stand.\n */\n async markMessagesRead(\n query?: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request('POST', '/buyer-portal/messages/read', {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * Upload a file for the buyer's next message to one shop, under the shop's\n * attachment rules (`attachment_rules` on the message page). It belongs to\n * the buyer until a message names it in `attachments`; one no message took\n * within a day is cleared. Uploading again with the same `clientUploadId`\n * returns the file the first upload stored.\n */\n async uploadMessageFile(\n file: Blob,\n clientUploadId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras & { fileName?: string },\n ): Promise<BuyerConversationAttachment> {\n const { fileName, ...extras } = options ?? {};\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', '/buyer-portal/messages/files', {\n body: form,\n query: query as Record<string, string | boolean | null | undefined>,\n ...extras,\n });\n }\n\n /** Download a file a message of the buyer's conversation with one shop carries. */\n async downloadMessageFile(\n fileId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request('GET', `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {\n query: query as Record<string, string | boolean | null | undefined>,\n responseType: 'blob',\n ...options,\n });\n }\n\n /** Remove a file the buyer uploaded that no message took. */\n async removeMessageFile(\n fileId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request('DELETE', `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {\n query: query as Record<string, string | boolean | null | undefined>,\n ...options,\n });\n }\n\n /** The buyer's contact and billing details, and what they may change. */\n async getProfile(options?: RequestExtras): Promise<BuyerPortalProfile> {\n return this.request('GET', '/buyer-portal/profile', { ...options });\n }\n\n /**\n * Change the buyer's contact and billing details. Fields left out stay as\n * they are; the merchant decides whether buyers may change them at all.\n */\n async updateProfile(\n params: BuyerPortalProfileUpdate,\n options?: RequestExtras,\n ): Promise<BuyerPortalProfile> {\n return this.request('POST', '/buyer-portal/profile', { body: params, ...options });\n }\n\n /**\n * Change the buyer's email address, as the profile's `email_policy` allows:\n * `request` names the new address, and under a `confirm_new` policy\n * `confirm` completes it with the proof sent there. A refusal comes back as\n * an outcome with `status: 'refused'`; a 403 means the policy does not let\n * the buyer change the address at all, and a 429 that the request limit was\n * reached.\n * `POST /buyer-portal/profile/contact-email`\n */\n async changeContactEmail(\n command: BuyerPortalContactEmailCommand,\n options?: RequestExtras,\n ): Promise<BuyerPortalContactEmailOutcome> {\n return this.request('POST', '/buyer-portal/profile/contact-email', {\n body: command,\n ...options,\n });\n }\n\n /**\n * Ask the shop for a refund of one of the buyer's purchases, named by its\n * `id` from `listPurchases()`. Nothing is refunded until the shop approves\n * the request with a refund.\n */\n async createRefundRequest(\n purchaseId: string,\n params: BuyerPortalRefundRequestCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalRefundRequest> {\n return this.request(\n 'POST',\n `/buyer-portal/purchases/${encodeURIComponent(purchaseId)}/refund-requests`,\n { body: params, ...options },\n );\n }\n\n async listInvoices(\n params?: BuyerInvoiceListQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalInvoicePage> {\n return this.request('GET', '/buyer-portal/invoices', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n async retrieveInvoice(invoiceId: string, options?: RequestExtras): Promise<BuyerPortalInvoice> {\n return this.request('GET', `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {\n ...options,\n });\n }\n\n /** Download the owned, published invoice as PDF bytes. */\n async downloadInvoicePdf(invoiceId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n async listPurchases(\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPurchasePage> {\n return this.request('GET', '/buyer-portal/purchases', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n async listSubscriptions(\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionPage> {\n return this.request('GET', '/buyer-portal/subscriptions', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n /** Apply an action allowed by the subscription capabilities and portal grant. */\n async actOnSubscription(\n subscriptionId: string,\n params: BuyerPortalSubscriptionActionRequest,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscription> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,\n { body: params, ...options },\n );\n }\n\n async listSubscriptionPlans(\n subscriptionId: string,\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPlanPage> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,\n { query: params as Record<string, number | null | undefined>, ...options },\n );\n }\n\n async changeSubscriptionPlan(\n subscriptionId: string,\n params: BuyerPortalPlanChangeRequest,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscription> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,\n { body: params, ...options },\n );\n }\n\n async listNativePlans(\n profileId: string,\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPlanPage> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,\n { query: params as Record<string, number | null | undefined>, ...options },\n );\n }\n\n /** Retry with the same subscription ID and accepted terms after a lost response. */\n async enrollNative(\n params: NativeCreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentResponse> {\n return this.request('POST', '/buyer-portal/subscriptions/native/enroll', {\n body: params,\n ...options,\n });\n }\n\n async getNativeEnrollment(\n subscriptionId: string,\n params: NativeEnrollmentStatusQuery,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentResponse> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,\n { query: { profile_id: params.profile_id }, ...options },\n );\n }\n\n async abandonNativeEnrollment(\n subscriptionId: string,\n params: NativeEnrollmentStatusQuery,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentAbandonResponse> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,\n { query: { profile_id: params.profile_id }, ...options },\n );\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/subscriptions.ts"],"sourcesContent":["import type {\n BuyerPortalSubscriptionCapabilities,\n NativeShopConfigRequest,\n NativeShopConfigResponse,\n NativeDunningConfigRequest,\n NativeDunningConfigResponse,\n AdoptSubscriptionRequest,\n AdoptSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateAndConfirmSubscriptionRequest,\n ConfirmSubscriptionRequest,\n UpdateSubscriptionRequest,\n PauseSubscriptionRequest,\n ResumeSubscriptionRequest,\n CancelSubscriptionRequest,\n SubscriptionResponse,\n ConfirmSubscriptionResponse,\n PauseSubscriptionResponse,\n ResumeSubscriptionResponse,\n CancelSubscriptionResponse,\n GetSubscriptionItemsResponse,\n GetSubscriptionItemsParams,\n SubscriptionEstimateResponse,\n SubscriptionEstimateParams,\n SubscriptionListParams,\n SubscriptionPaymentLookupRequest,\n SubscriptionPaymentLookupResponse,\n SubscriptionInvoiceListParams,\n SubscriptionInvoiceListResponse,\n SubscriptionBillingProcessorResponse,\n SubscriptionImportApplyRequest,\n SubscriptionImportApplyResponse,\n SubscriptionImportPreviewRequest,\n SubscriptionImportPreviewResponse,\n SubscriptionItemsPage,\n SubscriptionSyncRequest,\n SubscriptionSyncResponse,\n SubscriptionSyncResult,\n SubscriptionInvoiceRefundConfirmRequest,\n SubscriptionInvoiceRefundListResponse,\n SubscriptionInvoiceRefundRequest,\n SubscriptionInvoiceRefundResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * Subscription endpoints are profile-scoped: the backend requires an\n * `X-Profile-Id` header to resolve the shop / billing processor (`IR_04`\n * otherwise). Pass it through the per-call `options.headers`, e.g.\n * `subscriptions.list(params, { headers: { 'X-Profile-Id': profileId } })`.\n */\nexport class Subscriptions {\n constructor(private readonly request: RequestFn) {}\n\n /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */\n async getNativeConfig(options?: RequestExtras): Promise<NativeShopConfigResponse> {\n return this.request('GET', '/subscriptions/native/config', { ...options });\n }\n\n /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */\n async updateNativeConfig(\n params: NativeShopConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeShopConfigResponse> {\n return this.request('PUT', '/subscriptions/native/config', { body: params, ...options });\n }\n\n /** Read merchant-wide renewal recovery settings. */\n async getNativeDunning(options?: RequestExtras): Promise<NativeDunningConfigResponse> {\n return this.request('GET', '/subscriptions/native/dunning', { ...options });\n }\n\n async updateNativeDunning(\n params: NativeDunningConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeDunningConfigResponse> {\n return this.request('PUT', '/subscriptions/native/dunning', { body: params, ...options });\n }\n\n /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */\n async getCapabilities(\n subscriptionId: string,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionCapabilities> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,\n { ...options },\n );\n }\n\n /**\n * Create and immediately confirm a subscription. `POST /subscriptions`\n *\n * For billing processors that require buyer approval (e.g. PayPal), the\n * response carries a `redirect_url` the customer must be sent to.\n */\n async createAndConfirm(\n params: CreateAndConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', '/subscriptions', { body: params, ...options });\n }\n\n /** Create a subscription without confirming it. `POST /subscriptions/create` */\n async create(\n params: CreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('POST', '/subscriptions/create', { body: params, ...options });\n }\n\n /**\n * Adopt an existing Creem subscription. `POST /subscriptions/adopt`\n *\n * Requires adoption to be enabled on the deployment and `X-Profile-Id` in\n * options.headers. Adoption charges nothing and emits no invoice or webhook.\n * Repeating the processor subscription ID returns the existing DeloPay ID.\n * Retry when handoff_confirmed is false. That flag confirms persistence,\n * not the merchant's external switch-over: stop processing Creem events in\n * your own integration when handing subsequent events to DeloPay.\n */\n async adopt(\n params: AdoptSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<AdoptSubscriptionResponse> {\n return this.request('POST', '/subscriptions/adopt', { body: params, ...options });\n }\n\n /** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */\n async retrieve(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}`, {\n ...options,\n });\n }\n\n /**\n * Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`\n *\n * Like {@link createAndConfirm}, the response may carry a `redirect_url` for\n * processors that require buyer approval.\n */\n async confirm(\n subscriptionId: string,\n params: ConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async update(\n subscriptionId: string,\n params: UpdateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('PUT', `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * List subscriptions for the profile, or one customer's with `customer_id`.\n * `GET /subscriptions/list`\n */\n async list(\n params?: SubscriptionListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse[]> {\n return this.request('GET', '/subscriptions/list', {\n query: csvQuery(params, ['profile_ids', 'industry']),\n ...options,\n });\n }\n\n /** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */\n async getEstimate(\n params: SubscriptionEstimateParams,\n options?: RequestExtras,\n ): Promise<SubscriptionEstimateResponse> {\n return this.request('GET', '/subscriptions/estimate', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */\n async getItems(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<GetSubscriptionItemsResponse[]> {\n return this.request('GET', '/subscriptions/items', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * {@link getItems}, with whether the list is only the first part of what the\n * processor holds. `GET /subscriptions/items`\n *\n * The backend states that in the `X-Delopay-Items-Truncated` response\n * header (Stripe Billing lists its first 100 products), which the plain\n * {@link getItems} cannot return. Without `limit` and `offset` every item\n * the billing account offers is listed, up to 500.\n */\n async getItemsPage(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<SubscriptionItemsPage> {\n let truncated = false;\n const items = await this.request<GetSubscriptionItemsResponse[]>(\n 'GET',\n '/subscriptions/items',\n {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n onDownloadProgress: (event) => {\n // The headers arrive with the first event; a retried request reports\n // them again, and the last attempt is the one the items come from.\n truncated = event.headers.get('x-delopay-items-truncated')?.toLowerCase() === 'true';\n options?.onDownloadProgress?.(event);\n },\n },\n );\n return { items, truncated };\n }\n\n /**\n * Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n *\n * The body defaults to `{}` so the request still carries\n * `Content-Type: application/json` even when no params are passed — the\n * backend rejects the POST otherwise (\"Unsupported content type\").\n */\n async pause(\n subscriptionId: string,\n params?: PauseSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<PauseSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async resume(\n subscriptionId: string,\n params?: ResumeSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ResumeSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel`\n *\n * A subscription in a state it cannot be cancelled from is refused with\n * `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async cancel(\n subscriptionId: string,\n params?: CancelSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<CancelSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Read 1 to 50 subscriptions back from their billing processor and mirror\n * what it reports. `POST /subscriptions/sync`\n *\n * Nothing is written at the processor. A status is mirrored only with the\n * time the processor stamped it with, and never over a newer event already\n * recorded; a plan only with its own stamp. One result per id, in request\n * order; one that fails does not stop the others.\n */\n async sync(\n params: SubscriptionSyncRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionSyncResponse> {\n return this.request('POST', '/subscriptions/sync', { body: params, ...options });\n }\n\n /**\n * Read one subscription back from its billing processor and mirror what it\n * reports, as {@link sync} does, with what the processor reported beside\n * what the mirror now holds. `POST /subscriptions/{subscriptionId}/sync`\n */\n async syncOne(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionSyncResult> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/sync`, {\n ...options,\n });\n }\n\n /**\n * List the subscriptions a billing account holds at its processor, and how\n * each relates to DeloPay's: already held, new (its buyer is a DeloPay\n * customer), needing a customer, ended, or not adoptable here.\n * `POST /subscriptions/import/preview`\n *\n * Reads only; nothing is written here or at the processor. Creem and\n * Stripe Billing can be listed; PayPal cannot, which `capabilities` states\n * (`reason_code: 'listing_unsupported'`).\n */\n async importPreview(\n params: SubscriptionImportPreviewRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportPreviewResponse> {\n return this.request('POST', '/subscriptions/import/preview', { body: params, ...options });\n }\n\n /**\n * Take 1 to 25 processor subscriptions over, each through {@link adopt}\n * with every one of its checks, one after another.\n * `POST /subscriptions/import/apply`\n *\n * One result per selection, in request order; one refused does not stop\n * the others.\n */\n async importApply(\n params: SubscriptionImportApplyRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportApplyResponse> {\n return this.request('POST', '/subscriptions/import/apply', { body: params, ...options });\n }\n\n /**\n * Resolve which of the given payments were raised by a subscription.\n * `POST /subscriptions/payments/lookup`\n *\n * The linkage exists in one direction only — an invoice points at the payment\n * it settled, and nothing is stamped on the payment — so this is the only way\n * to tell a subscription charge from a one-off one when you are holding a\n * page of payments. In particular, do not use `off_session` or the presence\n * of a mandate: an ordinary saved-card charge sets those identically.\n *\n * Ids that belong to no subscription are **absent** from `links` rather than\n * returned as an error, so match on presence:\n *\n * ```ts\n * const { links } = await subscriptions.lookupPayments(\n * { payment_ids: page.map((p) => p.payment_id) },\n * { headers: { 'X-Profile-Id': profileId } },\n * );\n * const bySubscription = new Map(links.map((l) => [l.payment_id, l]));\n * ```\n *\n * Profile-scoped like every other subscription route, and that matters more\n * here than elsewhere: a `payment_id` is merchant-supplied and only unique\n * within a merchant, so the shop is part of the question, not an\n * optimisation. Pass the profile that owns **the payments** — for a list\n * spanning several shops, group the ids by shop and call once per group.\n *\n * At most 200 ids per call.\n */\n async lookupPayments(\n params: SubscriptionPaymentLookupRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionPaymentLookupResponse> {\n return this.request('POST', '/subscriptions/payments/lookup', { body: params, ...options });\n }\n\n /**\n * One subscription's billing history, newest cycle first.\n * `GET /subscriptions/{subscriptionId}/invoices`\n *\n * {@link retrieve} carries only the *latest* invoice, which is the current\n * cycle — a subscription that has renewed monthly for a year has one of those\n * and twelve of these. Use this wherever a merchant needs to see what a\n * subscription has actually billed, in particular on self-charging processors\n * (Creem, PayPal) where each renewal is charged by the processor and mirrored\n * here rather than raised as a DeloPay payment.\n *\n * Two things to render honestly, both decided rather than incidental:\n *\n * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net\n * them: the difference between the two is not a smaller charge.\n * - A `refunded_amount` of `null` is \"not reported\" and must not render as\n * `0`. Likewise a processor-hosted origination records a bootstrap invoice\n * at `0` before the buyer has paid anything, so a zero amount on such a\n * subscription is a placeholder rather than a free cycle.\n *\n * Profile-scoped like every other subscription route.\n */\n async listInvoices(\n subscriptionId: string,\n params?: SubscriptionInvoiceListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceListResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * Refund one paid subscription invoice at the billing processor that charged it.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refund`\n *\n * Needs the refund permission, as a payment refund does, and the merchant's\n * refund rules apply. Only invoices of processor-billed cycles are refunded\n * here; a cycle paid by a payment is refunded through `refunds.create`. The\n * processor refunds the whole amount left on the charge, so omit `amount` or\n * send exactly that remainder.\n *\n * The answer is usually `pending` or `succeeded`: the invoice's refunded total\n * moves, and `invoice_refunded` is sent, once the processor reports the refund.\n * The same `idempotency_key` again answers the first refund and sends nothing.\n * While one refund of an invoice awaits the processor, another is refused.\n */\n async refundInvoice(\n subscriptionId: string,\n invoiceId: string,\n params: SubscriptionInvoiceRefundRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refund`,\n { body: params, ...options, bodyIdempotencyKey: params.idempotency_key },\n );\n }\n\n /**\n * The refunds of one subscription invoice made through the API, oldest first.\n * `GET /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds`\n *\n * Needs subscription read. A refund whose processor reported a refund of the\n * invoice without a refund time of its own, while this one awaited it, reads\n * `awaiting_confirmation` with the processor's refunds it may be in\n * `confirmation_candidates`.\n */\n async listInvoiceRefunds(\n subscriptionId: string,\n invoiceId: string,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundListResponse> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds`,\n options,\n );\n }\n\n /**\n * Confirm that a refund the processor reported is this refund, once checked\n * at the processor.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds/{refundId}/confirm`\n *\n * Needs the refund permission. Only a refund in `awaiting_confirmation` is\n * confirmed, and only with one of its `confirmation_candidates`; it becomes\n * `succeeded` with the processor's refund id and amount. The invoice's\n * refunded total does not move and no webhook is sent. The same candidate\n * again answers the refund as it stands. A refund that does not await\n * confirmation, or a processor refund that is not one of its candidates, is\n * refused with a 400 (`IR_16`); a subscription, invoice or refund that is not\n * found answers 404. Only `connector_refund_id` is sent, so a candidate from\n * `confirmation_candidates` can be passed as it is.\n */\n async confirmInvoiceRefund(\n subscriptionId: string,\n invoiceId: string,\n refundId: string,\n params: SubscriptionInvoiceRefundConfirmRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds/${encodeURIComponent(refundId)}/confirm`,\n { ...options, body: { connector_refund_id: params.connector_refund_id } },\n );\n }\n\n /**\n * Which billing processor this shop's subscriptions run on.\n * `GET /subscriptions/billing_processor`\n *\n * The same mapping is derivable from the connector inventory\n * (`GET /account/{merchant_id}/connectors`), but that route is gated by a\n * connector-read permission granted independently of subscriptions — so a\n * role authorised to create subscriptions could be unable to learn which\n * processor it was creating them on. This answers under the same\n * authorization as the rest of the subscription API.\n *\n * Reach for it when the client must branch on the processor *before* calling\n * — origination differs by processor, and guessing is destructive. Resolve\n * the shop's `billing_processor_id` first: a shop that runs no subscriptions\n * has none assigned, and this route has no identity to report for it.\n */\n async getBillingProcessor(\n options?: RequestExtras,\n ): Promise<SubscriptionBillingProcessorResponse> {\n return this.request('GET', '/subscriptions/billing_processor', { ...options });\n }\n}\n"],"mappings":";;;;;AAoDO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,SAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,gBAAgB,SAA4D;AAChF,WAAO,KAAK,QAAQ,OAAO,gCAAgC,EAAE,GAAG,QAAQ,CAAC;AAAA,EAC3E;AAAA;AAAA,EAGA,MAAM,mBACJ,QACA,SACmC;AACnC,WAAO,KAAK,QAAQ,OAAO,gCAAgC,EAAE,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAAA,EACzF;AAAA;AAAA,EAGA,MAAM,iBAAiB,SAA+D;AACpF,WAAO,KAAK,QAAQ,OAAO,iCAAiC,EAAE,GAAG,QAAQ,CAAC;AAAA,EAC5E;AAAA,EAEA,MAAM,oBACJ,QACA,SACsC;AACtC,WAAO,KAAK,QAAQ,OAAO,iCAAiC,EAAE,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAAA,EAC1F;AAAA;AAAA,EAGA,MAAM,gBACJ,gBACA,SAC8C;AAC9C,WAAO,KAAK;A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AAQ,CAAC;AAAA,MACtI,EAAE,GAAG,SAAS,MAAM,EAAE,qBAAqB,OAAO,oBAAoB,EAAE;AAAA,IAC1E;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,MAAM,oBACJ,SAC+C;AAC/C,WAAO,KAAK,QAAQ,OAAO,oCAAoC,EAAE,GAAG,QAAQ,CAAC;AAAA,EAC/E;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/resources/adminPricing.ts"],"sourcesContent":["import type { RequestFn } from '../../client';\nimport type { MerchantPricingViewResponse, PricingFeeType } from '../../types';\nimport type {\n AdminEventFeeListQuery,\n AdminEventFeeListResponse,\n AdminEventFeeRecord,\n AdminServiceUsageListQuery,\n AdminServiceUsageListResponse,\n AdminServiceUsageRecord,\n EffectivePricingQuery,\n EffectivePricingResponse,\n EventFeePreviewRequest,\n EventFeePreviewResponse,\n EventFeeRecordRequest,\n MerchantPricingBrandResponse,\n PricingBrand,\n PricingOverview,\n PricingOverviewQuery,\n PricingSaveRequest,\n PricingScope,\n PricingScopeView,\n RecurringFeeChargeListQuery,\n RecurringFeeChargeListResponse,\n RecurringFeeRunRequest,\n RecurringFeeRunResponse,\n ServiceUsagePreviewRequest,\n ServiceUsagePreviewResponse,\n ServiceUsageRecordRequest,\n} from '../types';\n\nconst BASE = '/admin-portal/pricing';\nconst brandPath = (brand: PricingBrand, feeType: PricingFeeType): string =>\n `${BASE}/brands/${encodeURIComponent(brand)}/${encodeURIComponent(feeType)}`;\nconst merchantBasePath = (merchantId: string): string =>\n `${BASE}/merchants/${encodeURIComponent(merchantId)}`;\nconst merchantFeePath = (merchantId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/${encodeURIComponent(feeType)}`;\nconst projectFeePath = (merchantId: string, projectId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/projects/${encodeURIComponent(projectId)}/${encodeURIComponent(feeType)}`;\nconst shopFeePath = (merchantId: string, profileId: string, feeType: PricingFeeType): string =>\n `${merchantBasePath(merchantId)}/shops/${encodeURIComponent(profileId)}/${encodeURIComponent(feeType)}`;\n\nconst UNICODE_EDGE_WHITESPACE = /^\\p{White_Space}+|\\p{White_Space}+$/gu;\n\nfunction trimUnicodeWhitespace(value: string): string {\n return value.replace(UNICODE_EDGE_WHITESPACE, '');\n}\n\nfunction assertOptionalProviderSlug(provider: string | null | undefined): string | undefined {\n if (provider === undefined || provider === null) {\n return undefined;\n }\n const trimmed = trimUnicodeWhitespace(provider);\n if (!trimmed) {\n throw new TypeError(\n 'Provider slug cannot be empty or whitespace; omit provider (or pass null when saving) for a service-wide rule.',\n );\n }\n return trimmed;\n}\n\nfunction validateSaveRequest(params: PricingSaveRequest): PricingSaveRequest {\n if (params.provider === undefined || params.provider === null) {\n return params;\n }\n const provider = assertOptionalProviderSlug(params.provider);\n return provider === params.provider ? params : { ...params, provider };\n}\n\nfunction scopeCancelQuery(scope: PricingScope): Record<string, string> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n return { brand: scope.brand };\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return { merchant_id: scope.merchant_id };\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return { merchant_id: scope.merchant_id, project_id: scope.project_id };\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return { merchant_id: scope.merchant_id, profile_id: scope.profile_id };\n }\n}\n\n/**\n * Unified platform pricing hierarchy across every fee type: brand default\n * (`delopay` / `spicepay`), merchant, project, and shop, plus the Effective\n * Price View showing where every price comes from.\n *\n * Every write carries the scope's optimistic `expected_revision` token; a write\n * against an older revision is refused with `412 Precondition Failed`.\n */\nexport class AdminPricing {\n constructor(private readonly request: RequestFn) {}\n\n /** Brand defaults, active/scheduled exceptions, and older setups. `GET /admin-portal/pricing` */\n async overview(params?: PricingOverviewQuery): Promise<PricingOverview> {\n return this.request('GET', BASE, {\n query: {\n merchant_id: params?.merchant_id,\n fee_type: params?.fee_type,\n provider: params?.provider,\n },\n });\n }\n\n /** Effective price view naming the exact source of every fee type. `GET /admin-portal/pricing/effective` */\n async effective(params: EffectivePricingQuery): Promise<EffectivePricingResponse> {\n return this.request('GET', `${BASE}/effective`, {\n query: {\n merchant_id: params.merchant_id,\n project_id: params.project_id,\n profile_id: params.profile_id,\n provider: params.provider,\n at: params.at,\n },\n });\n }\n\n /** Save a brand default price (service-wide or for one provider). `PUT /admin-portal/pricing/brands/{brand}/{fee_type}` */\n async saveBrand(\n brand: PricingBrand,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', brandPath(brand, feeType), { body: validateSaveRequest(params) });\n }\n\n /** Remove a provider-specific brand default override. Service-wide brand defaults cannot be removed. `DELETE /admin-portal/pricing/brands/{brand}/{fee_type}` */\n async removeBrand(\n brand: PricingBrand,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider: string,\n ): Promise<PricingScopeView> {\n const trimmed = trimUnicodeWhitespace(provider);\n if (!trimmed) {\n throw new TypeError(\n 'Removing a brand pricing rule requires a provider slug; service-wide brand defaults cannot be removed.',\n );\n }\n return this.request('DELETE', brandPath(brand, feeType), {\n query: { expected_revision: expectedRevision, provider: trimmed },\n });\n }\n\n /** Save a merchant exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */\n async saveMerchant(\n merchantId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', merchantFeePath(merchantId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a merchant exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/{fee_type}` */\n async removeMerchant(\n merchantId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', merchantFeePath(merchantId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a project exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */\n async saveProject(\n merchantId: string,\n projectId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', projectFeePath(merchantId, projectId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a project exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/projects/{project_id}/{fee_type}` */\n async removeProject(\n merchantId: string,\n projectId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', projectFeePath(merchantId, projectId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a shop exception. `PUT /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */\n async saveShop(\n merchantId: string,\n profileId: string,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n return this.request('PUT', shopFeePath(merchantId, profileId, feeType), {\n body: validateSaveRequest(params),\n });\n }\n\n /** Remove a shop exception (service-wide or for one provider). `DELETE /admin-portal/pricing/merchants/{merchant_id}/shops/{profile_id}/{fee_type}` */\n async removeShop(\n merchantId: string,\n profileId: string,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', shopFeePath(merchantId, profileId, feeType), {\n query: { expected_revision: expectedRevision, provider: validatedProvider },\n });\n }\n\n /** Save a price at any scope in the hierarchy (brand default, merchant, project, or shop). */\n async save(\n scope: PricingScope,\n feeType: PricingFeeType,\n params: PricingSaveRequest,\n ): Promise<PricingScopeView> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n return this.saveBrand(scope.brand, feeType, params);\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return this.saveMerchant(scope.merchant_id, feeType, params);\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return this.saveProject(scope.merchant_id, scope.project_id, feeType, params);\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return this.saveShop(scope.merchant_id, scope.profile_id, feeType, params);\n }\n }\n\n /** Remove an exception scope or a provider-specific brand override; service-wide brand defaults cannot be removed. */\n async remove(\n scope: PricingScope,\n feeType: PricingFeeType,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n switch (scope.level) {\n case 'brand_default':\n if (!scope.brand) {\n throw new TypeError('Brand default scope requires brand.');\n }\n if (!provider || !trimUnicodeWhitespace(provider)) {\n throw new TypeError('A brand default price cannot be removed without a provider.');\n }\n return this.removeBrand(scope.brand, feeType, expectedRevision, provider);\n case 'merchant':\n if (!scope.merchant_id) {\n throw new TypeError('Merchant scope requires merchant_id.');\n }\n return this.removeMerchant(scope.merchant_id, feeType, expectedRevision, provider);\n case 'project':\n if (!scope.merchant_id || !scope.project_id) {\n throw new TypeError('Project scope requires merchant_id and project_id.');\n }\n return this.removeProject(\n scope.merchant_id,\n scope.project_id,\n feeType,\n expectedRevision,\n provider,\n );\n case 'shop':\n if (!scope.merchant_id || !scope.profile_id) {\n throw new TypeError('Shop scope requires merchant_id and profile_id.');\n }\n return this.removeShop(\n scope.merchant_id,\n scope.profile_id,\n feeType,\n expectedRevision,\n provider,\n );\n }\n }\n\n /** Cancel a future scheduled version. `DELETE /admin-portal/pricing/versions/{version_id}` */\n async cancelVersion(\n versionId: string,\n feeType: PricingFeeType,\n scope: PricingScope,\n expectedRevision: string,\n provider?: string,\n ): Promise<PricingScopeView> {\n const scopeQuery = scopeCancelQuery(scope);\n const validatedProvider = assertOptionalProviderSlug(provider);\n return this.request('DELETE', `${BASE}/versions/${encodeURIComponent(versionId)}`, {\n query: {\n fee_type: feeType,\n provider: validatedProvider,\n ...scopeQuery,\n expected_revision: expectedRevision,\n },\n });\n }\n\n /** Read a merchant's effective and explicit pricing brand. `GET /admin-portal/pricing/merchants/{merchant_id}/brand` */\n async getMerchantBrand(merchantId: string): Promise<MerchantPricingBrandResponse> {\n return this.request('GET', `${merchantBasePath(merchantId)}/brand`);\n }\n\n /** Read the exact Pricing page view a merchant sees (read-only staff mirror). `GET /admin-portal/pricing/merchants/{merchant_id}/view` */\n async getMerchantView(merchantId: string): Promise<MerchantPricingViewResponse> {\n return this.request('GET', `${merchantBasePath(merchantId)}/view`);\n }\n\n /** Assign a merchant's pricing brand (`'delopay'` / `'spicepay'`), or `null` to inherit the deployment brand. `PUT /admin-portal/pricing/merchants/{merchant_id}/brand` */\n async setMerchantBrand(\n merchantId: string,\n brand: PricingBrand | null,\n ): Promise<MerchantPricingBrandResponse> {\n return this.request('PUT', `${merchantBasePath(merchantId)}/brand`, {\n body: { brand },\n });\n }\n\n /** List recorded third-party service uses across merchants with separate provider cost and markup. `GET /admin-portal/pricing/service-usages` */\n async listServiceUsages(\n params?: AdminServiceUsageListQuery,\n ): Promise<AdminServiceUsageListResponse> {\n return this.request('GET', `${BASE}/service-usages`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** Dry-run calculate the provider cost, platform markup, and total charge for a third-party service use. `POST /admin-portal/pricing/service-usages/preview` */\n async previewServiceUsage(\n params: ServiceUsagePreviewRequest,\n ): Promise<ServiceUsagePreviewResponse> {\n return this.request('POST', `${BASE}/service-usages/preview`, {\n body: params,\n });\n }\n\n /** Record and settle one third-party service use idempotently by `reference_id`. `POST /admin-portal/pricing/service-usages` */\n async recordServiceUsage(params: ServiceUsageRecordRequest): Promise<AdminServiceUsageRecord> {\n return this.request('POST', `${BASE}/service-usages`, {\n body: params,\n });\n }\n\n /** List recorded platform event fees across merchants. `GET /admin-portal/pricing/event-fees` */\n async listEventFees(params?: AdminEventFeeListQuery): Promise<AdminEventFeeListResponse> {\n return this.request('GET', `${BASE}/event-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** Dry-run calculate the platform event fee and effective FX rate for a hypothetical event. `POST /admin-portal/pricing/event-fees/preview` */\n async previewEventFee(params: EventFeePreviewRequest): Promise<EventFeePreviewResponse> {\n return this.request('POST', `${BASE}/event-fees/preview`, {\n body: params,\n });\n }\n\n /**\n * Record and settle one operator-recorded platform event fee. `POST /admin-portal/pricing/event-fees`\n *\n * Deduplicated by `(merchant_id, fee_type, reference_id)` (trimmed `reference_id`, without a\n * `test_mode` dimension). Retrying with a different `fee_type` bypasses deduplication and can\n * create a separate debit depending on `charge_status`; callers must use distinct `reference_id`\n * values for test and live records so a completed test write is never replayed as a live charge.\n */\n async recordEventFee(params: EventFeeRecordRequest): Promise<AdminEventFeeRecord> {\n return this.request('POST', `${BASE}/event-fees`, {\n body: params,\n });\n }\n\n /**\n * Preview (`dry_run: true`) or execute (`dry_run: false`) monthly recurring,\n * setup, and monthly-minimum fee charging. Only an explicit `dry_run: false`\n * posts live charges; omitted arguments or an omitted `dry_run` field default\n * to preview mode (`dry_run: true`).\n * `POST /admin-portal/pricing/recurring-fees/run`\n */\n async runRecurringFees(params: RecurringFeeRunRequest): Promise<RecurringFeeRunResponse> {\n const dry_run = params?.dry_run === false ? false : true;\n return this.request('POST', `${BASE}/recurring-fees/run`, {\n body: {\n ...params,\n dry_run,\n },\n });\n }\n\n /** List recorded monthly recurring, setup, and monthly-minimum fee charges. `GET /admin-portal/pricing/recurring-fees` */\n async listRecurringFees(\n params?: RecurringFeeChargeListQuery,\n ): Promise<RecurringFeeChargeListResponse> {\n return this.request('GET', `${BASE}/recurring-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n}\n"],"mappings":";AA8BA,IAAM,OAAO;AACb,IAAM,YAAY,CAAC,OAAqB,YACtC,GAAG,IAAI,WAAW,mBAAmB,KAAK,CAAC,IAAI,mBAAmB,OAAO,CAAC;AAC5E,IAAM,mBAAmB,CAAC,eACxB,GAAG,IAAI,cAAc,mBAAmB,UAAU,CAAC;AACrD,IAAM,kBAAkB,CAAC,YAAoB,YAC3C,GAAG,iBAAiB,UAAU,CAAC,IAAI,mBAAmB,OAAO,CAAC;AAChE,IAAM,iBAAiB,CAAC,YAAoB,WAAmB,YAC7D,GAAG,iBAAiB,UAAU,CAAC,aAAa,mBAAmB,SAAS,CAAC,IAAI,mBAAmB,OAAO,CAAC;AAC1G,IAAM,cAAc,CAAC,YAAoB,WAAmB,YAC1D,GAAG,iBAAiB,UAAU,CAAC,UAAU,mBAAmB,SAAS,CAAC,IAAI,mBAAmB,OAAO,CAAC;AAEvG,IAAM,0BAA0B;AAEhC,SAAS,sBAAsB,OAAuB;AACpD,SAAO,MAAM,QAAQ,yBAAyB,EAAE;AAClD;AAEA,SAAS,2BAA2B,UAAyD;AAC3F,MAAI,aAAa,UAAa,aAAa,MAAM;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,UAAU,sBAAsB,QAAQ;AAC9C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,oBAAoB,QAAgD;AAC3E,MAAI,OAAO,aAAa,UAAa,OAAO,aAAa,MAAM;AAC7D,WAAO;AAAA,EACT;AACA,QAAM,WAAW,2BAA2B,OAAO,QAAQ;AAC3D,SAAO,aAAa,OAAO,WAAW,SAAS,EAAE,GAAG,QAAQ,SAAS;AACvE;AAEA,SAAS,iBAAiB,OAA6C;AACrE,U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kE;AACvF,UAAM,UAAU,QAAQ,YAAY,QAAQ,QAAQ;AACpD,WAAO,KAAK,QAAQ,QAAQ,GAAG,IAAI,uBAAuB;AAAA,MACxD,MAAM;AAAA,QACJ,GAAG;AAAA,QACH;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,kBACJ,QACyC;AACzC,WAAO,KAAK,QAAQ,OAAO,GAAG,IAAI,mBAAmB;AAAA,MACnD,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/buyerPortal.ts"],"sourcesContent":["import type { RequestExtras, RequestFn } from '../client';\nimport type {\n BuyerCaseList,\n BuyerConversationAttachment,\n BuyerPortalAttachmentQuery,\n BuyerPortalContactEmailCommand,\n BuyerPortalContactEmailOutcome,\n BuyerPortalConversationList,\n BuyerPortalConversationQuery,\n BuyerPortalMessage,\n BuyerPortalMessageCreate,\n BuyerPortalMessagePage,\n BuyerInvoiceListQuery,\n BuyerPortalInvoice,\n BuyerPortalInvoicePage,\n BuyerPortalPageQuery,\n BuyerPortalProfile,\n BuyerPortalProfileUpdate,\n BuyerPortalPurchasePage,\n BuyerPortalRefundRequest,\n BuyerPortalRefundRequestCreate,\n BuyerPortalSession,\n BuyerPortalSubscriptionPage,\n BuyerPortalSubscription,\n BuyerPortalSubscriptionActionRequest,\n BuyerPortalPlanPage,\n BuyerPortalPlanChangeRequest,\n NativeCreateSubscriptionRequest,\n NativeEnrollmentResponse,\n NativeEnrollmentStatusQuery,\n NativeEnrollmentAbandonResponse,\n BuyerEvidence,\n BuyerEvidenceEntry,\n BuyerEvidenceExtensionRequest,\n BuyerEvidenceFile,\n BuyerEvidenceSubmit,\n} from '../types';\n\n/**\n * Buyer access using a customer portal grant, sent in the api-key header.\n * Use a separate client constructed with the portal token, not a merchant secret\n * key or dashboard JWT. The grant determines buyer identity and permitted shops.\n */\nexport class BuyerPortal {\n constructor(private readonly request: RequestFn) {}\n\n async getSession(options?: RequestExtras): Promise<BuyerPortalSession> {\n return this.request('GET', '/buyer-portal/session', { ...options });\n }\n\n /**\n * The buyer's cases at the shop: the refund requests they sent and the\n * disputes about their purchases, newest first, with where each stands, who\n * acts next, the outcome and the recorded steps.\n */\n async listCases(options?: RequestExtras): Promise<BuyerCaseList> {\n return this.request('GET', '/buyer-portal/cases', { ...options });\n }\n\n /**\n * A case's evidence: what may be handed in and by when, the files saved\n * and handed in, and what the reviewer said. Opened on the first read\n * while the case still waits.\n */\n async caseEvidence(caseId: string, options?: RequestExtras): Promise<BuyerEvidence> {\n return this.request('GET', `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence`, {\n ...options,\n });\n }\n\n /**\n * Upload a file for a case. It is saved, not handed in, until a\n * submission takes it. Uploading again with the same `clientUploadId`\n * returns the file the first upload stored, also after the cut-off.\n */\n async uploadEvidenceFile(\n caseId: string,\n file: Blob,\n clientUploadId: string,\n options?: RequestExtras & { fileName?: string },\n ): Promise<BuyerEvidenceFile> {\n const { fileName, ...extras } = options ?? {};\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(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files`,\n { body: form, ...extras },\n );\n }\n\n /** Download a file of the case's evidence. */\n async downloadEvidenceFile(\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,\n {\n responseType: 'blob',\n ...options,\n },\n );\n }\n\n /** Remove a saved file. A file a submission took stays. */\n async removeEvidenceFile(caseId: string, fileId: string, options?: RequestExtras): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,\n {\n ...options,\n },\n );\n }\n\n /**\n * Hand in an explanation, saved files or both, while the buyer's window\n * is open. Sending again with the same `client_submission_id` returns the\n * submission the first send stored.\n */\n async submitEvidence(\n caseId: string,\n params: BuyerEvidenceSubmit,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/submissions`,\n { body: params, ...options },\n );\n }\n\n /** Ask for more time, once until the cut-off is next set. */\n async requestEvidenceExtension(\n caseId: string,\n params: BuyerEvidenceExtensionRequest,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,\n { body: params, ...options },\n );\n }\n\n /**\n * The buyer's conversations with the shop, the latest message first. A\n * portal link for the whole merchant lists one per shop and mode.\n */\n async listConversations(options?: RequestExtras): Promise<BuyerPortalConversationList> {\n return this.request('GET', '/buyer-portal/conversations', { ...options });\n }\n\n /**\n * The conversation with one shop and its newest messages, oldest first;\n * `before` pages back. A link issued for one shop may leave `shop` out.\n */\n async listMessages(\n query?: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessagePage> {\n return this.request('GET', '/buyer-portal/messages', {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * A message to the shop. A message to a closed conversation reopens it.\n * Sending again with the same `client_message_id` returns the message the\n * first send stored.\n */\n async sendMessage(\n message: BuyerPortalMessageCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessage> {\n return this.request('POST', '/buyer-portal/messages', { body: message, ...options });\n }\n\n /**\n * The buyer has read the conversation with the shop up to its last accepted\n * message. Answers with the buyer's conversations as they now stand.\n */\n async markMessagesRead(\n query?: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request('POST', '/buyer-portal/messages/read', {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * Upload a file for the buyer's next message to one shop, under the shop's\n * attachment rules (`attachment_rules` on the message page). It belongs to\n * the buyer until a message names it in `attachments`; one no message took\n * within a day is cleared. Uploading again with the same `clientUploadId`\n * returns the file the first upload stored.\n */\n async uploadMessageFile(\n file: Blob,\n clientUploadId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras & { fileName?: string },\n ): Promise<BuyerConversationAttachment> {\n const { fileName, ...extras } = options ?? {};\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', '/buyer-portal/messages/files', {\n body: form,\n query: query as Record<string, string | boolean | null | undefined>,\n ...extras,\n });\n }\n\n /** Download a file a message of the buyer's conversation with one shop carries. */\n async downloadMessageFile(\n fileId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request('GET', `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {\n query: query as Record<string, string | boolean | null | undefined>,\n responseType: 'blob',\n ...options,\n });\n }\n\n /** Remove a file the buyer uploaded that no message took. */\n async removeMessageFile(\n fileId: string,\n query?: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request('DELETE', `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {\n query: query as Record<string, string | boolean | null | undefined>,\n ...options,\n });\n }\n\n /** The buyer's contact and billing details, and what they may change. */\n async getProfile(options?: RequestExtras): Promise<BuyerPortalProfile> {\n return this.request('GET', '/buyer-portal/profile', { ...options });\n }\n\n /**\n * Change the buyer's contact and billing details. Fields left out stay as\n * they are; the merchant decides whether buyers may change them at all.\n */\n async updateProfile(\n params: BuyerPortalProfileUpdate,\n options?: RequestExtras,\n ): Promise<BuyerPortalProfile> {\n return this.request('POST', '/buyer-portal/profile', { body: params, ...options });\n }\n\n /**\n * Change the buyer's email address, as the profile's `email_policy` allows:\n * `request` names the new address, and under a `confirm_new` policy\n * `confirm` completes it with the proof sent there. A refusal comes back as\n * an outcome with `status: 'refused'`; a 403 means the policy does not let\n * the buyer change the address at all, and a 429 that the request limit was\n * reached.\n * `POST /buyer-portal/profile/contact-email`\n */\n async changeContactEmail(\n command: BuyerPortalContactEmailCommand,\n options?: RequestExtras,\n ): Promise<BuyerPortalContactEmailOutcome> {\n return this.request('POST', '/buyer-portal/profile/contact-email', {\n body: command,\n ...options,\n });\n }\n\n /**\n * Ask the shop for a refund of one of the buyer's purchases, named by its\n * `id` from `listPurchases()`. Nothing is refunded until the shop approves\n * the request with a refund.\n */\n async createRefundRequest(\n purchaseId: string,\n params: BuyerPortalRefundRequestCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalRefundRequest> {\n return this.request(\n 'POST',\n `/buyer-portal/purchases/${encodeURIComponent(purchaseId)}/refund-requests`,\n { body: params, ...options },\n );\n }\n\n async listInvoices(\n params?: BuyerInvoiceListQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalInvoicePage> {\n return this.request('GET', '/buyer-portal/invoices', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n async retrieveInvoice(invoiceId: string, options?: RequestExtras): Promise<BuyerPortalInvoice> {\n return this.request('GET', `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {\n ...options,\n });\n }\n\n /** Download the owned, published invoice as PDF bytes. */\n async downloadInvoicePdf(invoiceId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n async listPurchases(\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPurchasePage> {\n return this.request('GET', '/buyer-portal/purchases', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n async listSubscriptions(\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionPage> {\n return this.request('GET', '/buyer-portal/subscriptions', {\n query: params as Record<string, number | null | undefined>,\n ...options,\n });\n }\n\n /** Apply an action allowed by the subscription capabilities and portal grant. */\n async actOnSubscription(\n subscriptionId: string,\n params: BuyerPortalSubscriptionActionRequest,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscription> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,\n { body: params, ...options },\n );\n }\n\n async listSubscriptionPlans(\n subscriptionId: string,\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPlanPage> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,\n { query: params as Record<string, number | null | undefined>, ...options },\n );\n }\n\n async changeSubscriptionPlan(\n subscriptionId: string,\n params: BuyerPortalPlanChangeRequest,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscription> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,\n { body: params, ...options },\n );\n }\n\n async listNativePlans(\n profileId: string,\n params?: BuyerPortalPageQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalPlanPage> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,\n { query: params as Record<string, number | null | undefined>, ...options },\n );\n }\n\n /** Retry with the same subscription ID and accepted terms after a lost response. */\n async enrollNative(\n params: NativeCreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentResponse> {\n return this.request('POST', '/buyer-portal/subscriptions/native/enroll', {\n body: params,\n ...options,\n });\n }\n\n async getNativeEnrollment(\n subscriptionId: string,\n params: NativeEnrollmentStatusQuery,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentResponse> {\n return this.request(\n 'GET',\n `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,\n { query: { profile_id: params.profile_id }, ...options },\n );\n }\n\n async abandonNativeEnrollment(\n subscriptionId: string,\n params: NativeEnrollmentStatusQuery,\n options?: RequestExtras,\n ): Promise<NativeEnrollmentAbandonResponse> {\n return this.request(\n 'POST',\n `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,\n { query: { profile_id: params.profile_id }, ...options },\n );\n }\n}\n"],"mappings":";AA2CO,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,SAAoB;AAApB;AAAA,EAAqB;AAAA,EAElD,MAAM,WAAW,SAAsD;AACrE,WAAO,KAAK,QAAQ,OAAO,yBAAyB,EAAE,GAAG,QAAQ,CAAC;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,UAAU,SAAiD;AAC/D,WAAO,KAAK,QAAQ,OAAO,uBAAuB,EAAE,GAAG,QAAQ,CAAC;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAa,QAAgB,SAAiD;AAClF,WAAO,KAAK,QAAQ,OAAO,uBAAuB,mBAAmB,MAAM,CAAC,aAAa;AAAA,MACvF,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,mBACJ,QACA,MACA,gBACA,SAC4B;AAC5B,UAAM,EAAE,UAAU,GAAG,OAAO,IAAI,WAAW,CAAC;AAC5C,UAAM,OAAO,IAAI,SAAS;AAC1B,SAAK,OAAO,oBAAoB,cAAc;AAC9C,QAAI,aAAa,OAAW,MAAK,OAAO,QAAQ,IAAI;AAAA,QAC/C,MAAK,OAAO,QAAQ,MAAM,QAAQ;AACvC,WAAO,KAAK;AAAA,MACV;AAAA,MACA,uBAAuB,mBAAmB,MAAM,CAAC;AAAA,MACjD,EAAE,MAAM,MAAM,GAAG,OAAO;AAAA,IAC1B;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,qBACJ,QACA,QACA,SACe;AACf,WAAO,KAAK;AAAA,MACV;AAAA,MACA,uBAAuB,mBAAmB,MAAM,CAAC,mB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AA;AAC/C,QAAA;AACqC,QAAA;AAC1C,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiByC,EAAA;AACpB,IAAA;AACjB,MAAA;AAC+C,MAAA;AAC/C,MAAA;AAC2E,QAAA;AACtE,QAAA;AACqC,QAAA;AAC1C,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAasC,EAAA;AACkB,IAAA;AACyB,MAAA;AAC1E,MAAA;AACqC,MAAA;AACzC,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB8C,EAAA;AAC+B,IAAA;AAClE,MAAA;AACmC,QAAA;AACvB,QAAA;AACD,QAAA;AACU,QAAA;AAC5B,MAAA;AACG,MAAA;AACqC,MAAA;AACzC,IAAA;AACH,EAAA;AACF;AD/VsG;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-K3XXGAOR.cjs","sourcesContent":[null,"import { Delopay } from './client';\nimport type { DelopayLogger, RequestExtras } from './client';\nimport { DelopayError } from './error';\nimport type {\n BrowserCardClaimRequest,\n BrowserCardClaimResponse,\n CheckoutAddonChoiceRequest,\n CheckoutAddonChoiceResponse,\n CheckoutDataResponse,\n CheckoutTax,\n CheckoutTaxRequest,\n CheckoutIdentityEmailCodeRequest,\n CheckoutIdentityEmailCodeResponse,\n CheckoutIdentityEmailVerifyRequest,\n CheckoutIdentityEmailVerifyResponse,\n CheckoutIdentityReuseRequest,\n CheckoutIdentityVerificationResponse,\n CheckoutIdentityVerificationStartRequest,\n CheckoutDeviceSessionCompleteRequest,\n CheckoutDeviceSessionResponse,\n ConfirmSubscriptionRequest,\n ConfirmSubscriptionResponse,\n EpayoutsMethodsOptions,\n EpayoutsMethodsResponse,\n MollieApplePaySessionRequest,\n MollieApplePaySessionResponse,\n MicropaymentBankSessionRequest,\n MicropaymentBankSessionResponse,\n EpayoutsPaypalDeclineRequest,\n EpayoutsPaypalDeclineResponse,\n EpayoutsPaypalOrderResponse,\n PaymentAbandonAttemptResponse,\n PaymentReopenAttemptResponse,\n PaymentConfirmRequest,\n PaymentMethodListResponse,\n PaymentMethodPresentationResponse,\n PaymentResponse,\n PaymentsPostSessionTokensRequest,\n PaymentsPostSessionTokensResponse,\n PaymentUpdateRequest,\n RecordCheckoutEventRequest,\n RecordCheckoutEventResponse,\n ReplayIngestParams,\n ReplayIngestResponse,\n NomupayCardAuthorizationRequest,\n NomupayCardAuthorizationResponse,\n StripeHostedConfirmRequest,\n SubscriptionCheckoutResponse,\n SubscriptionReturnStatusResponse,\n SelectSubscriptionMethodRequest,\n SubscriptionCheckoutMethod,\n SubscriptionMethodOptionsResponse,\n SubscriptionResponse,\n StripeHostedConfirmResponse,\n EnigmaFormSession,\n VaultCollectSessionParams,\n VaultCollectSessionResponse,\n VaultPaymentMethodRequest,\n VaultPaymentMethodResponse,\n VaultSavedCardsResponse,\n} from './types';\n\n/**\n * A publishable (browser-safe) API key. The template type rejects secret\n * keys (`prd_…` / `snd_…`) at compile time, so a checkout cannot be handed\n * a credential that would reach secret-key routes.\n */\nexport type PublishableKey = `pk_${string}`;\n\n/**\n * Drop any caller-supplied credential headers (case-insensitively), so a\n * route can only ever carry the one credential its family requires — the\n * class's isolation guarantee must hold against per-call `headers` too.\n * Non-credential extras (`Idempotency-Key`, `X-Dp-*`, …) pass through.\n */\nfunction withoutCredentialHeaders(extra?: Record<string, string>): Record<string, string> {\n if (!extra) return {};\n const out: Record<string, string> = {};\n for (const [key, value] of Object.entries(extra)) {\n const lower = key.toLowerCase();\n if (lower === 'api-key' || lower === 'authorization') continue;\n out[key] = value;\n }\n return out;\n}\n\n/** The query a vault form session is asked with: the buyer's locale and the form's look. */\nfunction vaultFormQuery(params?: VaultCollectSessionParams): Record<string, string | undefined> {\n const look = params?.appearance;\n return {\n locale: params?.locale,\n form_surface: look?.surface,\n form_text: look?.text,\n form_border: look?.border,\n form_accent: look?.accent,\n form_danger: look?.danger,\n form_font: look?.font,\n form_radius: look?.radius,\n form_size: look?.size,\n form_labels: look?.labels,\n form_chrome: look?.chrome,\n form_label: look?.label,\n form_hints: look?.hints === undefined ? undefined : String(look.hints),\n form_order: look?.order,\n form_marks: look?.marks,\n form_focus: look?.focus,\n form_motion: look?.motion,\n form_height: look?.height,\n form_gap: look?.gap,\n form_corner: look?.corner,\n form_fill: look?.fill,\n form_custom: look?.custom ? 'true' : undefined,\n };\n}\n\n/** Drop one header (case-insensitively) from a caller-supplied extras map. */\nfunction withoutHeader(headers: Record<string, string>, name: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === name) continue;\n out[key] = value;\n }\n return out;\n}\n\n/** Configuration for a {@link CheckoutSession}. */\nexport interface CheckoutSessionOptions {\n /** The merchant the payment belongs to. */\n merchantId: string;\n /** The payment this session is about. */\n paymentId: string;\n /**\n * The merchant's publishable key (`pk_prd_…` / `pk_snd_…`), from the\n * checkout payload's `pub_key`. Required for the `/payments/*` and\n * `/payment-methods` calls.\n */\n publishableKey?: PublishableKey;\n /**\n * The payment's client secret, from the checkout payload. Required for\n * every `/payment-link/*` call, and rides along on the payment calls.\n */\n clientSecret?: string;\n /** Override the API base URL (e.g. `/api` behind a same-origin proxy). */\n baseUrl?: string;\n /** Use the sandbox environment. Ignored when `baseUrl` is set. */\n sandbox?: boolean;\n /** Per-request timeout in milliseconds. */\n timeout?: number;\n /** Maximum automatic retries for retryable requests. */\n maxRetries?: number;\n debug?: boolean;\n logger?: DelopayLogger;\n}\n\n/**\n * Buyer-side client for a single hosted-checkout payment.\n *\n * Binds the two browser-safe credentials once — the merchant's publishable\n * key and the payment's client secret — and sends each request with exactly\n * the credential its route expects:\n *\n * - `/payment-link/*` side-channel routes authenticate with\n * `Authorization: Bearer <client_secret>`.\n * - `/payments/*` and `/payment-methods` authenticate with the publishable\n * key in the `api-key` header, with the client secret as query parameter\n * or body field.\n *\n * Neither credential can reach a secret-key route: the publishable key is\n * typed to the `pk_` prefix and the client secret only ever leaves as a\n * bearer token / parameter, never as an `api-key`.\n *\n * @example\n * ```typescript\n * const session = new CheckoutSession({\n * merchantId: checkout.merchant_id,\n * paymentId: checkout.payment_id,\n * publishableKey: checkout.pub_key,\n * clientSecret: checkout.client_secret,\n * });\n * const catalog = await session.epayoutsMethods('de');\n * ```\n */\n/**\n * A `CompressionStream` constructor, as much of it as this module uses.\n *\n * Declared structurally rather than taken from the DOM lib: the global is\n * absent in some runtimes this SDK is dropped into, and a type that asserts it\n * exists would make the feature test look redundant to the next reader.\n */\ntype GzipStreamCtor = new (format: 'gzip') => {\n readable: ReadableStream<Uint8Array>;\n writable: WritableStream<Uint8Array>;\n};\n\n/**\n * Gzip a JSON body, or answer `null` where the runtime cannot.\n *\n * `null` is not a failure — it is the caller's instruction to send the body\n * uncompressed. `CompressionStream` is a global in Node 18+ and in current\n * browsers but is missing from older Safari and from some embedded runtimes,\n * and this SDK carries no runtime dependencies, so there is no polyfill to\n * reach for. Sending plain JSON is always correct; the server reads the\n * encoding off the header it is given.\n *\n * The compressed stream is drained to an `ArrayBuffer` rather than handed to\n * `fetch` as a stream. A streamed request body needs `duplex: 'half'`, cannot\n * be replayed on a retry, and is refused outright together with `keepalive` —\n * which is precisely the case a recorder needs when the page is navigating\n * away.\n */\nasync function gzipJson(value: unknown): Promise<ArrayBuffer | null> {\n const ctor = (globalThis as { CompressionStream?: GzipStreamCtor }).CompressionStream;\n if (typeof ctor !== 'function') return null;\n try {\n const bytes = new TextEncoder().encode(JSON.stringify(value));\n return await new Response(\n new Blob([bytes]).stream().pipeThrough(new ctor('gzip')),\n ).arrayBuffer();\n } catch {\n // A runtime carrying the constructor but unable to run it — no\n // `Blob.prototype.stream`, no `pipeThrough` — is the uncompressed case\n // too. A recording must never cost the caller a payment page.\n return null;\n }\n}\n\nexport class CheckoutSession {\n private readonly client: Delopay;\n private readonly merchantId: string;\n private readonly paymentId: string;\n private readonly publishableKey?: PublishableKey;\n private readonly clientSecret?: string;\n\n constructor(options: CheckoutSessionOptions) {\n this.merchantId = options.merchantId;\n this.paymentId = options.paymentId;\n this.publishableKey = options.publishableKey;\n this.clientSecret = options.clientSecret;\n // Constructed WITHOUT a key: every call attaches its own credential\n // explicitly, so a bearer-authenticated route never carries an api-key\n // header and vice versa.\n this.client = new Delopay('', {\n baseUrl: options.baseUrl,\n sandbox: options.sandbox,\n timeout: options.timeout,\n maxRetries: options.maxRetries,\n debug: options.debug,\n logger: options.logger,\n });\n }\n\n private get linkBase(): string {\n return `/payment-link/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`;\n }\n\n /** Headers for the client-secret bearer routes (`/payment-link/*`). */\n private bearerHeaders(extra?: Record<string, string>): Record<string, string> {\n return {\n ...withoutCredentialHeaders(extra),\n Authorization: `Bearer ${this.requireClientSecret()}`,\n };\n }\n\n /** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */\n private pkHeaders(extra?: Record<string, string>): Record<string, string> {\n if (!this.publishableKey) {\n throw new DelopayError('This call requires the publishable key', {\n status: 0,\n code: 'MISSING_CREDENTIAL',\n type: 'invalid_request',\n });\n }\n return { ...withoutCredentialHeaders(extra), 'api-key': this.publishableKey };\n }\n\n private requireClientSecret(): string {\n if (!this.clientSecret) {\n throw new DelopayError('This call requires the payment client secret', {\n status: 0,\n code: 'MISSING_CREDENTIAL',\n type: 'invalid_request',\n });\n }\n return this.clientSecret;\n }\n\n /**\n * The hosted checkout's bootstrap payload for a one-time payment —\n * `CheckoutDetails` while payable, a status view once settled.\n *\n * Deliberately unauthenticated: a `pay_` link bootstraps before any\n * credential exists, so no credential header is ever attached (caller\n * extras are still stripped of credentials). Core fields and the collection\n * policy are typed; provider-specific fields remain available as unknown.\n *\n * `theme` (a named checkout variant) and `country` are the route's declared\n * query parameters. `country` is a manual override of the buyer country the\n * router otherwise resolves from the client IP — it decides which payment\n * methods the layout shows — as an ISO 3166-1 alpha-2 code, sent uppercased\n * and omitted when empty. `locale` travels as `Accept-Language` — the only\n * channel the backend's locale resolution reads; a `?locale=` query is\n * silently ignored by this route.\n *\n * `cardOnly` is a direct link to the card form (`payment_method=card`):\n * when the Stripe card form being prepared is the one the link names, its\n * PaymentIntent is created for `card` alone. `cardProvider` and\n * `cardAccount` name that form's connector and account; absent or blank\n * matches any.\n *\n * `entry` opens one of the shop's checkout entries (`?entry=`): the layout\n * holds only that entry's methods and is drawn in its named look, and\n * `entry` on the answer says whether it had anything to offer.\n *\n * `GET /payment-link/data/{merchantId}/{paymentId}`\n */\n async fetchCheckoutData(\n params?: {\n locale?: string;\n theme?: string;\n country?: string;\n cardOnly?: boolean;\n cardProvider?: string;\n cardAccount?: string;\n entry?: string;\n },\n options?: RequestExtras,\n ): Promise<CheckoutDataResponse> {\n const country = params?.country?.trim().toUpperCase();\n return this.client.request(\n 'GET',\n `/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,\n {\n query: {\n theme: params?.theme,\n country: country || undefined,\n card_only: params?.cardOnly || undefined,\n card_provider: params?.cardOnly ? params.cardProvider?.trim() || undefined : undefined,\n card_account: params?.cardOnly ? params.cardAccount?.trim() || undefined : undefined,\n entry: params?.entry?.trim() || undefined,\n },\n ...options,\n headers: {\n ...(params?.locale\n ? {\n ...withoutHeader(withoutCredentialHeaders(options?.headers), 'accept-language'),\n 'Accept-Language': params.locale,\n }\n : withoutCredentialHeaders(options?.headers)),\n },\n },\n );\n }\n\n /**\n * The subscription twin of {@link CheckoutSession.fetchCheckoutData}: the\n * bootstrap payload for a `sub_` checkout. Authenticated with the\n * subscription's client secret (construct the session with the `sub_…` id\n * in the `paymentId` slot). `locale` travels as `Accept-Language`, same\n * as {@link CheckoutSession.fetchCheckoutData}.\n *\n * `GET /subscriptions/data/{merchantId}/{subscriptionId}`\n */\n async fetchSubscriptionData(\n params?: { locale?: string },\n options?: RequestExtras,\n ): Promise<SubscriptionCheckoutResponse> {\n return this.client.request(\n 'GET',\n `/subscriptions/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,\n {\n ...options,\n headers: {\n ...(params?.locale\n ? {\n ...withoutHeader(this.bearerHeaders(options?.headers), 'accept-language'),\n 'Accept-Language': params.locale,\n }\n : this.bearerHeaders(options?.headers)),\n },\n },\n );\n }\n\n /**\n * Report buyer/device signals for rails that never reach\n * `/payments/{id}/confirm` (the Stripe SAQ-A rail: raw cards, Apple Pay,\n * Google Pay). Same telemetry contract as\n * {@link CheckoutSession.recordEvent}: sent with `keepalive: true`, and\n * failures resolve instead of rejecting — signals must never block or\n * break a checkout. Unauthenticated by design.\n *\n * `POST /payment-link/client-signals/{merchantId}/{paymentId}`\n */\n async reportClientSignals(\n params: {\n browser_info?: Record<string, unknown>;\n signals: Record<string, unknown>;\n },\n options?: RequestExtras,\n ): Promise<void> {\n try {\n await this.client.request(\n 'POST',\n `/payment-link/client-signals/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,\n {\n body: params,\n keepalive: true,\n ...options,\n headers: withoutCredentialHeaders(options?.headers),\n },\n );\n } catch {\n // Telemetry: swallowing is the contract, not an oversight.\n }\n }\n\n /**\n * Store one slice of the buyer's checkout recording on our own side.\n * Called by the hosted checkout as the buyer works through the page; the\n * client secret is attached automatically.\n *\n * **Not telemetry semantics, on purpose.** Unlike\n * {@link CheckoutSession.recordEvent}, this rejects with a `DelopayError`\n * like every other payment call, because the recorder has to tell the\n * answers apart: a `400` with code `IR_16` means the backend will not take\n * this recording (recording is off on that deployment, the recording is\n * full, the payment is already recording a different session, or this\n * number is stored with different content) and the recorder must stop; any\n * other `400` is the slice itself being refused; a transport failure may be\n * retried with the **same** bytes under the **same** number, which the\n * backend answers with `duplicate: true`.\n *\n * Pass `keepalive: true` for the last slice of a page that is navigating\n * away (a redirect rail); browsers refuse keepalive bodies over ~64 KiB, so\n * only a small final slice should carry it.\n *\n * Pass `compress: true` to send the slice gzipped. Recorded page events\n * compress heavily, so this is mostly a saving on the buyer's connection. It\n * is opt-in and degrades silently: a runtime without `CompressionStream`\n * sends the same slice uncompressed rather than failing, so a caller never\n * has to feature-test before asking for it.\n *\n * ⚠️ `keepalive` overrides it. Compressing means awaiting a stream read\n * before the request is made, and `keepalive` protects a request only once\n * it has been initiated — so a page torn down mid-compression would drop the\n * final slice altogether. A slice sent with `keepalive` therefore always\n * travels uncompressed, whatever `compress` says. Passing both is allowed and\n * is what a recorder should do: every ordinary slice compresses, and the last\n * one is sent the way that actually arrives.\n *\n * For a precompressed event array, pass `compressed_events` and `gzipBody`.\n * The latter receives the complete JSON request (including the session's\n * client secret) and must return gzip bytes synchronously. Fetch then starts\n * before this method yields, including on a page-navigation slice. A\n * keepalive request is used only when that prepared body is at most 60 KiB.\n *\n * `POST /payments/{paymentId}/replay/slice` (publishable key)\n */\n async storeReplaySlice(\n params: ReplayIngestParams,\n options?: RequestExtras & {\n keepalive?: boolean;\n compress?: boolean;\n /** Gzip a prepared JSON envelope synchronously before the request starts. */\n gzipBody?: (body: Uint8Array) => Uint8Array;\n },\n ): Promise<ReplayIngestResponse> {\n const { keepalive, compress, gzipBody, ...extras } = options ?? {};\n // Built before anything can be compressed, so a missing credential still\n // rejects without a request going out.\n const body = { ...params, client_secret: this.requireClientSecret() };\n const headers = this.pkHeaders(extras.headers);\n // `keepalive` wins over `compress`, and that is a correctness rule rather\n // than a preference. `keepalive` preserves a request only once it has been\n // *initiated*; compressing first means awaiting a stream read, and a page\n // torn down during that await never reaches `fetch()` at all — the final\n // slice is then lost outright, which is the one thing `keepalive` exists to\n // prevent. Losing a slice to save bytes is the wrong trade, so the slice a\n // page is navigating away from travels uncompressed. It is also the\n // smallest one: browsers refuse keepalive bodies over ~64 KiB anyway.\n const encoded = gzipBody?.(new TextEncoder().encode(JSON.stringify(body)));\n const gzipped = encoded\n ? Uint8Array.from(encoded).buffer\n : compress === true && keepalive !== true\n ? await gzipJson(body)\n : null;\n return this.client.request(\n 'POST',\n `/payments/${encodeURIComponent(this.paymentId)}/replay/slice`,\n {\n body: gzipped ?? body,\n ...(keepalive !== undefined\n ? { keepalive: encoded ? keepalive && encoded.byteLength <= 60 * 1024 : keepalive }\n : {}),\n ...extras,\n // `Content-Type` has to be stated for the compressed body: the client\n // only sets it for a body it serialises itself, and the bytes are\n // still JSON — gzip is how they travel, not what they are.\n headers:\n gzipped === null\n ? headers\n : { ...headers, 'Content-Type': 'application/json', 'Content-Encoding': 'gzip' },\n },\n );\n }\n\n /**\n * The status a buyer coming back from the processor's checkout may read:\n * the subscription's status, and whether the processor has reported it yet\n * (`awaiting_processor`). Construct the session with the `sub_…` id in the\n * `paymentId` slot.\n *\n * Authenticated with the return token (`rt`) the return URL carried, sent as\n * `Authorization: Bearer <rt>`. That token reads only this, for a day; it is\n * never the client secret, which this call does not send.\n *\n * `GET /subscriptions/return-status/{merchantId}/{subscriptionId}`\n */\n async subscriptionReturnStatus(\n returnToken: string,\n options?: RequestExtras,\n ): Promise<SubscriptionReturnStatusResponse> {\n if (!returnToken) {\n throw new DelopayError('This call requires the return token (rt) from the return URL', {\n status: 0,\n code: 'MISSING_CREDENTIAL',\n type: 'invalid_request',\n });\n }\n return this.client.request(\n 'GET',\n `/subscriptions/return-status/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,\n {\n ...options,\n headers: {\n ...withoutCredentialHeaders(options?.headers),\n Authorization: `Bearer ${returnToken}`,\n },\n },\n );\n }\n\n /**\n * The methods the buyer may pick for a subscription that waits for the\n * choice (`method_choice_pending`), judged for the buyer. Call it from the\n * buyer's browser: the sell-to country is read from this request's own\n * connection. A cancelled subscription answers 400, and one that already\n * bills on an account answers 409 (`DE_20`). Authenticated with the\n * subscription's client secret.\n *\n * `GET /subscriptions/method-options/{merchantId}/{subscriptionId}`\n */\n async subscriptionMethodOptions(\n options?: RequestExtras,\n ): Promise<SubscriptionMethodOptionsResponse> {\n return this.client.request(\n 'GET',\n `/subscriptions/method-options/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,\n {\n ...options,\n headers: this.bearerHeaders(options?.headers),\n },\n );\n }\n\n /**\n * Bind a waiting subscription to the method the buyer picked and open its\n * first cycle on that method's billing account. The methods are judged\n * again from this request; afterwards\n * {@link CheckoutSession.fetchSubscriptionData} describes the bound\n * subscription (Stripe's Payment Element for `card`, `confirmSubscription`\n * for the others). Picking the same method again answers the bound\n * subscription. A subscription bound to another method already, or whose\n * billing account changed meanwhile, answers 409 (`DE_20`); a method not\n * offered to this buyer, or a cancelled subscription, answers 400.\n * Authenticated with the subscription's client secret.\n *\n * `POST /subscriptions/select-method/{merchantId}/{subscriptionId}`\n */\n async selectSubscriptionMethod(\n method: SubscriptionCheckoutMethod,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n const body: SelectSubscriptionMethodRequest = { method };\n return this.client.request(\n 'POST',\n `/subscriptions/select-method/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,\n {\n body,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n },\n );\n }\n\n /**\n * Confirm a subscription (PayPal approval rail). The client secret is\n * attached automatically; the shop's profile id travels as the\n * `X-Profile-Id` header the subscription routes require.\n *\n * `POST /subscriptions/{subscriptionId}/confirm` (publishable key)\n */\n async confirmSubscription(\n subscriptionId: string,\n profileId: string,\n params: Omit<ConfirmSubscriptionRequest, 'client_secret'>,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.client.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`,\n {\n body: { ...params, client_secret: this.requireClientSecret() },\n ...options,\n // Strip any caller-supplied x-profile-id first (case-insensitively):\n // Fetch folds duplicate headers into `caller, pro_x`, and the\n // subscription routes must see exactly one profile scope.\n headers: {\n ...withoutHeader(this.pkHeaders(options?.headers), 'x-profile-id'),\n 'X-Profile-Id': profileId,\n },\n },\n );\n }\n\n /**\n * The e-Payouts rail catalog for the buyer's country, plus the set of\n * countries that have at least one vendor.\n *\n * `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`\n *\n * Pass `{ paypalSdk: true }` from a checkout drawing an experimental PayPal\n * SDK pane to also receive e-Payouts' PayPal client id\n * (`paypal_client_id`, `paypal_currency`); it is present only when `ppal`\n * is among the methods.\n *\n * @param country - Lowercase ISO 3166-1 alpha-2 country code.\n */\n async epayoutsMethods(\n country: string,\n options?: RequestExtras & EpayoutsMethodsOptions,\n ): Promise<EpayoutsMethodsResponse> {\n const { paypalSdk, merchantConnectorId, ...extras } = options ?? {};\n return this.client.request('GET', `${this.linkBase}/epayouts/methods`, {\n query: paypalSdk\n ? {\n cc: country,\n paypal_sdk: 'true',\n ...(merchantConnectorId ? { merchant_connector_id: merchantConnectorId } : {}),\n }\n : { cc: country },\n ...extras,\n headers: this.bearerHeaders(extras.headers),\n });\n }\n\n /**\n * The PayPal order e-Payouts created for the payment, for the PayPal SDK's\n * `createOrder` on the PayPal Express or Pay with card pane, after the payment\n * was confirmed through that pane. Return `order_id` from `createOrder` and\n * send the buyer to `approve_url` once PayPal approved it; without an order,\n * or when PayPal's button cannot be drawn, send the buyer to `redirect_url`.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`\n */\n async epayoutsPaypalOrder(options?: RequestExtras): Promise<EpayoutsPaypalOrderResponse> {\n return this.client.request('POST', `${this.linkBase}/epayouts/paypal-order`, {\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Report PayPal's refusal of the card or the payer on the PayPal Express or\n * Pay with card pane (for example `INSTRUMENT_DECLINED`, `PAYER_CANNOT_PAY`,\n * or `AUTHENTICATION_FAILED` for a failed 3-D Secure). The attempt is\n * recorded declined and the payment stays payable with another card or\n * method. An issue that is not a refusal, or a payment that no longer awaits\n * PayPal, is left as it is (`declined: false`). Nothing here captures: the\n * payment settles from e-Payouts' notification.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-decline`\n */\n async epayoutsPaypalDecline(\n params: EpayoutsPaypalDeclineRequest,\n options?: RequestExtras,\n ): Promise<EpayoutsPaypalDeclineResponse> {\n return this.client.request('POST', `${this.linkBase}/epayouts/paypal-decline`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Record a buyer-side checkout event on the payment's status timeline.\n *\n * Telemetry semantics, built in so callers can genuinely fire-and-forget:\n * the request is sent with `keepalive: true` (it survives the document\n * navigating away, e.g. right before a `window.open`), and transport or\n * server failures resolve to `undefined` instead of rejecting — telemetry\n * must never break a checkout or surface an unhandled rejection. Do not\n * `await` this in a click handler that must stay synchronous.\n *\n * A missing client secret still throws `MISSING_CREDENTIAL`: that is a\n * wiring bug, not a telemetry failure.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/checkout-events`\n */\n async recordEvent(\n params: RecordCheckoutEventRequest,\n options?: RequestExtras,\n ): Promise<RecordCheckoutEventResponse | undefined> {\n const headers = this.bearerHeaders(options?.headers);\n try {\n return await this.client.request('POST', `${this.linkBase}/checkout-events`, {\n body: params,\n keepalive: true,\n ...options,\n headers,\n });\n } catch {\n return undefined;\n }\n }\n\n /** Create a new Apple merchant-validation session for a payable Mollie checkout.\n * Requires a live Mollie validation key even for a test payment; never charges.\n * Browser Origin must match the configured checkout domain.\n */\n async mollieApplePaySession(\n params: MollieApplePaySessionRequest,\n options?: RequestExtras,\n ): Promise<MollieApplePaySessionResponse> {\n return this.client.request('POST', `${this.linkBase}/mollie/apple-pay-session`, {\n ...options,\n body: params,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Prepare MicroPayment transfer instructions or an unsigned SEPA mandate.\n * No debit is approved. Show the returned mandate disclosure before collecting\n * acceptance, then confirm with metadata.micropayment_preparation and, for\n * new SEPA mandates, explicit customer_acceptance. Every SEPA confirm must\n * acknowledge its amount/date notice with metadata.micropayment_prenotified.\n * Echo native_pane_merchant_connector_id and the returned\n * native_pane_quote_generation on confirm. Saved reuse sends\n * recurring_details: { type: 'payment_method_id', data: payment_method_id }\n * with payment_method: 'bank_debit', payment_method_type: 'sepa' and no raw\n * bank data. Only saved off-session preparation may omit quote_generation.\n * Transfer instructions become available only after canonical confirmation.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/micropayment/bank-session`\n */\n async micropaymentBankSession(\n params: MicropaymentBankSessionRequest,\n options?: RequestExtras,\n ): Promise<MicropaymentBankSessionResponse> {\n return this.client.request('POST', `${this.linkBase}/micropayment/bank-session`, {\n ...options,\n body: params,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * A short-lived VGS Collect session for browser-side card capture.\n *\n * **Exactly one refusal means \"this shop has no vault\": a 400 carrying\n * `IR_19`.** Every other refusal means a vault exists and could not be used,\n * and answering it by falling back to the processor's own card pane sends an\n * unprotected card number to the very processor the shop pays to hide it\n * from — the bug this endpoint's error contract exists to prevent.\n *\n * A **404 is not benign.** The router answers it when the shop's vault\n * account cannot be found — the state a shop is left in when its vault\n * connector is deleted while the profile keeps naming the id: it still\n * reports the vault as enabled and still expects its cards cloaked. The same\n * status also covers a payment that does not exist.\n *\n * `params.appearance` asks for a form styled to match the page (Enigma\n * Vault). The answer then carries `height`, the frame height to use. If the\n * vault refuses the styled form the answer is the plain one, without\n * `height`. `params.locale` is the buyer's locale.\n *\n * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`\n */\n async vaultCollectSession(\n options?: RequestExtras,\n params?: VaultCollectSessionParams,\n ): Promise<VaultCollectSessionResponse> {\n return this.client.request('GET', `${this.linkBase}/vault/collect-session`, {\n ...options,\n query: vaultFormQuery(params),\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * The saved cards the buyer of this payment can pay with, on a shop whose\n * vault keeps the security code itself (Enigma Vault): the cards of the\n * payment's own customer that the shop's vault holds, most recently used\n * first. A payment without a customer answers an empty list.\n *\n * Draw saved cards from this list, not from the customer's payment-method\n * list: that one also carries cards the security-code form cannot open.\n * To pay with one, mint its form with {@link vaultSecurityCodeSession},\n * and confirm with its `payment_token` once the form reports the code\n * stored.\n *\n * A shop without a vault, and a VGS shop, answer `400`.\n *\n * `GET /payment-link/{merchantId}/{paymentId}/vault/saved-cards`\n */\n async vaultSavedCards(options?: RequestExtras): Promise<VaultSavedCardsResponse> {\n return this.client.request('GET', `${this.linkBase}/vault/saved-cards`, {\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Remove one of the buyer's saved cards, named by its `payment_token` from\n * {@link vaultSavedCards}: from the customer's saved cards and from the\n * shop's vault, with every saved copy of the same card. Only a card of the\n * payment's own customer that the shop's vault holds can be removed, and\n * only within the payment's session.\n *\n * Refusals throw a `DelopayError`:\n *\n * - `400` with code `IR_16` and `data.reason` set to a\n * {@link VaultSavedCardRemovalRefusal}: the card stays listed.\n * `saved_card_in_use` means a subscription or agreement still charges it,\n * `saved_card_payment_in_progress` a payment with it is in flight, and\n * `saved_card_removal_unavailable` that the shop cannot remove cards here.\n * - `404`: the card is not one this buyer can remove, for example because it\n * is already gone.\n * - `422` with code `IR_29`: the token is no longer held. Read\n * {@link vaultSavedCards} again and remove the card by its new token.\n *\n * `DELETE /payment-link/{merchantId}/{paymentId}/vault/saved-cards/{paymentToken}`\n */\n async vaultRemoveSavedCard(paymentToken: string, options?: RequestExtras): Promise<void> {\n await this.client.request(\n 'DELETE',\n `${this.linkBase}/vault/saved-cards/${encodeURIComponent(paymentToken)}`,\n {\n ...options,\n headers: this.bearerHeaders(options?.headers),\n },\n );\n }\n\n /**\n * Mint the security-code form for a saved card, on a shop whose vault keeps\n * the code itself (Enigma Vault). The buyer re-enters the code into the\n * vault's own form, so it never reaches the checkout; confirm with the saved\n * card's `payment_token` once the form reports it stored.\n *\n * `paymentToken` is the saved card's token from {@link vaultSavedCards}. A\n * VGS shop answers `400`: VGS re-collects the code with Collect.\n *\n * `params.appearance` asks for a form styled to match the page, as on\n * {@link vaultCollectSession}. The styled form is the security-code field\n * alone, with no label: draw the label beside the frame, and size the frame\n * to the answer's `height`. `labels` is ignored. If the vault refuses the\n * styled form the answer is the plain one, without `height`.\n *\n * The form stores one code and then disables itself. After a failed\n * payment, mint a new form before the buyer tries again.\n *\n * `GET /payment-link/{merchantId}/{paymentId}/vault/security-code-session`\n */\n async vaultSecurityCodeSession(\n paymentToken: string,\n options?: RequestExtras,\n params?: VaultCollectSessionParams,\n ): Promise<EnigmaFormSession> {\n return this.client.request('GET', `${this.linkBase}/vault/security-code-session`, {\n ...options,\n query: { payment_token: paymentToken, ...vaultFormQuery(params) },\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Register the aliased card as a payment method and mint the one-shot\n * `payment_token` the confirm call spends.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/vault/payment-method`\n */\n async registerVaultPaymentMethod(\n params: VaultPaymentMethodRequest,\n options?: RequestExtras,\n ): Promise<VaultPaymentMethodResponse> {\n return this.client.request('POST', `${this.linkBase}/vault/payment-method`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Reserve this payment attempt before a hosted card form contacts Stripe,\n * Airwallex, or NomuPay. Send the provider object rendered to this checkout\n * and retain the same `flow_id` across retries and any 3-D Secure step.\n *\n * Only `authorized: true` permits the form to contact its processor. A\n * competing flow receives `false` and must reload; an unresolved provider\n * outcome stays reserved, regardless of elapsed time. A buyer-blocklist\n * refusal throws a `DelopayError` with code `DE_14`; a shop whose payments\n * DeloPay stopped is refused with `DE_22`, and a shop whose payments the\n * merchant switched off with `DE_21`.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/browser-card-claim`\n */\n async claimBrowserCard(\n params: BrowserCardClaimRequest,\n options?: RequestExtras,\n ): Promise<BrowserCardClaimResponse> {\n return this.client.request('POST', `${this.linkBase}/browser-card-claim`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Confirm the Stripe card form's PaymentIntent through the router, for a\n * checkout payload with `card_connector_server_confirm: true`. Stripe refuses\n * a Stripe.js confirm of such an intent.\n *\n * Send the PaymentMethod `stripe.createPaymentMethod` produced from the\n * Payment Element (or Express Checkout Element), which needs\n * `paymentMethodCreation: 'manual'` on the Elements instance. A\n * ConfirmationToken is refused with `400`: Stripe will not confirm such an\n * intent with one.\n *\n * The router judges the card's issuing country and the buyer's IP country\n * against the shop's sell-to restrictions before Stripe authorises, and a\n * refusal throws a `DelopayError` with code `DE_10`. A buyer on the\n * merchant's buyer blocklist is refused before any Stripe call with code\n * `DE_14` (`buyer_blocked`, 422), which names no entry, a shop whose\n * payments DeloPay stopped with `DE_22`, and a shop whose payments the\n * merchant switched off with `DE_21`. A buyer the merchant's buyer risk\n * model refuses fails with `DE_23` (`buyer_risk_refused`, 422), which says\n * nothing about the signals. When the answer's\n * `status` is `requires_action`, run `stripe.handleNextAction` with its\n * `client_secret` — safe, because the intent is `confirmation_method=manual`\n * and that secret confirms nothing without the secret key — then call this\n * again without a payment method to finalize.\n *\n * Reserve the attempt with {@link claimBrowserCard} first. Send its granted\n * `flow_id` as `browser_flow_id` on both the initial and post-action confirm;\n * an omitted, null or nonholder flow is refused with `400` and code `IR_16`.\n *\n * A PaymentMethod rules out what `stripe.createPaymentMethod` cannot\n * produce: Stripe names Amazon Pay and Klarna in the Express Checkout\n * Element, which need `stripe.createConfirmationToken` instead. Neither can\n * be paid through this route, so a caller must not offer them on a\n * server-confirmed intent — mount the Express Checkout Element with those\n * methods `'never'`, as DeloPay's own checkout does. The router drops only\n * the methods its server-side confirm cannot finish at all (BLIK and ACSS\n * pre-authorized debits) from the card form's mount, so the rest of the\n * selection still reaches the element and is the caller's to constrain.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/stripe-confirm`\n */\n async confirmStripeCardForm(\n params: StripeHostedConfirmRequest,\n options?: RequestExtras,\n ): Promise<StripeHostedConfirmResponse> {\n return this.client.request('POST', `${this.linkBase}/stripe-confirm`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Make the buyer's add-on choice while the checkout data answers\n * `type: 'addon_choice'`.\n *\n * Only price ids and quantities are sent; the router prices them from the\n * catalog and judges every selection group's bounds. The payment's lines and\n * amount change together, once: the choice is final afterwards, the same\n * choice sent again answers the same result, and another is refused with\n * `IR_16` — as is a choice once anything could have been charged at the\n * previous amount. Fetch the checkout data again afterwards for the payment\n * methods at the final amount.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/addons`\n */\n async chooseAddons(\n params: CheckoutAddonChoiceRequest,\n options?: RequestExtras,\n ): Promise<CheckoutAddonChoiceResponse> {\n return this.client.request('POST', `${this.linkBase}/addons`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Send the buyer's tax country, region and VAT ID while the checkout data's\n * `tax.step` is `open`, and get the VAT the payment carries for them.\n *\n * `close: false` recalculates and keeps the step open, for a live total\n * while the buyer types; it also opens a confirmed step again while nothing\n * was prepared at a provider. `close: true` recalculates and confirms: the\n * payment is charged what the answer says, and the checkout data, fetched\n * again, answers the payment methods with `tax.step` `closed`. A confirmed\n * step answers the same closing request again. A change once something was\n * prepared at a provider is refused with `DE_28` (409), as is one while the\n * add-on choice is open or after the checkout expired. A malformed country\n * or region is refused with `IR_06` (400).\n *\n * `POST /payment-link/{merchantId}/{paymentId}/tax`\n */\n async submitTax(params: CheckoutTaxRequest, options?: RequestExtras): Promise<CheckoutTax> {\n return this.client.request('POST', `${this.linkBase}/tax`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * The payment's identity verification step: whether the payment asked for\n * one, its outcome, and the provider's page while it is pending. A pending\n * verification is read from the provider first, so call this when the buyer\n * comes back from the provider's page.\n *\n * `required` is `false` when the payment asked for no verification.\n * `can_retry` is `true` after an expired or abandoned attempt; start a new\n * one with {@link CheckoutSession.startIdentityVerification}.\n *\n * `GET /payment-link/{merchantId}/{paymentId}/identity-verification`\n */\n async identityVerification(\n options?: RequestExtras,\n ): Promise<CheckoutIdentityVerificationResponse> {\n return this.client.request('GET', `${this.linkBase}/identity-verification`, {\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Resume the payment's pending identity verification, start it, or start a\n * new attempt after an expired or abandoned one. For legacy single-step\n * verifications, send the buyer to the returned top-level\n * `verification_url`. When starting or resuming a specific `step_index` in\n * a multi-step flow, locate the matching entry in `response.steps` by\n * `step_index` and redirect to its `verification_url` (top-level\n * `verification_url` summarizes the first unverified step, not necessarily\n * the requested index). The provider sends the buyer back to `return_url`,\n * which must be on the payment's checkout origin.\n *\n * Refusals throw a `DelopayError`: `400` when the return URL is not on the\n * payment's checkout or the verification is already decided, `404` when the\n * payment asked for no verification.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/identity-verification`\n */\n async startIdentityVerification(\n params: CheckoutIdentityVerificationStartRequest,\n options?: RequestExtras,\n ): Promise<CheckoutIdentityVerificationResponse> {\n return this.client.request('POST', `${this.linkBase}/identity-verification`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Mail the buyer a code that confirms their email, so the payment can reuse\n * a verification the merchant already has for them. Offer it only while the\n * checkout data says `identity_verification_reuse_allowed`. The answer is\n * the same whether or not the merchant verified anyone with the address.\n *\n * Refusals throw a `DelopayError`: `400` with code `DE_26` and the reason as\n * its message (`IV_REUSE_OFF` when the payment's requirement does not allow\n * reuse, `IV_REUSE_STEP` when the payment has no verification step a reuse\n * can stand for, `IV_EMAIL_INVALID`), `429` after too many codes for the\n * caller or the address.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/identity-verification/email-code`\n */\n async sendIdentityEmailCode(\n params: CheckoutIdentityEmailCodeRequest,\n options?: RequestExtras,\n ): Promise<CheckoutIdentityEmailCodeResponse> {\n return this.client.request('POST', `${this.linkBase}/identity-verification/email-code`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Check the code the buyer entered. `reusable` says only whether the\n * merchant has a verification the payment can reuse; then call\n * {@link CheckoutSession.reuseIdentityVerification}. Otherwise pass the\n * `challenge_id` as `email_challenge_id` to\n * {@link CheckoutSession.startIdentityVerification}, so a later payment can\n * reuse the verification it starts.\n *\n * Refusals throw a `DelopayError`: `400` with code `DE_26` and the reason as\n * its message. `IV_CODE_INCORRECT` is a wrong code, with the tries left in\n * `data.attempts_left`; `IV_CODE_EXPIRED` is an expired code or one out of\n * tries; `IV_CHALLENGE_UNKNOWN` names no code of this payment.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/identity-verification/email-code/verify`\n */\n async verifyIdentityEmailCode(\n params: CheckoutIdentityEmailVerifyRequest,\n options?: RequestExtras,\n ): Promise<CheckoutIdentityEmailVerifyResponse> {\n return this.client.request('POST', `${this.linkBase}/identity-verification/email-code/verify`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Reuse the merchant's verification for the buyer's confirmed email as the\n * payment's verification. Needs the challenge confirmed on this payment in\n * the last 30 minutes, and uses it up. No provider session, provider cost or\n * DeloPay fee is made. Answers the payment's verification step, verified.\n *\n * Refusals throw a `DelopayError`: `400` with code `DE_26` and the reason as\n * its message (`IV_CHALLENGE_NOT_CONFIRMED`, `IV_REUSE_NOT_ELIGIBLE`,\n * `IV_REUSE_OFF`, `IV_REUSE_STEP`).\n *\n * `POST /payment-link/{merchantId}/{paymentId}/identity-verification/reuse`\n */\n async reuseIdentityVerification(\n params: CheckoutIdentityReuseRequest,\n options?: RequestExtras,\n ): Promise<CheckoutIdentityVerificationResponse> {\n return this.client.request('POST', `${this.linkBase}/identity-verification/reuse`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Start the device assessment of the payment's checkout. `required` is\n * `false` when the shop assesses no devices, the payment's device is already\n * assessed, or the provider cannot start a session: go on without it. Run\n * the named `library` with the `token`, then call\n * {@link CheckoutSession.completeDeviceSession}.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/device-session`\n */\n async startDeviceSession(options?: RequestExtras): Promise<CheckoutDeviceSessionResponse> {\n return this.client.request('POST', `${this.linkBase}/device-session`, {\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Report the device assessment finished. The router records it with the\n * provider and stores the signal on the payment. Refused with `400` when the\n * session and token are not the payment's pending ones.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/device-session/complete`\n */\n async completeDeviceSession(\n params: CheckoutDeviceSessionCompleteRequest,\n options?: RequestExtras,\n ): Promise<void> {\n await this.client.request('POST', `${this.linkBase}/device-session/complete`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * Ask whether NomuPay's COPYandPAY widget may submit a card, from the\n * form's pre-submit hook.\n *\n * Only for a checkout stamped `NomupayOppwaCheckoutData.submit_grant`: the\n * card form sits beside always-shown wallet buttons of another account, and\n * this answer closes those buttons before it allows the card. `authorized`\n * is `false` when the payment no longer waits for a payment method, or when\n * this is not the attempt's live card-form checkout; when a wallet beside it\n * is already being paid, the route answers an error instead. Submit the\n * widget only on `true`.\n *\n * `POST /payment-link/{merchantId}/{paymentId}/nomupay-card-authorization`\n */\n async nomupayCardAuthorization(\n params: NomupayCardAuthorizationRequest,\n options?: RequestExtras,\n ): Promise<NomupayCardAuthorizationResponse> {\n return this.client.request('POST', `${this.linkBase}/nomupay-card-authorization`, {\n body: params,\n ...options,\n headers: this.bearerHeaders(options?.headers),\n });\n }\n\n /**\n * The payment's current state — status polling for redirect/popup rails.\n *\n * `GET /payments/{paymentId}` (publishable key + client secret)\n */\n async retrievePayment(options?: RequestExtras): Promise<PaymentResponse> {\n return this.client.request('GET', `/payments/${encodeURIComponent(this.paymentId)}`, {\n query: { client_secret: this.requireClientSecret() },\n ...options,\n headers: this.pkHeaders(options?.headers),\n });\n }\n\n /**\n * Update the payment before confirmation (e.g. persist custom-field\n * answers as `metadata` on rails that never hit `/confirm`). The client\n * secret is attached automatically.\n *\n * `POST /payments/{paymentId}` (publishable key)\n */\n async updatePayment(\n params: PaymentUpdateRequest,\n options?: RequestExtras,\n ): Promise<PaymentResponse> {\n return this.client.request('POST', `/payments/${encodeURIComponent(this.paymentId)}`, {\n body: { ...params, client_secret: this.requireClientSecret() },\n ...options,\n headers: this.pkHeaders(options?.headers),\n });\n }\n\n /**\n * Confirm the payment. The client secret is attached automatically; pass\n * an `Idempotency-Key` header via `options` to make retries safe.\n *\n * `POST /payments/{paymentId}/confirm` (publishable key)\n */\n async confirmPayment(\n params: PaymentConfirmRequest,\n options?: RequestExtras,\n ): Promise<PaymentResponse> {\n return this.client.request('POST', `/payments/${encodeURIComponent(this.paymentId)}/confirm`, {\n body: { ...params, client_secret: this.requireClientSecret() },\n ...options,\n headers: this.pkHeaders(options?.headers),\n });\n }\n\n /**\n * Mint the processor-side session a browser SDK completes — the PayPal\n * order that PayPal's buttons or Card Fields attach the buyer's choice to.\n * The client secret is attached automatically.\n *\n * For PayPal Card Fields pass `payment_method: 'card'` and the\n * `merchant_connector_id` the checkout was rendered with; the order id comes\n * back in `next_action.next_action_data.order_id` and is what the SDK's\n * `createOrder` returns. The confirm that captures it sends the same order\n * and account as `payment_method_data.card_reference`.\n *\n * Send a distinct `Idempotency-Key` through `options.headers` for each new\n * card submission; reuse it only to retry that same session request. The\n * returned order is bound to this attempt and account. Sessions cannot\n * replace an order while authentication or money processing is unresolved,\n * or after authorization/capture; stale or foreign references are refused.\n *\n * `POST /payments/{paymentId}/post-session-tokens` (publishable key)\n */\n async postSessionTokens(\n params: PaymentsPostSessionTokensRequest,\n options?: RequestExtras,\n ): Promise<PaymentsPostSessionTokensResponse> {\n return this.client.request(\n 'POST',\n `/payments/${encodeURIComponent(this.paymentId)}/post-session-tokens`,\n {\n body: { ...params, client_secret: this.requireClientSecret() },\n ...options,\n headers: this.pkHeaders(options?.headers),\n },\n );\n }\n\n /**\n * Abandon the attempt the buyer left open on a connector's hosted page\n * (the payment sits in `requires_customer_action`) and open a fresh attempt\n * awaiting a payment method, so the same payment can be confirmed again\n * with another method or connector. Nothing has been authorised on the\n * abandoned attempt; it is voided locally and kept in the attempt history.\n * Idempotent: a payment already in `requires_payment_method` comes back\n * unchanged with `abandoned_attempt_id: null`.\n *\n * `POST /payments/{paymentId}/abandon-attempt` (publishable key + client secret)\n */\n async abandonAttempt(options?: RequestExtras): Promise<PaymentAbandonAttemptResponse> {\n return this.client.request(\n 'POST',\n `/payments/${encodeURIComponent(this.paymentId)}/abandon-attempt`,\n {\n body: { client_secret: this.requireClientSecret() },\n ...options,\n headers: this.pkHeaders(options?.headers),\n },\n );\n }\n\n /**\n * Reopen a provider session the buyer switched away from, when they pick the\n * same method again, instead of opening a second session at the provider\n *. Pass an `attempt_id` from the checkout's\n * `reopenable_attempts`; the attempt becomes the payment's active one again\n * and `redirect_url` sends the buyer back to it. Refused (`IR_16`) when the\n * payment no longer awaits a method, a payment is under way on the checkout,\n * or the session can no longer be reopened (settled, lapsed at the provider,\n * ended by the switch); open a new session as usual then.\n *\n * `POST /payments/{paymentId}/reopen-attempt` (publishable key + client secret)\n */\n async reopenAttempt(\n attemptId: string,\n options?: RequestExtras,\n ): Promise<PaymentReopenAttemptResponse> {\n return this.client.request(\n 'POST',\n `/payments/${encodeURIComponent(this.paymentId)}/reopen-attempt`,\n {\n body: { client_secret: this.requireClientSecret(), attempt_id: attemptId },\n ...options,\n headers: this.pkHeaders(options?.headers),\n },\n );\n }\n\n /**\n * Payment methods available for this payment.\n *\n * `GET /payment-methods` (publishable key + client secret)\n *\n * @param params - Optional filters; `country` is the highest-precedence\n * geo hint, ahead of billing address and IP geolocation.\n */\n async listPaymentMethods(\n params?: { country?: string },\n options?: RequestExtras,\n ): Promise<PaymentMethodListResponse> {\n return this.client.request('GET', '/payment-methods', {\n query: { client_secret: this.requireClientSecret(), country: params?.country },\n ...options,\n headers: this.pkHeaders(options?.headers),\n });\n }\n\n /**\n * This payment's checkout buttons, as the hosted checkout draws them: order,\n * labels, artwork, and what selecting each one does. The shop, environment,\n * currency and amount are the payment's. Ask again when the cart changes;\n * an answer is never reused for another payment.\n *\n * `GET /account/payment-methods/presentation` (publishable key + client secret)\n *\n * @param params - `country` outranks the billing address and IP\n * geolocation; `locale` names the language of the labels.\n */\n async paymentMethodPresentation(\n params?: { country?: string; locale?: string; contract_version?: number },\n options?: RequestExtras,\n ): Promise<PaymentMethodPresentationResponse> {\n return this.client.request('GET', '/account/payment-methods/presentation', {\n query: {\n client_secret: this.requireClientSecret(),\n country: params?.country,\n locale: params?.locale,\n contract_version: params?.contract_version,\n },\n ...options,\n headers: this.pkHeaders(options?.headers),\n });\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/shopify.ts"],"sourcesContent":["import type {\n ShopifyConnectRequest,\n ShopifyConnectResponse,\n ShopifyConnection,\n ShopifyConnectionList,\n ShopifyConnectionResponse,\n ShopifyPaymentModeUpdate,\n ShopifySettingsUpdate,\n ShopifySyncEvent,\n ShopifySyncEventsQuery,\n ShopifySyncEventsResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/**\n * A shop's link to the merchant's Shopify store: the merchant creates an app\n * in their own Shopify account, saves its keys here, approves it in Shopify,\n * and the storefront script sends the store's buyers to this shop's hosted\n * checkout. Every route names the shop by its profile id.\n *\n * Reading the connections, the sync log and its retry, and switching the\n * payment mode, take an API key or a dashboard session; a session needs the\n * shop's Read permission to read and its Write to retry or switch. Connecting, changing the settings and disconnecting take\n * a signed-in dashboard session only, never an API key, with the shop's Write\n * permission. A key or role pinned to another shop, or a checkout template's\n * profile, is refused as unknown (404). No answer carries the app's client\n * secret or the store's access token.\n */\nexport class Shopify {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The shop's connection, if any, with the storefront's last reports, and\n * what the merchant's app must list (redirect URL, access scopes). Takes an\n * API key or a dashboard session with the shop's Read permission; a server\n * that predates API-key access refuses a key with 401. Read-only: never\n * returns a secret or a token.\n *\n * `GET /shopify/connections/{profileId}`\n */\n async retrieveConnection(\n profileId: string,\n options?: RequestExtras,\n ): Promise<ShopifyConnectionResponse> {\n return this.request('GET', `/shopify/connections/${encodeURIComponent(profileId)}`, options);\n }\n\n /**\n * The caller's stores with their payment mode: one per shop at most, and\n * only its own shop's for a shop-bound key or a shop-scoped role. Never\n * returns a secret or a token.\n *\n * `GET /shopify/connections`\n */\n async listConnections(options?: RequestExtras): Promise<ShopifyConnectionList> {\n return this.request('GET', '/shopify/connections', options);\n }\n\n /**\n * Switch the store between live and test payments. To `test`,\n * `confirm_shop_domain` must be the store's address exactly as the\n * connection shows it, and a payment provider of the shop must be able to\n * take a test payment (`test_payments_available`; 422 otherwise). In test,\n * storefront checkouts started from then on make test payments, and their\n * Shopify orders are tagged `<brand> TEST` (such as `DeloPay TEST`) and\n * must not be fulfilled. That holds only once the whole deployment serves\n * test mode (every API server, the storefront script and the order sync):\n * a deployment still mid-rollout can make a live payment or an untagged\n * order, so switch only once the deployment has finished rolling it out.\n * Back to `live` needs no typed address. Asking for the mode the store is\n * already in changes nothing. A switch made by someone else meanwhile is\n * refused with 412. A storefront checkout already started keeps the mode it\n * began in; the storefront shows the change within about a minute.\n *\n * `POST /shopify/connections/{profileId}/payment_mode`\n */\n async updatePaymentMode(\n profileId: string,\n params: ShopifyPaymentModeUpdate,\n options?: RequestExtras,\n ): Promise<ShopifyConnection> {\n return this.request(\n 'POST',\n `/shopify/connections/${encodeURIComponent(profileId)}/payment_mode`,\n { ...options, body: params },\n );\n }\n\n /**\n * Save the app's keys and get the Shopify page the merchant approves the app\n * on. Refused while the shop is connected (412), except to approve again in\n * place: when the connection's `authorization_expired` is `true`, saving the\n * same store's keys for the same app (same `shop_domain` and `client_id`)\n * starts a new approval while the store stays connected with its settings\n * and script. Saving the keys renews nothing by itself: the merchant must\n * open the returned `authorize_url` and approve the app again, so neither a\n * successful call nor the `connected` status proves the approval is done;\n * `authorization_expired` turns `false` once it is. Refused when the store\n * is connected to another shop (409).\n *\n * `PUT /shopify/connections/{profileId}`\n */\n async connect(\n profileId: string,\n params: ShopifyConnectRequest,\n options?: RequestExtras,\n ): Promise<ShopifyConnectResponse> {\n return this.request('PUT', `/shopify/connections/${encodeURIComponent(profileId)}`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * Change the storefront settings: the takeover switch, the mode, the\n * appearance, the accepted terms. Switching the takeover on needs an\n * approved connection, and in `skip_checkout` mode the accepted terms\n * (412 otherwise).\n *\n * `PATCH /shopify/connections/{profileId}`\n */\n async updateSettings(\n profileId: string,\n params: ShopifySettingsUpdate,\n options?: RequestExtras,\n ): Promise<ShopifyConnection> {\n return this.request('PATCH', `/shopify/connections/${encodeURIComponent(profileId)}`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * Disconnect the store. Buyers go back to Shopify checkout at once, and the\n * stored keys are wiped.\n *\n * `DELETE /shopify/connections/{profileId}`\n */\n async disconnect(profileId: string, options?: RequestExtras): Promise<void> {\n return this.request('DELETE', `/shopify/connections/${encodeURIComponent(profileId)}`, options);\n }\n\n /**\n * The shop's recent syncs with its store, newest first: the order of each\n * paid storefront payment, refunds in both directions, dispute flags and\n * webhook registrations. A `held` or `failed` entry was told to the\n * merchant; a `pending` one with a `reason` is retrying by itself. For the\n * next page, pass the answer's `next_cursor` as `cursor` with the same\n * filters; it is set on every full page and absent on a short one. Never\n * page by the oldest `created_at` as `before`: that skips entries sharing\n * its time.\n *\n * `GET /shopify/connections/{profileId}/sync_events`\n */\n async listSyncEvents(\n profileId: string,\n query?: ShopifySyncEventsQuery,\n options?: RequestExtras,\n ): Promise<ShopifySyncEventsResponse> {\n return this.request(\n 'GET',\n `/shopify/connections/${encodeURIComponent(profileId)}/sync_events`,\n {\n ...options,\n query: { ...query },\n },\n );\n }\n\n /**\n * Run a failed, held or waiting sync again within a minute, as a first\n * attempt would: a held order whose total still differs from what was paid\n * is held again. Never makes a second order or a second refund. An entry\n * that cannot be retried answers 404.\n *\n * `POST /shopify/connections/{profileId}/sync_events/{eventId}/retry`\n */\n async retrySyncEvent(\n profileId: string,\n eventId: string,\n options?: RequestExtras,\n ): Promise<ShopifySyncEvent> {\n return this.request(\n 'POST',\n `/shopify/connections/${encodeURIComponent(profileId)}/sync_events/${encodeURIComponent(eventId)}/retry`,\n options,\n );\n }\n}\n"],"mappings":";AA4BO,IAAM,UAAN,MAAc;AAAA,EACnB,YAA6B,SAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlD,MAAM,mBACJ,WACA,SACoC;AACpC,WAAO,KAAK,QAAQ,OAAO,wBAAwB,mBAAmB,SAAS,CAAC,IAAI,OAAO;AAAA,EAC7F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,gBAAgB,SAAyD;AAC7E,WAAO,KAAK,QAAQ,OAAO,wBAAwB,OAAO;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,MAAM,kBACJ,WACA,QACA,SAC4B;AAC5B,WAAO,KAAK;AAAA,MACV;AAAA,MACA,wBAAwB,mBAAmB,SAAS,CAAC;AAAA,MACrD,EAAE,GAAG,SAAS,MAAM,OAAO;AAAA,IAC7B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAM,QACJ,WACA,QACA,SACiC;AACjC,WAAO,KAAK,QAAQ,OAAO,wBAAwB,mBAAmB,SAAS,CAAC,IAAI;AAAA,MAClF,GAAG;AAAA,MACH,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,eACJ,WACA,QACA,S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AAAA;AAAA;AAAA;AAsB8C,EAAA;AAChC,IAAA;AACV,MAAA;AACiE,MAAA;AACM,MAAA;AACzE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAekD,EAAA;AACpC,IAAA;AACV,MAAA;AACiE,MAAA;AACjE,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuB8C,EAAA;AAChC,IAAA;AACV,MAAA;AACiE,MAAA;AACO,MAAA;AAC1E,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBiD,EAAA;AAC8B,IAAA;AAC/E,EAAA;AACF;AD7JoF;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-PYNHK6AP.cjs","sourcesContent":[null,"import type {\n BuyerPortalSubscriptionCapabilities,\n NativeShopConfigRequest,\n NativeShopConfigResponse,\n NativeDunningConfigRequest,\n NativeDunningConfigResponse,\n AdoptSubscriptionRequest,\n AdoptSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateAndConfirmSubscriptionRequest,\n ConfirmSubscriptionRequest,\n UpdateSubscriptionRequest,\n PauseSubscriptionRequest,\n ResumeSubscriptionRequest,\n CancelSubscriptionRequest,\n SubscriptionResponse,\n ConfirmSubscriptionResponse,\n PauseSubscriptionResponse,\n ResumeSubscriptionResponse,\n CancelSubscriptionResponse,\n GetSubscriptionItemsResponse,\n GetSubscriptionItemsParams,\n SubscriptionEstimateResponse,\n SubscriptionEstimateParams,\n SubscriptionListParams,\n SubscriptionPaymentLookupRequest,\n SubscriptionPaymentLookupResponse,\n SubscriptionInvoiceListParams,\n SubscriptionInvoiceListResponse,\n SubscriptionBillingProcessorResponse,\n SubscriptionImportApplyRequest,\n SubscriptionImportApplyResponse,\n SubscriptionImportPreviewRequest,\n SubscriptionImportPreviewResponse,\n SubscriptionItemsPage,\n SubscriptionSyncRequest,\n SubscriptionSyncResponse,\n SubscriptionSyncResult,\n SubscriptionInvoiceRefundConfirmRequest,\n SubscriptionInvoiceRefundListResponse,\n SubscriptionInvoiceRefundRequest,\n SubscriptionInvoiceRefundResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * Subscription endpoints are profile-scoped: the backend requires an\n * `X-Profile-Id` header to resolve the shop / billing processor (`IR_04`\n * otherwise). Pass it through the per-call `options.headers`, e.g.\n * `subscriptions.list(params, { headers: { 'X-Profile-Id': profileId } })`.\n */\nexport class Subscriptions {\n constructor(private readonly request: RequestFn) {}\n\n /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */\n async getNativeConfig(options?: RequestExtras): Promise<NativeShopConfigResponse> {\n return this.request('GET', '/subscriptions/native/config', { ...options });\n }\n\n /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */\n async updateNativeConfig(\n params: NativeShopConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeShopConfigResponse> {\n return this.request('PUT', '/subscriptions/native/config', { body: params, ...options });\n }\n\n /** Read merchant-wide renewal recovery settings. */\n async getNativeDunning(options?: RequestExtras): Promise<NativeDunningConfigResponse> {\n return this.request('GET', '/subscriptions/native/dunning', { ...options });\n }\n\n async updateNativeDunning(\n params: NativeDunningConfigRequest,\n options?: RequestExtras,\n ): Promise<NativeDunningConfigResponse> {\n return this.request('PUT', '/subscriptions/native/dunning', { body: params, ...options });\n }\n\n /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */\n async getCapabilities(\n subscriptionId: string,\n options?: RequestExtras,\n ): Promise<BuyerPortalSubscriptionCapabilities> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,\n { ...options },\n );\n }\n\n /**\n * Create and immediately confirm a subscription. `POST /subscriptions`\n *\n * For billing processors that require buyer approval (e.g. PayPal), the\n * response carries a `redirect_url` the customer must be sent to.\n */\n async createAndConfirm(\n params: CreateAndConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', '/subscriptions', { body: params, ...options });\n }\n\n /** Create a subscription without confirming it. `POST /subscriptions/create` */\n async create(\n params: CreateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('POST', '/subscriptions/create', { body: params, ...options });\n }\n\n /**\n * Adopt an existing Creem subscription. `POST /subscriptions/adopt`\n *\n * Requires adoption to be enabled on the deployment and `X-Profile-Id` in\n * options.headers. Adoption charges nothing and emits no invoice or webhook.\n * Repeating the processor subscription ID returns the existing DeloPay ID.\n * Retry when handoff_confirmed is false. That flag confirms persistence,\n * not the merchant's external switch-over: stop processing Creem events in\n * your own integration when handing subsequent events to DeloPay.\n */\n async adopt(\n params: AdoptSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<AdoptSubscriptionResponse> {\n return this.request('POST', '/subscriptions/adopt', { body: params, ...options });\n }\n\n /** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */\n async retrieve(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}`, {\n ...options,\n });\n }\n\n /**\n * Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`\n *\n * Like {@link createAndConfirm}, the response may carry a `redirect_url` for\n * processors that require buyer approval.\n */\n async confirm(\n subscriptionId: string,\n params: ConfirmSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ConfirmSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async update(\n subscriptionId: string,\n params: UpdateSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse> {\n return this.request('PUT', `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * List subscriptions for the profile, or one customer's with `customer_id`.\n * `GET /subscriptions/list`\n */\n async list(\n params?: SubscriptionListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionResponse[]> {\n return this.request('GET', '/subscriptions/list', {\n query: csvQuery(params, ['profile_ids', 'industry']),\n ...options,\n });\n }\n\n /** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */\n async getEstimate(\n params: SubscriptionEstimateParams,\n options?: RequestExtras,\n ): Promise<SubscriptionEstimateResponse> {\n return this.request('GET', '/subscriptions/estimate', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */\n async getItems(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<GetSubscriptionItemsResponse[]> {\n return this.request('GET', '/subscriptions/items', {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * {@link getItems}, with whether the list is only the first part of what the\n * processor holds. `GET /subscriptions/items`\n *\n * The backend states that in the `X-Delopay-Items-Truncated` response\n * header (Stripe Billing lists its first 100 products), which the plain\n * {@link getItems} cannot return. Without `limit` and `offset` every item\n * the billing account offers is listed, up to 500.\n */\n async getItemsPage(\n params: GetSubscriptionItemsParams,\n options?: RequestExtras,\n ): Promise<SubscriptionItemsPage> {\n let truncated = false;\n const items = await this.request<GetSubscriptionItemsResponse[]>(\n 'GET',\n '/subscriptions/items',\n {\n query: params as unknown as Record<string, string | number | undefined>,\n ...options,\n onDownloadProgress: (event) => {\n // The headers arrive with the first event; a retried request reports\n // them again, and the last attempt is the one the items come from.\n truncated = event.headers.get('x-delopay-items-truncated')?.toLowerCase() === 'true';\n options?.onDownloadProgress?.(event);\n },\n },\n );\n return { items, truncated };\n }\n\n /**\n * Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n *\n * The body defaults to `{}` so the request still carries\n * `Content-Type: application/json` even when no params are passed — the\n * backend rejects the POST otherwise (\"Unsupported content type\").\n */\n async pause(\n subscriptionId: string,\n params?: PauseSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<PauseSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume`\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async resume(\n subscriptionId: string,\n params?: ResumeSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<ResumeSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel`\n *\n * A subscription in a state it cannot be cancelled from is refused with\n * `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).\n *\n * From the dashboard this counts against the caller's `subscription_change`\n * operation limit; an over-limit call fails with `DE_01` and nothing reaches\n * the processor. Calls made with an API key are not limited.\n */\n async cancel(\n subscriptionId: string,\n params?: CancelSubscriptionRequest,\n options?: RequestExtras,\n ): Promise<CancelSubscriptionResponse> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {\n body: params ?? {},\n ...options,\n });\n }\n\n /**\n * Read 1 to 50 subscriptions back from their billing processor and mirror\n * what it reports. `POST /subscriptions/sync`\n *\n * Nothing is written at the processor. A status is mirrored only with the\n * time the processor stamped it with, and never over a newer event already\n * recorded; a plan only with its own stamp. One result per id, in request\n * order; one that fails does not stop the others.\n */\n async sync(\n params: SubscriptionSyncRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionSyncResponse> {\n return this.request('POST', '/subscriptions/sync', { body: params, ...options });\n }\n\n /**\n * Read one subscription back from its billing processor and mirror what it\n * reports, as {@link sync} does, with what the processor reported beside\n * what the mirror now holds. `POST /subscriptions/{subscriptionId}/sync`\n */\n async syncOne(subscriptionId: string, options?: RequestExtras): Promise<SubscriptionSyncResult> {\n return this.request('POST', `/subscriptions/${encodeURIComponent(subscriptionId)}/sync`, {\n ...options,\n });\n }\n\n /**\n * List the subscriptions a billing account holds at its processor, and how\n * each relates to DeloPay's: already held, new (its buyer is a DeloPay\n * customer), needing a customer, ended, or not adoptable here.\n * `POST /subscriptions/import/preview`\n *\n * Reads only; nothing is written here or at the processor. Creem and\n * Stripe Billing can be listed; PayPal cannot, which `capabilities` states\n * (`reason_code: 'listing_unsupported'`).\n */\n async importPreview(\n params: SubscriptionImportPreviewRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportPreviewResponse> {\n return this.request('POST', '/subscriptions/import/preview', { body: params, ...options });\n }\n\n /**\n * Take 1 to 25 processor subscriptions over, each through {@link adopt}\n * with every one of its checks, one after another.\n * `POST /subscriptions/import/apply`\n *\n * One result per selection, in request order; one refused does not stop\n * the others.\n */\n async importApply(\n params: SubscriptionImportApplyRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionImportApplyResponse> {\n return this.request('POST', '/subscriptions/import/apply', { body: params, ...options });\n }\n\n /**\n * Resolve which of the given payments were raised by a subscription.\n * `POST /subscriptions/payments/lookup`\n *\n * The linkage exists in one direction only — an invoice points at the payment\n * it settled, and nothing is stamped on the payment — so this is the only way\n * to tell a subscription charge from a one-off one when you are holding a\n * page of payments. In particular, do not use `off_session` or the presence\n * of a mandate: an ordinary saved-card charge sets those identically.\n *\n * Ids that belong to no subscription are **absent** from `links` rather than\n * returned as an error, so match on presence:\n *\n * ```ts\n * const { links } = await subscriptions.lookupPayments(\n * { payment_ids: page.map((p) => p.payment_id) },\n * { headers: { 'X-Profile-Id': profileId } },\n * );\n * const bySubscription = new Map(links.map((l) => [l.payment_id, l]));\n * ```\n *\n * Profile-scoped like every other subscription route, and that matters more\n * here than elsewhere: a `payment_id` is merchant-supplied and only unique\n * within a merchant, so the shop is part of the question, not an\n * optimisation. Pass the profile that owns **the payments** — for a list\n * spanning several shops, group the ids by shop and call once per group.\n *\n * At most 200 ids per call.\n */\n async lookupPayments(\n params: SubscriptionPaymentLookupRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionPaymentLookupResponse> {\n return this.request('POST', '/subscriptions/payments/lookup', { body: params, ...options });\n }\n\n /**\n * One subscription's billing history, newest cycle first.\n * `GET /subscriptions/{subscriptionId}/invoices`\n *\n * {@link retrieve} carries only the *latest* invoice, which is the current\n * cycle — a subscription that has renewed monthly for a year has one of those\n * and twelve of these. Use this wherever a merchant needs to see what a\n * subscription has actually billed, in particular on self-charging processors\n * (Creem, PayPal) where each renewal is charged by the processor and mirrored\n * here rather than raised as a DeloPay payment.\n *\n * Two things to render honestly, both decided rather than incidental:\n *\n * - `amount` is **gross** and `refunded_amount` sits beside it. Do not net\n * them: the difference between the two is not a smaller charge.\n * - A `refunded_amount` of `null` is \"not reported\" and must not render as\n * `0`. Likewise a processor-hosted origination records a bootstrap invoice\n * at `0` before the buyer has paid anything, so a zero amount on such a\n * subscription is a placeholder rather than a free cycle.\n *\n * Profile-scoped like every other subscription route.\n */\n async listInvoices(\n subscriptionId: string,\n params?: SubscriptionInvoiceListParams,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceListResponse> {\n return this.request('GET', `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices`, {\n query: params as Record<string, string | number | undefined>,\n ...options,\n });\n }\n\n /**\n * Refund one paid subscription invoice at the billing processor that charged it.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refund`\n *\n * Needs the refund permission, as a payment refund does, and the merchant's\n * refund rules apply. Only invoices of processor-billed cycles are refunded\n * here; a cycle paid by a payment is refunded through `refunds.create`. The\n * processor refunds the whole amount left on the charge, so omit `amount` or\n * send exactly that remainder.\n *\n * The answer is usually `pending` or `succeeded`: the invoice's refunded total\n * moves, and `invoice_refunded` is sent, once the processor reports the refund.\n * The same `idempotency_key` again answers the first refund and sends nothing.\n * While one refund of an invoice awaits the processor, another is refused.\n */\n async refundInvoice(\n subscriptionId: string,\n invoiceId: string,\n params: SubscriptionInvoiceRefundRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refund`,\n { body: params, ...options, bodyIdempotencyKey: params.idempotency_key },\n );\n }\n\n /**\n * The refunds of one subscription invoice made through the API, oldest first.\n * `GET /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds`\n *\n * Needs subscription read. A refund whose processor reported a refund of the\n * invoice without a refund time of its own, while this one awaited it, reads\n * `awaiting_confirmation` with the processor's refunds it may be in\n * `confirmation_candidates`.\n */\n async listInvoiceRefunds(\n subscriptionId: string,\n invoiceId: string,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundListResponse> {\n return this.request(\n 'GET',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds`,\n options,\n );\n }\n\n /**\n * Confirm that a refund the processor reported is this refund, once checked\n * at the processor.\n * `POST /subscriptions/{subscriptionId}/invoices/{invoiceId}/refunds/{refundId}/confirm`\n *\n * Needs the refund permission. Only a refund in `awaiting_confirmation` is\n * confirmed, and only with one of its `confirmation_candidates`; it becomes\n * `succeeded` with the processor's refund id and amount. The invoice's\n * refunded total does not move and no webhook is sent. The same candidate\n * again answers the refund as it stands. A refund that does not await\n * confirmation, or a processor refund that is not one of its candidates, is\n * refused with a 400 (`IR_16`); a subscription, invoice or refund that is not\n * found answers 404. Only `connector_refund_id` is sent, so a candidate from\n * `confirmation_candidates` can be passed as it is.\n */\n async confirmInvoiceRefund(\n subscriptionId: string,\n invoiceId: string,\n refundId: string,\n params: SubscriptionInvoiceRefundConfirmRequest,\n options?: RequestExtras,\n ): Promise<SubscriptionInvoiceRefundResponse> {\n return this.request(\n 'POST',\n `/subscriptions/${encodeURIComponent(subscriptionId)}/invoices/${encodeURIComponent(invoiceId)}/refunds/${encodeURIComponent(refundId)}/confirm`,\n { ...options, body: { connector_refund_id: params.connector_refund_id } },\n );\n }\n\n /**\n * Which billing processor this shop's subscriptions run on.\n * `GET /subscriptions/billing_processor`\n *\n * The same mapping is derivable from the connector inventory\n * (`GET /account/{merchant_id}/connectors`), but that route is gated by a\n * connector-read permission granted independently of subscriptions — so a\n * role authorised to create subscriptions could be unable to learn which\n * processor it was creating them on. This answers under the same\n * authorization as the rest of the subscription API.\n *\n * Reach for it when the client must branch on the processor *before* calling\n * — origination differs by processor, and guessing is destructive. Resolve\n * the shop's `billing_processor_id` first: a shop that runs no subscriptions\n * has none assigned, and this route has no identity to report for it.\n */\n async getBillingProcessor(\n options?: RequestExtras,\n ): Promise<SubscriptionBillingProcessorResponse> {\n return this.request('GET', '/subscriptions/billing_processor', { ...options });\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/dist/chunk-YFRAI34Y.cjs","../src/resources/shopify.ts"],"names":[],"mappings":"AAAA;AC4BO,IAAM,QAAA,EAAN,MAAc;AAAA,EACnB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlD,MAAM,kBAAA,CACJ,SAAA,EACA,OAAA,EACoC;AACpC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,qBAAA,EAAwB,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AAClF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS+E,EAAA;AACnB,IAAA;AAC5D,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwB8B,EAAA;AAChB,IAAA;AACV,MAAA;AACqD,MAAA;AAC1B,MAAA;AAC7B,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBmC,EAAA;AAC+C,IAAA;AAC3E,MAAA;AACG,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc8B,EAAA;AACqD,IAAA;AAC5E,MAAA;AACG,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ4E,EAAA;AACD,IAAA;AAC3E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBsC,EAAA;AACxB,IAAA;AACV,MAAA;AACqD,MAAA;AACrD,MAAA;AACK,QAAA;AACe,QAAA;AACpB,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc6B,EAAA;AACf,IAAA;AACV,MAAA;AACqE,MAAA;AACrE,MAAA;AACF,IAAA;AACF,EAAA;AACF;ADvDqF;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-YFRAI34Y.cjs","sourcesContent":[null,"import type {\n ShopifyConnectRequest,\n ShopifyConnectResponse,\n ShopifyConnection,\n ShopifyConnectionList,\n ShopifyConnectionResponse,\n ShopifyPaymentModeUpdate,\n ShopifySettingsUpdate,\n ShopifySyncEvent,\n ShopifySyncEventsQuery,\n ShopifySyncEventsResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/**\n * A shop's link to the merchant's Shopify store: the merchant creates an app\n * in their own Shopify account, saves its keys here, approves it in Shopify,\n * and the storefront script sends the store's buyers to this shop's hosted\n * checkout. Every route names the shop by its profile id.\n *\n * Reading the connections, the sync log and its retry, and switching the\n * payment mode, take an API key or a dashboard session; a session needs the\n * shop's Read permission to read and its Write to retry or switch. Connecting, changing the settings and disconnecting take\n * a signed-in dashboard session only, never an API key, with the shop's Write\n * permission. A key or role pinned to another shop, or a checkout template's\n * profile, is refused as unknown (404). No answer carries the app's client\n * secret or the store's access token.\n */\nexport class Shopify {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The shop's connection, if any, with the storefront's last reports, and\n * what the merchant's app must list (redirect URL, access scopes). Takes an\n * API key or a dashboard session with the shop's Read permission; a server\n * that predates API-key access refuses a key with 401. Read-only: never\n * returns a secret or a token.\n *\n * `GET /shopify/connections/{profileId}`\n */\n async retrieveConnection(\n profileId: string,\n options?: RequestExtras,\n ): Promise<ShopifyConnectionResponse> {\n return this.request('GET', `/shopify/connections/${encodeURIComponent(profileId)}`, options);\n }\n\n /**\n * The caller's stores with their payment mode: one per shop at most, and\n * only its own shop's for a shop-bound key or a shop-scoped role. Never\n * returns a secret or a token.\n *\n * `GET /shopify/connections`\n */\n async listConnections(options?: RequestExtras): Promise<ShopifyConnectionList> {\n return this.request('GET', '/shopify/connections', options);\n }\n\n /**\n * Switch the store between live and test payments. To `test`,\n * `confirm_shop_domain` must be the store's address exactly as the\n * connection shows it, and a payment provider of the shop must be able to\n * take a test payment (`test_payments_available`; 422 otherwise). In test,\n * storefront checkouts started from then on make test payments, and their\n * Shopify orders are tagged `<brand> TEST` (such as `DeloPay TEST`) and\n * must not be fulfilled. That holds only once the whole deployment serves\n * test mode (every API server, the storefront script and the order sync):\n * a deployment still mid-rollout can make a live payment or an untagged\n * order, so switch only once the deployment has finished rolling it out.\n * Back to `live` needs no typed address. Asking for the mode the store is\n * already in changes nothing. A switch made by someone else meanwhile is\n * refused with 412. A storefront checkout already started keeps the mode it\n * began in; the storefront shows the change within about a minute.\n *\n * `POST /shopify/connections/{profileId}/payment_mode`\n */\n async updatePaymentMode(\n profileId: string,\n params: ShopifyPaymentModeUpdate,\n options?: RequestExtras,\n ): Promise<ShopifyConnection> {\n return this.request(\n 'POST',\n `/shopify/connections/${encodeURIComponent(profileId)}/payment_mode`,\n { ...options, body: params },\n );\n }\n\n /**\n * Save the app's keys and get the Shopify page the merchant approves the app\n * on. Refused while the shop is connected (412), except to approve again in\n * place: when the connection's `authorization_expired` is `true`, saving the\n * same store's keys for the same app (same `shop_domain` and `client_id`)\n * starts a new approval while the store stays connected with its settings\n * and script. Saving the keys renews nothing by itself: the merchant must\n * open the returned `authorize_url` and approve the app again, so neither a\n * successful call nor the `connected` status proves the approval is done;\n * `authorization_expired` turns `false` once it is. Refused when the store\n * is connected to another shop (409).\n *\n * `PUT /shopify/connections/{profileId}`\n */\n async connect(\n profileId: string,\n params: ShopifyConnectRequest,\n options?: RequestExtras,\n ): Promise<ShopifyConnectResponse> {\n return this.request('PUT', `/shopify/connections/${encodeURIComponent(profileId)}`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * Change the storefront settings: the takeover switch, the mode, the\n * appearance, the accepted terms. Switching the takeover on needs an\n * approved connection, and in `skip_checkout` mode the accepted terms\n * (412 otherwise).\n *\n * `PATCH /shopify/connections/{profileId}`\n */\n async updateSettings(\n profileId: string,\n params: ShopifySettingsUpdate,\n options?: RequestExtras,\n ): Promise<ShopifyConnection> {\n return this.request('PATCH', `/shopify/connections/${encodeURIComponent(profileId)}`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * Disconnect the store. Buyers go back to Shopify checkout at once, and the\n * stored keys are wiped.\n *\n * `DELETE /shopify/connections/{profileId}`\n */\n async disconnect(profileId: string, options?: RequestExtras): Promise<void> {\n return this.request('DELETE', `/shopify/connections/${encodeURIComponent(profileId)}`, options);\n }\n\n /**\n * The shop's recent syncs with its store, newest first: the order of each\n * paid storefront payment, refunds in both directions, dispute flags and\n * webhook registrations. A `held` or `failed` entry was told to the\n * merchant; a `pending` one with a `reason` is retrying by itself. For the\n * next page, pass the answer's `next_cursor` as `cursor` with the same\n * filters; it is set on every full page and absent on a short one. Never\n * page by the oldest `created_at` as `before`: that skips entries sharing\n * its time.\n *\n * `GET /shopify/connections/{profileId}/sync_events`\n */\n async listSyncEvents(\n profileId: string,\n query?: ShopifySyncEventsQuery,\n options?: RequestExtras,\n ): Promise<ShopifySyncEventsResponse> {\n return this.request(\n 'GET',\n `/shopify/connections/${encodeURIComponent(profileId)}/sync_events`,\n {\n ...options,\n query: { ...query },\n },\n );\n }\n\n /**\n * Run a failed, held or waiting sync again within a minute, as a first\n * attempt would: a held order whose total still differs from what was paid\n * is held again. Never makes a second order or a second refund. An entry\n * that cannot be retried answers 404.\n *\n * `POST /shopify/connections/{profileId}/sync_events/{eventId}/retry`\n */\n async retrySyncEvent(\n profileId: string,\n eventId: string,\n options?: RequestExtras,\n ): Promise<ShopifySyncEvent> {\n return this.request(\n 'POST',\n `/shopify/connections/${encodeURIComponent(profileId)}/sync_events/${encodeURIComponent(eventId)}/retry`,\n options,\n );\n }\n}\n"]}
|