@owlmeans/server-payment 0.1.18-rc.9 → 0.1.18

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 (537) hide show
  1. package/README.md +157 -26
  2. package/agent-meta/manifest.json +30 -4
  3. package/agent-meta/skills/server-payment/SKILL.md +613 -54
  4. package/agent-meta/skills/server-payment/parts/reference.md +174 -0
  5. package/build/access/types.d.ts +46 -0
  6. package/build/access/types.d.ts.map +1 -0
  7. package/build/access/types.js +2 -0
  8. package/build/access/types.js.map +1 -0
  9. package/build/access.d.ts +6 -0
  10. package/build/access.d.ts.map +1 -0
  11. package/build/access.js +45 -0
  12. package/build/access.js.map +1 -0
  13. package/build/actions/index.d.ts +1 -0
  14. package/build/actions/index.d.ts.map +1 -1
  15. package/build/actions/index.js +1 -0
  16. package/build/actions/index.js.map +1 -1
  17. package/build/actions/resync-subscriptions.d.ts +3 -0
  18. package/build/actions/resync-subscriptions.d.ts.map +1 -0
  19. package/build/actions/resync-subscriptions.js +7 -0
  20. package/build/actions/resync-subscriptions.js.map +1 -0
  21. package/build/actions/resync.d.ts +6 -1
  22. package/build/actions/resync.d.ts.map +1 -1
  23. package/build/actions/resync.js +15 -5
  24. package/build/actions/resync.js.map +1 -1
  25. package/build/actions/webhook.d.ts +2 -1
  26. package/build/actions/webhook.d.ts.map +1 -1
  27. package/build/actions/webhook.js +10 -4
  28. package/build/actions/webhook.js.map +1 -1
  29. package/build/bootstrap/types.d.ts +16 -0
  30. package/build/bootstrap/types.d.ts.map +1 -0
  31. package/build/bootstrap/types.js +2 -0
  32. package/build/bootstrap/types.js.map +1 -0
  33. package/build/bootstrap.d.ts +6 -0
  34. package/build/bootstrap.d.ts.map +1 -0
  35. package/build/bootstrap.js +26 -0
  36. package/build/bootstrap.js.map +1 -0
  37. package/build/catalogue/types.d.ts +38 -0
  38. package/build/catalogue/types.d.ts.map +1 -0
  39. package/build/catalogue/types.js +2 -0
  40. package/build/catalogue/types.js.map +1 -0
  41. package/build/catalogue.d.ts +6 -0
  42. package/build/catalogue.d.ts.map +1 -0
  43. package/build/catalogue.js +110 -0
  44. package/build/catalogue.js.map +1 -0
  45. package/build/commit/types.d.ts +22 -0
  46. package/build/commit/types.d.ts.map +1 -0
  47. package/build/commit/types.js +2 -0
  48. package/build/commit/types.js.map +1 -0
  49. package/build/commit.d.ts +6 -0
  50. package/build/commit.d.ts.map +1 -0
  51. package/build/commit.js +125 -0
  52. package/build/commit.js.map +1 -0
  53. package/build/config.d.ts +44 -5
  54. package/build/config.d.ts.map +1 -1
  55. package/build/config.js +216 -10
  56. package/build/config.js.map +1 -1
  57. package/build/consts.d.ts +74 -16
  58. package/build/consts.d.ts.map +1 -1
  59. package/build/consts.js +86 -23
  60. package/build/consts.js.map +1 -1
  61. package/build/consts.local.d.ts +94 -0
  62. package/build/consts.local.d.ts.map +1 -0
  63. package/build/consts.local.js +44 -0
  64. package/build/consts.local.js.map +1 -0
  65. package/build/consumer/cancellation/types.d.ts +11 -0
  66. package/build/consumer/cancellation/types.d.ts.map +1 -0
  67. package/build/consumer/cancellation/types.js +2 -0
  68. package/build/consumer/cancellation/types.js.map +1 -0
  69. package/build/consumer/cancellation.d.ts +6 -0
  70. package/build/consumer/cancellation.d.ts.map +1 -0
  71. package/build/consumer/cancellation.js +33 -0
  72. package/build/consumer/cancellation.js.map +1 -0
  73. package/build/consumer/capture/types.d.ts +50 -0
  74. package/build/consumer/capture/types.d.ts.map +1 -0
  75. package/build/consumer/capture/types.js +2 -0
  76. package/build/consumer/capture/types.js.map +1 -0
  77. package/build/consumer/capture.d.ts +6 -0
  78. package/build/consumer/capture.d.ts.map +1 -0
  79. package/build/consumer/capture.js +284 -0
  80. package/build/consumer/capture.js.map +1 -0
  81. package/build/consumer/consts.local.d.ts +10 -0
  82. package/build/consumer/consts.local.d.ts.map +1 -0
  83. package/build/consumer/consts.local.js +11 -0
  84. package/build/consumer/consts.local.js.map +1 -0
  85. package/build/consumer/format/types.d.ts +30 -0
  86. package/build/consumer/format/types.d.ts.map +1 -0
  87. package/build/consumer/format/types.js +2 -0
  88. package/build/consumer/format/types.js.map +1 -0
  89. package/build/consumer/format.d.ts +4 -0
  90. package/build/consumer/format.d.ts.map +1 -0
  91. package/build/consumer/format.js +73 -0
  92. package/build/consumer/format.js.map +1 -0
  93. package/build/consumer/handlers.d.ts +21 -0
  94. package/build/consumer/handlers.d.ts.map +1 -0
  95. package/build/consumer/handlers.js +174 -0
  96. package/build/consumer/handlers.js.map +1 -0
  97. package/build/consumer/index.d.ts +10 -0
  98. package/build/consumer/index.d.ts.map +1 -0
  99. package/build/consumer/index.js +6 -0
  100. package/build/consumer/index.js.map +1 -0
  101. package/build/consumer/mail/types.d.ts +29 -0
  102. package/build/consumer/mail/types.d.ts.map +1 -0
  103. package/build/consumer/mail/types.js +2 -0
  104. package/build/consumer/mail/types.js.map +1 -0
  105. package/build/consumer/mail.d.ts +6 -0
  106. package/build/consumer/mail.d.ts.map +1 -0
  107. package/build/consumer/mail.js +313 -0
  108. package/build/consumer/mail.js.map +1 -0
  109. package/build/consumer/observers/types.d.ts +15 -0
  110. package/build/consumer/observers/types.d.ts.map +1 -0
  111. package/build/consumer/observers/types.js +2 -0
  112. package/build/consumer/observers/types.js.map +1 -0
  113. package/build/consumer/observers.d.ts +6 -0
  114. package/build/consumer/observers.d.ts.map +1 -0
  115. package/build/consumer/observers.js +74 -0
  116. package/build/consumer/observers.js.map +1 -0
  117. package/build/consumer/origin/types.d.ts +17 -0
  118. package/build/consumer/origin/types.d.ts.map +1 -0
  119. package/build/consumer/origin/types.js +2 -0
  120. package/build/consumer/origin/types.js.map +1 -0
  121. package/build/consumer/origin.d.ts +8 -0
  122. package/build/consumer/origin.d.ts.map +1 -0
  123. package/build/consumer/origin.js +43 -0
  124. package/build/consumer/origin.js.map +1 -0
  125. package/build/consumer/reconcile/types.d.ts +13 -0
  126. package/build/consumer/reconcile/types.d.ts.map +1 -0
  127. package/build/consumer/reconcile/types.js +2 -0
  128. package/build/consumer/reconcile/types.js.map +1 -0
  129. package/build/consumer/reconcile.d.ts +5 -0
  130. package/build/consumer/reconcile.d.ts.map +1 -0
  131. package/build/consumer/reconcile.js +320 -0
  132. package/build/consumer/reconcile.js.map +1 -0
  133. package/build/consumer/records/types.d.ts +66 -0
  134. package/build/consumer/records/types.d.ts.map +1 -0
  135. package/build/consumer/records/types.js +2 -0
  136. package/build/consumer/records/types.js.map +1 -0
  137. package/build/consumer/records.d.ts +6 -0
  138. package/build/consumer/records.d.ts.map +1 -0
  139. package/build/consumer/records.js +243 -0
  140. package/build/consumer/records.js.map +1 -0
  141. package/build/consumer/service.d.ts +28 -0
  142. package/build/consumer/service.d.ts.map +1 -0
  143. package/build/consumer/service.js +706 -0
  144. package/build/consumer/service.js.map +1 -0
  145. package/build/consumer/types.d.ts +84 -0
  146. package/build/consumer/types.d.ts.map +1 -0
  147. package/build/consumer/types.js +2 -0
  148. package/build/consumer/types.js.map +1 -0
  149. package/build/consumer/types.local.d.ts +26 -0
  150. package/build/consumer/types.local.d.ts.map +1 -0
  151. package/build/consumer/types.local.js +2 -0
  152. package/build/consumer/types.local.js.map +1 -0
  153. package/build/consumer/withdrawal/types.d.ts +36 -0
  154. package/build/consumer/withdrawal/types.d.ts.map +1 -0
  155. package/build/consumer/withdrawal/types.js +2 -0
  156. package/build/consumer/withdrawal/types.js.map +1 -0
  157. package/build/consumer/withdrawal.d.ts +6 -0
  158. package/build/consumer/withdrawal.d.ts.map +1 -0
  159. package/build/consumer/withdrawal.js +237 -0
  160. package/build/consumer/withdrawal.js.map +1 -0
  161. package/build/entitlement.d.ts +4 -0
  162. package/build/entitlement.d.ts.map +1 -0
  163. package/build/entitlement.js +72 -0
  164. package/build/entitlement.js.map +1 -0
  165. package/build/entrypoints.d.ts +19 -2
  166. package/build/entrypoints.d.ts.map +1 -1
  167. package/build/entrypoints.js +16 -4
  168. package/build/entrypoints.js.map +1 -1
  169. package/build/gate/request.d.ts +4 -0
  170. package/build/gate/request.d.ts.map +1 -0
  171. package/build/gate/request.js +17 -0
  172. package/build/gate/request.js.map +1 -0
  173. package/build/gate/types.d.ts +15 -0
  174. package/build/gate/types.d.ts.map +1 -0
  175. package/build/gate/types.js +2 -0
  176. package/build/gate/types.js.map +1 -0
  177. package/build/gate.d.ts +13 -9
  178. package/build/gate.d.ts.map +1 -1
  179. package/build/gate.js +36 -21
  180. package/build/gate.js.map +1 -1
  181. package/build/index.d.ts +50 -3
  182. package/build/index.d.ts.map +1 -1
  183. package/build/index.js +29 -3
  184. package/build/index.js.map +1 -1
  185. package/build/limit.d.ts +11 -0
  186. package/build/limit.d.ts.map +1 -0
  187. package/build/limit.js +48 -0
  188. package/build/limit.js.map +1 -0
  189. package/build/log.d.ts +3 -0
  190. package/build/log.d.ts.map +1 -0
  191. package/build/log.js +4 -0
  192. package/build/log.js.map +1 -0
  193. package/build/models/declarations/types.d.ts +22 -0
  194. package/build/models/declarations/types.d.ts.map +1 -0
  195. package/build/models/declarations/types.js +2 -0
  196. package/build/models/declarations/types.js.map +1 -0
  197. package/build/models/declarations.d.ts +4 -0
  198. package/build/models/declarations.d.ts.map +1 -0
  199. package/build/models/declarations.js +26 -0
  200. package/build/models/declarations.js.map +1 -0
  201. package/build/models/purchase/types.d.ts +13 -0
  202. package/build/models/purchase/types.d.ts.map +1 -0
  203. package/build/models/purchase/types.js +2 -0
  204. package/build/models/purchase/types.js.map +1 -0
  205. package/build/models/purchase.d.ts +4 -0
  206. package/build/models/purchase.d.ts.map +1 -0
  207. package/build/models/purchase.js +37 -0
  208. package/build/models/purchase.js.map +1 -0
  209. package/build/observer.d.ts +9 -0
  210. package/build/observer.d.ts.map +1 -1
  211. package/build/observer.js +38 -12
  212. package/build/observer.js.map +1 -1
  213. package/build/plan/types.d.ts +21 -0
  214. package/build/plan/types.d.ts.map +1 -0
  215. package/build/plan/types.js +2 -0
  216. package/build/plan/types.js.map +1 -0
  217. package/build/plan.d.ts +7 -0
  218. package/build/plan.d.ts.map +1 -0
  219. package/build/plan.js +29 -0
  220. package/build/plan.js.map +1 -0
  221. package/build/plugins/checkout-plugins/types.d.ts +25 -0
  222. package/build/plugins/checkout-plugins/types.d.ts.map +1 -0
  223. package/build/plugins/checkout-plugins/types.js +2 -0
  224. package/build/plugins/checkout-plugins/types.js.map +1 -0
  225. package/build/plugins/checkout-plugins.d.ts +12 -0
  226. package/build/plugins/checkout-plugins.d.ts.map +1 -0
  227. package/build/plugins/checkout-plugins.js +72 -0
  228. package/build/plugins/checkout-plugins.js.map +1 -0
  229. package/build/plugins/checkout-policy/types.d.ts +18 -0
  230. package/build/plugins/checkout-policy/types.d.ts.map +1 -0
  231. package/build/plugins/checkout-policy/types.js +2 -0
  232. package/build/plugins/checkout-policy/types.js.map +1 -0
  233. package/build/plugins/checkout-policy.d.ts +4 -0
  234. package/build/plugins/checkout-policy.d.ts.map +1 -0
  235. package/build/plugins/checkout-policy.js +26 -0
  236. package/build/plugins/checkout-policy.js.map +1 -0
  237. package/build/plugins/checkout-registry/types.d.ts +7 -0
  238. package/build/plugins/checkout-registry/types.d.ts.map +1 -0
  239. package/build/plugins/checkout-registry/types.js +2 -0
  240. package/build/plugins/checkout-registry/types.js.map +1 -0
  241. package/build/plugins/checkout-registry.d.ts +8 -0
  242. package/build/plugins/checkout-registry.d.ts.map +1 -0
  243. package/build/plugins/checkout-registry.js +21 -0
  244. package/build/plugins/checkout-registry.js.map +1 -0
  245. package/build/plugins/consts.local.d.ts +13 -0
  246. package/build/plugins/consts.local.d.ts.map +1 -0
  247. package/build/plugins/consts.local.js +22 -0
  248. package/build/plugins/consts.local.js.map +1 -0
  249. package/build/plugins/customer-lock/types.d.ts +6 -0
  250. package/build/plugins/customer-lock/types.d.ts.map +1 -0
  251. package/build/plugins/customer-lock/types.js +2 -0
  252. package/build/plugins/customer-lock/types.js.map +1 -0
  253. package/build/plugins/customer-lock.d.ts +5 -0
  254. package/build/plugins/customer-lock.d.ts.map +1 -0
  255. package/build/plugins/customer-lock.js +22 -0
  256. package/build/plugins/customer-lock.js.map +1 -0
  257. package/build/plugins/estimate/cache.d.ts +4 -0
  258. package/build/plugins/estimate/cache.d.ts.map +1 -0
  259. package/build/plugins/estimate/cache.js +7 -0
  260. package/build/plugins/estimate/cache.js.map +1 -0
  261. package/build/plugins/estimate/types.d.ts +27 -0
  262. package/build/plugins/estimate/types.d.ts.map +1 -0
  263. package/build/plugins/estimate/types.js +2 -0
  264. package/build/plugins/estimate/types.js.map +1 -0
  265. package/build/plugins/estimate.d.ts +6 -0
  266. package/build/plugins/estimate.d.ts.map +1 -0
  267. package/build/plugins/estimate.js +271 -0
  268. package/build/plugins/estimate.js.map +1 -0
  269. package/build/plugins/events/types.d.ts +12 -0
  270. package/build/plugins/events/types.d.ts.map +1 -0
  271. package/build/plugins/events/types.js +2 -0
  272. package/build/plugins/events/types.js.map +1 -0
  273. package/build/plugins/events.d.ts +6 -13
  274. package/build/plugins/events.d.ts.map +1 -1
  275. package/build/plugins/events.js +441 -144
  276. package/build/plugins/events.js.map +1 -1
  277. package/build/plugins/fx/types.d.ts +33 -0
  278. package/build/plugins/fx/types.d.ts.map +1 -0
  279. package/build/plugins/fx/types.js +2 -0
  280. package/build/plugins/fx/types.js.map +1 -0
  281. package/build/plugins/fx.d.ts +6 -0
  282. package/build/plugins/fx.d.ts.map +1 -0
  283. package/build/plugins/fx.js +83 -0
  284. package/build/plugins/fx.js.map +1 -0
  285. package/build/plugins/portal/types.d.ts +44 -0
  286. package/build/plugins/portal/types.d.ts.map +1 -0
  287. package/build/plugins/portal/types.js +2 -0
  288. package/build/plugins/portal/types.js.map +1 -0
  289. package/build/plugins/portal.d.ts +6 -0
  290. package/build/plugins/portal.d.ts.map +1 -0
  291. package/build/plugins/portal.js +255 -0
  292. package/build/plugins/portal.js.map +1 -0
  293. package/build/plugins/refunds/types.d.ts +35 -0
  294. package/build/plugins/refunds/types.d.ts.map +1 -0
  295. package/build/plugins/refunds/types.js +2 -0
  296. package/build/plugins/refunds/types.js.map +1 -0
  297. package/build/plugins/refunds.d.ts +6 -0
  298. package/build/plugins/refunds.d.ts.map +1 -0
  299. package/build/plugins/refunds.js +81 -0
  300. package/build/plugins/refunds.js.map +1 -0
  301. package/build/plugins/session/types.d.ts +32 -0
  302. package/build/plugins/session/types.d.ts.map +1 -0
  303. package/build/plugins/session/types.js +2 -0
  304. package/build/plugins/session/types.js.map +1 -0
  305. package/build/plugins/session.d.ts +4 -0
  306. package/build/plugins/session.d.ts.map +1 -0
  307. package/build/plugins/session.js +58 -0
  308. package/build/plugins/session.js.map +1 -0
  309. package/build/plugins/status.d.ts +8 -0
  310. package/build/plugins/status.d.ts.map +1 -0
  311. package/build/plugins/status.js +21 -0
  312. package/build/plugins/status.js.map +1 -0
  313. package/build/plugins/stripe/types.d.ts +20 -0
  314. package/build/plugins/stripe/types.d.ts.map +1 -0
  315. package/build/plugins/stripe/types.js +2 -0
  316. package/build/plugins/stripe/types.js.map +1 -0
  317. package/build/plugins/stripe.d.ts +5 -13
  318. package/build/plugins/stripe.d.ts.map +1 -1
  319. package/build/plugins/stripe.js +481 -129
  320. package/build/plugins/stripe.js.map +1 -1
  321. package/build/plugins/subscriptions/types.d.ts +41 -0
  322. package/build/plugins/subscriptions/types.d.ts.map +1 -0
  323. package/build/plugins/subscriptions/types.js +2 -0
  324. package/build/plugins/subscriptions/types.js.map +1 -0
  325. package/build/plugins/subscriptions.d.ts +6 -0
  326. package/build/plugins/subscriptions.d.ts.map +1 -0
  327. package/build/plugins/subscriptions.js +169 -0
  328. package/build/plugins/subscriptions.js.map +1 -0
  329. package/build/plugins/types.d.ts +7 -0
  330. package/build/plugins/types.d.ts.map +1 -0
  331. package/build/plugins/types.js +2 -0
  332. package/build/plugins/types.js.map +1 -0
  333. package/build/plugins/types.local.d.ts +75 -0
  334. package/build/plugins/types.local.d.ts.map +1 -0
  335. package/build/plugins/types.local.js +2 -0
  336. package/build/plugins/types.local.js.map +1 -0
  337. package/build/plugins/webhook-manager/types.d.ts +62 -0
  338. package/build/plugins/webhook-manager/types.d.ts.map +1 -0
  339. package/build/plugins/webhook-manager/types.js +2 -0
  340. package/build/plugins/webhook-manager/types.js.map +1 -0
  341. package/build/plugins/webhook-manager.d.ts +8 -0
  342. package/build/plugins/webhook-manager.d.ts.map +1 -0
  343. package/build/plugins/webhook-manager.js +245 -0
  344. package/build/plugins/webhook-manager.js.map +1 -0
  345. package/build/protocol.d.ts +13 -0
  346. package/build/protocol.d.ts.map +1 -0
  347. package/build/protocol.js +17 -0
  348. package/build/protocol.js.map +1 -0
  349. package/build/reconcile/types.d.ts +17 -0
  350. package/build/reconcile/types.d.ts.map +1 -0
  351. package/build/reconcile/types.js +2 -0
  352. package/build/reconcile/types.js.map +1 -0
  353. package/build/reconcile.d.ts +12 -0
  354. package/build/reconcile.d.ts.map +1 -0
  355. package/build/reconcile.js +91 -0
  356. package/build/reconcile.js.map +1 -0
  357. package/build/resource.d.ts +12 -1
  358. package/build/resource.d.ts.map +1 -1
  359. package/build/resource.js +97 -6
  360. package/build/resource.js.map +1 -1
  361. package/build/schemas.d.ts +19 -0
  362. package/build/schemas.d.ts.map +1 -0
  363. package/build/schemas.js +244 -0
  364. package/build/schemas.js.map +1 -0
  365. package/build/service.d.ts +28 -3
  366. package/build/service.d.ts.map +1 -1
  367. package/build/service.js +140 -19
  368. package/build/service.js.map +1 -1
  369. package/build/subscription/types.d.ts +21 -0
  370. package/build/subscription/types.d.ts.map +1 -0
  371. package/build/subscription/types.js +2 -0
  372. package/build/subscription/types.js.map +1 -0
  373. package/build/subscription.d.ts +4 -0
  374. package/build/subscription.d.ts.map +1 -0
  375. package/build/subscription.js +84 -0
  376. package/build/subscription.js.map +1 -0
  377. package/build/sync/types.d.ts +25 -0
  378. package/build/sync/types.d.ts.map +1 -0
  379. package/build/sync/types.js +2 -0
  380. package/build/sync/types.js.map +1 -0
  381. package/build/sync.d.ts +4 -3
  382. package/build/sync.d.ts.map +1 -1
  383. package/build/sync.js +231 -79
  384. package/build/sync.js.map +1 -1
  385. package/build/types.d.ts +1258 -36
  386. package/build/types.d.ts.map +1 -1
  387. package/build/types.local.d.ts +22 -0
  388. package/build/types.local.d.ts.map +1 -0
  389. package/build/types.local.js +2 -0
  390. package/build/types.local.js.map +1 -0
  391. package/build/usage/types.d.ts +56 -0
  392. package/build/usage/types.d.ts.map +1 -0
  393. package/build/usage/types.js +2 -0
  394. package/build/usage/types.js.map +1 -0
  395. package/build/usage.d.ts +6 -0
  396. package/build/usage.d.ts.map +1 -0
  397. package/build/usage.js +365 -0
  398. package/build/usage.js.map +1 -0
  399. package/build/utils/types.d.ts +31 -0
  400. package/build/utils/types.d.ts.map +1 -0
  401. package/build/utils/types.js +2 -0
  402. package/build/utils/types.js.map +1 -0
  403. package/build/utils.d.ts +21 -7
  404. package/build/utils.d.ts.map +1 -1
  405. package/build/utils.js +56 -17
  406. package/build/utils.js.map +1 -1
  407. package/package.json +22 -17
  408. package/src/access/types.ts +52 -0
  409. package/src/access.ts +86 -0
  410. package/src/actions/index.ts +1 -0
  411. package/src/actions/resync-subscriptions.ts +10 -0
  412. package/src/actions/resync.ts +14 -5
  413. package/src/actions/webhook.ts +9 -4
  414. package/src/bootstrap/types.ts +16 -0
  415. package/src/bootstrap.ts +31 -0
  416. package/src/catalogue/types.ts +32 -0
  417. package/src/catalogue.ts +135 -0
  418. package/src/commit/types.ts +27 -0
  419. package/src/commit.ts +152 -0
  420. package/src/config.ts +234 -14
  421. package/src/consts.local.ts +62 -0
  422. package/src/consts.ts +100 -36
  423. package/src/consumer/cancellation/types.ts +13 -0
  424. package/src/consumer/cancellation.ts +43 -0
  425. package/src/consumer/capture/types.ts +53 -0
  426. package/src/consumer/capture.ts +321 -0
  427. package/src/consumer/consts.local.ts +18 -0
  428. package/src/consumer/format/types.ts +29 -0
  429. package/src/consumer/format.ts +85 -0
  430. package/src/consumer/handlers.ts +204 -0
  431. package/src/consumer/index.ts +9 -0
  432. package/src/consumer/mail/types.ts +31 -0
  433. package/src/consumer/mail.ts +353 -0
  434. package/src/consumer/observers/types.ts +22 -0
  435. package/src/consumer/observers.ts +97 -0
  436. package/src/consumer/origin/types.ts +17 -0
  437. package/src/consumer/origin.ts +61 -0
  438. package/src/consumer/reconcile/types.ts +13 -0
  439. package/src/consumer/reconcile.ts +330 -0
  440. package/src/consumer/records/types.ts +64 -0
  441. package/src/consumer/records.ts +288 -0
  442. package/src/consumer/service.ts +768 -0
  443. package/src/consumer/types.local.ts +22 -0
  444. package/src/consumer/types.ts +96 -0
  445. package/src/consumer/withdrawal/types.ts +37 -0
  446. package/src/consumer/withdrawal.ts +268 -0
  447. package/src/entitlement.ts +85 -0
  448. package/src/entrypoints.ts +17 -4
  449. package/src/gate/request.ts +24 -0
  450. package/src/gate/types.ts +13 -0
  451. package/src/gate.ts +47 -30
  452. package/src/index.ts +55 -3
  453. package/src/limit.ts +54 -0
  454. package/src/log.ts +4 -0
  455. package/src/models/declarations/types.ts +22 -0
  456. package/src/models/declarations.ts +30 -0
  457. package/src/models/purchase/types.ts +13 -0
  458. package/src/models/purchase.ts +43 -0
  459. package/src/observer.ts +44 -11
  460. package/src/plan/types.ts +21 -0
  461. package/src/plan.ts +46 -0
  462. package/src/plugins/checkout-plugins/types.ts +25 -0
  463. package/src/plugins/checkout-plugins.ts +90 -0
  464. package/src/plugins/checkout-policy/types.ts +18 -0
  465. package/src/plugins/checkout-policy.ts +34 -0
  466. package/src/plugins/checkout-registry/types.ts +7 -0
  467. package/src/plugins/checkout-registry.ts +23 -0
  468. package/src/plugins/consts.local.ts +30 -0
  469. package/src/plugins/customer-lock/types.ts +5 -0
  470. package/src/plugins/customer-lock.ts +25 -0
  471. package/src/plugins/estimate/cache.ts +12 -0
  472. package/src/plugins/estimate/types.ts +28 -0
  473. package/src/plugins/estimate.ts +305 -0
  474. package/src/plugins/events/types.ts +11 -0
  475. package/src/plugins/events.ts +466 -132
  476. package/src/plugins/fx/types.ts +40 -0
  477. package/src/plugins/fx.ts +101 -0
  478. package/src/plugins/portal/types.ts +45 -0
  479. package/src/plugins/portal.ts +284 -0
  480. package/src/plugins/refunds/types.ts +31 -0
  481. package/src/plugins/refunds.ts +95 -0
  482. package/src/plugins/session/types.ts +28 -0
  483. package/src/plugins/session.ts +73 -0
  484. package/src/plugins/status.ts +22 -0
  485. package/src/plugins/stripe/types.ts +20 -0
  486. package/src/plugins/stripe.ts +523 -135
  487. package/src/plugins/subscriptions/types.ts +39 -0
  488. package/src/plugins/subscriptions.ts +195 -0
  489. package/src/plugins/types.local.ts +61 -0
  490. package/src/plugins/types.ts +7 -0
  491. package/src/plugins/webhook-manager/types.ts +63 -0
  492. package/src/plugins/webhook-manager.ts +288 -0
  493. package/src/protocol.ts +29 -0
  494. package/src/reconcile/types.ts +17 -0
  495. package/src/reconcile.ts +110 -0
  496. package/src/resource.ts +158 -11
  497. package/src/schemas.ts +271 -0
  498. package/src/service.ts +161 -19
  499. package/src/subscription/types.ts +23 -0
  500. package/src/subscription.ts +104 -0
  501. package/src/sync/types.ts +25 -0
  502. package/src/sync.ts +255 -72
  503. package/src/types.local.ts +18 -0
  504. package/src/types.ts +1365 -32
  505. package/src/usage/types.ts +51 -0
  506. package/src/usage.ts +432 -0
  507. package/src/utils/types.ts +30 -0
  508. package/src/utils.ts +94 -29
  509. package/tests/checkout-consumer.spec.ts +366 -0
  510. package/tests/checkout-locks.spec.ts +161 -0
  511. package/tests/checkout-plugins.spec.ts +164 -0
  512. package/tests/checkout.spec.ts +209 -93
  513. package/tests/consumer-events.spec.ts +215 -0
  514. package/tests/consumer-fixtures.ts +134 -0
  515. package/tests/consumer-ops.spec.ts +350 -0
  516. package/tests/consumer-rights.integration.spec.ts +147 -0
  517. package/tests/consumer-rights.spec.ts +572 -0
  518. package/tests/context.ts +110 -0
  519. package/tests/entitlement.spec.ts +139 -0
  520. package/tests/estimate.spec.ts +350 -0
  521. package/tests/events.spec.ts +357 -0
  522. package/tests/fake-stripe.ts +981 -0
  523. package/tests/gate-handlers.spec.ts +120 -0
  524. package/tests/gate.spec.ts +63 -72
  525. package/tests/gateway-options.spec.ts +180 -0
  526. package/tests/limit-gate.spec.ts +66 -0
  527. package/tests/portal.spec.ts +202 -0
  528. package/tests/protocol.spec.ts +17 -3
  529. package/tests/sync.spec.ts +114 -0
  530. package/tests/usage.integration.spec.ts +133 -0
  531. package/tests/usage.spec.ts +169 -0
  532. package/tests/webhook-manager.spec.ts +149 -0
  533. package/build/model.d.ts +0 -6
  534. package/build/model.d.ts.map +0 -1
  535. package/build/model.js +0 -33
  536. package/build/model.js.map +0 -1
  537. package/src/model.ts +0 -37
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/plugins/consts.local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAG3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IAC1C,wBAAwB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,uBAAuB;IACpG,sBAAsB;CACvB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,YAAY,GAAsC,MAAM,CAAC,MAAM,CAAC;IAC3E,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,QAAQ;CAChE,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;AAE9B,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,wBAAwB,EAAE,QAAQ;IAClC,gCAAgC,EAAE,iBAAiB;IACnD,iCAAiC,EAAE,kBAAkB;IACrD,uBAAuB,EAAE,QAAQ;CAClC,CAAA;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAA;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAEjD,gHAAgH;AAChH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAEhD,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ /** Serialized work per paygate customer, within this process. */
2
+ export interface CustomerLockHelper {
3
+ /** Serialize the work on one paygate customer within this process. */
4
+ withCustomerLock: <T>(customerId: string | undefined, fn: () => Promise<T>) => Promise<T>;
5
+ }
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/customer-lock/types.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,gBAAgB,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CAC1F"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/customer-lock/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { CustomerLockHelper } from './customer-lock/types.js';
2
+ export declare const createCustomerLockHelper: () => CustomerLockHelper;
3
+ /** The process's customer locks — one set shared by every caller. */
4
+ export declare const customerLockHelper: CustomerLockHelper;
5
+ //# sourceMappingURL=customer-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-lock.d.ts","sourceRoot":"","sources":["../../src/plugins/customer-lock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,eAAO,MAAM,wBAAwB,QAAO,kBAkB3C,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,oBAA6B,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { Mutex } from 'async-mutex';
2
+ export const createCustomerLockHelper = () => {
3
+ const customerMutex = {};
4
+ const withCustomerLock = async (customerId, fn) => {
5
+ const key = customerId ?? '';
6
+ const mutex = customerMutex[key] = customerMutex[key] ?? new Mutex();
7
+ const release = await mutex.acquire();
8
+ try {
9
+ return await fn();
10
+ }
11
+ finally {
12
+ release();
13
+ if (!mutex.isLocked()) {
14
+ delete customerMutex[key];
15
+ }
16
+ }
17
+ };
18
+ return { withCustomerLock };
19
+ };
20
+ /** The process's customer locks — one set shared by every caller. */
21
+ export const customerLockHelper = createCustomerLockHelper();
22
+ //# sourceMappingURL=customer-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-lock.js","sourceRoot":"","sources":["../../src/plugins/customer-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGnC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAuB,EAAE;IAC/D,MAAM,aAAa,GAA0B,EAAE,CAAA;IAE/C,MAAM,gBAAgB,GAAG,KAAK,EAAK,UAA8B,EAAE,EAAoB,EAAc,EAAE;QACrG,MAAM,GAAG,GAAG,UAAU,IAAI,EAAE,CAAA;QAC5B,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,EAAE,CAAA;QACpE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAA;QACrC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAA;QACnB,CAAC;gBAAS,CAAC;YACT,OAAO,EAAE,CAAA;YACT,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACtB,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAC7B,CAAC,CAAA;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { EstimateCache } from './types.js';
2
+ /** @param taxTtlMs default 24h; @param fxTtlMs default 1h; @param customerTtlMs default 5min. */
3
+ export declare const makeEstimateCache: (taxTtlMs?: number, fxTtlMs?: number, customerTtlMs?: number) => EstimateCache;
4
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/plugins/estimate/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAK/C,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,cAClB,MAAM,YAAkC,MAAM,kBACzC,MAAM,KACpB,aAED,CAAA"}
@@ -0,0 +1,7 @@
1
+ // One instance per gateway service, never module-level (a test builds many contexts in one process,
2
+ // and a module-level cache would make "no Stripe call" assertions order-dependent).
3
+ /** @param taxTtlMs default 24h; @param fxTtlMs default 1h; @param customerTtlMs default 5min. */
4
+ export const makeEstimateCache = (taxTtlMs = 24 * 60 * 60 * 1_000, fxTtlMs = 60 * 60 * 1_000, customerTtlMs = 5 * 60 * 1_000) => ({
5
+ taxTtlMs, fxTtlMs, customerTtlMs, tax: new Map(), fx: new Map(), customer: new Map(), inflight: new Map(),
6
+ });
7
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/plugins/estimate/cache.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,oFAAoF;AAEpF,iGAAiG;AACjG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAQ,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,OAAO,GAAW,EAAE,GAAG,EAAE,GAAG,KAAK,EAC1E,aAAa,GAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EACvB,EAAE,CAAC,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE;CAC1G,CAAC,CAAA"}
@@ -0,0 +1,27 @@
1
+ import type Stripe from 'stripe';
2
+ import type { PriceEstimate } from '@owlmeans/payment';
3
+ import type { PriceEstimateParams } from '../../types.js';
4
+ import type { CacheEntry, FxOutcome, TaxOutcome } from '../types.local.js';
5
+ export interface EstimateCache {
6
+ taxTtlMs: number;
7
+ fxTtlMs: number;
8
+ customerTtlMs: number;
9
+ tax: Map<string, CacheEntry<TaxOutcome>>;
10
+ fx: Map<string, CacheEntry<FxOutcome>>;
11
+ customer: Map<string, CacheEntry<Stripe.Customer | null>>;
12
+ inflight: Map<string, Promise<unknown>>;
13
+ }
14
+ /** Price estimates of a context: Stripe Tax and the local-currency line. */
15
+ export interface EstimateHelper {
16
+ /**
17
+ * A Stripe Tax estimate (and, when the pricing policy asks for it, a local-currency conversion) for
18
+ * one product/plan, at a billing country the request names or the entity's paygate customer does.
19
+ *
20
+ * Costs one Tax Calculation API call ($0.05) per distinct (currency, country, amount, tax code,
21
+ * behavior, matching tax ids) within `cache`'s TTL, and one free FX Quotes call per distinct
22
+ * (currency, local currency) — never more, and never for a rate-limit or connection error, which is
23
+ * never cached.
24
+ */
25
+ estimateStripePrice: (stripe: Stripe, params: PriceEstimateParams, cache: EstimateCache) => Promise<PriceEstimate>;
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/estimate/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE1E,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;IACxC,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;IACtC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAA;IACzD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;CACxC;AAED,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B;;;;;;;;OAQG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;CACnH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/estimate/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { Context as ApiContext } from '@owlmeans/server-api';
2
+ import type { EstimateHelper } from './estimate/types.js';
3
+ export declare const makeEstimateHelper: (ctx: ApiContext) => EstimateHelper;
4
+ /** The price estimates of a context — one per context. */
5
+ export declare const estimateOf: (target: ApiContext<import("@owlmeans/server-api").Config>) => EstimateHelper;
6
+ //# sourceMappingURL=estimate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../src/plugins/estimate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAMjE,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAsGxE,eAAO,MAAM,kBAAkB,QAAS,UAAU,KAAG,cA+LpD,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,UAAU,+EAAyC,CAAA"}
@@ -0,0 +1,271 @@
1
+ import { CheckoutPricingMode, currencyOfCountry, ProductError, TaxBehavior, TaxEstimateStatus, TaxType, UnknownProduct, checkoutPricingHelper, consumerRegionHelper, priceEstimateHelper } from '@owlmeans/payment';
2
+ import { memoHelper } from '@owlmeans/context';
3
+ import { STRIPE_FX_QUOTES_API_VERSION, STRIPE_PAYGATE_ALIAS } from '../consts.js';
4
+ import { NON_SCALABLE_REASONS, TAX_TYPE_MAP } from './consts.local.js';
5
+ import { fxOf } from './fx.js';
6
+ import { paymentAccessOf } from '../access.js';
7
+ import { paymentUtils } from '../utils.js';
8
+ import { catalogueOf } from '../catalogue.js';
9
+ import { planHelper } from '../plan.js';
10
+ /**
11
+ * A keyed value cached for `ttlMs`, with in-flight requests shared across concurrent callers. Only
12
+ * a settled (resolved) outcome is cached — a thrown error (a rate limit, a dropped connection) never
13
+ * is, so the next call simply tries again.
14
+ */
15
+ const cached = async (store, inflight, key, ttlMs, factory) => {
16
+ const now = Date.now();
17
+ const hit = store.get(key);
18
+ if (hit != null && hit.expiresAt > now) {
19
+ return hit.value;
20
+ }
21
+ const pending = inflight.get(key);
22
+ if (pending != null) {
23
+ return pending;
24
+ }
25
+ const promise = factory().then(value => {
26
+ store.set(key, { value, expiresAt: Date.now() + ttlMs });
27
+ inflight.delete(key);
28
+ return value;
29
+ }).catch(error => {
30
+ inflight.delete(key);
31
+ throw error;
32
+ });
33
+ inflight.set(key, promise);
34
+ return promise;
35
+ };
36
+ // -------------------------------------------------------------------------------------------
37
+ // Tax
38
+ // -------------------------------------------------------------------------------------------
39
+ /** A duck-typed check, matching `isMissingObject` above: the installed SDK's own error classes. */
40
+ const isInvalidRequest = (error) => error?.type === 'StripeInvalidRequestError';
41
+ /** A linear percentage rate scales with the amount; a flat fee, a partial exemption, or several inclusive rates do not. */
42
+ const scalableOf = (breakdown, behavior) => {
43
+ if (breakdown.some(row => row.tax_rate_details?.rate_type === 'flat_amount'))
44
+ return false;
45
+ if (breakdown.some(row => NON_SCALABLE_REASONS.has(row.taxability_reason)))
46
+ return false;
47
+ if (behavior === TaxBehavior.Inclusive && breakdown.length > 1)
48
+ return false;
49
+ return true;
50
+ };
51
+ const statusOf = (breakdown, taxMinor) => {
52
+ if (breakdown.some(row => row.taxability_reason === 'reverse_charge'))
53
+ return TaxEstimateStatus.ReverseCharge;
54
+ if (taxMinor > 0)
55
+ return TaxEstimateStatus.Taxed;
56
+ if (breakdown.some(row => row.taxability_reason === 'not_supported'))
57
+ return TaxEstimateStatus.AtCheckout;
58
+ return TaxEstimateStatus.None;
59
+ };
60
+ const taxTypeOf = (raw) => raw != null && raw in TAX_TYPE_MAP ? TAX_TYPE_MAP[raw] : TaxType.Tax;
61
+ const ratesOf = (breakdown) => breakdown
62
+ .filter((row) => row.tax_rate_details != null)
63
+ .map(row => ({
64
+ type: taxTypeOf(row.tax_rate_details.tax_type),
65
+ percentage: row.tax_rate_details.percentage_decimal,
66
+ ratePpm: priceEstimateHelper.ratePpmOf(row.tax_rate_details.percentage_decimal),
67
+ ...(row.tax_rate_details.country != null ? { country: row.tax_rate_details.country } : {}),
68
+ ...(row.tax_rate_details.state != null ? { state: row.tax_rate_details.state } : {}),
69
+ }));
70
+ const taxEstimateOf = (calculation, behavior, subtotalMinor) => {
71
+ const breakdown = calculation.tax_breakdown ?? [];
72
+ const taxMinor = calculation.tax_amount_exclusive + calculation.tax_amount_inclusive;
73
+ const status = statusOf(breakdown, taxMinor);
74
+ return {
75
+ status, subtotalMinor, taxMinor, totalMinor: calculation.amount_total,
76
+ scalable: scalableOf(breakdown, behavior), rates: ratesOf(breakdown),
77
+ };
78
+ };
79
+ /** The reference amount and currency of the estimate: an amount plan's default preset, else the plan's own price. */
80
+ const referenceOf = (plan) => {
81
+ if (plan.pricingMode === CheckoutPricingMode.Amount) {
82
+ if (plan.amountPolicy == null)
83
+ throw new ProductError(`amount-policy:${plan.sku}`);
84
+ return {
85
+ subtotalMinor: checkoutPricingHelper.chargeAmountMinor(plan.amountPolicy.defaultMinor, plan.amountPolicy),
86
+ currency: plan.amountPolicy.currency.toLowerCase(),
87
+ };
88
+ }
89
+ return { subtotalMinor: Math.round(plan.price * 100), currency: (plan.currency ?? 'usd').toLowerCase() };
90
+ };
91
+ /** A placeholder estimate — no known tax, shown by its `status`, never by its zeroed numbers. */
92
+ const unresolvedEstimate = (status, subtotalMinor) => ({
93
+ status, subtotalMinor, taxMinor: 0, totalMinor: subtotalMinor, scalable: false, rates: [],
94
+ });
95
+ export const makeEstimateHelper = (ctx) => {
96
+ const access = paymentAccessOf(ctx);
97
+ // Customer lookup — the fallback country and the tax ids a request-given country still checks.
98
+ const cachedCustomer = async (stripe, entityId, cache) => cached(cache.customer, cache.inflight, `customer:${entityId}`, cache.customerTtlMs, async () => {
99
+ const record = await access.paygateCustomers().byEntity(entityId, STRIPE_PAYGATE_ALIAS);
100
+ if (record == null || record.deletedAt != null) {
101
+ return null;
102
+ }
103
+ try {
104
+ const retrieved = await stripe.customers.retrieve(record.externalId, { expand: ['tax_ids'] });
105
+ return retrieved.deleted ? null : retrieved;
106
+ }
107
+ catch (error) {
108
+ if (paymentUtils.isMissingObject(error))
109
+ return null;
110
+ throw error;
111
+ }
112
+ });
113
+ /**
114
+ * The reference amount in the currency the buyer is charged in: a recurring or quantity plan's
115
+ * synced price in that currency (its default or an option — no paygate call), else the plan's own
116
+ * catalogue reference. An amount plan keeps its policy currency.
117
+ */
118
+ const chargedReferenceOf = async (product, plan, chargeCurrency) => {
119
+ const reference = referenceOf(plan);
120
+ if (chargeCurrency == null || plan.pricingMode === CheckoutPricingMode.Amount || chargeCurrency === reference.currency && plan.currencyPrices == null) {
121
+ return reference;
122
+ }
123
+ const synced = (await access.fingerprints().bySku(product.sku))?.prices?.find(price => price.planSku === plan.sku);
124
+ if (synced == null) {
125
+ return reference;
126
+ }
127
+ if (synced.currency === chargeCurrency) {
128
+ return { subtotalMinor: synced.unitAmount, currency: chargeCurrency };
129
+ }
130
+ const option = synced.options.find(entry => entry.currency === chargeCurrency);
131
+ return option != null ? { subtotalMinor: option.unitAmount, currency: chargeCurrency } : reference;
132
+ };
133
+ // Currency: Stripe FX Quotes, a PREVIEW endpoint — see `STRIPE_FX_QUOTES_API_VERSION`. A buyer's
134
+ // local currency is priced by Adaptive Pricing at the BASE rate plus its own conversion fee
135
+ // (`price × (1 + fee)`, 2–4% as Stripe decides), which the quote's fee-inclusive `exchange_rate`
136
+ // (base × (1 − `fx_fee_rate`), 2%) understates; a policy declaring `adaptiveFeeRate` is estimated
137
+ // the way Checkout prices it, one without keeps the quote's rate.
138
+ const fetchFxRate = async (stripe, currency, localCurrency, apiVersion, settlementCurrency = currency, adaptiveFeeRate) => {
139
+ const settlement = settlementCurrency.toLowerCase();
140
+ const sourceRate = settlement === currency
141
+ ? { referenceRate: 1 }
142
+ : await fxOf(ctx).stripeFxRate(stripe, currency, settlement, apiVersion);
143
+ if (sourceRate == null)
144
+ return null;
145
+ if (localCurrency === settlement) {
146
+ return { currency: localCurrency, exchangeRate: 1 / sourceRate.referenceRate };
147
+ }
148
+ const localRate = await fxOf(ctx).stripeFxRate(stripe, localCurrency, settlement, apiVersion);
149
+ if (localRate == null)
150
+ return null;
151
+ const settlementPerLocal = adaptiveFeeRate != null ? localRate.baseRate / (1 + adaptiveFeeRate) : localRate.exchangeRate;
152
+ const feeRate = adaptiveFeeRate ?? localRate.fxFeeRate;
153
+ return {
154
+ currency: localCurrency, exchangeRate: settlementPerLocal / sourceRate.referenceRate,
155
+ ...(feeRate != null ? { fxFeeRate: feeRate } : {}),
156
+ };
157
+ };
158
+ const estimateStripePrice = async (stripe, params, cache) => {
159
+ const product = await catalogueOf(ctx).findProduct(params.productSku);
160
+ if (product == null)
161
+ throw new UnknownProduct(params.productSku);
162
+ const plans = (await access.payment().allPlans(product.sku))
163
+ .filter(plan => planHelper.isSoldThrough(product, plan, STRIPE_PAYGATE_ALIAS));
164
+ const plan = params.planSku != null
165
+ ? plans.find(item => item.sku === params.planSku)
166
+ : plans.find(item => item.recurring != null) ?? plans[0];
167
+ if (plan == null)
168
+ throw new ProductError(params.planSku != null ? `plan:${params.planSku}` : 'plan');
169
+ const pricing = await access.payment().pricingPolicy();
170
+ const behavior = pricing.tax.behavior ?? TaxBehavior.Exclusive;
171
+ const rights = await access.payment().consumerRightsPolicy();
172
+ // A locked billing country overrides whatever the request names: a picker shows it, locked.
173
+ const profile = rights != null ? await access.consumerRightsOf()?.profile(params.entityId) ?? null : null;
174
+ const locked = profile?.locked === true && profile.country != null;
175
+ let country = locked ? profile.country : params.country?.toUpperCase();
176
+ let source = locked ? 'profile' : country != null ? 'request' : undefined;
177
+ let matchingTaxIds = [];
178
+ let taxabilityOverride;
179
+ const customer = await cachedCustomer(stripe, params.entityId, cache);
180
+ if (customer != null) {
181
+ if (country == null && customer.address?.country != null) {
182
+ country = customer.address.country;
183
+ source = 'customer';
184
+ }
185
+ if (country != null) {
186
+ matchingTaxIds = (customer.tax_ids?.data ?? [])
187
+ .filter(taxId => taxId.country === country)
188
+ .map(taxId => ({ type: taxId.type, value: taxId.value }));
189
+ if (customer.tax_exempt === 'exempt')
190
+ taxabilityOverride = 'customer_exempt';
191
+ else if (customer.tax_exempt === 'reverse')
192
+ taxabilityOverride = 'reverse_charge';
193
+ }
194
+ }
195
+ const region = rights != null ? consumerRegionHelper.regionOf(country, rights) : null;
196
+ const settlementCurrency = (await access.stripePricingConfig())?.settlementCurrency?.toLowerCase();
197
+ // The currency the checkout session charges: the region's (or the locked profile's) under a policy
198
+ // with region currencies, else none forced.
199
+ const chargeCurrency = rights != null && rights.currencies != null && Object.keys(rights.currencies).length > 0
200
+ ? (profile?.currency ?? consumerRegionHelper.chargeCurrencyOf(region, rights, settlementCurrency ?? (plan.currency ?? 'usd'))).toLowerCase()
201
+ : null;
202
+ const { subtotalMinor, currency } = await chargedReferenceOf(product, plan, chargeCurrency);
203
+ const where = { ...(region != null ? { region } : {}), ...(locked ? { locked: true } : {}) };
204
+ if (country == null) {
205
+ return { currency, behavior, tax: unresolvedEstimate(TaxEstimateStatus.LocationRequired, subtotalMinor), ...where };
206
+ }
207
+ const cacheKey = JSON.stringify([
208
+ currency, country, subtotalMinor, product.taxCode ?? null, behavior,
209
+ matchingTaxIds.map(id => `${id.type}:${id.value}`).sort(), taxabilityOverride ?? null,
210
+ ]);
211
+ const outcome = await cached(cache.tax, cache.inflight, `tax:${cacheKey}`, cache.taxTtlMs, async () => {
212
+ try {
213
+ const calculation = await stripe.tax.calculations.create({
214
+ currency,
215
+ line_items: [{
216
+ amount: subtotalMinor, reference: plan.sku, tax_behavior: behavior,
217
+ ...(product.taxCode != null ? { tax_code: product.taxCode } : {}),
218
+ }],
219
+ customer_details: {
220
+ address: { country },
221
+ address_source: 'billing',
222
+ // Cast: `Stripe.TaxId.type` (the customer's saved tax id) and the Tax Calculation
223
+ // parameter's own tax-id-type enum are independently generated from Stripe's OpenAPI
224
+ // spec and can drift apart in this pinned SDK; every value here still came from a real
225
+ // Stripe `TaxId` record, so it is valid at the API even where the two types disagree.
226
+ ...(matchingTaxIds.length > 0
227
+ ? { tax_ids: matchingTaxIds }
228
+ : {}),
229
+ ...(taxabilityOverride != null ? { taxability_override: taxabilityOverride } : {}),
230
+ },
231
+ });
232
+ return { ok: true, calculation };
233
+ }
234
+ catch (error) {
235
+ if (isInvalidRequest(error))
236
+ return { ok: false, code: error.code };
237
+ throw error;
238
+ }
239
+ });
240
+ const tax = outcome.ok
241
+ ? taxEstimateOf(outcome.calculation, behavior, subtotalMinor)
242
+ : unresolvedEstimate(TaxEstimateStatus.AtCheckout, subtotalMinor);
243
+ const result = { country, source, currency, behavior, tax, ...where };
244
+ // Adaptive Pricing — and so a local-currency line — applies only to a session CHARGED in the
245
+ // settlement currency; a forced region currency (exact USD) is shown as it is. An amount plan is
246
+ // estimated in its policy currency but charged in the region's currency (converted per session,
247
+ // `chargeAmount`), so the session's currency decides, never the reference's: a EUR-charged top-up
248
+ // gets its local line through the same USD → settlement → local chain the session takes.
249
+ const charged = chargeCurrency ?? currency;
250
+ const adaptive = rights?.currencies == null || charged === (settlementCurrency ?? charged);
251
+ if (pricing.currency.estimate && pricing.currency.adaptive === true && adaptive) {
252
+ const localCurrency = currencyOfCountry(country);
253
+ if (localCurrency != null && localCurrency !== currency) {
254
+ const stripePricing = await access.stripePricingConfig();
255
+ const apiVersion = stripePricing?.fxApiVersion ?? STRIPE_FX_QUOTES_API_VERSION;
256
+ const settlementCurrency = stripePricing?.settlementCurrency?.toLowerCase() ?? currency;
257
+ // A preview endpoint: unreachable or erroring never fails the estimate, it only drops `local`.
258
+ const feeRate = pricing.currency.adaptiveFeeRate;
259
+ const fx = await cached(cache.fx, cache.inflight, `fx:${currency}:${settlementCurrency}:${localCurrency}:${apiVersion}:${feeRate ?? ''}`, cache.fxTtlMs, () => fetchFxRate(stripe, currency, localCurrency, apiVersion, settlementCurrency, feeRate)).catch(() => null);
260
+ if (fx != null) {
261
+ result.local = { currency: fx.currency, exchangeRate: fx.exchangeRate, ...(fx.fxFeeRate != null ? { fxFeeRate: fx.fxFeeRate } : {}) };
262
+ }
263
+ }
264
+ }
265
+ return result;
266
+ };
267
+ return { estimateStripePrice };
268
+ };
269
+ /** The price estimates of a context — one per context. */
270
+ export const estimateOf = memoHelper.oncePer(makeEstimateHelper);
271
+ //# sourceMappingURL=estimate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.js","sourceRoot":"","sources":["../../src/plugins/estimate.ts"],"names":[],"mappings":"AACA,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@
1
+ import type Stripe from 'stripe';
2
+ export interface EventHandler {
3
+ (event: Stripe.Event): Promise<void>;
4
+ }
5
+ /** The Stripe event dispatch table of one context and client. */
6
+ export interface StripeEventHandler {
7
+ /** The handler of each event type this package processes. */
8
+ handlers: Record<string, EventHandler>;
9
+ /** Run the handler of an event's type; every other type is ignored. A throw escapes so Stripe delivers again. */
10
+ process: (event: Stripe.Event) => Promise<void>;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,WAAW,YAAY;IAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE;AAEtE,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACtC,iHAAiH;IACjH,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAChD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/events/types.ts"],"names":[],"mappings":""}
@@ -1,16 +1,9 @@
1
1
  import type Stripe from 'stripe';
2
- import { SubscriptionStatus } from '@owlmeans/payment';
3
2
  import type { Context as ApiContext } from '@owlmeans/server-api';
4
- export declare const createEventHandler: (context: ApiContext, stripe: Stripe) => {
5
- process: (event: Stripe.Event) => Promise<void>;
6
- 'customer.created': (event: Stripe.CustomerCreatedEvent) => Promise<void>;
7
- 'customer.updated': (event: Stripe.CustomerUpdatedEvent) => Promise<void>;
8
- 'checkout.session.completed': (event: Stripe.CheckoutSessionCompletedEvent) => Promise<void>;
9
- 'checkout.session.async_payment_succeeded': (event: Stripe.CheckoutSessionAsyncPaymentSucceededEvent) => Promise<void>;
10
- 'customer.subscription.created': (event: Stripe.CustomerSubscriptionCreatedEvent) => Promise<void>;
11
- 'customer.subscription.updated': (event: Stripe.CustomerSubscriptionUpdatedEvent) => Promise<void>;
12
- 'customer.subscription.deleted': (event: Stripe.CustomerSubscriptionDeletedEvent) => Promise<void>;
13
- _upsertCustomer: (customer: Stripe.Customer) => Promise<void>;
14
- _syncSubscription: (pgSubscription: Stripe.Subscription, forced?: SubscriptionStatus) => Promise<void>;
15
- };
3
+ import type { StripeEventHandler } from './events/types.js';
4
+ /**
5
+ * The Stripe event dispatch table. `process` runs the handler of an event type and ignores every
6
+ * other type; a throw escapes so Stripe delivers the event again.
7
+ */
8
+ export declare const createEventHandler: (ctx: ApiContext, stripe: Stripe) => StripeEventHandler;
16
9
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/plugins/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAC4C,kBAAkB,EACpE,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAuCjE,eAAO,MAAM,kBAAkB,YAAa,UAAU,UAAU,MAAM;qBAmE3C,MAAM,CAAC,KAAK;gCAGD,MAAM,CAAC,oBAAoB;gCAC3B,MAAM,CAAC,oBAAoB;0CACjB,MAAM,CAAC,6BAA6B;wDACtB,MAAM,CAAC,yCAAyC;6CAE3D,MAAM,CAAC,gCAAgC;6CACvC,MAAM,CAAC,gCAAgC;6CACvC,MAAM,CAAC,gCAAgC;gCAGpD,MAAM,CAAC,QAAQ;wCAgBP,MAAM,CAAC,YAAY,WAAW,kBAAkB;CAwC7F,CAAA"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/plugins/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAUjE,OAAO,KAAK,EAAgB,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAqBzE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAS,UAAU,UAAU,MAAM,KAAG,kBA6dpE,CAAA"}