@delopay/sdk 0.497.0 → 0.499.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.map +1 -1
- package/dist/chunk-244VZFFO.cjs.map +1 -1
- package/dist/chunk-2IJRBJXW.cjs.map +1 -1
- package/dist/chunk-34PC72O7.cjs.map +1 -1
- package/dist/chunk-3GBWQWTP.cjs.map +1 -1
- package/dist/chunk-3YBBJT3Y.cjs.map +1 -1
- package/dist/chunk-44QBWVRS.cjs.map +1 -1
- package/dist/chunk-4EKAWNYI.cjs.map +1 -1
- package/dist/chunk-4LN4BR2T.cjs.map +1 -1
- package/dist/chunk-4T4XHPYN.cjs.map +1 -1
- package/dist/{chunk-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-CAMALM35.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-IKXGA2Z5.cjs.map +1 -1
- package/dist/chunk-IR2LFKKA.cjs.map +1 -1
- 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-K3XXGAOR.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-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-PYNHK6AP.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-RI42IDRR.cjs.map +1 -1
- package/dist/chunk-S77LQWYC.cjs.map +1 -1
- package/dist/chunk-S7SBNOGS.cjs.map +1 -1
- 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-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-YFRAI34Y.cjs.map +1 -1
- package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
- package/dist/chunk-YW4DVKNT.cjs.map +1 -1
- package/dist/chunk-ZGMIHHGL.cjs.map +1 -1
- package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
- package/dist/chunk-ZMJT2YPZ.cjs.map +1 -1
- package/dist/chunk-ZUULK36E.cjs.map +1 -1
- package/dist/client.cjs.map +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.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- 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 +3 -3
- 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 +1 -1
- 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.map +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.map +1 -1
- package/dist/resources/shops.cjs.map +1 -1
- package/dist/resources/stripeConnect.cjs.map +1 -1
- package/dist/resources/subscriptions.cjs.map +1 -1
- package/dist/resources/support.cjs.map +1 -1
- package/dist/resources/threeDsRules.cjs.map +1 -1
- package/dist/resources/users.cjs.map +1 -1
- package/dist/resources/vatRates.cjs.map +1 -1
- package/dist/resources/verification.cjs.map +1 -1
- package/dist/resources/webhooks.cjs.map +1 -1
- package/dist/resources/whopResolutionCases.cjs.map +1 -1
- package/dist/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 +61 -4
- package/dist/types.d.ts +61 -4
- package/package.json +19 -17
- package/dist/chunk-2NVGA4G5.cjs.map +0 -1
- package/dist/chunk-F6LZ2YNM.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/dist/chunk-EQ6P6ZND.cjs","../src/feeProgram.ts"],"names":[],"mappings":"AAAA;ACoCO,SAAS,IAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,MAAM,OAAA,EACJ,OAAO,MAAA,IAAU,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,EAAU,MAAM,EAAA,EAAI,EAAE,IAAA,EAAM,cAAA,EAAgB,MAAM,CAAA;AACxF,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,OAAO,CAAA;AACxD;AAOO,SAAS,YAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,GAAA,EAAK,UAAA;AAAA,IACL,UAAA;AAAA,IACA,KAAA,EAAO,EAAE,IAAA,EAAM,kBAAA,EAAoB,KAAA,EAAO,EAAE,GAAA,EAAK,MAAM,EAAE;AAAA,EAC3D,CAAA;AACF;AAGO,SAAS,KAAA,CAAA,GAAS,QAAA,EAAsC;AAC7D,EAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,SAAS,CAAA;AACjC;AAGO,SAAS,KAAA,CAAA,GAAS,QAAA,EAAsC;AAC7D,EAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,SAAS,CAAA;AACjC;AAsEA,SAAS,WAAA,CAAY,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Connector,\n Currency,\n EuclidComparison,\n EuclidComparisonType,\n EuclidIfStatement,\n EuclidValue,\n PaymentMethod,\n PlatformFeeKind,\n PlatformFeeOutput,\n PlatformFeeProgram,\n PlatformFeeRule,\n RuleSchedule,\n} from './types';\n\n/** A single condition leaf in the builder's condition tree. */\nexport interface LeafNode {\n kind: 'leaf';\n lhs: string;\n comparison: EuclidComparisonType;\n value: EuclidValue;\n}\n\n/** An AND (`all`) or OR (`any`) group of condition nodes. */\nexport interface GroupNode {\n kind: 'all' | 'any';\n children: ConditionNode[];\n}\n\nexport type ConditionNode = LeafNode | GroupNode;\n\n/**\n * A condition leaf. Numeric values (amount, merchant_volume) tag as `number`;\n * string values (payment_method, connector, currency, card_network) tag as\n * `enum_variant`.\n */\nexport function leaf(\n lhs: string,\n comparison: EuclidComparisonType,\n value: string | number,\n): LeafNode {\n const tagged: EuclidValue =\n typeof value === 'number' ? { type: 'number', value } : { type: 'enum_variant', value };\n return { kind: 'leaf', lhs, comparison, value: tagged };\n}\n\n/**\n * A condition on one entry of the payment's merchant-supplied metadata (the\n * `routing_parameters` string map). `equal` and `not_equal` compare the\n * stored string with `value`; a payment without the key never matches `equal`.\n */\nexport function metadataLeaf(\n key: string,\n comparison: 'equal' | 'not_equal',\n value: string,\n): LeafNode {\n return {\n kind: 'leaf',\n lhs: 'metadata',\n comparison,\n value: { type: 'metadata_variant', value: { key, value } },\n };\n}\n\n/** AND group — all children must match. */\nexport function allOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'all', children };\n}\n\n/** OR group — any child matching is enough. */\nexport function anyOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'any', children };\n}\n\n/**\n * How a rule (or the default) prices a transaction. `fee_type` is inferred:\n * percentage-only → `percentage`, flat-only → `flat`, both → `combined`.\n */\nexport interface FeeSpecInput {\n /** Percentage fee, e.g. `2.5` means 2.5%. */\n percentage?: number;\n /** Flat fee in minor units. */\n flat?: number;\n /** ISO 4217 currency for the flat fee. */\n flatCurrency?: string;\n /** Clamp floor in minor units. */\n min?: number;\n /** Clamp ceiling in minor units. */\n max?: number;\n}\n\n/**\n * Friendly conditions for a rule. Every provided key becomes one condition and\n * they are ANDed together. For dimensions not covered here (payment-method-type\n * keys like `crypto`/`wallet`, metadata, value arrays) use `rawConditions`.\n */\nexport interface FeeRuleConditions {\n paymentMethod?: PaymentMethod;\n connector?: Connector;\n currency?: Currency;\n cardNetwork?: string;\n /**\n * Customer billing-address country. Must be the exact backend `Country` enum\n * variant (PascalCase full name, e.g. `Germany`/`UnitedStatesOfAmerica`), not\n * an ISO code — the engine lowers `billing_country` via case-sensitive\n * `from_str`.\n */\n billingCountry?: string;\n /** `amount == n` (minor units). */\n amountEquals?: number;\n /** `amount > n` (minor units). */\n amountGreaterThan?: number;\n /** `amount < n` (minor units). */\n amountLessThan?: number;\n /**\n * `merchant_volume == n` — the merchant's previous-month volume snapshot\n * (USD minor units). Combine with any other condition, e.g.\n * `{ paymentMethod: 'crypto', merchantVolumeGreaterThan: 1_000_000 }`.\n */\n merchantVolumeEquals?: number;\n /** `merchant_volume > n` (USD minor units). */\n merchantVolumeGreaterThan?: number;\n /** `merchant_volume < n` (USD minor units). */\n merchantVolumeLessThan?: number;\n}\n\nexport interface FeeRuleInput {\n name: string;\n /** Friendly conditions (ANDed). Omit for an always-matching rule (prefer `otherwise`). */\n when?: FeeRuleConditions;\n /** Extra raw conditions ANDed in, for dimensions `when` does not cover. */\n rawConditions?: EuclidComparison[];\n /** Nested AND/OR condition tree. Mutually exclusive with `when`/`rawConditions`. */\n match?: ConditionNode;\n fee: FeeSpecInput;\n /**\n * A recurring window outside which the rule is skipped and the next rule or\n * `otherwise` applies. Omit for a rule that applies at all times.\n */\n schedule?: RuleSchedule;\n}\n\nfunction toFeeOutput(spec: FeeSpecInput): PlatformFeeOutput {\n const hasPct = spec.percentage != null;\n const hasFlat = spec.flat != null;\n const feeType: PlatformFeeKind = hasPct && hasFlat ? 'combined' : hasFlat ? 'flat' : 'percentage';\n return {\n fee_type: feeType,\n percentage_fee: spec.percentage ?? null,\n flat_fee_amount: spec.flat ?? null,\n flat_fee_currency: spec.flatCurrency ?? null,\n min_fee_amount: spec.min ?? null,\n max_fee_amount: spec.max ?? null,\n };\n}\n\nfunction enumCondition(lhs: string, value: string): EuclidComparison {\n return { lhs, comparison: 'equal', value: { type: 'enum_variant', value }, metadata: {} };\n}\n\nfunction numberCondition(\n lhs: string,\n comparison: EuclidComparisonType,\n value: number,\n): EuclidComparison {\n return { lhs, comparison, value: { type: 'number', value }, metadata: {} };\n}\n\nfunction buildConditions(\n when: FeeRuleConditions = {},\n raw: EuclidComparison[] = [],\n): EuclidComparison[] {\n const out: EuclidComparison[] = [];\n if (when.paymentMethod != null) out.push(enumCondition('payment_method', when.paymentMethod));\n if (when.connector != null) out.push(enumCondition('connector', when.connector));\n if (when.currency != null) out.push(enumCondition('currency', when.currency));\n if (when.cardNetwork != null) out.push(enumCondition('card_network', when.cardNetwork));\n if (when.billingCountry != null) out.push(enumCondition('billing_country', when.billingCountry));\n if (when.amountEquals != null) out.push(numberCondition('amount', 'equal', when.amountEquals));\n if (when.amountGreaterThan != null) {\n out.push(numberCondition('amount', 'greater_than', when.amountGreaterThan));\n }\n if (when.amountLessThan != null) {\n out.push(numberCondition('amount', 'less_than', when.amountLessThan));\n }\n if (when.merchantVolumeEquals != null) {\n out.push(numberCondition('merchant_volume', 'equal', when.merchantVolumeEquals));\n }\n if (when.merchantVolumeGreaterThan != null) {\n out.push(numberCondition('merchant_volume', 'greater_than', when.merchantVolumeGreaterThan));\n }\n if (when.merchantVolumeLessThan != null) {\n out.push(numberCondition('merchant_volume', 'less_than', when.merchantVolumeLessThan));\n }\n out.push(...raw);\n return out;\n}\n\nfunction leafToComparison(node: LeafNode): EuclidComparison {\n return { lhs: node.lhs, comparison: node.comparison, value: node.value, metadata: {} };\n}\n\n/**\n * Flatten associativity (nested all-in-all / any-in-any) and collapse\n * single-child groups, so every group child of an `all` is an `any`.\n * @internal\n */\nexport function normalizeNode(node: ConditionNode): ConditionNode {\n if (node.kind === 'leaf') return node;\n const children = node.children.map(normalizeNode);\n const flat: ConditionNode[] = [];\n for (const c of children) {\n if (c.kind === node.kind) flat.push(...c.children);\n else flat.push(c);\n }\n if (flat.length === 1) return flat[0];\n return { kind: node.kind, children: flat };\n}\n\nfunction toStatement(node: ConditionNode): EuclidIfStatement {\n if (node.kind === 'leaf') return { condition: [leafToComparison(node)], nested: null };\n // Unreachable via current callers (encodeStatements strips top-level any); kept for totality.\n if (node.kind === 'any') {\n return { condition: [], nested: node.children.map(toStatement) };\n }\n // 'all': after normalize, group children are all 'any'.\n const leaves = node.children.filter((c): c is LeafNode => c.kind === 'leaf');\n const groups = node.children.filter((c): c is GroupNode => c.kind !== 'leaf');\n const condition = leaves.map(leafToComparison);\n if (groups.length === 0) return { condition, nested: null };\n const [first, ...rest] = groups;\n // `first` is an OR; AND each of its branches with the remaining OR groups.\n const nested = first.children.map((branch) => toStatement(normalizeNode(allOf(branch, ...rest))));\n return { condition, nested };\n}\n\nfunction assertNoEmptyAnyOf(node: ConditionNode): void {\n if (node.kind === 'leaf') return;\n if (node.kind === 'any' && node.children.length === 0) {\n throw new Error('feeProgram: an anyOf() group must have at least one condition');\n }\n node.children.forEach(assertNoEmptyAnyOf);\n}\n\n/**\n * Encode a rule's match (a condition tree) into the engine's `statements[]`.\n * A top-level OR spreads across statements; anything else is a single statement.\n * @internal\n */\nexport function encodeStatements(match: ConditionNode): EuclidIfStatement[] {\n const m = normalizeNode(match);\n if (m.kind === 'any') return m.children.map(toStatement);\n return [toStatement(m)];\n}\n\nfunction comparisonToLeaf(c: EuclidComparison): LeafNode {\n return { kind: 'leaf', lhs: c.lhs, comparison: c.comparison, value: c.value };\n}\n\nfunction statementToNode(stmt: EuclidIfStatement): ConditionNode {\n const leaves = stmt.condition.map(comparisonToLeaf);\n if (stmt.nested && stmt.nested.length > 0) {\n const orNode = anyOf(...stmt.nested.map(statementToNode));\n if (leaves.length === 0) return orNode;\n return allOf(...leaves, orNode);\n }\n return leaves.length === 1 ? leaves[0] : allOf(...leaves);\n}\n\n/**\n * Decode a rule's `statements[]` back into a condition tree.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function ruleMatchToTree(statements: EuclidIfStatement[]): ConditionNode {\n if (statements.length === 1) return normalizeNode(statementToNode(statements[0]));\n return normalizeNode(anyOf(...statements.map(statementToNode)));\n}\n\n/**\n * Decode a stored program into the builder's editable model.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function programToTree(program: PlatformFeeProgram): {\n rules: {\n name: string;\n match: ConditionNode;\n fee: PlatformFeeOutput | null;\n schedule: RuleSchedule | null;\n }[];\n otherwise: PlatformFeeOutput | null;\n} {\n return {\n rules: program.rules.map((r) => ({\n name: r.name,\n match: ruleMatchToTree(r.statements),\n fee: r.connectorSelection.fee ?? null,\n schedule: r.connectorSelection.schedule ?? null,\n })),\n otherwise: program.defaultSelection.fee ?? null,\n };\n}\n\n/**\n * Fluent builder for a platform fee-rule program. Emits the exact Euclid wire\n * shape (camelCase tree, tagged values, `metadata: {}` everywhere) so callers\n * never hand-write the AST. Rules are evaluated in order; the first match wins,\n * else `otherwise` (the default selection).\n *\n * @example\n * ```ts\n * const algorithm = feeProgram()\n * .rule({ name: 'crypto', when: { paymentMethod: 'crypto' }, fee: { percentage: 1.0 } })\n * .rule({\n * name: 'card_on_cryptomus',\n * when: { paymentMethod: 'card', connector: 'cryptomus' },\n * fee: { percentage: 2.0 },\n * })\n * .otherwise({ percentage: 3.0 })\n * .build();\n *\n * await delopay.fees.rules.upsert({ algorithm }, merchantId);\n * ```\n */\nexport class FeeProgramBuilder {\n private readonly rules: PlatformFeeRule[] = [];\n private defaultFee: PlatformFeeOutput | null = null;\n\n /** Append a rule. Provided `when`/`rawConditions` are ANDed. */\n rule(input: FeeRuleInput): this {\n if (input.match) assertNoEmptyAnyOf(input.match);\n const statements: PlatformFeeRule['statements'] = input.match\n ? encodeStatements(input.match)\n : [{ condition: buildConditions(input.when, input.rawConditions) }];\n const connectorSelection: PlatformFeeRule['connectorSelection'] = {\n fee: toFeeOutput(input.fee),\n };\n if (input.schedule !== undefined) connectorSelection.schedule = input.schedule;\n this.rules.push({ name: input.name, connectorSelection, statements });\n return this;\n }\n\n /** Set the default selection (applied when no rule matches). */\n otherwise(fee: FeeSpecInput): this {\n this.defaultFee = toFeeOutput(fee);\n return this;\n }\n\n /** Produce the wire-ready program. */\n build(): PlatformFeeProgram {\n return {\n defaultSelection: { fee: this.defaultFee },\n rules: this.rules,\n metadata: {},\n };\n }\n}\n\n/** Start building a platform fee-rule program. See {@link FeeProgramBuilder}. */\nexport function feeProgram(): FeeProgramBuilder {\n return new FeeProgramBuilder();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-EQ6P6ZND.cjs","../src/feeProgram.ts"],"names":[],"mappings":"AAAA;ACoCO,SAAS,IAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,MAAM,OAAA,EACJ,OAAO,MAAA,IAAU,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,EAAU,MAAM,EAAA,EAAI,EAAE,IAAA,EAAM,cAAA,EAAgB,MAAM,CAAA;AACxF,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,OAAO,CAAA;AACxD;AAOO,SAAS,YAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,GAAA,EAAK,UAAA;AAAA,IACL,UAAA;AAAA,IACA,KAAA,EAAO,EAAE,IA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AA;AAAA,MACzC,KAAA,EAAO,IAAA,CAAK,KAAA;AAAA,MACZ,QAAA,EAAU,CAAC;AAAA,IACb,CAAA;AAAA,EACF;AACF,CAAA;AAGO,SAAS,UAAA,CAAA,EAAgC;AAC9C,EAAA,OAAO,IAAI,iBAAA,CAAkB,CAAA;AAC/B;AD7MA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6VAAC","file":"/tmp/publish-sdk-04990/dist/chunk-EQ6P6ZND.cjs","sourcesContent":[null,"import type {\n Connector,\n Currency,\n EuclidComparison,\n EuclidComparisonType,\n EuclidIfStatement,\n EuclidValue,\n PaymentMethod,\n PlatformFeeKind,\n PlatformFeeOutput,\n PlatformFeeProgram,\n PlatformFeeRule,\n RuleSchedule,\n} from './types';\n\n/** A single condition leaf in the builder's condition tree. */\nexport interface LeafNode {\n kind: 'leaf';\n lhs: string;\n comparison: EuclidComparisonType;\n value: EuclidValue;\n}\n\n/** An AND (`all`) or OR (`any`) group of condition nodes. */\nexport interface GroupNode {\n kind: 'all' | 'any';\n children: ConditionNode[];\n}\n\nexport type ConditionNode = LeafNode | GroupNode;\n\n/**\n * A condition leaf. Numeric values (amount, merchant_volume) tag as `number`;\n * string values (payment_method, connector, currency, card_network) tag as\n * `enum_variant`.\n */\nexport function leaf(\n lhs: string,\n comparison: EuclidComparisonType,\n value: string | number,\n): LeafNode {\n const tagged: EuclidValue =\n typeof value === 'number' ? { type: 'number', value } : { type: 'enum_variant', value };\n return { kind: 'leaf', lhs, comparison, value: tagged };\n}\n\n/**\n * A condition on one entry of the payment's merchant-supplied metadata (the\n * `routing_parameters` string map). `equal` and `not_equal` compare the\n * stored string with `value`; a payment without the key never matches `equal`.\n */\nexport function metadataLeaf(\n key: string,\n comparison: 'equal' | 'not_equal',\n value: string,\n): LeafNode {\n return {\n kind: 'leaf',\n lhs: 'metadata',\n comparison,\n value: { type: 'metadata_variant', value: { key, value } },\n };\n}\n\n/** AND group — all children must match. */\nexport function allOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'all', children };\n}\n\n/** OR group — any child matching is enough. */\nexport function anyOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'any', children };\n}\n\n/**\n * How a rule (or the default) prices a transaction. `fee_type` is inferred:\n * percentage-only → `percentage`, flat-only → `flat`, both → `combined`.\n */\nexport interface FeeSpecInput {\n /** Percentage fee, e.g. `2.5` means 2.5%. */\n percentage?: number;\n /** Flat fee in minor units. */\n flat?: number;\n /** ISO 4217 currency for the flat fee. */\n flatCurrency?: string;\n /** Clamp floor in minor units. */\n min?: number;\n /** Clamp ceiling in minor units. */\n max?: number;\n}\n\n/**\n * Friendly conditions for a rule. Every provided key becomes one condition and\n * they are ANDed together. For dimensions not covered here (payment-method-type\n * keys like `crypto`/`wallet`, metadata, value arrays) use `rawConditions`.\n */\nexport interface FeeRuleConditions {\n paymentMethod?: PaymentMethod;\n connector?: Connector;\n currency?: Currency;\n cardNetwork?: string;\n /**\n * Customer billing-address country. Must be the exact backend `Country` enum\n * variant (PascalCase full name, e.g. `Germany`/`UnitedStatesOfAmerica`), not\n * an ISO code — the engine lowers `billing_country` via case-sensitive\n * `from_str`.\n */\n billingCountry?: string;\n /** `amount == n` (minor units). */\n amountEquals?: number;\n /** `amount > n` (minor units). */\n amountGreaterThan?: number;\n /** `amount < n` (minor units). */\n amountLessThan?: number;\n /**\n * `merchant_volume == n` — the merchant's previous-month volume snapshot\n * (USD minor units). Combine with any other condition, e.g.\n * `{ paymentMethod: 'crypto', merchantVolumeGreaterThan: 1_000_000 }`.\n */\n merchantVolumeEquals?: number;\n /** `merchant_volume > n` (USD minor units). */\n merchantVolumeGreaterThan?: number;\n /** `merchant_volume < n` (USD minor units). */\n merchantVolumeLessThan?: number;\n}\n\nexport interface FeeRuleInput {\n name: string;\n /** Friendly conditions (ANDed). Omit for an always-matching rule (prefer `otherwise`). */\n when?: FeeRuleConditions;\n /** Extra raw conditions ANDed in, for dimensions `when` does not cover. */\n rawConditions?: EuclidComparison[];\n /** Nested AND/OR condition tree. Mutually exclusive with `when`/`rawConditions`. */\n match?: ConditionNode;\n fee: FeeSpecInput;\n /**\n * A recurring window outside which the rule is skipped and the next rule or\n * `otherwise` applies. Omit for a rule that applies at all times.\n */\n schedule?: RuleSchedule;\n}\n\nfunction toFeeOutput(spec: FeeSpecInput): PlatformFeeOutput {\n const hasPct = spec.percentage != null;\n const hasFlat = spec.flat != null;\n const feeType: PlatformFeeKind = hasPct && hasFlat ? 'combined' : hasFlat ? 'flat' : 'percentage';\n return {\n fee_type: feeType,\n percentage_fee: spec.percentage ?? null,\n flat_fee_amount: spec.flat ?? null,\n flat_fee_currency: spec.flatCurrency ?? null,\n min_fee_amount: spec.min ?? null,\n max_fee_amount: spec.max ?? null,\n };\n}\n\nfunction enumCondition(lhs: string, value: string): EuclidComparison {\n return { lhs, comparison: 'equal', value: { type: 'enum_variant', value }, metadata: {} };\n}\n\nfunction numberCondition(\n lhs: string,\n comparison: EuclidComparisonType,\n value: number,\n): EuclidComparison {\n return { lhs, comparison, value: { type: 'number', value }, metadata: {} };\n}\n\nfunction buildConditions(\n when: FeeRuleConditions = {},\n raw: EuclidComparison[] = [],\n): EuclidComparison[] {\n const out: EuclidComparison[] = [];\n if (when.paymentMethod != null) out.push(enumCondition('payment_method', when.paymentMethod));\n if (when.connector != null) out.push(enumCondition('connector', when.connector));\n if (when.currency != null) out.push(enumCondition('currency', when.currency));\n if (when.cardNetwork != null) out.push(enumCondition('card_network', when.cardNetwork));\n if (when.billingCountry != null) out.push(enumCondition('billing_country', when.billingCountry));\n if (when.amountEquals != null) out.push(numberCondition('amount', 'equal', when.amountEquals));\n if (when.amountGreaterThan != null) {\n out.push(numberCondition('amount', 'greater_than', when.amountGreaterThan));\n }\n if (when.amountLessThan != null) {\n out.push(numberCondition('amount', 'less_than', when.amountLessThan));\n }\n if (when.merchantVolumeEquals != null) {\n out.push(numberCondition('merchant_volume', 'equal', when.merchantVolumeEquals));\n }\n if (when.merchantVolumeGreaterThan != null) {\n out.push(numberCondition('merchant_volume', 'greater_than', when.merchantVolumeGreaterThan));\n }\n if (when.merchantVolumeLessThan != null) {\n out.push(numberCondition('merchant_volume', 'less_than', when.merchantVolumeLessThan));\n }\n out.push(...raw);\n return out;\n}\n\nfunction leafToComparison(node: LeafNode): EuclidComparison {\n return { lhs: node.lhs, comparison: node.comparison, value: node.value, metadata: {} };\n}\n\n/**\n * Flatten associativity (nested all-in-all / any-in-any) and collapse\n * single-child groups, so every group child of an `all` is an `any`.\n * @internal\n */\nexport function normalizeNode(node: ConditionNode): ConditionNode {\n if (node.kind === 'leaf') return node;\n const children = node.children.map(normalizeNode);\n const flat: ConditionNode[] = [];\n for (const c of children) {\n if (c.kind === node.kind) flat.push(...c.children);\n else flat.push(c);\n }\n if (flat.length === 1) return flat[0];\n return { kind: node.kind, children: flat };\n}\n\nfunction toStatement(node: ConditionNode): EuclidIfStatement {\n if (node.kind === 'leaf') return { condition: [leafToComparison(node)], nested: null };\n // Unreachable via current callers (encodeStatements strips top-level any); kept for totality.\n if (node.kind === 'any') {\n return { condition: [], nested: node.children.map(toStatement) };\n }\n // 'all': after normalize, group children are all 'any'.\n const leaves = node.children.filter((c): c is LeafNode => c.kind === 'leaf');\n const groups = node.children.filter((c): c is GroupNode => c.kind !== 'leaf');\n const condition = leaves.map(leafToComparison);\n if (groups.length === 0) return { condition, nested: null };\n const [first, ...rest] = groups;\n // `first` is an OR; AND each of its branches with the remaining OR groups.\n const nested = first.children.map((branch) => toStatement(normalizeNode(allOf(branch, ...rest))));\n return { condition, nested };\n}\n\nfunction assertNoEmptyAnyOf(node: ConditionNode): void {\n if (node.kind === 'leaf') return;\n if (node.kind === 'any' && node.children.length === 0) {\n throw new Error('feeProgram: an anyOf() group must have at least one condition');\n }\n node.children.forEach(assertNoEmptyAnyOf);\n}\n\n/**\n * Encode a rule's match (a condition tree) into the engine's `statements[]`.\n * A top-level OR spreads across statements; anything else is a single statement.\n * @internal\n */\nexport function encodeStatements(match: ConditionNode): EuclidIfStatement[] {\n const m = normalizeNode(match);\n if (m.kind === 'any') return m.children.map(toStatement);\n return [toStatement(m)];\n}\n\nfunction comparisonToLeaf(c: EuclidComparison): LeafNode {\n return { kind: 'leaf', lhs: c.lhs, comparison: c.comparison, value: c.value };\n}\n\nfunction statementToNode(stmt: EuclidIfStatement): ConditionNode {\n const leaves = stmt.condition.map(comparisonToLeaf);\n if (stmt.nested && stmt.nested.length > 0) {\n const orNode = anyOf(...stmt.nested.map(statementToNode));\n if (leaves.length === 0) return orNode;\n return allOf(...leaves, orNode);\n }\n return leaves.length === 1 ? leaves[0] : allOf(...leaves);\n}\n\n/**\n * Decode a rule's `statements[]` back into a condition tree.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function ruleMatchToTree(statements: EuclidIfStatement[]): ConditionNode {\n if (statements.length === 1) return normalizeNode(statementToNode(statements[0]));\n return normalizeNode(anyOf(...statements.map(statementToNode)));\n}\n\n/**\n * Decode a stored program into the builder's editable model.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function programToTree(program: PlatformFeeProgram): {\n rules: {\n name: string;\n match: ConditionNode;\n fee: PlatformFeeOutput | null;\n schedule: RuleSchedule | null;\n }[];\n otherwise: PlatformFeeOutput | null;\n} {\n return {\n rules: program.rules.map((r) => ({\n name: r.name,\n match: ruleMatchToTree(r.statements),\n fee: r.connectorSelection.fee ?? null,\n schedule: r.connectorSelection.schedule ?? null,\n })),\n otherwise: program.defaultSelection.fee ?? null,\n };\n}\n\n/**\n * Fluent builder for a platform fee-rule program. Emits the exact Euclid wire\n * shape (camelCase tree, tagged values, `metadata: {}` everywhere) so callers\n * never hand-write the AST. Rules are evaluated in order; the first match wins,\n * else `otherwise` (the default selection).\n *\n * @example\n * ```ts\n * const algorithm = feeProgram()\n * .rule({ name: 'crypto', when: { paymentMethod: 'crypto' }, fee: { percentage: 1.0 } })\n * .rule({\n * name: 'card_on_cryptomus',\n * when: { paymentMethod: 'card', connector: 'cryptomus' },\n * fee: { percentage: 2.0 },\n * })\n * .otherwise({ percentage: 3.0 })\n * .build();\n *\n * await delopay.fees.rules.upsert({ algorithm }, merchantId);\n * ```\n */\nexport class FeeProgramBuilder {\n private readonly rules: PlatformFeeRule[] = [];\n private defaultFee: PlatformFeeOutput | null = null;\n\n /** Append a rule. Provided `when`/`rawConditions` are ANDed. */\n rule(input: FeeRuleInput): this {\n if (input.match) assertNoEmptyAnyOf(input.match);\n const statements: PlatformFeeRule['statements'] = input.match\n ? encodeStatements(input.match)\n : [{ condition: buildConditions(input.when, input.rawConditions) }];\n const connectorSelection: PlatformFeeRule['connectorSelection'] = {\n fee: toFeeOutput(input.fee),\n };\n if (input.schedule !== undefined) connectorSelection.schedule = input.schedule;\n this.rules.push({ name: input.name, connectorSelection, statements });\n return this;\n }\n\n /** Set the default selection (applied when no rule matches). */\n otherwise(fee: FeeSpecInput): this {\n this.defaultFee = toFeeOutput(fee);\n return this;\n }\n\n /** Produce the wire-ready program. */\n build(): PlatformFeeProgram {\n return {\n defaultSelection: { fee: this.defaultFee },\n rules: this.rules,\n metadata: {},\n };\n }\n}\n\n/** Start building a platform fee-rule program. See {@link FeeProgramBuilder}. */\nexport function feeProgram(): FeeProgramBuilder {\n return new FeeProgramBuilder();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-EXPWQBI3.cjs","../src/resources/files.ts"],"names":[],"mappings":"AAAA;ACEO,IAAM,MAAA,EAAN,MAAY;AAAA,EACjB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,MAAA,CAAO,MAAA,EAAmE;AAC9E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,QAAA,EAAU,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxD;AAAA;AAAA,EAGA,MAAM,QAAA,CAAS,MAAA,EAAkD;AAC/D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,OAAA,EAAU,kBAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AACjE,EAAA;AAAA;AAG+D,EAAA;AACF,IAAA;AAC7D,EAAA;AACF;ADDoE;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-EXPWQBI3.cjs","sourcesContent":[null,"import type { RequestFn } from '../client';\n\nexport class Files {\n constructor(private readonly request: RequestFn) {}\n\n /** Upload a file. `POST /files` */\n async create(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/files', { body: params });\n }\n\n /** Retrieve/download a file. `GET /files/{fileId}` */\n async retrieve(fileId: string): Promise<Record<string, unknown>> {\n return this.request('GET', `/files/${encodeURIComponent(fileId)}`);\n }\n\n /** Delete a file. `DELETE /files/{fileId}` */\n async delete(fileId: string): Promise<Record<string, unknown>> {\n return this.request('DELETE', `/files/${encodeURIComponent(fileId)}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-EYHSXJMJ.cjs","../src/resources/persons.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACwCO,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,EAOlD,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EYHSXJMJ.cjs","sourcesContent":[null,"import type {\n MerchantFlaggedPersonList,\n MerchantFlaggedPersonListParams,\n MerchantPersonFlagCreate,\n MerchantPersonFlagList,\n MerchantPersonFlagUpdate,\n MerchantPersonFlagView,\n PaymentPersonResponse,\n PersonListParams,\n PersonListResponse,\n PersonResponse,\n PersonScopeParams,\n RelatedPersonsResponse,\n} from '../types';\nimport type { RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\ntype Query = Record<string, string | number | boolean | null | undefined>;\n\n/**\n * Persons: the payments of one merchant that belong to the same person,\n * joined by a shared customer id, email, device id or card. Two payments\n * that share one of them are one person, also through a chain of payments.\n * An IP address is shown and never joins. An identifier seen with too many\n * different persons is marked `common` and joins nothing.\n *\n * A payment gets its person a few minutes after it was created or changed;\n * until then it has none. When two persons turn out to be one, the older\n * `person_id` stays and the other id keeps resolving to it.\n *\n * Every route takes an API key or a dashboard session. A full secret key\n * reads; a restricted key needs the `persons_view` permission group; a\n * dashboard session needs the persons permission in its role. A credential\n * bound to one shop reads that shop's persons, with every figure counted\n * there. A caller that sees only part of a shop's payments is refused with\n * `403`.\n *\n * The merchant's own flags on its persons (`listFlags`, `flag`, `updateFlag`,\n * `removeFlag`, `listFlagged`) take a dashboard session only, never an API\n * key. Reading them needs the persons permission; setting, changing and\n * removing them needs the persons manage permission. A flag marks a person as\n * suspicious for the merchant's own team: it changes no payment, and no other\n * merchant sees it.\n */\nexport class Persons {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * One page of persons, by default the most recent payment first, with the\n * number of persons the request matches.\n * `GET /persons`\n */\n async list(params?: PersonListParams): Promise<PersonListResponse> {\n return this.request('GET', '/persons', {\n query: csvQuery(params, ['buyer_risk_band', 'industry']),\n });\n }\n\n /**\n * One person: its figures, the identifiers and IP addresses its payments\n * carry, and its payments by status, shop, payment method, risk band and\n * environment. The id of a person that was merged into another returns\n * that person, with `merged_from` naming the id asked for. A person with\n * no payment in the scope is not found (`404`).\n * `GET /persons/{person_id}`\n */\n async retrieve(personId: string, params?: PersonScopeParams): Promise<PersonResponse> {\n return this.request('GET', `/persons/${encodeURIComponent(personId)}`, {\n query: params as Query | undefined,\n });\n }\n\n /**\n * Other persons of the merchant that may be the same person, the likeliest\n * first, at most 20. An estimate from the devices the persons paid with;\n * related persons stay separate persons.\n * `GET /persons/{person_id}/related`\n */\n async related(personId: string, params?: PersonScopeParams): Promise<RelatedPersonsResponse> {\n return this.request('GET', `/persons/${encodeURIComponent(personId)}/related`, {\n query: params as Query | undefined,\n });\n }\n\n /**\n * The person of one payment, with how many payments the person has and\n * which kinds of identifier tie this payment to the others. `404` while\n * the payment has no person yet.\n * `GET /persons/payment/{payment_id}`\n */\n async ofPayment(paymentId: string, params?: PersonScopeParams): Promise<PaymentPersonResponse> {\n return this.request('GET', `/persons/payment/${encodeURIComponent(paymentId)}`, {\n query: params as Query | undefined,\n });\n }\n\n /**\n * Every flag the merchant's team set on the person, active and removed,\n * newest first, with those of the persons merged into it. A merged person\n * reads as the person it merged into. A person with no payment in the\n * scope, or another merchant's, is not found (`404`).\n * `GET /persons/{person_id}/flags`\n */\n async listFlags(personId: string, params?: PersonScopeParams): Promise<MerchantPersonFlagList> {\n return this.request('GET', `/persons/${encodeURIComponent(personId)}/flags`, {\n query: params as Query | undefined,\n });\n }\n\n /**\n * Flags the person for the merchant's team, with a reason and an optional\n * note. A merged person's flag goes on the person it merged into. A person\n * already flagged is refused with `IR_38` (400).\n * `POST /persons/{person_id}/flags`\n */\n async flag(\n personId: string,\n body: MerchantPersonFlagCreate,\n params?: PersonScopeParams,\n ): Promise<MerchantPersonFlagView> {\n return this.request('POST', `/persons/${encodeURIComponent(personId)}/flags`, {\n body,\n query: params as Query | undefined,\n });\n }\n\n /**\n * Replaces an active flag's reason and note at the `version` read. A\n * colleague's newer change, or a removal, since that read is refused with\n * `IR_16` (400) rather than overwritten.\n * `PUT /persons/{person_id}/flags/{flag_id}`\n */\n async updateFlag(\n personId: string,\n flagId: string,\n body: MerchantPersonFlagUpdate,\n params?: PersonScopeParams,\n ): Promise<MerchantPersonFlagView> {\n return this.request(\n 'PUT',\n `/persons/${encodeURIComponent(personId)}/flags/${encodeURIComponent(flagId)}`,\n { body, query: params as Query | undefined },\n );\n }\n\n /**\n * Removes a flag at the `version` read: the flag stops and stays in the\n * history with who removed it and when, which is what this answers. A\n * colleague's change since that read is refused with `IR_16` (400).\n * `DELETE /persons/{person_id}/flags/{flag_id}?version=`\n */\n async removeFlag(\n personId: string,\n flagId: string,\n version: number,\n params?: PersonScopeParams,\n ): Promise<MerchantPersonFlagView> {\n return this.request(\n 'DELETE',\n `/persons/${encodeURIComponent(personId)}/flags/${encodeURIComponent(flagId)}`,\n { query: { ...(params as Query | undefined), version } },\n );\n }\n\n /**\n * One page of the persons in scope with an active flag of the merchant,\n * each once with its newest active flag, newest flag first, and how many\n * there are over every page. A `limit` outside 1 to 100 is a `400`.\n * `GET /persons/flagged`\n */\n async listFlagged(params?: MerchantFlaggedPersonListParams): Promise<MerchantFlaggedPersonList> {\n return this.request('GET', '/persons/flagged', { query: params as Query | undefined });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-F3I5DOWV.cjs","../src/resources/poll.ts"],"names":[],"mappings":"AAAA;ACGO,IAAM,KAAA,EAAN,MAAW;AAAA,EAChB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA,EAElD,MAAM,SAAA,CAAU,MAAA,EAA6C;AAC3D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,aAAA,EAAgB,kBAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AACvE,EAAA;AACF;ADA0E;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-F3I5DOWV.cjs","sourcesContent":[null,"import type { PollStatusResponse } from '../types';\nimport type { RequestFn } from '../client';\n\nexport class Poll {\n constructor(private readonly request: RequestFn) {}\n\n async getStatus(pollId: string): Promise<PollStatusResponse> {\n return this.request('GET', `/poll/status/${encodeURIComponent(pollId)}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-F46K5H3U.cjs","../src/internal/resources/adminNotices.ts"],"names":[],"mappings":"AAAA;ACcA,IAAM,KAAA,EAAO,uBAAA;AACb,IAAM,KAAA,EAAO,CAAC,QAAA,EAAA,GAA6B,CAAA,EAAA;AASjB;AACyB,EAAA;AAApB,IAAA;AAAqB,EAAA;AAAA;AAGF,EAAA;AAC1B,IAAA;AACtB,EAAA;AAAA;AAGgF,EAAA;AAC1D,IAAA;AACtB,EAAA;AAAA;AAG0E,EAAA;AACpD,IAAA;AACtB,EAAA;AAAA;AAG2E,EAAA;AACrD,IAAA;AACtB,EAAA;AAAA;AAGe,EAAA;AACO,IAAA;AACtB,EAAA;AAAA;AAG+B,EAAA;AACT,IAAA;AACtB,EAAA;AAAA;AAGiB,EAAA;AACK,IAAA;AACtB,EAAA;AAAA;AAG+B,EAAA;AACT,IAAA;AACtB,EAAA;AAAA;AAGe,EAAA;AACO,IAAA;AACtB,EAAA;AAAA;AAGgC,EAAA;AACV,IAAA;AACtB,EAAA;AAAA;AAG+B,EAAA;AACT,IAAA;AACtB,EAAA;AAAA;AAGsB,EAAA;AACA,IAAA;AACC,MAAA;AACpB,IAAA;AACH,EAAA;AACF;AD9B0B;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-F46K5H3U.cjs","sourcesContent":[null,"import type { RequestFn } from '../../client';\nimport type { NoticeList, NoticeListParams } from '../../types';\nimport type {\n PlatformNotice,\n PlatformNoticeAudience,\n PlatformNoticeCreateParams,\n PlatformNoticeDetail,\n PlatformNoticeList,\n PlatformNoticeListParams,\n PlatformNoticeOptions,\n PlatformNoticePreview,\n PlatformNoticeUpdateParams,\n} from '../types';\n\nconst BASE = '/admin-portal/notices';\nconst path = (noticeId: string): string => `${BASE}/${encodeURIComponent(noticeId)}`;\n\n/**\n * Notices staff send to the people of merchants and to colleagues. What the\n * caller may send follows their staff actions; an employee limited to\n * selected merchants reaches only those. A notice to every merchant can wait\n * for a second member of staff (`pending_approval`), never its author or\n * whoever last changed it, for 72 hours.\n */\nexport class AdminNotices {\n constructor(private readonly request: RequestFn) {}\n\n /** What the caller may send, and the staff roles, colleagues and merchant roles. `GET /admin-portal/notices/options` */\n async options(): Promise<PlatformNoticeOptions> {\n return this.request('GET', `${BASE}/options`);\n }\n\n /** How many people, at how many merchants, an audience reaches right now. `POST /admin-portal/notices/preview` */\n async preview(audience: PlatformNoticeAudience): Promise<PlatformNoticePreview> {\n return this.request('POST', `${BASE}/preview`, { body: { audience } });\n }\n\n /** Send now, at `send_at`, or keep as a draft; or wait for approval. `POST /admin-portal/notices` */\n async create(params: PlatformNoticeCreateParams): Promise<PlatformNotice> {\n return this.request('POST', BASE, { body: params });\n }\n\n /** What staff sent, newest first: sent and withdrawn by default. `GET /admin-portal/notices` */\n async list(params?: PlatformNoticeListParams): Promise<PlatformNoticeList> {\n return this.request('GET', BASE, { query: { ...params } });\n }\n\n /** One notice with its recipients and their merchant. `GET /admin-portal/notices/{noticeId}` */\n async retrieve(noticeId: string): Promise<PlatformNoticeDetail> {\n return this.request('GET', path(noticeId));\n }\n\n /** Change a notice not sent yet, at the version read. `PUT /admin-portal/notices/{noticeId}` */\n async update(noticeId: string, params: PlatformNoticeUpdateParams): Promise<PlatformNotice> {\n return this.request('PUT', path(noticeId), { body: params });\n }\n\n /** Send a draft or a scheduled notice now. `POST /admin-portal/notices/{noticeId}/send` */\n async sendStored(noticeId: string, version: number): Promise<PlatformNotice> {\n return this.request('POST', `${path(noticeId)}/send`, { body: { version } });\n }\n\n /** Delete a notice not sent yet. `DELETE /admin-portal/notices/{noticeId}` */\n async delete(noticeId: string, version: number): Promise<PlatformNotice> {\n return this.request('DELETE', path(noticeId), { query: { version } });\n }\n\n /** Take a sent notice back from everyone it reached. `POST /admin-portal/notices/{noticeId}/withdraw` */\n async withdraw(noticeId: string): Promise<PlatformNoticeDetail> {\n return this.request('POST', `${path(noticeId)}/withdraw`);\n }\n\n /** Approve a notice to every merchant another member of staff wrote. `POST /admin-portal/notices/{noticeId}/approve` */\n async approve(noticeId: string, version: number): Promise<PlatformNoticeDetail> {\n return this.request('POST', `${path(noticeId)}/approve`, { body: { version } });\n }\n\n /** Refuse a notice to every merchant, saying why. `POST /admin-portal/notices/{noticeId}/refuse` */\n async refuse(noticeId: string, version: number, note: string): Promise<PlatformNoticeDetail> {\n return this.request('POST', `${path(noticeId)}/refuse`, { body: { version, note } });\n }\n\n /** The notices one merchant's people sent each other, read-only. `GET /admin-portal/notices/merchants/{merchantId}` */\n async merchantNotices(merchantId: string, params?: NoticeListParams): Promise<NoticeList> {\n return this.request('GET', `${BASE}/merchants/${encodeURIComponent(merchantId)}`, {\n query: { ...params },\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/dist/chunk-F6QJB4XP.cjs","../src/resources/billing.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACyBA,IAAM,mBAAA,EAAN,MAAyB;AAAA,EACvB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD,MAAM,UAAA,CACJ,UAAA,EACA,MAAA,EACqC;AACrC,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,MAAA;AAAA,MACA,CAAA,SAAA,EAAY,kBAAA,CAAmB,UAAU,CAAC,CAAA,wBAAA,CAAA;AAAA,MAC1C,EAAE,IAAA,EAAM,OA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;AAAA;AAAA;AAAA,EAAA;AAUE,IAAA;AAAgF,MAAA;AACxE,IAAA;AACP,EAAA;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAYE,IAAA;AAAgF,MAAA;AACxC,IAAA;AACvC,EAAA;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAgBE,IAAA;AAAwF,MAAA;AAC/E,IAAA;AACR,EAAA;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAgBE,IAAA;AAAoF,MAAA;AAC3E,IAAA;AACR,EAAA;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAiBE,IAAA;AAA0F,MAAA;AACjF,IAAA;AACR,EAAA;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAcE,IAAA;AAAyF,MAAA;AACjF,MAAA;AACH,IAAA;AACJ,EAAA;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAWE,IAAA;AAA+E,EAAA;AACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAgBE,IAAA;AAAY,MAAA;AACV,MAAA;AAC4F,IAAA;AAC9F,EAAA;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAcE,IAAA;AAAmF,MAAA;AAC1E,IAAA;AACR,EAAA;AAEL;AD1EA;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-F6QJB4XP.cjs","sourcesContent":[null,"import type {\n BillingProfileResponse,\n BillingSetupRequest,\n BillingSetupResponse,\n BillingCompleteSetupRequest,\n TopupRequest,\n TopupResponse,\n LedgerResponse,\n LedgerListParams,\n BlockedAttemptListResponse,\n BlockedAttemptListParams,\n AutoRechargeUpdateRequest,\n AllocationTransferRequest,\n AllocationTransferResponse,\n AllocationListResponse,\n AllocationResponse,\n ServiceUsageListParams,\n ServiceUsageListResponse,\n MerchantPricingViewResponse,\n AcceptPricingChangeResponse,\n BillingStatementParams,\n BillingStatementResponse,\n EventFeeListParams,\n EventFeeListResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/** Manage per-shop prepaid balance allocations transferred from the host merchant treasury. */\nclass BillingAllocations {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Transfer funds from the host merchant treasury into a shop's allocation.\n *\n * @param merchantId - The host merchant account ID.\n * @param params - Transfer details (amount, target profile/shop ID).\n * @returns The allocation transfer result.\n */\n async transferIn(\n merchantId: string,\n params: AllocationTransferRequest,\n ): Promise<AllocationTransferResponse> {\n return this.request(\n 'POST',\n `/billing/${encodeURIComponent(merchantId)}/allocations/transfer-in`,\n { body: params },\n );\n }\n\n /**\n * Transfer funds from a shop's allocation back to the host merchant treasury.\n *\n * @param merchantId - The host merchant account ID.\n * @param params - Transfer details (amount, source profile/shop ID).\n * @returns The allocation transfer result.\n */\n async transferOut(\n merchantId: string,\n params: AllocationTransferRequest,\n ): Promise<AllocationTransferResponse> {\n return this.request(\n 'POST',\n `/billing/${encodeURIComponent(merchantId)}/allocations/transfer-out`,\n {\n body: params,\n },\n );\n }\n\n /**\n * List all shop balance allocations for a merchant.\n *\n * @param merchantId - The merchant account ID.\n * @returns List of shop allocations.\n */\n async list(merchantId: string): Promise<AllocationListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/allocations`);\n }\n\n /**\n * Get the balance allocation for a specific shop.\n *\n * @param merchantId - The merchant account ID.\n * @param profileId - The shop (business profile) ID.\n * @returns The shop's balance allocation.\n */\n async get(merchantId: string, profileId: string): Promise<AllocationResponse> {\n return this.request(\n 'GET',\n `/billing/${encodeURIComponent(merchantId)}/allocations/${encodeURIComponent(profileId)}`,\n );\n }\n}\n\n/**\n * Manage prepaid billing balances — top-ups, card setup, auto-recharge, and the balance ledger.\n *\n * Delopay deducts a platform fee from the merchant's prepaid balance on every successful payment.\n * Use these endpoints to fund and monitor that balance.\n */\nexport class Billing {\n /** Per-shop balance allocation management for host merchants. */\n readonly allocations: BillingAllocations;\n\n constructor(private readonly request: RequestFn) {\n this.allocations = new BillingAllocations(request);\n }\n\n /**\n * Retrieve a merchant's billing profile (balance, status, auto-recharge config).\n *\n * @param merchantId - The merchant account ID.\n * @returns The billing profile.\n *\n * @example\n * ```typescript\n * const profile = await delopay.billing.getProfile('merch_123');\n * console.log(profile.balance, profile.status);\n * ```\n */\n async getProfile(merchantId: string): Promise<BillingProfileResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}`);\n }\n\n /**\n * Start a Stripe SetupIntent flow to collect a payment card for auto-recharge.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional setup parameters.\n * @returns The Stripe client secret needed to render the card element.\n */\n async setup(merchantId: string, params?: BillingSetupRequest): Promise<BillingSetupResponse> {\n return this.request('POST', `/billing/${encodeURIComponent(merchantId)}/setup`, {\n body: params,\n });\n }\n\n /**\n * Confirm card setup after the Stripe SetupIntent completes on the frontend.\n *\n * @param merchantId - The merchant account ID.\n * @param params - The Stripe SetupIntent ID to confirm.\n * @returns The updated billing profile.\n */\n async completeSetup(\n merchantId: string,\n params: BillingCompleteSetupRequest,\n ): Promise<BillingProfileResponse> {\n return this.request('POST', `/billing/${encodeURIComponent(merchantId)}/setup/complete`, {\n body: params,\n });\n }\n\n /**\n * Manually top up a merchant's prepaid balance by charging their saved card.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Top-up amount and currency.\n * @returns The top-up result.\n */\n async topup(merchantId: string, params: TopupRequest): Promise<TopupResponse> {\n return this.request('POST', `/billing/${encodeURIComponent(merchantId)}/topup`, {\n body: params,\n });\n }\n\n /**\n * List the balance ledger (credits and debits) for a merchant, the newest\n * entry first unless `sort_by` says otherwise.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional pagination, filters (entry types, a creation\n * window) and sort.\n * @returns The ledger entries.\n */\n async listLedger(merchantId: string, params?: LedgerListParams): Promise<LedgerResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/ledger`, {\n query: csvQuery(params, ['entry_type']),\n });\n }\n\n /**\n * List recorded third-party service uses for a merchant with separate\n * provider cost, platform fee markup, and charged total in the merchant's\n * billing currency.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional shop, service type, provider, charge status,\n * test-mode, date window, and pagination filters.\n * @returns Paginated service usage records.\n */\n async listServiceUsages(\n merchantId: string,\n params?: ServiceUsageListParams,\n ): Promise<ServiceUsageListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/service-usages`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * List recorded platform event fees (disputes, refunds, declined attempts,\n * 3-D Secure attempts, currency conversion markups, international card\n * surcharges, and payouts) for a merchant.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional shop, event fee type, entity ID, charge status,\n * test-mode, date window, and pagination filters.\n * @returns Paginated platform event fee records.\n */\n async listEventFees(\n merchantId: string,\n params?: EventFeeListParams,\n ): Promise<EventFeeListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/event-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * List payment attempts that were blocked by the billing suspension gate\n * (account suspended, setup incomplete, or shop allocation suspended).\n *\n * These attempts never created a payment, so they do not appear in the\n * payments list — this is the only way to retrieve them.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional filters (profile, reason, date range) and pagination.\n * @returns The blocked-attempt entries with a total count.\n */\n async listBlockedAttempts(\n merchantId: string,\n params?: BlockedAttemptListParams,\n ): Promise<BlockedAttemptListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/blocked-attempts`, {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /**\n * Update auto-recharge configuration (threshold, top-up amount, enabled flag).\n *\n * @param merchantId - The merchant account ID.\n * @param params - Auto-recharge settings to update.\n * @returns The updated billing profile.\n */\n async updateAutoRecharge(\n merchantId: string,\n params: AutoRechargeUpdateRequest,\n options?: RequestExtras,\n ): Promise<BillingProfileResponse> {\n return this.request('PATCH', `/billing/${encodeURIComponent(merchantId)}/auto-recharge`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Retrieve the merchant-facing Pricing page payload: effective merchant baseline\n * prices, project and shop exceptions side by side with the merchant baseline,\n * upcoming scheduled or pending-acceptance price changes, and recorded acceptances.\n *\n * @param merchantId - The merchant account ID.\n * @returns The merchant pricing view.\n */\n async getPricing(merchantId: string): Promise<MerchantPricingViewResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/pricing`);\n }\n\n /**\n * Record the merchant's acceptance of a pending price change.\n *\n * Must be called directly by an authorized merchant user (staff support-switch\n * and act-as sessions are refused with `403`).\n *\n * @param merchantId - The merchant account ID.\n * @param versionId - The pending pricing version ID to accept.\n * @returns The immutable acceptance record and whether the price took effect immediately.\n */\n async acceptPricingChange(\n merchantId: string,\n versionId: string,\n ): Promise<AcceptPricingChangeResponse> {\n return this.request(\n 'POST',\n `/billing/${encodeURIComponent(merchantId)}/pricing/versions/${encodeURIComponent(versionId)}/accept`,\n );\n }\n\n /**\n * Retrieve a monthly platform billing statement grouped by fee type so the groups\n * reconcile to the total platform fees of the period.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional UTC calendar month (`YYYY-MM`) and shop (`profile_id`) filter.\n * @returns The per-currency grouped monthly statement.\n */\n async getStatement(\n merchantId: string,\n params?: BillingStatementParams,\n ): Promise<BillingStatementResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/statement`, {\n query: params as Record<string, string | undefined>,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-F6QJB4XP.cjs","../src/resources/billing.ts"],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AA;AAAA;AAAA;AAAA,EAAA;AAgBE,IAAA;AAAY,MAAA;AACV,MAAA;AAC4F,IAAA;AAC9F,EAAA;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAcE,IAAA;AAAmF,MAAA;AAC1E,IAAA;AACR,EAAA;AAEL;AD1EA;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-F6QJB4XP.cjs","sourcesContent":[null,"import type {\n BillingProfileResponse,\n BillingSetupRequest,\n BillingSetupResponse,\n BillingCompleteSetupRequest,\n TopupRequest,\n TopupResponse,\n LedgerResponse,\n LedgerListParams,\n BlockedAttemptListResponse,\n BlockedAttemptListParams,\n AutoRechargeUpdateRequest,\n AllocationTransferRequest,\n AllocationTransferResponse,\n AllocationListResponse,\n AllocationResponse,\n ServiceUsageListParams,\n ServiceUsageListResponse,\n MerchantPricingViewResponse,\n AcceptPricingChangeResponse,\n BillingStatementParams,\n BillingStatementResponse,\n EventFeeListParams,\n EventFeeListResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/** Manage per-shop prepaid balance allocations transferred from the host merchant treasury. */\nclass BillingAllocations {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Transfer funds from the host merchant treasury into a shop's allocation.\n *\n * @param merchantId - The host merchant account ID.\n * @param params - Transfer details (amount, target profile/shop ID).\n * @returns The allocation transfer result.\n */\n async transferIn(\n merchantId: string,\n params: AllocationTransferRequest,\n ): Promise<AllocationTransferResponse> {\n return this.request(\n 'POST',\n `/billing/${encodeURIComponent(merchantId)}/allocations/transfer-in`,\n { body: params },\n );\n }\n\n /**\n * Transfer funds from a shop's allocation back to the host merchant treasury.\n *\n * @param merchantId - The host merchant account ID.\n * @param params - Transfer details (amount, source profile/shop ID).\n * @returns The allocation transfer result.\n */\n async transferOut(\n merchantId: string,\n params: AllocationTransferRequest,\n ): Promise<AllocationTransferResponse> {\n return this.request(\n 'POST',\n `/billing/${encodeURIComponent(merchantId)}/allocations/transfer-out`,\n {\n body: params,\n },\n );\n }\n\n /**\n * List all shop balance allocations for a merchant.\n *\n * @param merchantId - The merchant account ID.\n * @returns List of shop allocations.\n */\n async list(merchantId: string): Promise<AllocationListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/allocations`);\n }\n\n /**\n * Get the balance allocation for a specific shop.\n *\n * @param merchantId - The merchant account ID.\n * @param profileId - The shop (business profile) ID.\n * @returns The shop's balance allocation.\n */\n async get(merchantId: string, profileId: string): Promise<AllocationResponse> {\n return this.request(\n 'GET',\n `/billing/${encodeURIComponent(merchantId)}/allocations/${encodeURIComponent(profileId)}`,\n );\n }\n}\n\n/**\n * Manage prepaid billing balances — top-ups, card setup, auto-recharge, and the balance ledger.\n *\n * Delopay deducts a platform fee from the merchant's prepaid balance on every successful payment.\n * Use these endpoints to fund and monitor that balance.\n */\nexport class Billing {\n /** Per-shop balance allocation management for host merchants. */\n readonly allocations: BillingAllocations;\n\n constructor(private readonly request: RequestFn) {\n this.allocations = new BillingAllocations(request);\n }\n\n /**\n * Retrieve a merchant's billing profile (balance, status, auto-recharge config).\n *\n * @param merchantId - The merchant account ID.\n * @returns The billing profile.\n *\n * @example\n * ```typescript\n * const profile = await delopay.billing.getProfile('merch_123');\n * console.log(profile.balance, profile.status);\n * ```\n */\n async getProfile(merchantId: string): Promise<BillingProfileResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}`);\n }\n\n /**\n * Start a Stripe SetupIntent flow to collect a payment card for auto-recharge.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional setup parameters.\n * @returns The Stripe client secret needed to render the card element.\n */\n async setup(merchantId: string, params?: BillingSetupRequest): Promise<BillingSetupResponse> {\n return this.request('POST', `/billing/${encodeURIComponent(merchantId)}/setup`, {\n body: params,\n });\n }\n\n /**\n * Confirm card setup after the Stripe SetupIntent completes on the frontend.\n *\n * @param merchantId - The merchant account ID.\n * @param params - The Stripe SetupIntent ID to confirm.\n * @returns The updated billing profile.\n */\n async completeSetup(\n merchantId: string,\n params: BillingCompleteSetupRequest,\n ): Promise<BillingProfileResponse> {\n return this.request('POST', `/billing/${encodeURIComponent(merchantId)}/setup/complete`, {\n body: params,\n });\n }\n\n /**\n * Manually top up a merchant's prepaid balance by charging their saved card.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Top-up amount and currency.\n * @returns The top-up result.\n */\n async topup(merchantId: string, params: TopupRequest): Promise<TopupResponse> {\n return this.request('POST', `/billing/${encodeURIComponent(merchantId)}/topup`, {\n body: params,\n });\n }\n\n /**\n * List the balance ledger (credits and debits) for a merchant, the newest\n * entry first unless `sort_by` says otherwise.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional pagination, filters (entry types, a creation\n * window) and sort.\n * @returns The ledger entries.\n */\n async listLedger(merchantId: string, params?: LedgerListParams): Promise<LedgerResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/ledger`, {\n query: csvQuery(params, ['entry_type']),\n });\n }\n\n /**\n * List recorded third-party service uses for a merchant with separate\n * provider cost, platform fee markup, and charged total in the merchant's\n * billing currency.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional shop, service type, provider, charge status,\n * test-mode, date window, and pagination filters.\n * @returns Paginated service usage records.\n */\n async listServiceUsages(\n merchantId: string,\n params?: ServiceUsageListParams,\n ): Promise<ServiceUsageListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/service-usages`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * List recorded platform event fees (disputes, refunds, declined attempts,\n * 3-D Secure attempts, currency conversion markups, international card\n * surcharges, and payouts) for a merchant.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional shop, event fee type, entity ID, charge status,\n * test-mode, date window, and pagination filters.\n * @returns Paginated platform event fee records.\n */\n async listEventFees(\n merchantId: string,\n params?: EventFeeListParams,\n ): Promise<EventFeeListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/event-fees`, {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * List payment attempts that were blocked by the billing suspension gate\n * (account suspended, setup incomplete, or shop allocation suspended).\n *\n * These attempts never created a payment, so they do not appear in the\n * payments list — this is the only way to retrieve them.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional filters (profile, reason, date range) and pagination.\n * @returns The blocked-attempt entries with a total count.\n */\n async listBlockedAttempts(\n merchantId: string,\n params?: BlockedAttemptListParams,\n ): Promise<BlockedAttemptListResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/blocked-attempts`, {\n query: params as Record<string, string | number | undefined>,\n });\n }\n\n /**\n * Update auto-recharge configuration (threshold, top-up amount, enabled flag).\n *\n * @param merchantId - The merchant account ID.\n * @param params - Auto-recharge settings to update.\n * @returns The updated billing profile.\n */\n async updateAutoRecharge(\n merchantId: string,\n params: AutoRechargeUpdateRequest,\n options?: RequestExtras,\n ): Promise<BillingProfileResponse> {\n return this.request('PATCH', `/billing/${encodeURIComponent(merchantId)}/auto-recharge`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Retrieve the merchant-facing Pricing page payload: effective merchant baseline\n * prices, project and shop exceptions side by side with the merchant baseline,\n * upcoming scheduled or pending-acceptance price changes, and recorded acceptances.\n *\n * @param merchantId - The merchant account ID.\n * @returns The merchant pricing view.\n */\n async getPricing(merchantId: string): Promise<MerchantPricingViewResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/pricing`);\n }\n\n /**\n * Record the merchant's acceptance of a pending price change.\n *\n * Must be called directly by an authorized merchant user (staff support-switch\n * and act-as sessions are refused with `403`).\n *\n * @param merchantId - The merchant account ID.\n * @param versionId - The pending pricing version ID to accept.\n * @returns The immutable acceptance record and whether the price took effect immediately.\n */\n async acceptPricingChange(\n merchantId: string,\n versionId: string,\n ): Promise<AcceptPricingChangeResponse> {\n return this.request(\n 'POST',\n `/billing/${encodeURIComponent(merchantId)}/pricing/versions/${encodeURIComponent(versionId)}/accept`,\n );\n }\n\n /**\n * Retrieve a monthly platform billing statement grouped by fee type so the groups\n * reconcile to the total platform fees of the period.\n *\n * @param merchantId - The merchant account ID.\n * @param params - Optional UTC calendar month (`YYYY-MM`) and shop (`profile_id`) filter.\n * @returns The per-currency grouped monthly statement.\n */\n async getStatement(\n merchantId: string,\n params?: BillingStatementParams,\n ): Promise<BillingStatementResponse> {\n return this.request('GET', `/billing/${encodeURIComponent(merchantId)}/statement`, {\n query: params as Record<string, string | undefined>,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-F6S3WCCB.cjs","../src/resources/mandates.ts"],"names":[],"mappings":"AAAA;ACIO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,QAAA,CAAS,SAAA,EAA6C;AAC1D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,UAAA,EAAa,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AACvE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQiE,EAAA;AACI,IAAA;AACrE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQmE,EAAA;AACpB,IAAA;AACpC,MAAA;AACR,IAAA;AACH,EAAA;AACF;ADH0E;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-F6S3WCCB.cjs","sourcesContent":[null,"import type { MandateResponse, MandateRevokedResponse, MandateListParams } from '../types';\nimport type { RequestFn } from '../client';\n\n/** View and revoke recurring payment mandates. */\nexport class Mandates {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Retrieve a mandate by its ID.\n *\n * @param mandateId - The unique mandate ID.\n * @returns The mandate.\n */\n async retrieve(mandateId: string): Promise<MandateResponse> {\n return this.request('GET', `/mandates/${encodeURIComponent(mandateId)}`);\n }\n\n /**\n * Revoke an active mandate, preventing future charges.\n *\n * @param mandateId - The mandate ID to revoke.\n * @returns Revocation confirmation.\n */\n async revoke(mandateId: string): Promise<MandateRevokedResponse> {\n return this.request('POST', `/mandates/revoke/${encodeURIComponent(mandateId)}`);\n }\n\n /**\n * List mandates, optionally filtered by customer or status.\n *\n * @param params - Optional filter and pagination parameters.\n * @returns Array of mandates.\n */\n async list(params?: MandateListParams): Promise<MandateResponse[]> {\n return this.request('GET', '/mandates/list', {\n query: params as Record<string, string | number | undefined>,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/dist/chunk-FQRC4NJG.cjs","../src/resources/invoices.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACcA,IAAM,iBAAA,EAAmB,CAAC,QAAA,EAAU,MAAM,CAAA;AA4BnC,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAalD,MAAM,MAAA,CACJ,MAAA,EACA,OAAA,EACkC;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,WAAA,EAAa,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,IAAA,CAAK,MAAA,EAA2B,OAAA,EAA+C;AACnF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,WAAA,E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B,OAAA,EAA2D;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,UAAA,EAAa,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AACvE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYoC,EAAA;AACoC,IAAA;AAC9D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOwE,EAAA;AACR,IAAA;AAChE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS6F,EAAA;AACrB,IAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaoC,EAAA;AACoC,IAAA;AAC9D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWoC,EAAA;AACoC,IAAA;AAC9D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO6E,EAAA;AACN,IAAA;AACrD,MAAA;AACX,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ6F,EAAA;AACrB,IAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB2F,EAAA;AACnB,IAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOgG,EAAA;AACzB,IAAA;AAChE,MAAA;AACJ,IAAA;AACH,EAAA;AACF;AD3E0E;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-FQRC4NJG.cjs","sourcesContent":[null,"import type {\n CreateCreditNoteRequest,\n CreateInvoiceRequest,\n InvoiceEmailDelivery,\n InvoiceEmailDeliveryList,\n InvoiceExportParams,\n InvoiceList,\n InvoiceListQuery,\n InvoicePageQuery,\n InvoiceShareLink,\n MerchantInvoiceDocument,\n UpdateInvoiceRequest,\n VoidInvoiceRequest,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/** The invoice list filters that take several values. */\nconst INVOICE_CSV_KEYS = ['status', 'kind'] as const;\n\n/**\n * The invoices and credit notes a merchant issues to their buyers.\n *\n * DeloPay renders and stores each document **in the merchant's name**. The\n * seller block comes from the invoice settings (see `invoiceSettings`) and\n * every amount from the source — a paid payment or a paid subscription cycle —\n * so no method here takes a seller, an amount or a quantity, except the\n * optional partial amounts of a credit note, which the API caps at what the\n * line has left.\n *\n * A document is `draft` → `issued` → `voided`. A draft is unnumbered and\n * editable, and deleting it leaves no gap; `finalize` numbers it, freezes it\n * and stores its PDF; an issued document is corrected with a credit note, or\n * voided if it never reached the buyer.\n *\n * Scope comes from the caller: a shop-scoped key or dashboard session sees\n * only its shop, and a merchant-level one narrows with `profile_id` on the\n * list filters. Reading needs the `Invoice` area's read grant; every change\n * needs its write grant.\n *\n * Refusals: `IR_16` (400) for a document in the wrong state or a source that\n * may not be invoiced, `IR_06` (422) for a finalise the document cannot pass,\n * and `DE_13` (409) for a second live invoice of one source. The first two\n * carry `error.data` as a `MerchantInvoiceRefusal`; the last as a\n * `MerchantInvoiceConflict`.\n */\nexport class Invoices {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a draft from a paid payment or subscription cycle, and with\n * `finalize: true` issue it in the same call.\n * `POST /invoices`\n *\n * Send an `Idempotency-Key` header in `options.headers` to make this safe to\n * retry: the same key and body return the document it created, in its\n * current state, even after a lost response, and a different body under the\n * same key answers 409. A retry of a `finalize: true` request whose draft\n * was committed but not finalised finalises that draft.\n */\n async create(\n params: CreateInvoiceRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('POST', '/invoices', { body: params, ...options });\n }\n\n /**\n * One page of documents, newest first unless `sort_by` says otherwise. List\n * rows carry no `lines` unless `include_lines` is set, and never a `refund`\n * summary. Several `status` or `kind` values match a document in any of\n * them.\n * `GET /invoices`\n */\n async list(params?: InvoiceListQuery, options?: RequestExtras): Promise<InvoiceList> {\n return this.request('GET', '/invoices', {\n query: csvQuery(params, INVOICE_CSV_KEYS),\n ...options,\n });\n }\n\n /**\n * One page of a payment's invoice and its credit notes, lines included. The\n * page also says whether a merchant of record sold the payment\n * (`merchant_of_record`, which `create` then refuses) and what was refunded\n * (`refunded_amount`, and `refund` on each invoice). Needs the payment read\n * grant as well.\n * `GET /payments/{payment_id}/invoices`\n */\n async listForPayment(\n paymentId: string,\n params?: InvoicePageQuery,\n options?: RequestExtras,\n ): Promise<InvoiceList> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/invoices`, {\n query: params === undefined ? undefined : { ...params },\n ...options,\n });\n }\n\n /**\n * The documents with a line of one product; a bundle's components count,\n * flagged `included`. Takes the list filters; the product is the path's.\n * `GET /products/{product_id}/invoices`\n */\n async listForProduct(\n productId: string,\n params?: Omit<InvoiceListQuery, 'product_id'>,\n options?: RequestExtras,\n ): Promise<InvoiceList> {\n return this.request('GET', `/products/${encodeURIComponent(productId)}/invoices`, {\n query: csvQuery(params, INVOICE_CSV_KEYS),\n ...options,\n });\n }\n\n /**\n * The documents of one period, with the list's filters, as CSV\n * (`text/csv; charset=utf-8`) by default. Amounts are decimal in each\n * document's currency; drafts have an empty number.\n *\n * Another file is asked for with `Accept` in `options.headers`:\n * `application/json` (the rows as `records`, with `record_count` and the\n * filters applied), `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n * (an Excel workbook) or `application/zip` (the stored PDF of every issued or\n * voided document, with the CSV as `invoices.csv`; at most 500 documents).\n * `GET /invoices/export`\n */\n async export(params: InvoiceExportParams, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', '/invoices/export', {\n query: csvQuery(params, INVOICE_CSV_KEYS),\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * One document, lines included.\n * `GET /invoices/{invoice_id}`\n */\n async retrieve(invoiceId: string, options?: RequestExtras): Promise<MerchantInvoiceDocument> {\n return this.request('GET', `/invoices/${encodeURIComponent(invoiceId)}`, { ...options });\n }\n\n /**\n * Edit a draft: its words, buyer, dates and tax treatment, never what was\n * paid. Absent fields stay; `null` clears a clearable one. A document that\n * is not a draft is refused (`not_a_draft`).\n * `PATCH /invoices/{invoice_id}`\n */\n async update(\n invoiceId: string,\n params: UpdateInvoiceRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('PATCH', `/invoices/${encodeURIComponent(invoiceId)}`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Delete a draft. A draft has no number, so nothing leaves a gap; an issued\n * document is refused (`not_a_draft`) — void or credit it instead.\n * `DELETE /invoices/{invoice_id}`\n */\n async delete(invoiceId: string, options?: RequestExtras): Promise<void> {\n return this.request('DELETE', `/invoices/${encodeURIComponent(invoiceId)}`, { ...options });\n }\n\n /**\n * Issue a draft: allocate its number, freeze it and store its PDF. It is\n * immutable afterwards. A document that would be legally incomplete is\n * refused with `IR_06` and a reason (`seller_tax_id_missing`,\n * `line_tax_unexplained`, …) that says what to fix and where.\n * `POST /invoices/{invoice_id}/finalize`\n */\n async finalize(invoiceId: string, options?: RequestExtras): Promise<MerchantInvoiceDocument> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/finalize`, {\n ...options,\n });\n }\n\n /**\n * Withdraw an issued document with a reason; its number stays used. For a\n * document that never reached the buyer — one they hold is corrected with\n * `createCreditNote`. An invoice with live credit notes is refused\n * (`has_credit_notes`).\n * `POST /invoices/{invoice_id}/void`\n */\n async void(\n invoiceId: string,\n params: VoidInvoiceRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/void`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Correct an issued invoice with a credit note: all of what it has left, or\n * the named lines. Returns the **credit note**, not the invoice.\n * `POST /invoices/{invoice_id}/credit-note`\n */\n async createCreditNote(\n invoiceId: string,\n params: CreateCreditNoteRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/credit-note`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * The document as a PDF. An issued document is its stored copy; a draft\n * renders live under a DRAFT banner, and a voided one under a VOIDED banner.\n * `GET /invoices/{invoice_id}/pdf`\n */\n async downloadPdf(invoiceId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/invoices/${encodeURIComponent(invoiceId)}/pdf`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * A public link to an issued document's stored PDF, valid for 7 days.\n * **Anyone holding the link can open the document**, without logging in. A\n * document that is not issued is refused (`not_issued`).\n * `POST /invoices/{invoice_id}/share-link`\n */\n async createShareLink(invoiceId: string, options?: RequestExtras): Promise<InvoiceShareLink> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/share-link`, {\n ...options,\n });\n }\n\n /**\n * Mail an issued invoice to the buyer address it carries, its PDF attached,\n * in the document's language. Each call is a new message (the next\n * `revision`) and resolves with what became of it: `sent`, or `failed` with\n * `error_code`. Refused (`IR_16`) with `not_an_invoice` (a credit note),\n * `not_issued`, `no_buyer_email`, `send_in_progress` (an earlier message is\n * queued or being sent) and `send_limit_reached` (5 sends by hand in 24\n * hours). Shops with the `email.invoice_auto_send` setting mail every\n * invoice they issue without this call.\n *\n * The merchant's daily sending limit is **not** a refusal: the call answers\n * with the message `failed` and `error_code: 'merchant_limit_reached'`.\n * Check `status` on the result, not only that the call succeeded.\n * `POST /invoices/{invoice_id}/email`\n */\n async sendEmail(invoiceId: string, options?: RequestExtras): Promise<InvoiceEmailDelivery> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/email`, {\n ...options,\n });\n }\n\n /**\n * Every message about a document to its buyer, automatic and by hand,\n * newest first, with its delivery status. The recipient is masked.\n * `GET /invoices/{invoice_id}/emails`\n */\n async listEmails(invoiceId: string, options?: RequestExtras): Promise<InvoiceEmailDeliveryList> {\n return this.request('GET', `/invoices/${encodeURIComponent(invoiceId)}/emails`, {\n ...options,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-FQRC4NJG.cjs","../src/resources/invoices.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACcA,IAAM,iBAAA,EAAmB,CAAC,QAAA,EAAU,MAAM,CAAA;AA4BnC,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAalD,MAAM,MAAA,CACJ,MAAA,EACA,OAAA,EACkC;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,WAAA,EAAa,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,IAAA,CAAK,MAAA,EAA2B,OAAA,EAA+C;AACnF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,WAAA,EAAa;AAAA,MACtC,KAAA,EAAO,wCAAA,MAAS,EAAQ,gBAAgB,CAAA;AAAA,MACxC,GAAG;AAAA,IACL,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,cAAA,CACJ,SAAA,EACA,MAAA,EACA,OAAA,EACsB;AACtB,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,UAAA,EAAa,kBAAA,C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EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS6F,EAAA;AACrB,IAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaoC,EAAA;AACoC,IAAA;AAC9D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWoC,EAAA;AACoC,IAAA;AAC9D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO6E,EAAA;AACN,IAAA;AACrD,MAAA;AACX,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ6F,EAAA;AACrB,IAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB2F,EAAA;AACnB,IAAA;AACjE,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOgG,EAAA;AACzB,IAAA;AAChE,MAAA;AACJ,IAAA;AACH,EAAA;AACF;AD3E0E;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-FQRC4NJG.cjs","sourcesContent":[null,"import type {\n CreateCreditNoteRequest,\n CreateInvoiceRequest,\n InvoiceEmailDelivery,\n InvoiceEmailDeliveryList,\n InvoiceExportParams,\n InvoiceList,\n InvoiceListQuery,\n InvoicePageQuery,\n InvoiceShareLink,\n MerchantInvoiceDocument,\n UpdateInvoiceRequest,\n VoidInvoiceRequest,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/** The invoice list filters that take several values. */\nconst INVOICE_CSV_KEYS = ['status', 'kind'] as const;\n\n/**\n * The invoices and credit notes a merchant issues to their buyers.\n *\n * DeloPay renders and stores each document **in the merchant's name**. The\n * seller block comes from the invoice settings (see `invoiceSettings`) and\n * every amount from the source — a paid payment or a paid subscription cycle —\n * so no method here takes a seller, an amount or a quantity, except the\n * optional partial amounts of a credit note, which the API caps at what the\n * line has left.\n *\n * A document is `draft` → `issued` → `voided`. A draft is unnumbered and\n * editable, and deleting it leaves no gap; `finalize` numbers it, freezes it\n * and stores its PDF; an issued document is corrected with a credit note, or\n * voided if it never reached the buyer.\n *\n * Scope comes from the caller: a shop-scoped key or dashboard session sees\n * only its shop, and a merchant-level one narrows with `profile_id` on the\n * list filters. Reading needs the `Invoice` area's read grant; every change\n * needs its write grant.\n *\n * Refusals: `IR_16` (400) for a document in the wrong state or a source that\n * may not be invoiced, `IR_06` (422) for a finalise the document cannot pass,\n * and `DE_13` (409) for a second live invoice of one source. The first two\n * carry `error.data` as a `MerchantInvoiceRefusal`; the last as a\n * `MerchantInvoiceConflict`.\n */\nexport class Invoices {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a draft from a paid payment or subscription cycle, and with\n * `finalize: true` issue it in the same call.\n * `POST /invoices`\n *\n * Send an `Idempotency-Key` header in `options.headers` to make this safe to\n * retry: the same key and body return the document it created, in its\n * current state, even after a lost response, and a different body under the\n * same key answers 409. A retry of a `finalize: true` request whose draft\n * was committed but not finalised finalises that draft.\n */\n async create(\n params: CreateInvoiceRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('POST', '/invoices', { body: params, ...options });\n }\n\n /**\n * One page of documents, newest first unless `sort_by` says otherwise. List\n * rows carry no `lines` unless `include_lines` is set, and never a `refund`\n * summary. Several `status` or `kind` values match a document in any of\n * them.\n * `GET /invoices`\n */\n async list(params?: InvoiceListQuery, options?: RequestExtras): Promise<InvoiceList> {\n return this.request('GET', '/invoices', {\n query: csvQuery(params, INVOICE_CSV_KEYS),\n ...options,\n });\n }\n\n /**\n * One page of a payment's invoice and its credit notes, lines included. The\n * page also says whether a merchant of record sold the payment\n * (`merchant_of_record`, which `create` then refuses) and what was refunded\n * (`refunded_amount`, and `refund` on each invoice). Needs the payment read\n * grant as well.\n * `GET /payments/{payment_id}/invoices`\n */\n async listForPayment(\n paymentId: string,\n params?: InvoicePageQuery,\n options?: RequestExtras,\n ): Promise<InvoiceList> {\n return this.request('GET', `/payments/${encodeURIComponent(paymentId)}/invoices`, {\n query: params === undefined ? undefined : { ...params },\n ...options,\n });\n }\n\n /**\n * The documents with a line of one product; a bundle's components count,\n * flagged `included`. Takes the list filters; the product is the path's.\n * `GET /products/{product_id}/invoices`\n */\n async listForProduct(\n productId: string,\n params?: Omit<InvoiceListQuery, 'product_id'>,\n options?: RequestExtras,\n ): Promise<InvoiceList> {\n return this.request('GET', `/products/${encodeURIComponent(productId)}/invoices`, {\n query: csvQuery(params, INVOICE_CSV_KEYS),\n ...options,\n });\n }\n\n /**\n * The documents of one period, with the list's filters, as CSV\n * (`text/csv; charset=utf-8`) by default. Amounts are decimal in each\n * document's currency; drafts have an empty number.\n *\n * Another file is asked for with `Accept` in `options.headers`:\n * `application/json` (the rows as `records`, with `record_count` and the\n * filters applied), `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n * (an Excel workbook) or `application/zip` (the stored PDF of every issued or\n * voided document, with the CSV as `invoices.csv`; at most 500 documents).\n * `GET /invoices/export`\n */\n async export(params: InvoiceExportParams, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', '/invoices/export', {\n query: csvQuery(params, INVOICE_CSV_KEYS),\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * One document, lines included.\n * `GET /invoices/{invoice_id}`\n */\n async retrieve(invoiceId: string, options?: RequestExtras): Promise<MerchantInvoiceDocument> {\n return this.request('GET', `/invoices/${encodeURIComponent(invoiceId)}`, { ...options });\n }\n\n /**\n * Edit a draft: its words, buyer, dates and tax treatment, never what was\n * paid. Absent fields stay; `null` clears a clearable one. A document that\n * is not a draft is refused (`not_a_draft`).\n * `PATCH /invoices/{invoice_id}`\n */\n async update(\n invoiceId: string,\n params: UpdateInvoiceRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('PATCH', `/invoices/${encodeURIComponent(invoiceId)}`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Delete a draft. A draft has no number, so nothing leaves a gap; an issued\n * document is refused (`not_a_draft`) — void or credit it instead.\n * `DELETE /invoices/{invoice_id}`\n */\n async delete(invoiceId: string, options?: RequestExtras): Promise<void> {\n return this.request('DELETE', `/invoices/${encodeURIComponent(invoiceId)}`, { ...options });\n }\n\n /**\n * Issue a draft: allocate its number, freeze it and store its PDF. It is\n * immutable afterwards. A document that would be legally incomplete is\n * refused with `IR_06` and a reason (`seller_tax_id_missing`,\n * `line_tax_unexplained`, …) that says what to fix and where.\n * `POST /invoices/{invoice_id}/finalize`\n */\n async finalize(invoiceId: string, options?: RequestExtras): Promise<MerchantInvoiceDocument> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/finalize`, {\n ...options,\n });\n }\n\n /**\n * Withdraw an issued document with a reason; its number stays used. For a\n * document that never reached the buyer — one they hold is corrected with\n * `createCreditNote`. An invoice with live credit notes is refused\n * (`has_credit_notes`).\n * `POST /invoices/{invoice_id}/void`\n */\n async void(\n invoiceId: string,\n params: VoidInvoiceRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/void`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * Correct an issued invoice with a credit note: all of what it has left, or\n * the named lines. Returns the **credit note**, not the invoice.\n * `POST /invoices/{invoice_id}/credit-note`\n */\n async createCreditNote(\n invoiceId: string,\n params: CreateCreditNoteRequest,\n options?: RequestExtras,\n ): Promise<MerchantInvoiceDocument> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/credit-note`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * The document as a PDF. An issued document is its stored copy; a draft\n * renders live under a DRAFT banner, and a voided one under a VOIDED banner.\n * `GET /invoices/{invoice_id}/pdf`\n */\n async downloadPdf(invoiceId: string, options?: RequestExtras): Promise<Blob> {\n return this.request('GET', `/invoices/${encodeURIComponent(invoiceId)}/pdf`, {\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * A public link to an issued document's stored PDF, valid for 7 days.\n * **Anyone holding the link can open the document**, without logging in. A\n * document that is not issued is refused (`not_issued`).\n * `POST /invoices/{invoice_id}/share-link`\n */\n async createShareLink(invoiceId: string, options?: RequestExtras): Promise<InvoiceShareLink> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/share-link`, {\n ...options,\n });\n }\n\n /**\n * Mail an issued invoice to the buyer address it carries, its PDF attached,\n * in the document's language. Each call is a new message (the next\n * `revision`) and resolves with what became of it: `sent`, or `failed` with\n * `error_code`. Refused (`IR_16`) with `not_an_invoice` (a credit note),\n * `not_issued`, `no_buyer_email`, `send_in_progress` (an earlier message is\n * queued or being sent) and `send_limit_reached` (5 sends by hand in 24\n * hours). Shops with the `email.invoice_auto_send` setting mail every\n * invoice they issue without this call.\n *\n * The merchant's daily sending limit is **not** a refusal: the call answers\n * with the message `failed` and `error_code: 'merchant_limit_reached'`.\n * Check `status` on the result, not only that the call succeeded.\n * `POST /invoices/{invoice_id}/email`\n */\n async sendEmail(invoiceId: string, options?: RequestExtras): Promise<InvoiceEmailDelivery> {\n return this.request('POST', `/invoices/${encodeURIComponent(invoiceId)}/email`, {\n ...options,\n });\n }\n\n /**\n * Every message about a document to its buyer, automatic and by hand,\n * newest first, with its delivery status. The recipient is masked.\n * `GET /invoices/{invoice_id}/emails`\n */\n async listEmails(invoiceId: string, options?: RequestExtras): Promise<InvoiceEmailDeliveryList> {\n return this.request('GET', `/invoices/${encodeURIComponent(invoiceId)}/emails`, {\n ...options,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-FTWGI7UZ.cjs"],"names":[],"mappings":"AAAA","file":"/tmp/publish-sdk-04990/dist/chunk-FTWGI7UZ.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-FYISDU2Y.cjs","../src/resources/profiles.ts"],"names":[],"mappings":"AAAA;ACaO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,OAAA,CAAQ,SAAA,EAAmB,SAAA,EAAiD;AAChF,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,KAAA;AAAA,MACA,CAAA,SAAA,EAAY,kBAAA,CAAmB,SAAS,CAAC,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,SAAS,CAAC,CAAA,QAAA,CAAA;AAAA,MAC3F,EAAE,IAAA,EAAM,EAAE,WAAA,EAAa,KAAK,EAAqC;AAAA,IACnE,CAAA;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,OAAA,CAAQ,SAAA,EAAmB,SAAA,EAAiD;AAChF,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,KAAA;AAAA,MACA,CAAA,SAAA,EAAY,kBAAA,CAAmB,SAAS,CAAC,CAAA,kBAAA,EAAqB,kBAAA,CAAmB,SAAS,CAAC,CAAA,QAAA,CAAA;AAAA,MAC3F,EAAE,IAAA,EAAM,EAAE,WAAA,EAAa,MAAM,EAAqC;AAAA,IACpE,CAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,eAAA,CAAgB,SAAA,EAAmB,SAAA,EAAwD;AAC/F,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,KAAA;AAAA,MACA,CA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A;AAGE,IAAA;AAAuF,EAAA;AACzF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAUE,IAAA;AAA8E,EAAA;AAChF,EAAA;AAQE,IAAA;AAAY,MAAA;AACV,MAAA;AAC2F,MAAA;AAC3F,QAAA;AACQ,QAAA;AACH,MAAA;AACL,IAAA;AACF,EAAA;AACF,EAAA;AAGE,IAAA;AAAY,MAAA;AACV,MAAA;AAC2F,IAAA;AAC7F,EAAA;AACF;AAAA;AAAA,EAAA;AAME,IAAA;AAAY,MAAA;AACV,MAAA;AAC2F,IAAA;AAC7F,EAAA;AACF;AAAA,EAAA;AAIE,IAAA;AAAY,MAAA;AACV,MAAA;AAC2F,IAAA;AAC7F,EAAA;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAgBE,IAAA;AAAY,MAAA;AACV,MAAA;AAC2F,IAAA;AAC7F,EAAA;AAEJ;AD7BA;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-FYISDU2Y.cjs","sourcesContent":[null,"import type {\n ProfileCreateRequest,\n ProfileResponse,\n ProfileUpdateRequest,\n ShopArchiveUpdateRequest,\n ShopArchiveResponse,\n ShopPaymentsSwitchRequest,\n ShopPaymentsSwitchResponse,\n ArchivedShopResponse,\n VaultSwitchOffResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\nexport class Profiles {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Hide a shop from ordinary navigation. Its identity, project membership,\n * settings and retained records remain unchanged. Requires shop write access.\n * Repeating the same state is safe; use restore() to make it visible again.\n */\n async archive(accountId: string, profileId: string): Promise<ShopArchiveResponse> {\n return this.request(\n 'PUT',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/archive`,\n { body: { is_archived: true } satisfies ShopArchiveUpdateRequest },\n );\n }\n\n /** Restore an archived shop to navigation with the same identity and project. */\n async restore(accountId: string, profileId: string): Promise<ShopArchiveResponse> {\n return this.request(\n 'PUT',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/archive`,\n { body: { is_archived: false } satisfies ShopArchiveUpdateRequest },\n );\n }\n\n /**\n * Switch a shop's payments off. While they are off the shop takes no new\n * payment: creating one, and confirming one no provider holds yet, is\n * refused with `DE_21`, and its hosted checkout does not render. A payment a\n * provider already holds is finished; refunds and disputes are unaffected.\n * Needs the `ShopPaymentsSwitch` area's `Write` and a signed-in user.\n * Repeating the same state is safe.\n *\n * `PUT /account/{accountId}/business-profile/{profileId}/payments-switch`\n */\n async disablePayments(accountId: string, profileId: string): Promise<ShopPaymentsSwitchResponse> {\n return this.request(\n 'PUT',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/payments-switch`,\n { body: { payments_disabled: true } satisfies ShopPaymentsSwitchRequest },\n );\n }\n\n /** Switch a shop's payments on again after {@link Profiles.disablePayments}. */\n async enablePayments(accountId: string, profileId: string): Promise<ShopPaymentsSwitchResponse> {\n return this.request(\n 'PUT',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/payments-switch`,\n { body: { payments_disabled: false } satisfies ShopPaymentsSwitchRequest },\n );\n }\n\n /** Archived shop identities in the caller's merchant and shop-read scope. */\n async listArchived(accountId: string): Promise<ArchivedShopResponse[]> {\n return this.request(\n 'GET',\n `/account/${encodeURIComponent(accountId)}/business-profile/archived`,\n );\n }\n\n async create(accountId: string, params: ProfileCreateRequest): Promise<ProfileResponse> {\n return this.request('POST', `/account/${encodeURIComponent(accountId)}/business-profile`, {\n body: params,\n });\n }\n\n async retrieve(accountId: string, profileId: string): Promise<ProfileResponse> {\n return this.request(\n 'GET',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}`,\n );\n }\n\n async list(accountId: string): Promise<ProfileResponse[]> {\n return this.request('GET', `/account/${encodeURIComponent(accountId)}/business-profile`);\n }\n\n /**\n * List the business profiles the caller can see at profile scope — the\n * `ProfileAccountRead` twin of `list()` (which needs merchant-level read).\n * A shop-scoped user gets exactly their own shop back.\n *\n * `GET /account/{accountId}/profile`\n */\n async listByProfile(accountId: string): Promise<ProfileResponse[]> {\n return this.request('GET', `/account/${encodeURIComponent(accountId)}/profile`);\n }\n\n async update(\n accountId: string,\n profileId: string,\n params: ProfileUpdateRequest,\n options?: RequestExtras,\n ): Promise<ProfileResponse> {\n return this.request(\n 'POST',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}`,\n {\n body: params,\n ...options,\n },\n );\n }\n\n async delete(accountId: string, profileId: string): Promise<ProfileResponse> {\n return this.request(\n 'DELETE',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}`,\n );\n }\n\n // --- Advanced operations (Task 4.8) ---\n\n /** Toggle extended card info for a profile. `POST /account/{accountId}/business-profile/{profileId}/toggle-extended-card-info` */\n async toggleExtendedCardInfo(accountId: string, profileId: string): Promise<ProfileResponse> {\n return this.request(\n 'POST',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/toggle-extended-card-info`,\n );\n }\n\n /** Toggle connector agnostic MIT. `POST /account/{accountId}/business-profile/{profileId}/toggle-connector-agnostic-mit` */\n async toggleConnectorAgnosticMit(accountId: string, profileId: string): Promise<ProfileResponse> {\n return this.request(\n 'POST',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/toggle-connector-agnostic-mit`,\n );\n }\n\n /**\n * Switch the shop's card vault off. From the next checkout on, the checkout\n * draws each processor's own card form and card payments no longer depend on\n * the vault account. Cards saved in the vault cannot be charged while it is\n * off.\n *\n * The vault stays configured; switch it on again with {@link Profiles.update},\n * which verifies the vault first. Needs the permission to edit the shop's\n * connectors, not the one to edit the shop. Calling it for a shop whose vault\n * is already off changes nothing.\n *\n * `POST /account/{accountId}/business-profile/{profileId}/vault/switch-off`\n */\n async switchVaultOff(accountId: string, profileId: string): Promise<VaultSwitchOffResponse> {\n return this.request(\n 'POST',\n `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/vault/switch-off`,\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-GG52SAHA.cjs","../src/resources/refunds.ts"],"names":[],"mappings":"AAAA;ACoBO,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBlD,MAAM,MAAA,CAAO,MAAA,EAAsD;AACjE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,UAAA,EAAY,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAM,QAAA,CAAS,QAAA,EAA2C;AACxD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,SAAA,EAAY,kBAAA,CAAmB,QAAQ,CAAC,CAAA,CAAA;AACrE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa2B,EAAA;AAC2C,IAAA;AAC5D,MAAA;AACH,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQmE,EAAA;AACJ,IAAA;AAC/D,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa2C,EAAA;AAC0B,IAAA;AACrE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAayC,EAAA;AAC0B,IAAA;AACnE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS0F,EAAA;AACzC,IAAA;AACtC,MAAA;AACR,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsB+B,EAAA;AACsC,IAAA;AAC3D,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAM+B,EAAA;AACsC,IAAA;AAC3D,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAG4E,EAAA;AACN,IAAA;AACtE,EAAA;AAAA;AAKoC,EAAA;AAC6B,IAAA;AACjE,EAAA;AAAA;AAKoC,EAAA;AACgC,IAAA;AACpE,EAAA;AAAA;AAKoC,EAAA;AACgC,IAAA;AACpE,EAAA;AAAA;AAG+F,EAAA;AAC1B,IAAA;AAC3D,MAAA;AACP,IAAA;AACH,EAAA;AACF;ADnDwE;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-GG52SAHA.cjs","sourcesContent":[null,"import type {\n BuyerRefundRequest,\n BuyerRefundRequestApprove,\n BuyerRefundRequestDecline,\n BuyerRefundRequestList,\n BuyerRefundRequestListQuery,\n RefundCreateRequest,\n RefundResponse,\n RefundUpdateRequest,\n RefundListParams,\n RefundListResponse,\n RefundAggregateResponse,\n RefundBulkBlockBuyerRequest,\n RefundBulkBlockBuyerResponse,\n RefundBulkBlockPreviewRequest,\n RefundBulkBlockPreviewResponse,\n} from '../types';\nimport type { RequestExtras, RequestFn } from '../client';\n\n/** Create and manage refunds for completed payments. */\nexport class Refunds {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a refund for a payment.\n *\n * Dashboard-initiated refunds are subject to the caller's operation-limit\n * rule, resolved against the role the request authenticated with. An\n * over-limit refund either fails with `DE_01` (the rule blocks) or with\n * HTTP 409 `DE_06` — the rule requires approval, and `DelopayError.data`\n * carries `PendingApprovalErrorDetails`. No refund exists in either case;\n * `DE_06` names one that a second approver can still let through, via\n * `operationLimits.approve()`.\n *\n * @param params - Refund parameters, including the required `payment_id` and optional amount.\n * @returns The created refund.\n *\n * @example\n * ```typescript\n * const refund = await delopay.refunds.create({\n * payment_id: 'pay_abc123',\n * amount: 2500, // partial refund of 25.00 EUR\n * });\n * ```\n */\n async create(params: RefundCreateRequest): Promise<RefundResponse> {\n return this.request('POST', '/refunds', { body: params });\n }\n\n /**\n * Retrieve a refund by its ID.\n *\n * @param refundId - The unique refund ID.\n * @returns The refund.\n *\n * @example\n * ```typescript\n * const refund = await delopay.refunds.retrieve('ref_abc123');\n * ```\n */\n async retrieve(refundId: string): Promise<RefundResponse> {\n return this.request('GET', `/refunds/${encodeURIComponent(refundId)}`);\n }\n\n /**\n * Update the reason or metadata on an existing refund.\n *\n * @param refundId - The refund ID to update.\n * @param params - Fields to update (reason, metadata).\n * @returns The updated refund.\n */\n async update(\n refundId: string,\n params: RefundUpdateRequest,\n options?: RequestExtras,\n ): Promise<RefundResponse> {\n return this.request('POST', `/refunds/${encodeURIComponent(refundId)}`, {\n body: params,\n ...options,\n });\n }\n\n /**\n * List refunds, optionally filtered by payment, status, or date range.\n *\n * @param params - Optional filter and pagination parameters.\n * @returns Paginated list of refunds.\n */\n async list(params?: RefundListParams): Promise<RefundListResponse> {\n return this.request('POST', '/refunds/list', { body: params });\n }\n\n /**\n * Every identifier a block of each selected refund's buyer would name,\n * changing nothing: the payment's email and customer id, and every IP\n * address and device id seen on its checkout, each with where it was seen\n * and whether it is already blocked. Name the refunds by `ids` or by the\n * list's `filters`, exactly one of the two; at most `max_refunds` are read.\n *\n * `POST /refunds/bulk/block-buyer/preview`. Needs a dashboard JWT.\n */\n async bulkBlockPreview(\n request: RefundBulkBlockPreviewRequest,\n ): Promise<RefundBulkBlockPreviewResponse> {\n return this.request('POST', '/refunds/bulk/block-buyer/preview', { body: request });\n }\n\n /**\n * Add the buyer of each listed refund's payment to the buyer blocklist with\n * the chosen `kinds`, leaving out the `exclude`d identifiers, at most the\n * preview's `max_run_refunds` per call. The server reads each payment again;\n * it never blocks a value the request names. Identifiers already blocked\n * are not added again, and every refund gets its own result.\n *\n * `POST /refunds/bulk/block-buyer`. Needs a dashboard JWT.\n */\n async bulkBlockBuyer(\n request: RefundBulkBlockBuyerRequest,\n ): Promise<RefundBulkBlockBuyerResponse> {\n return this.request('POST', '/refunds/bulk/block-buyer', { body: request });\n }\n\n // --- OLAP extensions (Task 4.3) ---\n\n /**\n * Refund requests buyers raised from the customer portal, newest first.\n * Limited to the caller's shop when the caller is scoped to one.\n * `GET /refund-requests`\n */\n async listRequests(params?: BuyerRefundRequestListQuery): Promise<BuyerRefundRequestList> {\n return this.request('GET', '/refund-requests', {\n query: params as Record<string, string | number | null | undefined>,\n });\n }\n\n /**\n * Approve a buyer's refund request with a refund of its payment that has\n * succeeded, made with `create()` after the buyer asked. Approving records\n * the decision and moves no money. A refund that is still `pending` or in\n * `review` is refused: check it again later with `retrieve()` under the same\n * refund ID and approve once it has succeeded, rather than creating another\n * refund. `POST /refund-requests/{id}/approve`\n *\n * @example\n * ```typescript\n * const refund = await delopay.refunds.create({ payment_id: request.payment_id, amount: request.amount });\n * if (refund.status === 'succeeded') {\n * await delopay.refunds.approveRequest(request.id, { refund_id: refund.refund_id });\n * }\n * // Otherwise keep refund.refund_id, check it with retrieve() and approve once it has succeeded.\n * ```\n */\n async approveRequest(\n requestId: string,\n params: BuyerRefundRequestApprove,\n ): Promise<BuyerRefundRequest> {\n return this.request('POST', `/refund-requests/${encodeURIComponent(requestId)}/approve`, {\n body: params,\n });\n }\n\n /** Decline a buyer's refund request. The buyer sees the reply. `POST /refund-requests/{id}/decline` */\n async declineRequest(\n requestId: string,\n params: BuyerRefundRequestDecline,\n ): Promise<BuyerRefundRequest> {\n return this.request('POST', `/refund-requests/${encodeURIComponent(requestId)}/decline`, {\n body: params,\n });\n }\n\n /** List refunds (profile-scoped). `POST /refunds/profile/list` */\n async listByProfile(params?: RefundListParams): Promise<RefundListResponse> {\n return this.request('POST', '/refunds/profile/list', { body: params });\n }\n\n /** Get refund filter options. `GET /refunds/filter` */\n async getFilters(\n params?: Record<string, string | number | undefined>,\n ): Promise<Record<string, unknown>> {\n return this.request('GET', '/refunds/filter', { query: params });\n }\n\n /** Get refund aggregates. `GET /refunds/aggregate` */\n async aggregate(\n params?: Record<string, string | number | undefined>,\n ): Promise<RefundAggregateResponse> {\n return this.request('GET', '/refunds/aggregate', { query: params });\n }\n\n /** Get refund aggregates (profile-scoped). `GET /refunds/profile/aggregate` */\n async aggregateByProfile(\n params?: Record<string, string | number | undefined>,\n ): Promise<RefundAggregateResponse> {\n return this.request('GET', '/refunds/profile/aggregate', { query: params });\n }\n\n /** Manually update refund status. `PUT /refunds/{refundId}/manual-update` */\n async manualUpdate(refundId: string, params: Record<string, unknown>): Promise<RefundResponse> {\n return this.request('PUT', `/refunds/${encodeURIComponent(refundId)}/manual-update`, {\n body: params,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/tmp/sdk-pub-04970/dist/chunk-GK5FWN4H.cjs","../src/resources/buyerAccount.ts"],"names":[],"mappings":"AAAA;ACgDO,IAAM,aAAA,EAAN,MAAmB;AAAA,EACxB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,YAAA,CAAa,OAAA,EAA4D;AAC7E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,6BAAA,EAA+B,EAAE,GAAG,QAAQ,CAAC,CAAA;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAA,CACJ,MAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAA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,EAAA;AACH,IAAA;AACV,MAAA;AACiG,MAAA;AACjG,MAAA;AACE,QAAA;AACG,QAAA;AACL,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYkC,EAAA;AACuB,IAAA;AACnC,MAAA;AACf,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUqC,EAAA;AACqD,IAAA;AAC1F,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOuF,EAAA;AACM,IAAA;AACtF,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY0B,EAAA;AACZ,IAAA;AACV,MAAA;AACwF,MAAA;AAC3E,MAAA;AACf,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa8B,EAAA;AACgB,IAAA;AAClB,IAAA;AACoB,IAAA;AACM,IAAA;AACb,IAAA;AAC3B,IAAA;AACV,MAAA;AACwF,MAAA;AAChE,MAAA;AAC1B,IAAA;AACF,EAAA;AAAA;AAQiB,EAAA;AACH,IAAA;AACV,MAAA;AACwF,MAAA;AACxF,MAAA;AACgB,QAAA;AACX,QAAA;AACL,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAQiB,EAAA;AACH,IAAA;AACV,MAAA;AACwF,MAAA;AACxF,MAAA;AACK,QAAA;AACL,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY+B,EAAA;AACjB,IAAA;AACV,MAAA;AACwF,MAAA;AAC7D,MAAA;AAC7B,IAAA;AACF,EAAA;AAAA;AAQ+B,EAAA;AACjB,IAAA;AACV,MAAA;AACwF,MAAA;AAC7D,MAAA;AAC7B,IAAA;AACF,EAAA;AACF;ADpKwG;AACA;AACA;AACA","file":"/tmp/sdk-pub-04970/dist/chunk-GK5FWN4H.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type {\n BuyerConversationAttachment,\n BuyerPortalAttachmentQuery,\n BuyerAccountAnalytics,\n BuyerAccountAnalyticsQuery,\n BuyerAccountAvailability,\n BuyerAccountConfirmation,\n BuyerAccountConfirmRequest,\n BuyerAccountInvoiceList,\n BuyerAccountListQuery,\n BuyerAccountPortal,\n BuyerAccountPurchasePage,\n BuyerAccountPurchaseQuery,\n BuyerAccountRefundRequestList,\n BuyerCaseList,\n BuyerNoticeSettings,\n BuyerPortalConversationList,\n BuyerPortalConversationQuery,\n BuyerPortalMessage,\n BuyerPortalMessageCreate,\n BuyerPortalMessagePage,\n BuyerAccountSession,\n BuyerAccountSessionInfo,\n BuyerAccountShopList,\n BuyerAccountSignInRequest,\n BuyerAccountSignInResponse,\n BuyerAccountSubscriptionList,\n BuyerAccountSubscriptionQuery,\n BuyerAccountSectionQuery,\n BuyerAccountVerifyCodeRequest,\n BuyerAccountVerifyLinkRequest,\n BuyerEvidence,\n BuyerEvidenceEntry,\n BuyerEvidenceExtensionRequest,\n BuyerEvidenceFile,\n BuyerEvidenceSubmit,\n} from '../types';\n\n/**\n * The buyer account: a buyer signs in with their email address, by a code or\n * a link mailed to it, and sees their purchases across merchants.\n *\n * Starting and completing a sign-in need no credential. Everything after it\n * needs the buyer account session: construct a separate client with the\n * session `token` as its key. A customer portal grant is not a buyer account\n * session, and neither is a merchant secret key or a dashboard JWT.\n */\nexport class BuyerAccount {\n constructor(private readonly request: RequestFn) {}\n\n /** Whether buyers can sign in on this platform, and which methods are offered. */\n async availability(options?: RequestExtras): Promise<BuyerAccountAvailability> {\n return this.request('GET', '/buyer-account/availability', { ...options });\n }\n\n /**\n * Mail a sign-in code, a link, or both to the address, as the platform\n * offers. The answer is the same whether or not the address has purchases.\n */\n async startSignIn(\n params: BuyerAccountSignInRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountSignInResponse> {\n return this.request('POST', '/buyer-account/sign-in', { body: params, ...options });\n }\n\n /** Complete a sign-in with the code from the message. */\n async verifyCode(\n params: BuyerAccountVerifyCodeRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountSession> {\n return this.request('POST', '/buyer-account/sign-in/code', { body: params, ...options });\n }\n\n /** Complete a sign-in with the token of the link in the message. */\n async verifyLink(\n params: BuyerAccountVerifyLinkRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountSession> {\n return this.request('POST', '/buyer-account/sign-in/link', { body: params, ...options });\n }\n\n /** The current session: the address signed in with, masked, and its expiry. */\n async getSession(options?: RequestExtras): Promise<BuyerAccountSessionInfo> {\n return this.request('GET', '/buyer-account/session', { ...options });\n }\n\n /**\n * What the buyer is mailed about: a reply from a shop's team they have not\n * read, and news in their refund requests and disputes.\n */\n async noticeSettings(options?: RequestExtras): Promise<BuyerNoticeSettings> {\n return this.request('GET', '/buyer-account/notice-settings', { ...options });\n }\n\n /** Turn either mail on or off for the buyer, at every shop. */\n async setNoticeSettings(\n params: BuyerNoticeSettings,\n options?: RequestExtras,\n ): Promise<BuyerNoticeSettings> {\n return this.request('PUT', '/buyer-account/notice-settings', { body: params, ...options });\n }\n\n /** End the current session. */\n async signOut(options?: RequestExtras): Promise<void> {\n return this.request('DELETE', '/buyer-account/session', { ...options });\n }\n\n /**\n * The buyer's purchases across merchants, newest first, as receipts: shop,\n * date, amount, items and status. Page with `next_cursor`.\n */\n async listPurchases(\n params?: BuyerAccountPurchaseQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountPurchasePage> {\n return this.request('GET', '/buyer-account/purchases', {\n query: params as Record<string, string | number | null | undefined>,\n ...options,\n });\n }\n\n /**\n * The shops the buyer has purchases at, once each and by name. Pass a\n * shop's `shop` to `listPurchases` to list only that shop's purchases.\n */\n async listShops(options?: RequestExtras): Promise<BuyerAccountShopList> {\n return this.request('GET', '/buyer-account/shops', { ...options });\n }\n\n /**\n * The buyer's subscriptions across shops, newest first. A record the buyer\n * has not confirmed shows what a receipt carries, without its period or\n * cancellation. Follow `next_cursor` with the same shop and mode; an\n * omitted mode includes both modes.\n */\n async listSubscriptions(\n query?: BuyerAccountSubscriptionQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountSubscriptionList> {\n return this.request('GET', '/buyer-account/subscriptions', {\n query: query ? { ...query } : undefined,\n ...options,\n });\n }\n\n /**\n * The issued invoices of the records the buyer has confirmed through a\n * shop's own link, newest first. `unconfirmed_records` says when records\n * were left out. Follow `next_cursor` with the same shop and mode; an\n * omitted mode includes both modes.\n */\n async listInvoices(\n query?: BuyerAccountSectionQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountInvoiceList> {\n return this.request('GET', '/buyer-account/invoices', {\n query: query ? { ...query } : undefined,\n ...options,\n });\n }\n\n /**\n * The confirmed records' refund requests, newest first, with the shop's\n * decision. Follow `next_cursor` with the same shop and mode; an omitted\n * mode includes both modes.\n */\n async listRefundRequests(\n query?: BuyerAccountSectionQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountRefundRequestList> {\n return this.request('GET', '/buyer-account/refund-requests', {\n query: query ? { ...query } : undefined,\n ...options,\n });\n }\n\n /**\n * The cases of the records the buyer has confirmed: the refund requests\n * they sent and the disputes about their purchases, newest first, with\n * where each stands, who acts next, the outcome and the recorded steps.\n */\n async listCases(query?: BuyerAccountListQuery, options?: RequestExtras): Promise<BuyerCaseList> {\n return this.request('GET', '/buyer-account/cases', {\n query: query as Record<string, string | null | undefined>,\n ...options,\n });\n }\n\n /**\n * The conversations of the records the buyer has confirmed, the latest\n * message first. `unconfirmed_records` says when other records were left out.\n */\n async listConversations(\n query?: BuyerAccountListQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request('GET', '/buyer-account/conversations', {\n query: query as Record<string, string | null | undefined>,\n ...options,\n });\n }\n\n /**\n * The conversation of a confirmed record with one shop, and its newest\n * messages, oldest first; `before` pages back. `shop` is required here.\n */\n async listRecordMessages(\n record: string,\n query: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessagePage> {\n return this.request('GET', `/buyer-account/records/${encodeURIComponent(record)}/messages`, {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * A message from a confirmed record to one of its shops. A message to a\n * closed conversation reopens it. Sending again with the same\n * `client_message_id` returns the message the first send stored.\n */\n async sendRecordMessage(\n record: string,\n message: BuyerPortalMessageCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessage> {\n return this.request('POST', `/buyer-account/records/${encodeURIComponent(record)}/messages`, {\n body: message,\n ...options,\n });\n }\n\n /**\n * The buyer has read a record's conversation with one shop up to its last\n * accepted message. Answers with the buyer's conversations as they now stand.\n */\n async markRecordMessagesRead(\n record: string,\n query: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/read`,\n {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n },\n );\n }\n\n /**\n * Upload a file for the buyer's next message to one shop of a confirmed\n * record, under the shop's attachment rules (`attachment_rules` on the\n * message page). It belongs to the buyer until a message names it in\n * `attachments`; one no message took within a day is cleared. Uploading\n * again with the same `clientUploadId` returns the file the first upload\n * stored. `shop` is required here.\n */\n async uploadRecordMessageFile(\n record: string,\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(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/files`,\n {\n body: form,\n query: query as Record<string, string | boolean | null | undefined>,\n ...extras,\n },\n );\n }\n\n /** Download a file a message of a record's conversation with one shop carries. */\n async downloadRecordMessageFile(\n record: string,\n fileId: string,\n query: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/files/${encodeURIComponent(fileId)}`,\n {\n query: query as Record<string, string | boolean | null | undefined>,\n responseType: 'blob',\n ...options,\n },\n );\n }\n\n /** Remove a file the buyer uploaded for a record's conversation that no message took. */\n async removeRecordMessageFile(\n record: string,\n fileId: string,\n query: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/files/${encodeURIComponent(fileId)}`,\n {\n query: query as Record<string, string | boolean | null | undefined>,\n ...options,\n },\n );\n }\n\n /**\n * What the buyer spent in a period: paid purchases summed per currency,\n * never converted, for the whole period, per day, week or month, per shop\n * and per kind of purchase. `subscriptions`, when present, summarizes all\n * current subscriptions in the same shop and mode, independently of the\n * spending period and subscription list pagination.\n */\n async analytics(\n query: BuyerAccountAnalyticsQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountAnalytics> {\n return this.request('GET', '/buyer-account/analytics', {\n query: { ...query },\n ...options,\n });\n }\n\n /**\n * Confirm the record of a shop's customer portal link for the signed-in\n * buyer. The link's customer must carry the address the buyer signed in\n * with.\n */\n async confirm(\n params: BuyerAccountConfirmRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountConfirmation> {\n return this.request('POST', '/buyer-account/confirmations', { body: params, ...options });\n }\n\n /**\n * Open the shop's customer portal for a confirmed record, named by the\n * `record` its purchases carry. Opening another one for the same record\n * ends the previous one.\n */\n async openPortal(record: string, options?: RequestExtras): Promise<BuyerAccountPortal> {\n return this.request('POST', `/buyer-account/records/${encodeURIComponent(record)}/portal`, {\n ...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 * The case is one of a confirmed record's, named by the `record` its\n * purchases carry and the case id the case list shows.\n */\n async caseEvidence(\n record: string,\n caseId: string,\n options?: RequestExtras,\n ): Promise<BuyerEvidence> {\n return this.request(\n 'GET',\n `/buyer-account/records/${encodeURIComponent(record)}/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 record: string,\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-account/records/${encodeURIComponent(record)}/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 record: string,\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-account/records/${encodeURIComponent(record)}/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(\n record: string,\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-account/records/${encodeURIComponent(record)}/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 record: string,\n caseId: string,\n params: BuyerEvidenceSubmit,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/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 record: string,\n caseId: string,\n params: BuyerEvidenceExtensionRequest,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,\n { body: params, ...options },\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-GK5FWN4H.cjs","../src/resources/buyerAccount.ts"],"names":[],"mappings":"AAAA;ACgDO,IAAM,aAAA,EAAN,MAAmB;AAAA,EACxB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,YAAA,CAAa,OAAA,EAA4D;AAC7E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,6BAAA,EAA+B,EAAE,GAAG,QAAQ,CAAC,CAAA;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAA,CACJ,MAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACpF;AAAA;AAAA,EAGA,MAAM,UAAA,CACJ,MAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,6BAAA,EAA+B,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACzF;AAAA;AAAA,EAGA,MAAM,UAAA,CACJ,MAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,6BAAA,EAA+B,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACzF;AAAA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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa8B,EAAA;AACgB,IAAA;AAClB,IAAA;AACoB,IAAA;AACM,IAAA;AACb,IAAA;AAC3B,IAAA;AACV,MAAA;AACwF,MAAA;AAChE,MAAA;AAC1B,IAAA;AACF,EAAA;AAAA;AAQiB,EAAA;AACH,IAAA;AACV,MAAA;AACwF,MAAA;AACxF,MAAA;AACgB,QAAA;AACX,QAAA;AACL,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAQiB,EAAA;AACH,IAAA;AACV,MAAA;AACwF,MAAA;AACxF,MAAA;AACK,QAAA;AACL,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY+B,EAAA;AACjB,IAAA;AACV,MAAA;AACwF,MAAA;AAC7D,MAAA;AAC7B,IAAA;AACF,EAAA;AAAA;AAQ+B,EAAA;AACjB,IAAA;AACV,MAAA;AACwF,MAAA;AAC7D,MAAA;AAC7B,IAAA;AACF,EAAA;AACF;ADpKwG;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-GK5FWN4H.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type {\n BuyerConversationAttachment,\n BuyerPortalAttachmentQuery,\n BuyerAccountAnalytics,\n BuyerAccountAnalyticsQuery,\n BuyerAccountAvailability,\n BuyerAccountConfirmation,\n BuyerAccountConfirmRequest,\n BuyerAccountInvoiceList,\n BuyerAccountListQuery,\n BuyerAccountPortal,\n BuyerAccountPurchasePage,\n BuyerAccountPurchaseQuery,\n BuyerAccountRefundRequestList,\n BuyerCaseList,\n BuyerNoticeSettings,\n BuyerPortalConversationList,\n BuyerPortalConversationQuery,\n BuyerPortalMessage,\n BuyerPortalMessageCreate,\n BuyerPortalMessagePage,\n BuyerAccountSession,\n BuyerAccountSessionInfo,\n BuyerAccountShopList,\n BuyerAccountSignInRequest,\n BuyerAccountSignInResponse,\n BuyerAccountSubscriptionList,\n BuyerAccountSubscriptionQuery,\n BuyerAccountSectionQuery,\n BuyerAccountVerifyCodeRequest,\n BuyerAccountVerifyLinkRequest,\n BuyerEvidence,\n BuyerEvidenceEntry,\n BuyerEvidenceExtensionRequest,\n BuyerEvidenceFile,\n BuyerEvidenceSubmit,\n} from '../types';\n\n/**\n * The buyer account: a buyer signs in with their email address, by a code or\n * a link mailed to it, and sees their purchases across merchants.\n *\n * Starting and completing a sign-in need no credential. Everything after it\n * needs the buyer account session: construct a separate client with the\n * session `token` as its key. A customer portal grant is not a buyer account\n * session, and neither is a merchant secret key or a dashboard JWT.\n */\nexport class BuyerAccount {\n constructor(private readonly request: RequestFn) {}\n\n /** Whether buyers can sign in on this platform, and which methods are offered. */\n async availability(options?: RequestExtras): Promise<BuyerAccountAvailability> {\n return this.request('GET', '/buyer-account/availability', { ...options });\n }\n\n /**\n * Mail a sign-in code, a link, or both to the address, as the platform\n * offers. The answer is the same whether or not the address has purchases.\n */\n async startSignIn(\n params: BuyerAccountSignInRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountSignInResponse> {\n return this.request('POST', '/buyer-account/sign-in', { body: params, ...options });\n }\n\n /** Complete a sign-in with the code from the message. */\n async verifyCode(\n params: BuyerAccountVerifyCodeRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountSession> {\n return this.request('POST', '/buyer-account/sign-in/code', { body: params, ...options });\n }\n\n /** Complete a sign-in with the token of the link in the message. */\n async verifyLink(\n params: BuyerAccountVerifyLinkRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountSession> {\n return this.request('POST', '/buyer-account/sign-in/link', { body: params, ...options });\n }\n\n /** The current session: the address signed in with, masked, and its expiry. */\n async getSession(options?: RequestExtras): Promise<BuyerAccountSessionInfo> {\n return this.request('GET', '/buyer-account/session', { ...options });\n }\n\n /**\n * What the buyer is mailed about: a reply from a shop's team they have not\n * read, and news in their refund requests and disputes.\n */\n async noticeSettings(options?: RequestExtras): Promise<BuyerNoticeSettings> {\n return this.request('GET', '/buyer-account/notice-settings', { ...options });\n }\n\n /** Turn either mail on or off for the buyer, at every shop. */\n async setNoticeSettings(\n params: BuyerNoticeSettings,\n options?: RequestExtras,\n ): Promise<BuyerNoticeSettings> {\n return this.request('PUT', '/buyer-account/notice-settings', { body: params, ...options });\n }\n\n /** End the current session. */\n async signOut(options?: RequestExtras): Promise<void> {\n return this.request('DELETE', '/buyer-account/session', { ...options });\n }\n\n /**\n * The buyer's purchases across merchants, newest first, as receipts: shop,\n * date, amount, items and status. Page with `next_cursor`.\n */\n async listPurchases(\n params?: BuyerAccountPurchaseQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountPurchasePage> {\n return this.request('GET', '/buyer-account/purchases', {\n query: params as Record<string, string | number | null | undefined>,\n ...options,\n });\n }\n\n /**\n * The shops the buyer has purchases at, once each and by name. Pass a\n * shop's `shop` to `listPurchases` to list only that shop's purchases.\n */\n async listShops(options?: RequestExtras): Promise<BuyerAccountShopList> {\n return this.request('GET', '/buyer-account/shops', { ...options });\n }\n\n /**\n * The buyer's subscriptions across shops, newest first. A record the buyer\n * has not confirmed shows what a receipt carries, without its period or\n * cancellation. Follow `next_cursor` with the same shop and mode; an\n * omitted mode includes both modes.\n */\n async listSubscriptions(\n query?: BuyerAccountSubscriptionQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountSubscriptionList> {\n return this.request('GET', '/buyer-account/subscriptions', {\n query: query ? { ...query } : undefined,\n ...options,\n });\n }\n\n /**\n * The issued invoices of the records the buyer has confirmed through a\n * shop's own link, newest first. `unconfirmed_records` says when records\n * were left out. Follow `next_cursor` with the same shop and mode; an\n * omitted mode includes both modes.\n */\n async listInvoices(\n query?: BuyerAccountSectionQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountInvoiceList> {\n return this.request('GET', '/buyer-account/invoices', {\n query: query ? { ...query } : undefined,\n ...options,\n });\n }\n\n /**\n * The confirmed records' refund requests, newest first, with the shop's\n * decision. Follow `next_cursor` with the same shop and mode; an omitted\n * mode includes both modes.\n */\n async listRefundRequests(\n query?: BuyerAccountSectionQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountRefundRequestList> {\n return this.request('GET', '/buyer-account/refund-requests', {\n query: query ? { ...query } : undefined,\n ...options,\n });\n }\n\n /**\n * The cases of the records the buyer has confirmed: the refund requests\n * they sent and the disputes about their purchases, newest first, with\n * where each stands, who acts next, the outcome and the recorded steps.\n */\n async listCases(query?: BuyerAccountListQuery, options?: RequestExtras): Promise<BuyerCaseList> {\n return this.request('GET', '/buyer-account/cases', {\n query: query as Record<string, string | null | undefined>,\n ...options,\n });\n }\n\n /**\n * The conversations of the records the buyer has confirmed, the latest\n * message first. `unconfirmed_records` says when other records were left out.\n */\n async listConversations(\n query?: BuyerAccountListQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request('GET', '/buyer-account/conversations', {\n query: query as Record<string, string | null | undefined>,\n ...options,\n });\n }\n\n /**\n * The conversation of a confirmed record with one shop, and its newest\n * messages, oldest first; `before` pages back. `shop` is required here.\n */\n async listRecordMessages(\n record: string,\n query: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessagePage> {\n return this.request('GET', `/buyer-account/records/${encodeURIComponent(record)}/messages`, {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n });\n }\n\n /**\n * A message from a confirmed record to one of its shops. A message to a\n * closed conversation reopens it. Sending again with the same\n * `client_message_id` returns the message the first send stored.\n */\n async sendRecordMessage(\n record: string,\n message: BuyerPortalMessageCreate,\n options?: RequestExtras,\n ): Promise<BuyerPortalMessage> {\n return this.request('POST', `/buyer-account/records/${encodeURIComponent(record)}/messages`, {\n body: message,\n ...options,\n });\n }\n\n /**\n * The buyer has read a record's conversation with one shop up to its last\n * accepted message. Answers with the buyer's conversations as they now stand.\n */\n async markRecordMessagesRead(\n record: string,\n query: BuyerPortalConversationQuery,\n options?: RequestExtras,\n ): Promise<BuyerPortalConversationList> {\n return this.request(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/read`,\n {\n query: query as Record<string, string | number | boolean | null | undefined>,\n ...options,\n },\n );\n }\n\n /**\n * Upload a file for the buyer's next message to one shop of a confirmed\n * record, under the shop's attachment rules (`attachment_rules` on the\n * message page). It belongs to the buyer until a message names it in\n * `attachments`; one no message took within a day is cleared. Uploading\n * again with the same `clientUploadId` returns the file the first upload\n * stored. `shop` is required here.\n */\n async uploadRecordMessageFile(\n record: string,\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(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/files`,\n {\n body: form,\n query: query as Record<string, string | boolean | null | undefined>,\n ...extras,\n },\n );\n }\n\n /** Download a file a message of a record's conversation with one shop carries. */\n async downloadRecordMessageFile(\n record: string,\n fileId: string,\n query: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/files/${encodeURIComponent(fileId)}`,\n {\n query: query as Record<string, string | boolean | null | undefined>,\n responseType: 'blob',\n ...options,\n },\n );\n }\n\n /** Remove a file the buyer uploaded for a record's conversation that no message took. */\n async removeRecordMessageFile(\n record: string,\n fileId: string,\n query: BuyerPortalAttachmentQuery,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-account/records/${encodeURIComponent(record)}/messages/files/${encodeURIComponent(fileId)}`,\n {\n query: query as Record<string, string | boolean | null | undefined>,\n ...options,\n },\n );\n }\n\n /**\n * What the buyer spent in a period: paid purchases summed per currency,\n * never converted, for the whole period, per day, week or month, per shop\n * and per kind of purchase. `subscriptions`, when present, summarizes all\n * current subscriptions in the same shop and mode, independently of the\n * spending period and subscription list pagination.\n */\n async analytics(\n query: BuyerAccountAnalyticsQuery,\n options?: RequestExtras,\n ): Promise<BuyerAccountAnalytics> {\n return this.request('GET', '/buyer-account/analytics', {\n query: { ...query },\n ...options,\n });\n }\n\n /**\n * Confirm the record of a shop's customer portal link for the signed-in\n * buyer. The link's customer must carry the address the buyer signed in\n * with.\n */\n async confirm(\n params: BuyerAccountConfirmRequest,\n options?: RequestExtras,\n ): Promise<BuyerAccountConfirmation> {\n return this.request('POST', '/buyer-account/confirmations', { body: params, ...options });\n }\n\n /**\n * Open the shop's customer portal for a confirmed record, named by the\n * `record` its purchases carry. Opening another one for the same record\n * ends the previous one.\n */\n async openPortal(record: string, options?: RequestExtras): Promise<BuyerAccountPortal> {\n return this.request('POST', `/buyer-account/records/${encodeURIComponent(record)}/portal`, {\n ...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 * The case is one of a confirmed record's, named by the `record` its\n * purchases carry and the case id the case list shows.\n */\n async caseEvidence(\n record: string,\n caseId: string,\n options?: RequestExtras,\n ): Promise<BuyerEvidence> {\n return this.request(\n 'GET',\n `/buyer-account/records/${encodeURIComponent(record)}/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 record: string,\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-account/records/${encodeURIComponent(record)}/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 record: string,\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/buyer-account/records/${encodeURIComponent(record)}/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(\n record: string,\n caseId: string,\n fileId: string,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request(\n 'DELETE',\n `/buyer-account/records/${encodeURIComponent(record)}/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 record: string,\n caseId: string,\n params: BuyerEvidenceSubmit,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/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 record: string,\n caseId: string,\n params: BuyerEvidenceExtensionRequest,\n options?: RequestExtras,\n ): Promise<BuyerEvidenceEntry> {\n return this.request(\n 'POST',\n `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,\n { body: params, ...options },\n );\n }\n}\n"]}
|