@paygentic/sdk 0.9.15 → 0.9.17

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.
Files changed (517) hide show
  1. package/README.md +34 -6
  2. package/dist/commonjs/funcs/invoicesV2ListProjectedInvoices.d.ts +18 -0
  3. package/dist/commonjs/funcs/invoicesV2ListProjectedInvoices.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/invoicesV2ListProjectedInvoices.js +125 -0
  5. package/dist/commonjs/funcs/invoicesV2ListProjectedInvoices.js.map +1 -0
  6. package/dist/commonjs/funcs/invoicesV2RecordInvoicePayment.d.ts +27 -0
  7. package/dist/commonjs/funcs/invoicesV2RecordInvoicePayment.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/invoicesV2RecordInvoicePayment.js +133 -0
  9. package/dist/commonjs/funcs/invoicesV2RecordInvoicePayment.js.map +1 -0
  10. package/dist/commonjs/funcs/invoicesV2RetryInvoicePayment.d.ts +40 -0
  11. package/dist/commonjs/funcs/invoicesV2RetryInvoicePayment.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/invoicesV2RetryInvoicePayment.js +157 -0
  13. package/dist/commonjs/funcs/invoicesV2RetryInvoicePayment.js.map +1 -0
  14. package/dist/commonjs/funcs/merchantsReset.d.ts +22 -0
  15. package/dist/commonjs/funcs/merchantsReset.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/merchantsReset.js +129 -0
  17. package/dist/commonjs/funcs/merchantsReset.js.map +1 -0
  18. package/dist/commonjs/funcs/profitabilityGetProfitability.d.ts +1 -1
  19. package/dist/commonjs/funcs/profitabilityGetProfitability.js +1 -1
  20. package/dist/commonjs/funcs/revenueGet.d.ts +1 -1
  21. package/dist/commonjs/funcs/revenueGet.js +1 -1
  22. package/dist/commonjs/funcs/subscriptionsMigrateSubscriptionVersion.d.ts +19 -0
  23. package/dist/commonjs/funcs/subscriptionsMigrateSubscriptionVersion.d.ts.map +1 -0
  24. package/dist/commonjs/funcs/subscriptionsMigrateSubscriptionVersion.js +127 -0
  25. package/dist/commonjs/funcs/subscriptionsMigrateSubscriptionVersion.js.map +1 -0
  26. package/dist/commonjs/funcs/webhooksDisable.d.ts +18 -0
  27. package/dist/commonjs/funcs/webhooksDisable.d.ts.map +1 -0
  28. package/dist/commonjs/funcs/webhooksDisable.js +122 -0
  29. package/dist/commonjs/funcs/webhooksDisable.js.map +1 -0
  30. package/dist/commonjs/funcs/webhooksEnable.d.ts +19 -0
  31. package/dist/commonjs/funcs/webhooksEnable.d.ts.map +1 -0
  32. package/dist/commonjs/funcs/webhooksEnable.js +122 -0
  33. package/dist/commonjs/funcs/webhooksEnable.js.map +1 -0
  34. package/dist/commonjs/funcs/webhooksGet.d.ts +19 -0
  35. package/dist/commonjs/funcs/webhooksGet.d.ts.map +1 -0
  36. package/dist/commonjs/funcs/webhooksGet.js +122 -0
  37. package/dist/commonjs/funcs/webhooksGet.js.map +1 -0
  38. package/dist/commonjs/funcs/webhooksGetPortal.d.ts +19 -0
  39. package/dist/commonjs/funcs/webhooksGetPortal.d.ts.map +1 -0
  40. package/dist/commonjs/funcs/webhooksGetPortal.js +122 -0
  41. package/dist/commonjs/funcs/webhooksGetPortal.js.map +1 -0
  42. package/dist/commonjs/funcs/webhooksUpdate.d.ts +19 -0
  43. package/dist/commonjs/funcs/webhooksUpdate.d.ts.map +1 -0
  44. package/dist/commonjs/funcs/webhooksUpdate.js +123 -0
  45. package/dist/commonjs/funcs/webhooksUpdate.js.map +1 -0
  46. package/dist/commonjs/lib/config.d.ts +2 -2
  47. package/dist/commonjs/lib/config.js +2 -2
  48. package/dist/commonjs/models/currencybreakdownentry.d.ts +1 -1
  49. package/dist/commonjs/models/elapsedperiodbilling.d.ts +16 -0
  50. package/dist/commonjs/models/elapsedperiodbilling.d.ts.map +1 -0
  51. package/dist/commonjs/models/elapsedperiodbilling.js +50 -0
  52. package/dist/commonjs/models/elapsedperiodbilling.js.map +1 -0
  53. package/dist/commonjs/models/errors/index.d.ts +2 -0
  54. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  55. package/dist/commonjs/models/errors/index.js +2 -0
  56. package/dist/commonjs/models/errors/index.js.map +1 -1
  57. package/dist/commonjs/models/errors/recordinvoicepayment.d.ts +55 -0
  58. package/dist/commonjs/models/errors/recordinvoicepayment.d.ts.map +1 -0
  59. package/dist/commonjs/models/errors/recordinvoicepayment.js +76 -0
  60. package/dist/commonjs/models/errors/recordinvoicepayment.js.map +1 -0
  61. package/dist/commonjs/models/errors/retrypaymentresponseerror.d.ts +63 -0
  62. package/dist/commonjs/models/errors/retrypaymentresponseerror.d.ts.map +1 -0
  63. package/dist/commonjs/models/errors/retrypaymentresponseerror.js +81 -0
  64. package/dist/commonjs/models/errors/retrypaymentresponseerror.js.map +1 -0
  65. package/dist/commonjs/models/grouptrendentry.d.ts +5 -1
  66. package/dist/commonjs/models/grouptrendentry.d.ts.map +1 -1
  67. package/dist/commonjs/models/grouptrendentry.js +1 -0
  68. package/dist/commonjs/models/grouptrendentry.js.map +1 -1
  69. package/dist/commonjs/models/hostedlinkpaymentresult.d.ts +28 -0
  70. package/dist/commonjs/models/hostedlinkpaymentresult.d.ts.map +1 -0
  71. package/dist/commonjs/models/hostedlinkpaymentresult.js +56 -0
  72. package/dist/commonjs/models/hostedlinkpaymentresult.js.map +1 -0
  73. package/dist/commonjs/models/index.d.ts +14 -0
  74. package/dist/commonjs/models/index.d.ts.map +1 -1
  75. package/dist/commonjs/models/index.js +14 -0
  76. package/dist/commonjs/models/index.js.map +1 -1
  77. package/dist/commonjs/models/invoice.d.ts +7 -6
  78. package/dist/commonjs/models/invoice.d.ts.map +1 -1
  79. package/dist/commonjs/models/invoice.js +3 -2
  80. package/dist/commonjs/models/invoice.js.map +1 -1
  81. package/dist/commonjs/models/invoicepaymentlinkerrorcode.d.ts +17 -0
  82. package/dist/commonjs/models/invoicepaymentlinkerrorcode.d.ts.map +1 -0
  83. package/dist/commonjs/models/invoicepaymentlinkerrorcode.js +51 -0
  84. package/dist/commonjs/models/invoicepaymentlinkerrorcode.js.map +1 -0
  85. package/dist/commonjs/models/invoicepaymentmethod.d.ts +16 -0
  86. package/dist/commonjs/models/invoicepaymentmethod.d.ts.map +1 -0
  87. package/dist/commonjs/models/invoicepaymentmethod.js +50 -0
  88. package/dist/commonjs/models/invoicepaymentmethod.js.map +1 -0
  89. package/dist/commonjs/models/invoicepaymentprovider.d.ts +16 -0
  90. package/dist/commonjs/models/invoicepaymentprovider.d.ts.map +1 -0
  91. package/dist/commonjs/models/invoicepaymentprovider.js +50 -0
  92. package/dist/commonjs/models/invoicepaymentprovider.js.map +1 -0
  93. package/dist/commonjs/models/merchantreset.d.ts +41 -0
  94. package/dist/commonjs/models/merchantreset.d.ts.map +1 -0
  95. package/dist/commonjs/models/merchantreset.js +68 -0
  96. package/dist/commonjs/models/merchantreset.js.map +1 -0
  97. package/dist/commonjs/models/migratesubscriptionversionrequest.d.ts +37 -0
  98. package/dist/commonjs/models/migratesubscriptionversionrequest.d.ts.map +1 -0
  99. package/dist/commonjs/models/migratesubscriptionversionrequest.js +60 -0
  100. package/dist/commonjs/models/migratesubscriptionversionrequest.js.map +1 -0
  101. package/dist/commonjs/models/migratesubscriptionversionresponse.d.ts +47 -0
  102. package/dist/commonjs/models/migratesubscriptionversionresponse.d.ts.map +1 -0
  103. package/dist/commonjs/models/migratesubscriptionversionresponse.js +73 -0
  104. package/dist/commonjs/models/migratesubscriptionversionresponse.js.map +1 -0
  105. package/dist/commonjs/models/operations/createplan.d.ts +5 -0
  106. package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
  107. package/dist/commonjs/models/operations/createplan.js +1 -0
  108. package/dist/commonjs/models/operations/createplan.js.map +1 -1
  109. package/dist/commonjs/models/operations/createsubscription.d.ts +5 -0
  110. package/dist/commonjs/models/operations/createsubscription.d.ts.map +1 -1
  111. package/dist/commonjs/models/operations/createsubscription.js +1 -0
  112. package/dist/commonjs/models/operations/createsubscription.js.map +1 -1
  113. package/dist/commonjs/models/operations/createwebhooks.d.ts +15 -0
  114. package/dist/commonjs/models/operations/createwebhooks.d.ts.map +1 -0
  115. package/dist/commonjs/models/operations/createwebhooks.js +49 -0
  116. package/dist/commonjs/models/operations/createwebhooks.js.map +1 -0
  117. package/dist/commonjs/models/operations/deletewebhooks.d.ts +15 -0
  118. package/dist/commonjs/models/operations/deletewebhooks.d.ts.map +1 -0
  119. package/dist/commonjs/models/operations/deletewebhooks.js +49 -0
  120. package/dist/commonjs/models/operations/deletewebhooks.js.map +1 -0
  121. package/dist/commonjs/models/operations/getwebhookportal.d.ts +15 -0
  122. package/dist/commonjs/models/operations/getwebhookportal.d.ts.map +1 -0
  123. package/dist/commonjs/models/operations/getwebhookportal.js +49 -0
  124. package/dist/commonjs/models/operations/getwebhookportal.js.map +1 -0
  125. package/dist/commonjs/models/operations/getwebhooks.d.ts +15 -0
  126. package/dist/commonjs/models/operations/getwebhooks.d.ts.map +1 -0
  127. package/dist/commonjs/models/operations/getwebhooks.js +49 -0
  128. package/dist/commonjs/models/operations/getwebhooks.js.map +1 -0
  129. package/dist/commonjs/models/operations/index.d.ts +10 -0
  130. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  131. package/dist/commonjs/models/operations/index.js +10 -0
  132. package/dist/commonjs/models/operations/index.js.map +1 -1
  133. package/dist/commonjs/models/operations/listprojectedinvoices.d.ts +59 -0
  134. package/dist/commonjs/models/operations/listprojectedinvoices.d.ts.map +1 -0
  135. package/dist/commonjs/models/operations/listprojectedinvoices.js +70 -0
  136. package/dist/commonjs/models/operations/listprojectedinvoices.js.map +1 -0
  137. package/dist/commonjs/models/operations/migratesubscriptionversion.d.ts +18 -0
  138. package/dist/commonjs/models/operations/migratesubscriptionversion.d.ts.map +1 -0
  139. package/dist/commonjs/models/operations/migratesubscriptionversion.js +56 -0
  140. package/dist/commonjs/models/operations/migratesubscriptionversion.js.map +1 -0
  141. package/dist/commonjs/models/operations/recordinvoicepayment.d.ts +45 -0
  142. package/dist/commonjs/models/operations/recordinvoicepayment.d.ts.map +1 -0
  143. package/dist/commonjs/models/operations/recordinvoicepayment.js +75 -0
  144. package/dist/commonjs/models/operations/recordinvoicepayment.js.map +1 -0
  145. package/dist/commonjs/models/operations/resetmerchant.d.ts +15 -0
  146. package/dist/commonjs/models/operations/resetmerchant.d.ts.map +1 -0
  147. package/dist/commonjs/models/operations/resetmerchant.js +56 -0
  148. package/dist/commonjs/models/operations/resetmerchant.js.map +1 -0
  149. package/dist/commonjs/models/operations/retryinvoicepayment.d.ts +30 -0
  150. package/dist/commonjs/models/operations/retryinvoicepayment.d.ts.map +1 -0
  151. package/dist/commonjs/models/operations/retryinvoicepayment.js +64 -0
  152. package/dist/commonjs/models/operations/retryinvoicepayment.js.map +1 -0
  153. package/dist/commonjs/models/operations/updateplan.d.ts +5 -0
  154. package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
  155. package/dist/commonjs/models/operations/updateplan.js +1 -0
  156. package/dist/commonjs/models/operations/updateplan.js.map +1 -1
  157. package/dist/commonjs/models/operations/updatewebhooks.d.ts +30 -0
  158. package/dist/commonjs/models/operations/updatewebhooks.d.ts.map +1 -0
  159. package/dist/commonjs/models/operations/updatewebhooks.js +63 -0
  160. package/dist/commonjs/models/operations/updatewebhooks.js.map +1 -0
  161. package/dist/commonjs/models/outofbandpaymentresult.d.ts +15 -0
  162. package/dist/commonjs/models/outofbandpaymentresult.d.ts.map +1 -0
  163. package/dist/commonjs/models/outofbandpaymentresult.js +52 -0
  164. package/dist/commonjs/models/outofbandpaymentresult.js.map +1 -0
  165. package/dist/commonjs/models/plan.d.ts +5 -0
  166. package/dist/commonjs/models/plan.d.ts.map +1 -1
  167. package/dist/commonjs/models/plan.js +2 -0
  168. package/dist/commonjs/models/plan.js.map +1 -1
  169. package/dist/commonjs/models/profitabilityrow.d.ts +23 -4
  170. package/dist/commonjs/models/profitabilityrow.d.ts.map +1 -1
  171. package/dist/commonjs/models/profitabilityrow.js +13 -1
  172. package/dist/commonjs/models/profitabilityrow.js.map +1 -1
  173. package/dist/commonjs/models/profitabilitysummaryresponse.d.ts +1 -1
  174. package/dist/commonjs/models/retrypaymenterror.d.ts +28 -0
  175. package/dist/commonjs/models/retrypaymenterror.d.ts.map +1 -0
  176. package/dist/commonjs/models/retrypaymenterror.js +53 -0
  177. package/dist/commonjs/models/retrypaymenterror.js.map +1 -0
  178. package/dist/commonjs/models/retrypaymentresponse.d.ts +46 -0
  179. package/dist/commonjs/models/retrypaymentresponse.d.ts.map +1 -0
  180. package/dist/commonjs/models/retrypaymentresponse.js +63 -0
  181. package/dist/commonjs/models/retrypaymentresponse.js.map +1 -0
  182. package/dist/commonjs/models/revenuesummaryresponse.d.ts +1 -1
  183. package/dist/commonjs/models/revenuetrendbucket.d.ts +6 -2
  184. package/dist/commonjs/models/revenuetrendbucket.d.ts.map +1 -1
  185. package/dist/commonjs/models/revenuetrendbucket.js +1 -0
  186. package/dist/commonjs/models/revenuetrendbucket.js.map +1 -1
  187. package/dist/commonjs/models/subscription.d.ts +29 -0
  188. package/dist/commonjs/models/subscription.d.ts.map +1 -1
  189. package/dist/commonjs/models/subscription.js +14 -1
  190. package/dist/commonjs/models/subscription.js.map +1 -1
  191. package/dist/commonjs/models/subscriptionintervaladdop.d.ts +1 -1
  192. package/dist/commonjs/models/versiontransition.d.ts +58 -0
  193. package/dist/commonjs/models/versiontransition.d.ts.map +1 -0
  194. package/dist/commonjs/models/versiontransition.js +82 -0
  195. package/dist/commonjs/models/versiontransition.js.map +1 -0
  196. package/dist/commonjs/models/webhookportal.d.ts +34 -0
  197. package/dist/commonjs/models/webhookportal.d.ts.map +1 -0
  198. package/dist/commonjs/models/webhookportal.js +60 -0
  199. package/dist/commonjs/models/webhookportal.js.map +1 -0
  200. package/dist/commonjs/models/webhooks.d.ts +46 -0
  201. package/dist/commonjs/models/webhooks.d.ts.map +1 -0
  202. package/dist/commonjs/models/webhooks.js +63 -0
  203. package/dist/commonjs/models/webhooks.js.map +1 -0
  204. package/dist/commonjs/sdk/invoicesv2.d.ts +51 -0
  205. package/dist/commonjs/sdk/invoicesv2.d.ts.map +1 -1
  206. package/dist/commonjs/sdk/invoicesv2.js +60 -0
  207. package/dist/commonjs/sdk/invoicesv2.js.map +1 -1
  208. package/dist/commonjs/sdk/merchants.d.ts +16 -0
  209. package/dist/commonjs/sdk/merchants.d.ts.map +1 -0
  210. package/dist/commonjs/sdk/merchants.js +26 -0
  211. package/dist/commonjs/sdk/merchants.js.map +1 -0
  212. package/dist/commonjs/sdk/profitability.d.ts +1 -1
  213. package/dist/commonjs/sdk/profitability.js +1 -1
  214. package/dist/commonjs/sdk/revenue.d.ts +1 -1
  215. package/dist/commonjs/sdk/revenue.js +1 -1
  216. package/dist/commonjs/sdk/sdk.d.ts +6 -0
  217. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  218. package/dist/commonjs/sdk/sdk.js +8 -0
  219. package/dist/commonjs/sdk/sdk.js.map +1 -1
  220. package/dist/commonjs/sdk/subscriptions.d.ts +7 -0
  221. package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
  222. package/dist/commonjs/sdk/subscriptions.js +10 -0
  223. package/dist/commonjs/sdk/subscriptions.js.map +1 -1
  224. package/dist/commonjs/sdk/webhooks.d.ts +41 -0
  225. package/dist/commonjs/sdk/webhooks.d.ts.map +1 -0
  226. package/dist/commonjs/sdk/webhooks.js +62 -0
  227. package/dist/commonjs/sdk/webhooks.js.map +1 -0
  228. package/dist/esm/funcs/invoicesV2ListProjectedInvoices.d.ts +18 -0
  229. package/dist/esm/funcs/invoicesV2ListProjectedInvoices.d.ts.map +1 -0
  230. package/dist/esm/funcs/invoicesV2ListProjectedInvoices.js +89 -0
  231. package/dist/esm/funcs/invoicesV2ListProjectedInvoices.js.map +1 -0
  232. package/dist/esm/funcs/invoicesV2RecordInvoicePayment.d.ts +27 -0
  233. package/dist/esm/funcs/invoicesV2RecordInvoicePayment.d.ts.map +1 -0
  234. package/dist/esm/funcs/invoicesV2RecordInvoicePayment.js +97 -0
  235. package/dist/esm/funcs/invoicesV2RecordInvoicePayment.js.map +1 -0
  236. package/dist/esm/funcs/invoicesV2RetryInvoicePayment.d.ts +40 -0
  237. package/dist/esm/funcs/invoicesV2RetryInvoicePayment.d.ts.map +1 -0
  238. package/dist/esm/funcs/invoicesV2RetryInvoicePayment.js +121 -0
  239. package/dist/esm/funcs/invoicesV2RetryInvoicePayment.js.map +1 -0
  240. package/dist/esm/funcs/merchantsReset.d.ts +22 -0
  241. package/dist/esm/funcs/merchantsReset.d.ts.map +1 -0
  242. package/dist/esm/funcs/merchantsReset.js +93 -0
  243. package/dist/esm/funcs/merchantsReset.js.map +1 -0
  244. package/dist/esm/funcs/profitabilityGetProfitability.d.ts +1 -1
  245. package/dist/esm/funcs/profitabilityGetProfitability.js +1 -1
  246. package/dist/esm/funcs/revenueGet.d.ts +1 -1
  247. package/dist/esm/funcs/revenueGet.js +1 -1
  248. package/dist/esm/funcs/subscriptionsMigrateSubscriptionVersion.d.ts +19 -0
  249. package/dist/esm/funcs/subscriptionsMigrateSubscriptionVersion.d.ts.map +1 -0
  250. package/dist/esm/funcs/subscriptionsMigrateSubscriptionVersion.js +91 -0
  251. package/dist/esm/funcs/subscriptionsMigrateSubscriptionVersion.js.map +1 -0
  252. package/dist/esm/funcs/webhooksDisable.d.ts +18 -0
  253. package/dist/esm/funcs/webhooksDisable.d.ts.map +1 -0
  254. package/dist/esm/funcs/webhooksDisable.js +86 -0
  255. package/dist/esm/funcs/webhooksDisable.js.map +1 -0
  256. package/dist/esm/funcs/webhooksEnable.d.ts +19 -0
  257. package/dist/esm/funcs/webhooksEnable.d.ts.map +1 -0
  258. package/dist/esm/funcs/webhooksEnable.js +86 -0
  259. package/dist/esm/funcs/webhooksEnable.js.map +1 -0
  260. package/dist/esm/funcs/webhooksGet.d.ts +19 -0
  261. package/dist/esm/funcs/webhooksGet.d.ts.map +1 -0
  262. package/dist/esm/funcs/webhooksGet.js +86 -0
  263. package/dist/esm/funcs/webhooksGet.js.map +1 -0
  264. package/dist/esm/funcs/webhooksGetPortal.d.ts +19 -0
  265. package/dist/esm/funcs/webhooksGetPortal.d.ts.map +1 -0
  266. package/dist/esm/funcs/webhooksGetPortal.js +86 -0
  267. package/dist/esm/funcs/webhooksGetPortal.js.map +1 -0
  268. package/dist/esm/funcs/webhooksUpdate.d.ts +19 -0
  269. package/dist/esm/funcs/webhooksUpdate.d.ts.map +1 -0
  270. package/dist/esm/funcs/webhooksUpdate.js +87 -0
  271. package/dist/esm/funcs/webhooksUpdate.js.map +1 -0
  272. package/dist/esm/lib/config.d.ts +2 -2
  273. package/dist/esm/lib/config.js +2 -2
  274. package/dist/esm/models/currencybreakdownentry.d.ts +1 -1
  275. package/dist/esm/models/elapsedperiodbilling.d.ts +16 -0
  276. package/dist/esm/models/elapsedperiodbilling.d.ts.map +1 -0
  277. package/dist/esm/models/elapsedperiodbilling.js +14 -0
  278. package/dist/esm/models/elapsedperiodbilling.js.map +1 -0
  279. package/dist/esm/models/errors/index.d.ts +2 -0
  280. package/dist/esm/models/errors/index.d.ts.map +1 -1
  281. package/dist/esm/models/errors/index.js +2 -0
  282. package/dist/esm/models/errors/index.js.map +1 -1
  283. package/dist/esm/models/errors/recordinvoicepayment.d.ts +55 -0
  284. package/dist/esm/models/errors/recordinvoicepayment.d.ts.map +1 -0
  285. package/dist/esm/models/errors/recordinvoicepayment.js +39 -0
  286. package/dist/esm/models/errors/recordinvoicepayment.js.map +1 -0
  287. package/dist/esm/models/errors/retrypaymentresponseerror.d.ts +63 -0
  288. package/dist/esm/models/errors/retrypaymentresponseerror.d.ts.map +1 -0
  289. package/dist/esm/models/errors/retrypaymentresponseerror.js +44 -0
  290. package/dist/esm/models/errors/retrypaymentresponseerror.js.map +1 -0
  291. package/dist/esm/models/grouptrendentry.d.ts +5 -1
  292. package/dist/esm/models/grouptrendentry.d.ts.map +1 -1
  293. package/dist/esm/models/grouptrendentry.js +1 -0
  294. package/dist/esm/models/grouptrendentry.js.map +1 -1
  295. package/dist/esm/models/hostedlinkpaymentresult.d.ts +28 -0
  296. package/dist/esm/models/hostedlinkpaymentresult.d.ts.map +1 -0
  297. package/dist/esm/models/hostedlinkpaymentresult.js +19 -0
  298. package/dist/esm/models/hostedlinkpaymentresult.js.map +1 -0
  299. package/dist/esm/models/index.d.ts +14 -0
  300. package/dist/esm/models/index.d.ts.map +1 -1
  301. package/dist/esm/models/index.js +14 -0
  302. package/dist/esm/models/index.js.map +1 -1
  303. package/dist/esm/models/invoice.d.ts +7 -6
  304. package/dist/esm/models/invoice.d.ts.map +1 -1
  305. package/dist/esm/models/invoice.js +3 -2
  306. package/dist/esm/models/invoice.js.map +1 -1
  307. package/dist/esm/models/invoicepaymentlinkerrorcode.d.ts +17 -0
  308. package/dist/esm/models/invoicepaymentlinkerrorcode.d.ts.map +1 -0
  309. package/dist/esm/models/invoicepaymentlinkerrorcode.js +15 -0
  310. package/dist/esm/models/invoicepaymentlinkerrorcode.js.map +1 -0
  311. package/dist/esm/models/invoicepaymentmethod.d.ts +16 -0
  312. package/dist/esm/models/invoicepaymentmethod.d.ts.map +1 -0
  313. package/dist/esm/models/invoicepaymentmethod.js +14 -0
  314. package/dist/esm/models/invoicepaymentmethod.js.map +1 -0
  315. package/dist/esm/models/invoicepaymentprovider.d.ts +16 -0
  316. package/dist/esm/models/invoicepaymentprovider.d.ts.map +1 -0
  317. package/dist/esm/models/invoicepaymentprovider.js +14 -0
  318. package/dist/esm/models/invoicepaymentprovider.js.map +1 -0
  319. package/dist/esm/models/merchantreset.d.ts +41 -0
  320. package/dist/esm/models/merchantreset.d.ts.map +1 -0
  321. package/dist/esm/models/merchantreset.js +29 -0
  322. package/dist/esm/models/merchantreset.js.map +1 -0
  323. package/dist/esm/models/migratesubscriptionversionrequest.d.ts +37 -0
  324. package/dist/esm/models/migratesubscriptionversionrequest.d.ts.map +1 -0
  325. package/dist/esm/models/migratesubscriptionversionrequest.js +23 -0
  326. package/dist/esm/models/migratesubscriptionversionrequest.js.map +1 -0
  327. package/dist/esm/models/migratesubscriptionversionresponse.d.ts +47 -0
  328. package/dist/esm/models/migratesubscriptionversionresponse.d.ts.map +1 -0
  329. package/dist/esm/models/migratesubscriptionversionresponse.js +34 -0
  330. package/dist/esm/models/migratesubscriptionversionresponse.js.map +1 -0
  331. package/dist/esm/models/operations/createplan.d.ts +5 -0
  332. package/dist/esm/models/operations/createplan.d.ts.map +1 -1
  333. package/dist/esm/models/operations/createplan.js +1 -0
  334. package/dist/esm/models/operations/createplan.js.map +1 -1
  335. package/dist/esm/models/operations/createsubscription.d.ts +5 -0
  336. package/dist/esm/models/operations/createsubscription.d.ts.map +1 -1
  337. package/dist/esm/models/operations/createsubscription.js +1 -0
  338. package/dist/esm/models/operations/createsubscription.js.map +1 -1
  339. package/dist/esm/models/operations/createwebhooks.d.ts +15 -0
  340. package/dist/esm/models/operations/createwebhooks.d.ts.map +1 -0
  341. package/dist/esm/models/operations/createwebhooks.js +12 -0
  342. package/dist/esm/models/operations/createwebhooks.js.map +1 -0
  343. package/dist/esm/models/operations/deletewebhooks.d.ts +15 -0
  344. package/dist/esm/models/operations/deletewebhooks.d.ts.map +1 -0
  345. package/dist/esm/models/operations/deletewebhooks.js +12 -0
  346. package/dist/esm/models/operations/deletewebhooks.js.map +1 -0
  347. package/dist/esm/models/operations/getwebhookportal.d.ts +15 -0
  348. package/dist/esm/models/operations/getwebhookportal.d.ts.map +1 -0
  349. package/dist/esm/models/operations/getwebhookportal.js +12 -0
  350. package/dist/esm/models/operations/getwebhookportal.js.map +1 -0
  351. package/dist/esm/models/operations/getwebhooks.d.ts +15 -0
  352. package/dist/esm/models/operations/getwebhooks.d.ts.map +1 -0
  353. package/dist/esm/models/operations/getwebhooks.js +12 -0
  354. package/dist/esm/models/operations/getwebhooks.js.map +1 -0
  355. package/dist/esm/models/operations/index.d.ts +10 -0
  356. package/dist/esm/models/operations/index.d.ts.map +1 -1
  357. package/dist/esm/models/operations/index.js +10 -0
  358. package/dist/esm/models/operations/index.js.map +1 -1
  359. package/dist/esm/models/operations/listprojectedinvoices.d.ts +59 -0
  360. package/dist/esm/models/operations/listprojectedinvoices.d.ts.map +1 -0
  361. package/dist/esm/models/operations/listprojectedinvoices.js +32 -0
  362. package/dist/esm/models/operations/listprojectedinvoices.js.map +1 -0
  363. package/dist/esm/models/operations/migratesubscriptionversion.d.ts +18 -0
  364. package/dist/esm/models/operations/migratesubscriptionversion.d.ts.map +1 -0
  365. package/dist/esm/models/operations/migratesubscriptionversion.js +19 -0
  366. package/dist/esm/models/operations/migratesubscriptionversion.js.map +1 -0
  367. package/dist/esm/models/operations/recordinvoicepayment.d.ts +45 -0
  368. package/dist/esm/models/operations/recordinvoicepayment.d.ts.map +1 -0
  369. package/dist/esm/models/operations/recordinvoicepayment.js +36 -0
  370. package/dist/esm/models/operations/recordinvoicepayment.js.map +1 -0
  371. package/dist/esm/models/operations/resetmerchant.d.ts +15 -0
  372. package/dist/esm/models/operations/resetmerchant.d.ts.map +1 -0
  373. package/dist/esm/models/operations/resetmerchant.js +19 -0
  374. package/dist/esm/models/operations/resetmerchant.js.map +1 -0
  375. package/dist/esm/models/operations/retryinvoicepayment.d.ts +30 -0
  376. package/dist/esm/models/operations/retryinvoicepayment.d.ts.map +1 -0
  377. package/dist/esm/models/operations/retryinvoicepayment.js +26 -0
  378. package/dist/esm/models/operations/retryinvoicepayment.js.map +1 -0
  379. package/dist/esm/models/operations/updateplan.d.ts +5 -0
  380. package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
  381. package/dist/esm/models/operations/updateplan.js +1 -0
  382. package/dist/esm/models/operations/updateplan.js.map +1 -1
  383. package/dist/esm/models/operations/updatewebhooks.d.ts +30 -0
  384. package/dist/esm/models/operations/updatewebhooks.d.ts.map +1 -0
  385. package/dist/esm/models/operations/updatewebhooks.js +25 -0
  386. package/dist/esm/models/operations/updatewebhooks.js.map +1 -0
  387. package/dist/esm/models/outofbandpaymentresult.d.ts +15 -0
  388. package/dist/esm/models/outofbandpaymentresult.d.ts.map +1 -0
  389. package/dist/esm/models/outofbandpaymentresult.js +15 -0
  390. package/dist/esm/models/outofbandpaymentresult.js.map +1 -0
  391. package/dist/esm/models/plan.d.ts +5 -0
  392. package/dist/esm/models/plan.d.ts.map +1 -1
  393. package/dist/esm/models/plan.js +2 -0
  394. package/dist/esm/models/plan.js.map +1 -1
  395. package/dist/esm/models/profitabilityrow.d.ts +23 -4
  396. package/dist/esm/models/profitabilityrow.d.ts.map +1 -1
  397. package/dist/esm/models/profitabilityrow.js +12 -0
  398. package/dist/esm/models/profitabilityrow.js.map +1 -1
  399. package/dist/esm/models/profitabilitysummaryresponse.d.ts +1 -1
  400. package/dist/esm/models/retrypaymenterror.d.ts +28 -0
  401. package/dist/esm/models/retrypaymenterror.d.ts.map +1 -0
  402. package/dist/esm/models/retrypaymenterror.js +16 -0
  403. package/dist/esm/models/retrypaymenterror.js.map +1 -0
  404. package/dist/esm/models/retrypaymentresponse.d.ts +46 -0
  405. package/dist/esm/models/retrypaymentresponse.d.ts.map +1 -0
  406. package/dist/esm/models/retrypaymentresponse.js +26 -0
  407. package/dist/esm/models/retrypaymentresponse.js.map +1 -0
  408. package/dist/esm/models/revenuesummaryresponse.d.ts +1 -1
  409. package/dist/esm/models/revenuetrendbucket.d.ts +6 -2
  410. package/dist/esm/models/revenuetrendbucket.d.ts.map +1 -1
  411. package/dist/esm/models/revenuetrendbucket.js +1 -0
  412. package/dist/esm/models/revenuetrendbucket.js.map +1 -1
  413. package/dist/esm/models/subscription.d.ts +29 -0
  414. package/dist/esm/models/subscription.d.ts.map +1 -1
  415. package/dist/esm/models/subscription.js +13 -0
  416. package/dist/esm/models/subscription.js.map +1 -1
  417. package/dist/esm/models/subscriptionintervaladdop.d.ts +1 -1
  418. package/dist/esm/models/versiontransition.d.ts +58 -0
  419. package/dist/esm/models/versiontransition.d.ts.map +1 -0
  420. package/dist/esm/models/versiontransition.js +44 -0
  421. package/dist/esm/models/versiontransition.js.map +1 -0
  422. package/dist/esm/models/webhookportal.d.ts +34 -0
  423. package/dist/esm/models/webhookportal.d.ts.map +1 -0
  424. package/dist/esm/models/webhookportal.js +23 -0
  425. package/dist/esm/models/webhookportal.js.map +1 -0
  426. package/dist/esm/models/webhooks.d.ts +46 -0
  427. package/dist/esm/models/webhooks.d.ts.map +1 -0
  428. package/dist/esm/models/webhooks.js +26 -0
  429. package/dist/esm/models/webhooks.js.map +1 -0
  430. package/dist/esm/sdk/invoicesv2.d.ts +51 -0
  431. package/dist/esm/sdk/invoicesv2.d.ts.map +1 -1
  432. package/dist/esm/sdk/invoicesv2.js +60 -0
  433. package/dist/esm/sdk/invoicesv2.js.map +1 -1
  434. package/dist/esm/sdk/merchants.d.ts +16 -0
  435. package/dist/esm/sdk/merchants.d.ts.map +1 -0
  436. package/dist/esm/sdk/merchants.js +22 -0
  437. package/dist/esm/sdk/merchants.js.map +1 -0
  438. package/dist/esm/sdk/profitability.d.ts +1 -1
  439. package/dist/esm/sdk/profitability.js +1 -1
  440. package/dist/esm/sdk/revenue.d.ts +1 -1
  441. package/dist/esm/sdk/revenue.js +1 -1
  442. package/dist/esm/sdk/sdk.d.ts +6 -0
  443. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  444. package/dist/esm/sdk/sdk.js +8 -0
  445. package/dist/esm/sdk/sdk.js.map +1 -1
  446. package/dist/esm/sdk/subscriptions.d.ts +7 -0
  447. package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
  448. package/dist/esm/sdk/subscriptions.js +10 -0
  449. package/dist/esm/sdk/subscriptions.js.map +1 -1
  450. package/dist/esm/sdk/webhooks.d.ts +41 -0
  451. package/dist/esm/sdk/webhooks.d.ts.map +1 -0
  452. package/dist/esm/sdk/webhooks.js +58 -0
  453. package/dist/esm/sdk/webhooks.js.map +1 -0
  454. package/jsr.json +1 -1
  455. package/package.json +1 -1
  456. package/src/funcs/invoicesV2ListProjectedInvoices.ts +183 -0
  457. package/src/funcs/invoicesV2RecordInvoicePayment.ts +194 -0
  458. package/src/funcs/invoicesV2RetryInvoicePayment.ts +219 -0
  459. package/src/funcs/merchantsReset.ts +185 -0
  460. package/src/funcs/profitabilityGetProfitability.ts +1 -1
  461. package/src/funcs/revenueGet.ts +1 -1
  462. package/src/funcs/subscriptionsMigrateSubscriptionVersion.ts +186 -0
  463. package/src/funcs/webhooksDisable.ts +175 -0
  464. package/src/funcs/webhooksEnable.ts +179 -0
  465. package/src/funcs/webhooksGet.ts +175 -0
  466. package/src/funcs/webhooksGetPortal.ts +175 -0
  467. package/src/funcs/webhooksUpdate.ts +179 -0
  468. package/src/lib/config.ts +2 -2
  469. package/src/models/currencybreakdownentry.ts +1 -1
  470. package/src/models/elapsedperiodbilling.ts +23 -0
  471. package/src/models/errors/index.ts +2 -0
  472. package/src/models/errors/recordinvoicepayment.ts +86 -0
  473. package/src/models/errors/retrypaymentresponseerror.ts +102 -0
  474. package/src/models/grouptrendentry.ts +6 -1
  475. package/src/models/hostedlinkpaymentresult.ts +56 -0
  476. package/src/models/index.ts +14 -0
  477. package/src/models/invoice.ts +7 -6
  478. package/src/models/invoicepaymentlinkerrorcode.ts +26 -0
  479. package/src/models/invoicepaymentmethod.ts +23 -0
  480. package/src/models/invoicepaymentprovider.ts +23 -0
  481. package/src/models/merchantreset.ts +85 -0
  482. package/src/models/migratesubscriptionversionrequest.ts +62 -0
  483. package/src/models/migratesubscriptionversionresponse.ts +122 -0
  484. package/src/models/operations/createplan.ts +6 -0
  485. package/src/models/operations/createsubscription.ts +8 -0
  486. package/src/models/operations/createwebhooks.ts +34 -0
  487. package/src/models/operations/deletewebhooks.ts +34 -0
  488. package/src/models/operations/getwebhookportal.ts +34 -0
  489. package/src/models/operations/getwebhooks.ts +34 -0
  490. package/src/models/operations/index.ts +10 -0
  491. package/src/models/operations/listprojectedinvoices.ts +110 -0
  492. package/src/models/operations/migratesubscriptionversion.ts +47 -0
  493. package/src/models/operations/recordinvoicepayment.ts +112 -0
  494. package/src/models/operations/resetmerchant.ts +40 -0
  495. package/src/models/operations/retryinvoicepayment.ts +74 -0
  496. package/src/models/operations/updateplan.ts +6 -0
  497. package/src/models/operations/updatewebhooks.ts +71 -0
  498. package/src/models/outofbandpaymentresult.ts +37 -0
  499. package/src/models/plan.ts +9 -0
  500. package/src/models/profitabilityrow.ts +27 -4
  501. package/src/models/profitabilitysummaryresponse.ts +1 -1
  502. package/src/models/retrypaymenterror.ts +52 -0
  503. package/src/models/retrypaymentresponse.ts +80 -0
  504. package/src/models/revenuesummaryresponse.ts +1 -1
  505. package/src/models/revenuetrendbucket.ts +7 -2
  506. package/src/models/subscription.ts +45 -0
  507. package/src/models/subscriptionintervaladdop.ts +1 -1
  508. package/src/models/versiontransition.ts +104 -0
  509. package/src/models/webhookportal.ts +61 -0
  510. package/src/models/webhooks.ts +76 -0
  511. package/src/sdk/invoicesv2.ts +84 -0
  512. package/src/sdk/merchants.ts +31 -0
  513. package/src/sdk/profitability.ts +1 -1
  514. package/src/sdk/revenue.ts +1 -1
  515. package/src/sdk/sdk.ts +12 -0
  516. package/src/sdk/subscriptions.ts +18 -0
  517. package/src/sdk/webhooks.ts +100 -0
@@ -0,0 +1,219 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { PaygenticCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { PaygenticError } from "../models/errors/paygenticerror.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as models from "../models/index.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Retry Payment
31
+ *
32
+ * @remarks
33
+ * Charge the customer's saved payment method again for an unpaid invoice.
34
+ *
35
+ * The invoice must be in status `ISSUED` or `PAYMENT_FAILED`, auto-charge must be on for its subscription, and the invoice must have a payment session. If not, the response is 400.
36
+ *
37
+ * The response status tells you the result. Only 200 means that the charge succeeded. Every other response from this operation that has a `retry_payment_result` body has `success: false`, and `error.code` gives the reason:
38
+ *
39
+ * | Status | `error.code` | Meaning |
40
+ * | --- | --- | --- |
41
+ * | 200 | — | The charge succeeded, the provider had already collected it, or no amount is unpaid. |
42
+ * | 202 | `processing` | The provider accepted the charge. It settles later (for example, a bank debit). |
43
+ * | 402 | a decline code, for example `card_declined`, `insufficient_funds`, `do_not_honor`, `authentication_required` | The provider declined the payment method. |
44
+ * | 409 | `concurrent_attempt` | Another payment attempt for this invoice is in progress. |
45
+ * | 409 | `PAYMENT_SESSION_EXPIRED` | The payment link expired (after 30 days). Create a new link with `POST /v2/invoices/{id}/payment` and `method: hosted_link`, then retry. If the customer also has no usable saved payment method, the response is 422 instead. |
46
+ * | 409 | another value, or no `code` | The payment session cannot be charged in its current state (for example `session_unusable`, `non_confirmable`, `PAYMENT_PROCESSING`, `PAYMENT_ALREADY_COMPLETED`). Read `error.message` for the cause. |
47
+ * | 422 | `no_payment_method` | The customer has no usable saved payment method. Send a payment link instead. |
48
+ * | 502 | `provider_unavailable` or none | The payment provider did not answer, or the provider failed the charge for a reason that is not known. Retry later. |
49
+ *
50
+ * A 500 response has the standard error body, not `retry_payment_result`. It is an internal error, and a retry does not fix it.
51
+ *
52
+ * An invoice that does not exist returns 403, the same as an invoice of another merchant.
53
+ *
54
+ * This operation is rate limited to one call each minute for each invoice.
55
+ */
56
+ export function invoicesV2RetryInvoicePayment(
57
+ client: PaygenticCore,
58
+ request: operations.RetryInvoicePaymentRequest,
59
+ options?: RequestOptions,
60
+ ): APIPromise<
61
+ Result<
62
+ models.RetryPaymentResponse,
63
+ | errors.BadRequest
64
+ | errors.RetryPaymentResponseError
65
+ | errors.ErrorT
66
+ | PaygenticError
67
+ | ResponseValidationError
68
+ | ConnectionError
69
+ | RequestAbortedError
70
+ | RequestTimeoutError
71
+ | InvalidRequestError
72
+ | UnexpectedClientError
73
+ | SDKValidationError
74
+ >
75
+ > {
76
+ return new APIPromise($do(
77
+ client,
78
+ request,
79
+ options,
80
+ ));
81
+ }
82
+
83
+ async function $do(
84
+ client: PaygenticCore,
85
+ request: operations.RetryInvoicePaymentRequest,
86
+ options?: RequestOptions,
87
+ ): Promise<
88
+ [
89
+ Result<
90
+ models.RetryPaymentResponse,
91
+ | errors.BadRequest
92
+ | errors.RetryPaymentResponseError
93
+ | errors.ErrorT
94
+ | PaygenticError
95
+ | ResponseValidationError
96
+ | ConnectionError
97
+ | RequestAbortedError
98
+ | RequestTimeoutError
99
+ | InvalidRequestError
100
+ | UnexpectedClientError
101
+ | SDKValidationError
102
+ >,
103
+ APICall,
104
+ ]
105
+ > {
106
+ const parsed = safeParse(
107
+ request,
108
+ (value) =>
109
+ operations.RetryInvoicePaymentRequest$outboundSchema.parse(value),
110
+ "Input validation failed",
111
+ );
112
+ if (!parsed.ok) {
113
+ return [parsed, { status: "invalid" }];
114
+ }
115
+ const payload = parsed.value;
116
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
117
+
118
+ const pathParams = {
119
+ id: encodeSimple("id", payload.id, {
120
+ explode: false,
121
+ charEncoding: "percent",
122
+ }),
123
+ };
124
+ const path = pathToFunc("/v2/invoices/{id}/retryPayment")(pathParams);
125
+
126
+ const headers = new Headers(compactMap({
127
+ "Content-Type": "application/json",
128
+ Accept: "application/json",
129
+ }));
130
+
131
+ const secConfig = await extractSecurity(client._options.bearerAuth);
132
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
133
+ const requestSecurity = resolveGlobalSecurity(securityInput);
134
+
135
+ const context = {
136
+ options: client._options,
137
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
138
+ operationID: "retryInvoicePayment",
139
+ oAuth2Scopes: null,
140
+
141
+ resolvedSecurity: requestSecurity,
142
+
143
+ securitySource: client._options.bearerAuth,
144
+ retryConfig: options?.retries
145
+ || client._options.retryConfig
146
+ || { strategy: "none" },
147
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
148
+ };
149
+
150
+ const requestRes = client._createRequest(context, {
151
+ security: requestSecurity,
152
+ method: "POST",
153
+ baseURL: options?.serverURL,
154
+ path: path,
155
+ headers: headers,
156
+ body: body,
157
+ userAgent: client._options.userAgent,
158
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
159
+ }, options);
160
+ if (!requestRes.ok) {
161
+ return [requestRes, { status: "invalid" }];
162
+ }
163
+ const req = requestRes.value;
164
+
165
+ const doResult = await client._do(req, {
166
+ context,
167
+ errorCodes: [
168
+ "400",
169
+ "402",
170
+ "403",
171
+ "409",
172
+ "422",
173
+ "429",
174
+ "4XX",
175
+ "500",
176
+ "502",
177
+ "5XX",
178
+ ],
179
+ retryConfig: context.retryConfig,
180
+ retryCodes: context.retryCodes,
181
+ });
182
+ if (!doResult.ok) {
183
+ return [doResult, { status: "request-error", request: req }];
184
+ }
185
+ const response = doResult.value;
186
+
187
+ const responseFields = {
188
+ HttpMeta: { Response: response, Request: req },
189
+ };
190
+
191
+ const [result] = await M.match<
192
+ models.RetryPaymentResponse,
193
+ | errors.BadRequest
194
+ | errors.RetryPaymentResponseError
195
+ | errors.ErrorT
196
+ | PaygenticError
197
+ | ResponseValidationError
198
+ | ConnectionError
199
+ | RequestAbortedError
200
+ | RequestTimeoutError
201
+ | InvalidRequestError
202
+ | UnexpectedClientError
203
+ | SDKValidationError
204
+ >(
205
+ M.json([200, 202], models.RetryPaymentResponse$inboundSchema),
206
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
207
+ M.jsonErr([402, 409, 422], errors.RetryPaymentResponseError$inboundSchema),
208
+ M.jsonErr([403, 429], errors.ErrorT$inboundSchema),
209
+ M.jsonErr(500, errors.ErrorT$inboundSchema),
210
+ M.jsonErr(502, errors.RetryPaymentResponseError$inboundSchema),
211
+ M.fail("4XX"),
212
+ M.fail("5XX"),
213
+ )(response, req, { extraFields: responseFields });
214
+ if (!result.ok) {
215
+ return [result, { status: "complete", request: req, response }];
216
+ }
217
+
218
+ return [result, { status: "complete", request: req, response }];
219
+ }
@@ -0,0 +1,185 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { PaygenticCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { PaygenticError } from "../models/errors/paygenticerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Reset a merchant's data
31
+ *
32
+ * @remarks
33
+ * With `scope: merchant`, deletes the merchant's customers and everything attached to them: subscriptions, invoices, line items, payments, entitlements, grants, orders, test clocks, usage events, invoice documents and, when tax is enabled, the documents in the merchant's Quaderno sandbox account. `keepCatalog: true` keeps the catalog (products, plans, prices, fees, features, billable metrics), and `keepCatalog: false` deletes it too; the merchant's configuration is always kept. With `scope: customer`, deletes one customer and what is attached to it; test clocks and the Quaderno account's documents are kept, since they belong to no single customer.
34
+ *
35
+ * A `204` means every delete is done or scheduled: usage events and Quaderno documents finish in the background, and usage events still being ingested while it runs can survive it. A `502` means a store outside Postgres failed; the customers are already out of the API, and calling again with the same body finishes the reset. Calling again is always safe. While a customer waits for that, its external id is free for a new customer to take; a retry then deletes usage events by customer id only.
36
+ *
37
+ * Not available in production.
38
+ */
39
+ export function merchantsReset(
40
+ client: PaygenticCore,
41
+ request: operations.ResetMerchantRequest,
42
+ options?: RequestOptions,
43
+ ): APIPromise<
44
+ Result<
45
+ void,
46
+ | errors.BadRequest
47
+ | errors.ErrorT
48
+ | PaygenticError
49
+ | ResponseValidationError
50
+ | ConnectionError
51
+ | RequestAbortedError
52
+ | RequestTimeoutError
53
+ | InvalidRequestError
54
+ | UnexpectedClientError
55
+ | SDKValidationError
56
+ >
57
+ > {
58
+ return new APIPromise($do(
59
+ client,
60
+ request,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: PaygenticCore,
67
+ request: operations.ResetMerchantRequest,
68
+ options?: RequestOptions,
69
+ ): Promise<
70
+ [
71
+ Result<
72
+ void,
73
+ | errors.BadRequest
74
+ | errors.ErrorT
75
+ | PaygenticError
76
+ | ResponseValidationError
77
+ | ConnectionError
78
+ | RequestAbortedError
79
+ | RequestTimeoutError
80
+ | InvalidRequestError
81
+ | UnexpectedClientError
82
+ | SDKValidationError
83
+ >,
84
+ APICall,
85
+ ]
86
+ > {
87
+ const parsed = safeParse(
88
+ request,
89
+ (value) => operations.ResetMerchantRequest$outboundSchema.parse(value),
90
+ "Input validation failed",
91
+ );
92
+ if (!parsed.ok) {
93
+ return [parsed, { status: "invalid" }];
94
+ }
95
+ const payload = parsed.value;
96
+ const body = encodeJSON("body", payload.MerchantReset, { explode: true });
97
+
98
+ const pathParams = {
99
+ merchantId: encodeSimple("merchantId", payload.merchantId, {
100
+ explode: false,
101
+ charEncoding: "percent",
102
+ }),
103
+ };
104
+ const path = pathToFunc("/v0/merchants/{merchantId}/reset")(pathParams);
105
+
106
+ const headers = new Headers(compactMap({
107
+ "Content-Type": "application/json",
108
+ Accept: "application/json",
109
+ }));
110
+
111
+ const secConfig = await extractSecurity(client._options.bearerAuth);
112
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
113
+ const requestSecurity = resolveGlobalSecurity(securityInput);
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "resetMerchant",
119
+ oAuth2Scopes: null,
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.bearerAuth,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "POST",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ body: body,
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ errorCodes: ["400", "401", "403", "4XX", "500", "502", "5XX"],
148
+ retryConfig: context.retryConfig,
149
+ retryCodes: context.retryCodes,
150
+ });
151
+ if (!doResult.ok) {
152
+ return [doResult, { status: "request-error", request: req }];
153
+ }
154
+ const response = doResult.value;
155
+
156
+ const responseFields = {
157
+ HttpMeta: { Response: response, Request: req },
158
+ };
159
+
160
+ const [result] = await M.match<
161
+ void,
162
+ | errors.BadRequest
163
+ | errors.ErrorT
164
+ | PaygenticError
165
+ | ResponseValidationError
166
+ | ConnectionError
167
+ | RequestAbortedError
168
+ | RequestTimeoutError
169
+ | InvalidRequestError
170
+ | UnexpectedClientError
171
+ | SDKValidationError
172
+ >(
173
+ M.nil(204, z.void()),
174
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
175
+ M.jsonErr([401, 403], errors.ErrorT$inboundSchema),
176
+ M.jsonErr([500, 502], errors.ErrorT$inboundSchema),
177
+ M.fail("4XX"),
178
+ M.fail("5XX"),
179
+ )(response, req, { extraFields: responseFields });
180
+ if (!result.ok) {
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
183
+
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
30
30
  * Get profitability summary
31
31
  *
32
32
  * @remarks
33
- * Returns a per-customer profitability summary for a merchant over a date range. Each row aggregates revenue (from issued + paid invoices), cost (from metered cost discovery), profit, and margin. Customers are ranked by profit descending and capped at topN; the remainder is rolled into a single self-consistent 'Other' row whose revenue, cost, and profit reflect the same set of customers. Rows are inner-joined against the merchant's customer list, so orphaned meter subjects from deleted or unknown customers are dropped.
33
+ * Returns a per-customer profitability summary for a merchant over a date range. Each row aggregates revenue (invoices issued in the period, whatever their status since, less refunds, both excluding tax; the same figure /v0/revenue reports), cost (from metered cost discovery), profit, and margin. Customers are ranked by profit descending and capped at topN; the remainder is rolled into a single self-consistent 'Other' row whose revenue, cost, and profit reflect the same set of customers. Rows are joined against the merchant's customer list, so meter subjects that match no customer are dropped. Soft-deleted customers with revenue or cost in the period are folded into a single 'deleted' row, which always comes last, after 'Other', and takes no top-N slot.
34
34
  */
35
35
  export function profitabilityGetProfitability(
36
36
  client: PaygenticCore,
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
30
30
  * Get revenue summary
31
31
  *
32
32
  * @remarks
33
- * Returns revenue summary with invoice and payment breakdowns (outstanding/paid/writtenOff), plus a time-series trend. Revenue is sourced from all issued invoices (v0 + v1) and completed payments.
33
+ * Returns revenue summary with invoice and payment breakdowns (outstanding/paid/writtenOff), plus a time-series trend. Revenue is what was billed in the period (by default, invoices issued in it; see periodBasis), whatever their status since, less refunds, both excluding tax; completed payments are reported under payments, never in revenue.
34
34
  */
35
35
  export function revenueGet(
36
36
  client: PaygenticCore,
@@ -0,0 +1,186 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { PaygenticCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { PaygenticError } from "../models/errors/paygenticerror.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as models from "../models/index.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Migrate To A Plan Version
31
+ *
32
+ * @remarks
33
+ * Moves the subscription to a named version of its plan. By default the move follows the plan's versionTransition. With timing next_period, the move takes effect at the end of the current billing period: the current period bills as before, and each period that starts at or after that boundary bills from the target version. With timing immediate, entitlements change at once, in-arrears prices bill the whole current period at the target version, and in-advance prices change at the end of the current period, with no proration. The target can be an older or a newer published version. A migration always sets versionPolicy to pinned, so a later change of the plan's default version does not move the subscription. To follow the plan default again, call PATCH /v0/subscriptions/{id} with versionPolicy: 'floating'. A second migration before the boundary replaces the first. Migrating to the version the subscription is already on changes nothing except that it pins a floating subscription, so it is safe to repeat. A version number that does not exist on the plan and an archived version both return 404. The request is refused with 409 and a code when: the subscription is not live; the subscription ends at or before the boundary; a kept override has a rate that would mean something else on the new price; a feature's reset period, metric or pricing unit changes; or the new version sells a price that a continuing interval already covers.
34
+ */
35
+ export function subscriptionsMigrateSubscriptionVersion(
36
+ client: PaygenticCore,
37
+ request: operations.MigrateSubscriptionVersionRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.MigrateSubscriptionVersionResponse,
42
+ | errors.BadRequest
43
+ | errors.ErrorT
44
+ | PaygenticError
45
+ | ResponseValidationError
46
+ | ConnectionError
47
+ | RequestAbortedError
48
+ | RequestTimeoutError
49
+ | InvalidRequestError
50
+ | UnexpectedClientError
51
+ | SDKValidationError
52
+ >
53
+ > {
54
+ return new APIPromise($do(
55
+ client,
56
+ request,
57
+ options,
58
+ ));
59
+ }
60
+
61
+ async function $do(
62
+ client: PaygenticCore,
63
+ request: operations.MigrateSubscriptionVersionRequest,
64
+ options?: RequestOptions,
65
+ ): Promise<
66
+ [
67
+ Result<
68
+ models.MigrateSubscriptionVersionResponse,
69
+ | errors.BadRequest
70
+ | errors.ErrorT
71
+ | PaygenticError
72
+ | ResponseValidationError
73
+ | ConnectionError
74
+ | RequestAbortedError
75
+ | RequestTimeoutError
76
+ | InvalidRequestError
77
+ | UnexpectedClientError
78
+ | SDKValidationError
79
+ >,
80
+ APICall,
81
+ ]
82
+ > {
83
+ const parsed = safeParse(
84
+ request,
85
+ (value) =>
86
+ operations.MigrateSubscriptionVersionRequest$outboundSchema.parse(value),
87
+ "Input validation failed",
88
+ );
89
+ if (!parsed.ok) {
90
+ return [parsed, { status: "invalid" }];
91
+ }
92
+ const payload = parsed.value;
93
+ const body = encodeJSON("body", payload.MigrateSubscriptionVersionRequest, {
94
+ explode: true,
95
+ });
96
+
97
+ const pathParams = {
98
+ id: encodeSimple("id", payload.id, {
99
+ explode: false,
100
+ charEncoding: "percent",
101
+ }),
102
+ };
103
+ const path = pathToFunc("/v0/subscriptions/{id}/versionMigration")(
104
+ pathParams,
105
+ );
106
+
107
+ const headers = new Headers(compactMap({
108
+ "Content-Type": "application/json",
109
+ Accept: "application/json",
110
+ }));
111
+
112
+ const secConfig = await extractSecurity(client._options.bearerAuth);
113
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
114
+ const requestSecurity = resolveGlobalSecurity(securityInput);
115
+
116
+ const context = {
117
+ options: client._options,
118
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
119
+ operationID: "migrateSubscriptionVersion",
120
+ oAuth2Scopes: null,
121
+
122
+ resolvedSecurity: requestSecurity,
123
+
124
+ securitySource: client._options.bearerAuth,
125
+ retryConfig: options?.retries
126
+ || client._options.retryConfig
127
+ || { strategy: "none" },
128
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
129
+ };
130
+
131
+ const requestRes = client._createRequest(context, {
132
+ security: requestSecurity,
133
+ method: "POST",
134
+ baseURL: options?.serverURL,
135
+ path: path,
136
+ headers: headers,
137
+ body: body,
138
+ userAgent: client._options.userAgent,
139
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
140
+ }, options);
141
+ if (!requestRes.ok) {
142
+ return [requestRes, { status: "invalid" }];
143
+ }
144
+ const req = requestRes.value;
145
+
146
+ const doResult = await client._do(req, {
147
+ context,
148
+ errorCodes: ["400", "401", "403", "404", "409", "429", "4XX", "500", "5XX"],
149
+ retryConfig: context.retryConfig,
150
+ retryCodes: context.retryCodes,
151
+ });
152
+ if (!doResult.ok) {
153
+ return [doResult, { status: "request-error", request: req }];
154
+ }
155
+ const response = doResult.value;
156
+
157
+ const responseFields = {
158
+ HttpMeta: { Response: response, Request: req },
159
+ };
160
+
161
+ const [result] = await M.match<
162
+ models.MigrateSubscriptionVersionResponse,
163
+ | errors.BadRequest
164
+ | errors.ErrorT
165
+ | PaygenticError
166
+ | ResponseValidationError
167
+ | ConnectionError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | InvalidRequestError
171
+ | UnexpectedClientError
172
+ | SDKValidationError
173
+ >(
174
+ M.json(200, models.MigrateSubscriptionVersionResponse$inboundSchema),
175
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
176
+ M.jsonErr([401, 403, 404, 409, 429], errors.ErrorT$inboundSchema),
177
+ M.jsonErr(500, errors.ErrorT$inboundSchema),
178
+ M.fail("4XX"),
179
+ M.fail("5XX"),
180
+ )(response, req, { extraFields: responseFields });
181
+ if (!result.ok) {
182
+ return [result, { status: "complete", request: req, response }];
183
+ }
184
+
185
+ return [result, { status: "complete", request: req, response }];
186
+ }