@adonis-agora/payments 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/CHANGELOG.md +2347 -0
  2. package/dist/assets/spa/assets/index-CT5Zon6P.css +1 -0
  3. package/dist/assets/spa/assets/index-CvEbJEnq.js +41 -0
  4. package/dist/assets/spa/assets/index-CvEbJEnq.js.map +1 -0
  5. package/dist/assets/spa/index.html +20 -0
  6. package/dist/commands/main.d.ts +4 -3
  7. package/dist/commands/main.d.ts.map +1 -1
  8. package/dist/commands/main.js +9 -2
  9. package/dist/commands/main.js.map +1 -1
  10. package/dist/commands/payments_health.d.ts +31 -0
  11. package/dist/commands/payments_health.d.ts.map +1 -0
  12. package/dist/commands/payments_health.js +113 -0
  13. package/dist/commands/payments_health.js.map +1 -0
  14. package/dist/commands/payments_sync.d.ts +18 -4
  15. package/dist/commands/payments_sync.d.ts.map +1 -1
  16. package/dist/commands/payments_sync.js +136 -40
  17. package/dist/commands/payments_sync.js.map +1 -1
  18. package/dist/configure.d.ts +12 -5
  19. package/dist/configure.d.ts.map +1 -1
  20. package/dist/configure.js +18 -5
  21. package/dist/configure.js.map +1 -1
  22. package/dist/providers/dashboard_provider.d.ts +97 -0
  23. package/dist/providers/dashboard_provider.d.ts.map +1 -0
  24. package/dist/providers/dashboard_provider.js +430 -0
  25. package/dist/providers/dashboard_provider.js.map +1 -0
  26. package/dist/providers/payments_client_provider.d.ts +41 -0
  27. package/dist/providers/payments_client_provider.d.ts.map +1 -0
  28. package/dist/providers/payments_client_provider.js +95 -0
  29. package/dist/providers/payments_client_provider.js.map +1 -0
  30. package/dist/providers/payments_provider.d.ts +35 -0
  31. package/dist/providers/payments_provider.d.ts.map +1 -1
  32. package/dist/providers/payments_provider.js +250 -36
  33. package/dist/providers/payments_provider.js.map +1 -1
  34. package/dist/src/billing/billing_health.d.ts +85 -0
  35. package/dist/src/billing/billing_health.d.ts.map +1 -0
  36. package/dist/src/billing/billing_health.js +155 -0
  37. package/dist/src/billing/billing_health.js.map +1 -0
  38. package/dist/src/billing/billing_overview.d.ts +4 -3
  39. package/dist/src/billing/billing_overview.d.ts.map +1 -1
  40. package/dist/src/billing/billing_overview.js +14 -5
  41. package/dist/src/billing/billing_overview.js.map +1 -1
  42. package/dist/src/billing/billing_store.d.ts +634 -5
  43. package/dist/src/billing/billing_store.d.ts.map +1 -1
  44. package/dist/src/billing/billing_store.js +18 -1
  45. package/dist/src/billing/billing_store.js.map +1 -1
  46. package/dist/src/billing/index.d.ts +2 -1
  47. package/dist/src/billing/index.d.ts.map +1 -1
  48. package/dist/src/billing/index.js +1 -0
  49. package/dist/src/billing/index.js.map +1 -1
  50. package/dist/src/billing/list_query.d.ts +16 -0
  51. package/dist/src/billing/list_query.d.ts.map +1 -0
  52. package/dist/src/billing/list_query.js +28 -0
  53. package/dist/src/billing/list_query.js.map +1 -0
  54. package/dist/src/billing/lucid_billing_store.d.ts +122 -4
  55. package/dist/src/billing/lucid_billing_store.d.ts.map +1 -1
  56. package/dist/src/billing/lucid_billing_store.js +811 -13
  57. package/dist/src/billing/lucid_billing_store.js.map +1 -1
  58. package/dist/src/billing/mixins/index.d.ts +3 -0
  59. package/dist/src/billing/mixins/index.d.ts.map +1 -1
  60. package/dist/src/billing/mixins/index.js +3 -0
  61. package/dist/src/billing/mixins/index.js.map +1 -1
  62. package/dist/src/billing/mixins/with_audit_event.d.ts +48 -0
  63. package/dist/src/billing/mixins/with_audit_event.d.ts.map +1 -0
  64. package/dist/src/billing/mixins/with_audit_event.js +77 -0
  65. package/dist/src/billing/mixins/with_audit_event.js.map +1 -0
  66. package/dist/src/billing/mixins/with_customer.d.ts +39 -0
  67. package/dist/src/billing/mixins/with_customer.d.ts.map +1 -0
  68. package/dist/src/billing/mixins/with_customer.js +68 -0
  69. package/dist/src/billing/mixins/with_customer.js.map +1 -0
  70. package/dist/src/billing/mixins/with_dispute.d.ts +68 -0
  71. package/dist/src/billing/mixins/with_dispute.d.ts.map +1 -0
  72. package/dist/src/billing/mixins/with_dispute.js +83 -0
  73. package/dist/src/billing/mixins/with_dispute.js.map +1 -0
  74. package/dist/src/billing/mixins/with_payment.d.ts +42 -0
  75. package/dist/src/billing/mixins/with_payment.d.ts.map +1 -1
  76. package/dist/src/billing/mixins/with_payment.js +29 -3
  77. package/dist/src/billing/mixins/with_payment.js.map +1 -1
  78. package/dist/src/billing/mixins/with_subscription.d.ts +7 -0
  79. package/dist/src/billing/mixins/with_subscription.d.ts.map +1 -1
  80. package/dist/src/billing/mixins/with_subscription.js +15 -1
  81. package/dist/src/billing/mixins/with_subscription.js.map +1 -1
  82. package/dist/src/billing/mixins/with_usage_event.d.ts +7 -0
  83. package/dist/src/billing/mixins/with_usage_event.d.ts.map +1 -1
  84. package/dist/src/billing/mixins/with_usage_event.js +15 -1
  85. package/dist/src/billing/mixins/with_usage_event.js.map +1 -1
  86. package/dist/src/billing/mixins/with_webhook_event.d.ts +18 -0
  87. package/dist/src/billing/mixins/with_webhook_event.d.ts.map +1 -1
  88. package/dist/src/billing/mixins/with_webhook_event.js +18 -1
  89. package/dist/src/billing/mixins/with_webhook_event.js.map +1 -1
  90. package/dist/src/billing/resolve_dispatch.d.ts +22 -0
  91. package/dist/src/billing/resolve_dispatch.d.ts.map +1 -0
  92. package/dist/src/billing/resolve_dispatch.js +44 -0
  93. package/dist/src/billing/resolve_dispatch.js.map +1 -0
  94. package/dist/src/billing/resolve_store.d.ts +18 -0
  95. package/dist/src/billing/resolve_store.d.ts.map +1 -0
  96. package/dist/src/billing/resolve_store.js +35 -0
  97. package/dist/src/billing/resolve_store.js.map +1 -0
  98. package/dist/src/billing/schema.d.ts +108 -0
  99. package/dist/src/billing/schema.d.ts.map +1 -0
  100. package/dist/src/billing/schema.js +350 -0
  101. package/dist/src/billing/schema.js.map +1 -0
  102. package/dist/src/billing/webhook_dispatcher.d.ts +95 -16
  103. package/dist/src/billing/webhook_dispatcher.d.ts.map +1 -1
  104. package/dist/src/billing/webhook_dispatcher.js +186 -33
  105. package/dist/src/billing/webhook_dispatcher.js.map +1 -1
  106. package/dist/src/billing/webhook_events.d.ts +67 -1
  107. package/dist/src/billing/webhook_events.d.ts.map +1 -1
  108. package/dist/src/billing/webhook_events.js +15 -0
  109. package/dist/src/billing/webhook_events.js.map +1 -1
  110. package/dist/src/billing/webhook_processor.d.ts.map +1 -1
  111. package/dist/src/billing/webhook_processor.js +325 -5
  112. package/dist/src/billing/webhook_processor.js.map +1 -1
  113. package/dist/src/client/define_config.d.ts +150 -0
  114. package/dist/src/client/define_config.d.ts.map +1 -0
  115. package/dist/src/client/define_config.js +98 -0
  116. package/dist/src/client/define_config.js.map +1 -0
  117. package/dist/src/client/handlers.d.ts +71 -0
  118. package/dist/src/client/handlers.d.ts.map +1 -0
  119. package/dist/src/client/handlers.js +119 -0
  120. package/dist/src/client/handlers.js.map +1 -0
  121. package/dist/src/client/index.d.ts +16 -0
  122. package/dist/src/client/index.d.ts.map +1 -0
  123. package/dist/src/client/index.js +13 -0
  124. package/dist/src/client/index.js.map +1 -0
  125. package/dist/src/client/statuses.d.ts +38 -0
  126. package/dist/src/client/statuses.d.ts.map +1 -0
  127. package/dist/src/client/statuses.js +42 -0
  128. package/dist/src/client/statuses.js.map +1 -0
  129. package/dist/src/dashboard/actions.d.ts +143 -0
  130. package/dist/src/dashboard/actions.d.ts.map +1 -0
  131. package/dist/src/dashboard/actions.js +112 -0
  132. package/dist/src/dashboard/actions.js.map +1 -0
  133. package/dist/src/dashboard/auth.d.ts +136 -0
  134. package/dist/src/dashboard/auth.d.ts.map +1 -0
  135. package/dist/src/dashboard/auth.js +152 -0
  136. package/dist/src/dashboard/auth.js.map +1 -0
  137. package/dist/src/dashboard/define_config.d.ts +80 -0
  138. package/dist/src/dashboard/define_config.d.ts.map +1 -0
  139. package/dist/src/dashboard/define_config.js +83 -0
  140. package/dist/src/dashboard/define_config.js.map +1 -0
  141. package/dist/src/dashboard/handlers.d.ts +281 -0
  142. package/dist/src/dashboard/handlers.d.ts.map +1 -0
  143. package/dist/src/dashboard/handlers.js +960 -0
  144. package/dist/src/dashboard/handlers.js.map +1 -0
  145. package/dist/src/dashboard/index.d.ts +18 -0
  146. package/dist/src/dashboard/index.d.ts.map +1 -0
  147. package/dist/src/dashboard/index.js +14 -0
  148. package/dist/src/dashboard/index.js.map +1 -0
  149. package/dist/src/dashboard/login_page.d.ts +23 -0
  150. package/dist/src/dashboard/login_page.d.ts.map +1 -0
  151. package/dist/src/dashboard/login_page.js +170 -0
  152. package/dist/src/dashboard/login_page.js.map +1 -0
  153. package/dist/src/dashboard/period.d.ts +31 -0
  154. package/dist/src/dashboard/period.d.ts.map +1 -0
  155. package/dist/src/dashboard/period.js +44 -0
  156. package/dist/src/dashboard/period.js.map +1 -0
  157. package/dist/src/dashboard/session_cookie.d.ts +42 -0
  158. package/dist/src/dashboard/session_cookie.d.ts.map +1 -0
  159. package/dist/src/dashboard/session_cookie.js +97 -0
  160. package/dist/src/dashboard/session_cookie.js.map +1 -0
  161. package/dist/src/dashboard/spa.d.ts +24 -0
  162. package/dist/src/dashboard/spa.d.ts.map +1 -0
  163. package/dist/src/dashboard/spa.js +52 -0
  164. package/dist/src/dashboard/spa.js.map +1 -0
  165. package/dist/src/define_config.d.ts +244 -9
  166. package/dist/src/define_config.d.ts.map +1 -1
  167. package/dist/src/define_config.js +97 -1
  168. package/dist/src/define_config.js.map +1 -1
  169. package/dist/src/diagnostics.d.ts +287 -7
  170. package/dist/src/diagnostics.d.ts.map +1 -1
  171. package/dist/src/diagnostics.js +317 -1
  172. package/dist/src/diagnostics.js.map +1 -1
  173. package/dist/src/driver.d.ts +139 -5
  174. package/dist/src/driver.d.ts.map +1 -1
  175. package/dist/src/drivers/abacate.d.ts +12 -2
  176. package/dist/src/drivers/abacate.d.ts.map +1 -1
  177. package/dist/src/drivers/abacate.js +112 -19
  178. package/dist/src/drivers/abacate.js.map +1 -1
  179. package/dist/src/drivers/adyen.d.ts +164 -0
  180. package/dist/src/drivers/adyen.d.ts.map +1 -0
  181. package/dist/src/drivers/adyen.js +678 -0
  182. package/dist/src/drivers/adyen.js.map +1 -0
  183. package/dist/src/drivers/asaas.d.ts +52 -2
  184. package/dist/src/drivers/asaas.d.ts.map +1 -1
  185. package/dist/src/drivers/asaas.js +364 -29
  186. package/dist/src/drivers/asaas.js.map +1 -1
  187. package/dist/src/drivers/dodo.d.ts +135 -0
  188. package/dist/src/drivers/dodo.d.ts.map +1 -0
  189. package/dist/src/drivers/dodo.js +864 -0
  190. package/dist/src/drivers/dodo.js.map +1 -0
  191. package/dist/src/drivers/efi.d.ts +98 -0
  192. package/dist/src/drivers/efi.d.ts.map +1 -0
  193. package/dist/src/drivers/efi.js +628 -0
  194. package/dist/src/drivers/efi.js.map +1 -0
  195. package/dist/src/drivers/infinitepay.d.ts +156 -0
  196. package/dist/src/drivers/infinitepay.d.ts.map +1 -0
  197. package/dist/src/drivers/infinitepay.js +321 -0
  198. package/dist/src/drivers/infinitepay.js.map +1 -0
  199. package/dist/src/drivers/lemonsqueezy.d.ts +125 -0
  200. package/dist/src/drivers/lemonsqueezy.d.ts.map +1 -0
  201. package/dist/src/drivers/lemonsqueezy.js +632 -0
  202. package/dist/src/drivers/lemonsqueezy.js.map +1 -0
  203. package/dist/src/drivers/mercadopago.d.ts +97 -0
  204. package/dist/src/drivers/mercadopago.d.ts.map +1 -0
  205. package/dist/src/drivers/mercadopago.js +844 -0
  206. package/dist/src/drivers/mercadopago.js.map +1 -0
  207. package/dist/src/drivers/mollie.d.ts +125 -0
  208. package/dist/src/drivers/mollie.d.ts.map +1 -0
  209. package/dist/src/drivers/mollie.js +812 -0
  210. package/dist/src/drivers/mollie.js.map +1 -0
  211. package/dist/src/drivers/paddle.d.ts +148 -0
  212. package/dist/src/drivers/paddle.d.ts.map +1 -0
  213. package/dist/src/drivers/paddle.js +738 -0
  214. package/dist/src/drivers/paddle.js.map +1 -0
  215. package/dist/src/drivers/pagarme.d.ts +97 -0
  216. package/dist/src/drivers/pagarme.d.ts.map +1 -0
  217. package/dist/src/drivers/pagarme.js +829 -0
  218. package/dist/src/drivers/pagarme.js.map +1 -0
  219. package/dist/src/drivers/pagbank.d.ts +57 -0
  220. package/dist/src/drivers/pagbank.d.ts.map +1 -0
  221. package/dist/src/drivers/pagbank.js +499 -0
  222. package/dist/src/drivers/pagbank.js.map +1 -0
  223. package/dist/src/drivers/paypal.d.ts +120 -0
  224. package/dist/src/drivers/paypal.d.ts.map +1 -0
  225. package/dist/src/drivers/paypal.js +891 -0
  226. package/dist/src/drivers/paypal.js.map +1 -0
  227. package/dist/src/drivers/polar.d.ts +118 -0
  228. package/dist/src/drivers/polar.d.ts.map +1 -0
  229. package/dist/src/drivers/polar.js +604 -0
  230. package/dist/src/drivers/polar.js.map +1 -0
  231. package/dist/src/drivers/razorpay.d.ts +103 -0
  232. package/dist/src/drivers/razorpay.d.ts.map +1 -0
  233. package/dist/src/drivers/razorpay.js +867 -0
  234. package/dist/src/drivers/razorpay.js.map +1 -0
  235. package/dist/src/drivers/shared.d.ts +33 -0
  236. package/dist/src/drivers/shared.d.ts.map +1 -0
  237. package/dist/src/drivers/shared.js +37 -0
  238. package/dist/src/drivers/shared.js.map +1 -0
  239. package/dist/src/drivers/square.d.ts +133 -0
  240. package/dist/src/drivers/square.d.ts.map +1 -0
  241. package/dist/src/drivers/square.js +905 -0
  242. package/dist/src/drivers/square.js.map +1 -0
  243. package/dist/src/drivers/stripe.d.ts +40 -3
  244. package/dist/src/drivers/stripe.d.ts.map +1 -1
  245. package/dist/src/drivers/stripe.js +806 -25
  246. package/dist/src/drivers/stripe.js.map +1 -1
  247. package/dist/src/drivers/woovi.d.ts +10 -3
  248. package/dist/src/drivers/woovi.d.ts.map +1 -1
  249. package/dist/src/drivers/woovi.js +162 -29
  250. package/dist/src/drivers/woovi.js.map +1 -1
  251. package/dist/src/ensure_customer.d.ts +34 -1
  252. package/dist/src/ensure_customer.d.ts.map +1 -1
  253. package/dist/src/ensure_customer.js +29 -4
  254. package/dist/src/ensure_customer.js.map +1 -1
  255. package/dist/src/http.d.ts +37 -3
  256. package/dist/src/http.d.ts.map +1 -1
  257. package/dist/src/http.js +69 -5
  258. package/dist/src/http.js.map +1 -1
  259. package/dist/src/index.d.ts +40 -10
  260. package/dist/src/index.d.ts.map +1 -1
  261. package/dist/src/index.js +22 -4
  262. package/dist/src/index.js.map +1 -1
  263. package/dist/src/invoice/emit_invoice.d.ts.map +1 -1
  264. package/dist/src/invoice/emit_invoice.js +31 -11
  265. package/dist/src/invoice/emit_invoice.js.map +1 -1
  266. package/dist/src/money.d.ts +23 -5
  267. package/dist/src/money.d.ts.map +1 -1
  268. package/dist/src/money.js +72 -7
  269. package/dist/src/money.js.map +1 -1
  270. package/dist/src/payments_manager.d.ts +8 -1
  271. package/dist/src/payments_manager.d.ts.map +1 -1
  272. package/dist/src/payments_manager.js +168 -6
  273. package/dist/src/payments_manager.js.map +1 -1
  274. package/dist/src/services/main.d.ts +38 -0
  275. package/dist/src/services/main.d.ts.map +1 -1
  276. package/dist/src/services/main.js +130 -0
  277. package/dist/src/services/main.js.map +1 -1
  278. package/dist/src/telescope/index.d.ts +2 -0
  279. package/dist/src/telescope/index.d.ts.map +1 -1
  280. package/dist/src/telescope/index.js +1 -0
  281. package/dist/src/telescope/index.js.map +1 -1
  282. package/dist/src/telescope/payments_watcher.d.ts +10 -4
  283. package/dist/src/telescope/payments_watcher.d.ts.map +1 -1
  284. package/dist/src/telescope/payments_watcher.js +65 -13
  285. package/dist/src/telescope/payments_watcher.js.map +1 -1
  286. package/dist/src/telescope/register.d.ts +62 -0
  287. package/dist/src/telescope/register.d.ts.map +1 -0
  288. package/dist/src/telescope/register.js +48 -0
  289. package/dist/src/telescope/register.js.map +1 -0
  290. package/dist/src/testing/fake_payments.d.ts +62 -0
  291. package/dist/src/testing/fake_payments.d.ts.map +1 -0
  292. package/dist/src/testing/fake_payments.js +82 -0
  293. package/dist/src/testing/fake_payments.js.map +1 -0
  294. package/dist/src/testing/in_memory_billing_store.d.ts +151 -2
  295. package/dist/src/testing/in_memory_billing_store.d.ts.map +1 -1
  296. package/dist/src/testing/in_memory_billing_store.js +517 -4
  297. package/dist/src/testing/in_memory_billing_store.js.map +1 -1
  298. package/dist/src/testing/index.d.ts +2 -1
  299. package/dist/src/testing/index.d.ts.map +1 -1
  300. package/dist/src/testing/index.js +1 -0
  301. package/dist/src/testing/index.js.map +1 -1
  302. package/dist/src/types.d.ts +161 -5
  303. package/dist/src/types.d.ts.map +1 -1
  304. package/dist/src/types.js +30 -1
  305. package/dist/src/types.js.map +1 -1
  306. package/dist/src/webhook_handlers.d.ts +96 -2
  307. package/dist/src/webhook_handlers.d.ts.map +1 -1
  308. package/dist/src/webhook_handlers.js +91 -10
  309. package/dist/src/webhook_handlers.js.map +1 -1
  310. package/dist/src/webhook_security.d.ts +94 -3
  311. package/dist/src/webhook_security.d.ts.map +1 -1
  312. package/dist/src/webhook_security.js +173 -9
  313. package/dist/src/webhook_security.js.map +1 -1
  314. package/dist/stubs/config/payments.stub +13 -0
  315. package/dist/stubs/config/payments_client.stub +42 -0
  316. package/dist/stubs/config/payments_dashboard.stub +38 -0
  317. package/dist/stubs/database/migrations/create_billing_tables.stub +35 -77
  318. package/dist/stubs/make/webhook_handler/main.stub +29 -11
  319. package/package.json +60 -25
@@ -0,0 +1,62 @@
1
+ import type { PaymentsWatcher } from './payments_watcher.js';
2
+ /**
3
+ * Wiring the typed `payments` Telescope watcher, extracted from the provider so it can be
4
+ * tested for what it promises without standing up an application — and without installing
5
+ * `@adonis-agora/telescope`, which is an optional peer this package deliberately does not
6
+ * depend on.
7
+ *
8
+ * This was six lines every app copied into `start/telescope.ts`, and until someone did, a
9
+ * payments timeline showed generic `diagnostic` entries with the payload buried rather than
10
+ * typed `payments` ones. The wiring never varied, so it moved here.
11
+ *
12
+ * **There is no configuration for this, on purpose.** Every option that was drafted turned
13
+ * out to describe a situation the code can just detect:
14
+ *
15
+ * - "off, because I wire my own" — the channel claims say so. An app that registered its own
16
+ * watcher has already claimed the payments channels, and this skips.
17
+ * - "off, because I do not want telescope" — then telescope is not in the app, and this
18
+ * skips.
19
+ * - "on, and fail if telescope is missing" — a missing telescope means an empty timeline,
20
+ * which is not a reason to refuse to take payments.
21
+ */
22
+ /** The slice of a telescope store the watcher records through. */
23
+ export interface TelescopeRecorder {
24
+ record(entry: {
25
+ type: string;
26
+ content: unknown;
27
+ }): Promise<unknown>;
28
+ }
29
+ /** The slice of the AdonisJS application container this needs. */
30
+ export interface WatcherHost {
31
+ container: {
32
+ make(token: never): Promise<unknown>;
33
+ };
34
+ }
35
+ /** A disposable registration — the provider holds it so `shutdown()` can release it. */
36
+ export interface RegisteredWatcher {
37
+ dispose(): void;
38
+ }
39
+ export interface RegisterWatcherOptions {
40
+ /**
41
+ * Seams, for tests only. The import is a seam because telescope is not installed here and
42
+ * a test must be able to describe both worlds — present and absent — without it.
43
+ */
44
+ importTelescope?: () => Promise<{
45
+ TelescopeService: unknown;
46
+ }>;
47
+ makeWatcher?: () => PaymentsWatcher;
48
+ alreadyClaimed?: () => boolean;
49
+ }
50
+ /**
51
+ * Register the watcher against the app's telescope store, unless there is nothing to do.
52
+ *
53
+ * Returns `undefined` when it did not register, which is a normal outcome and not an error:
54
+ * telescope may be absent, or the app may already have wired its own watcher.
55
+ *
56
+ * The provider calls this in `ready()`, not `boot()`, and the order is the whole reason the
57
+ * claim check works: `start/` files run before `ready`, so an app that wires its own watcher
58
+ * has already claimed the channels by the time this looks. Registering in `boot()` would
59
+ * race that and double-record for every app that followed the old documentation.
60
+ */
61
+ export declare function registerPaymentsWatcher(app: WatcherHost, options?: RegisterWatcherOptions): Promise<RegisteredWatcher | undefined>;
62
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/telescope/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrE;AAED,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE;QAAE,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CACrD;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,gBAAgB,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,WAAW,CAAC,EAAE,MAAM,eAAe,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,WAAW,EAChB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAuCxC"}
@@ -0,0 +1,48 @@
1
+ import { isPaymentsDiagnosticClaimed } from '../diagnostics.js';
2
+ const TELESCOPE_PACKAGE = '@adonis-agora/telescope';
3
+ /**
4
+ * Register the watcher against the app's telescope store, unless there is nothing to do.
5
+ *
6
+ * Returns `undefined` when it did not register, which is a normal outcome and not an error:
7
+ * telescope may be absent, or the app may already have wired its own watcher.
8
+ *
9
+ * The provider calls this in `ready()`, not `boot()`, and the order is the whole reason the
10
+ * claim check works: `start/` files run before `ready`, so an app that wires its own watcher
11
+ * has already claimed the channels by the time this looks. Registering in `boot()` would
12
+ * race that and double-record for every app that followed the old documentation.
13
+ */
14
+ export async function registerPaymentsWatcher(app, options = {}) {
15
+ // Somebody already owns these channels — an app that wired `PaymentsWatcher` by hand, the
16
+ // way the docs used to say to. Registering a second one would record every payment event
17
+ // twice, and the app that followed the instructions would be the one it happened to.
18
+ const claimed = options.alreadyClaimed ?? (() => isPaymentsDiagnosticClaimed('charge.created'));
19
+ if (claimed())
20
+ return undefined;
21
+ try {
22
+ const telescope = options.importTelescope !== undefined
23
+ ? await options.importTelescope()
24
+ : // A non-literal specifier on purpose: `@adonis-agora/telescope` is an OPTIONAL peer
25
+ // and is not installed here, so a literal import would fail `tsc` in this repo even
26
+ // though it resolves fine in an app that has it.
27
+ (await import(TELESCOPE_PACKAGE));
28
+ const service = (await app.container.make(telescope.TelescopeService));
29
+ const store = service.telescopeStore;
30
+ const watcher = options.makeWatcher !== undefined
31
+ ? options.makeWatcher()
32
+ : new (await import('./payments_watcher.js')).PaymentsWatcher();
33
+ watcher.register({
34
+ // Recording is observability. A telescope store that is full, locked or briefly
35
+ // unreachable must not take a payment webhook down with it — so the promise is
36
+ // swallowed here rather than surfacing inside a diagnostics publish, which runs
37
+ // synchronously inside the charge that triggered it.
38
+ record: (entry) => void store.record(entry).catch(() => { }),
39
+ });
40
+ return watcher;
41
+ }
42
+ catch {
43
+ // Telescope is not in this app. Nothing to do, and nothing to say about it — an app
44
+ // without observability is a normal app, not a misconfigured one.
45
+ return undefined;
46
+ }
47
+ }
48
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/telescope/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAGhE,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAgDpD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAgB,EAChB,UAAkC,EAAE;IAEpC,0FAA0F;IAC1F,yFAAyF;IACzF,qFAAqF;IACrF,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAChG,IAAI,OAAO,EAAE;QAAE,OAAO,SAAS,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,SAAS,GACb,OAAO,CAAC,eAAe,KAAK,SAAS;YACnC,CAAC,CAAC,MAAM,OAAO,CAAC,eAAe,EAAE;YACjC,CAAC,CAAC,oFAAoF;gBACpF,oFAAoF;gBACpF,iDAAiD;gBAChD,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAA8C,CAAC;QAEtF,MAAM,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAyB,CAAC,CAE7E,CAAC;QACF,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC;QAErC,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,KAAK,SAAS;YAC/B,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE;YACvB,CAAC,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;QAEpE,OAAO,CAAC,QAAQ,CAAC;YACf,gFAAgF;YAChF,+EAA+E;YAC/E,gFAAgF;YAChF,qDAAqD;YACrD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;SAC5D,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,oFAAoF;QACpF,kEAAkE;QAClE,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ import type { BillingStore } from '../billing/billing_store.js';
2
+ import { PaymentsManager } from '../payments_manager.js';
3
+ import { FakePaymentsDriver } from './fake_payments_driver.js';
4
+ /**
5
+ * A real {@link PaymentsManager} over a {@link FakePaymentsDriver}.
6
+ *
7
+ * Until this existed `./testing` shipped the fake DRIVER and no way to build a manager
8
+ * around it, so every app wrote the same line:
9
+ *
10
+ * ```ts
11
+ * setPayments({ driver: () => fake } as never)
12
+ * ```
13
+ *
14
+ * `as never` is the tell. That object is not a manager: it has no `invoice()` and no
15
+ * `assertCapability()`, so a charge with `invoice: true` and a refund against a gateway
16
+ * that cannot refund both took a path the test could not exercise — the cast erased exactly
17
+ * the two methods whose absence would have been caught.
18
+ *
19
+ * No `methods` routing is configured on purpose: with one driver and no routing, `driver()`
20
+ * returns it unbound, which is what a test wants. Route explicitly if the test is ABOUT
21
+ * routing.
22
+ */
23
+ export declare function fakePayments(driver?: FakePaymentsDriver): PaymentsManager;
24
+ /**
25
+ * Install a manager on the `services/main` singleton and hand back the restore.
26
+ *
27
+ * The restore works when NOTHING was set, which is the normal case in a test that never
28
+ * booted a provider — and the case the hand-rolled save/restore could not express, because
29
+ * saving meant calling a `getPayments()` that throws when nothing is set.
30
+ *
31
+ * ```ts
32
+ * const fake = new FakePaymentsDriver()
33
+ * const restore = swapPayments(fakePayments(fake))
34
+ * afterEach(restore)
35
+ * ```
36
+ */
37
+ export declare function swapPayments(manager: PaymentsManager): () => void;
38
+ /** The same, for the billing store — `InMemoryBillingStore` is the usual argument. */
39
+ export declare function swapBillingStore(store: BillingStore): () => void;
40
+ /**
41
+ * Wait until every webhook this process accepted has finished processing.
42
+ *
43
+ * The gap it closes: with `billing.dispatcher: 'durable'` the delivery resolves when the
44
+ * event is ACCEPTED, not processed, so `await request(...)` returns before anything has
45
+ * happened. Apps papered over it with polling `waitFor` helpers — and could then write a
46
+ * NEGATIVE assertion only as a timed sleep, which is slow when it passes and wrong when the
47
+ * machine is busy.
48
+ *
49
+ * ```ts
50
+ * await client.post('/payments/webhook/asaas').json(payload)
51
+ * await flushWebhooks()
52
+ * expect(await grants.count()).toBe(0) // an assertion, not a sleep
53
+ * ```
54
+ *
55
+ * No-op when the billing layer is off (nothing dispatched, nothing to wait for). Throws on
56
+ * timeout rather than hanging — including the honest case where a separate worker process
57
+ * runs the events and no in-process wait can ever see them.
58
+ */
59
+ export declare function flushWebhooks(options?: {
60
+ timeoutMs?: number;
61
+ }): Promise<void>;
62
+ //# sourceMappingURL=fake_payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake_payments.d.ts","sourceRoot":"","sources":["../../../src/testing/fake_payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAUzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,MAAM,GAAE,kBAA6C,GACpD,eAAe,CAEjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,IAAI,CAOjE;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,IAAI,CAOhE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvF"}
@@ -0,0 +1,82 @@
1
+ import { PaymentsManager } from '../payments_manager.js';
2
+ import { findBillingStore, findPayments, findWebhookDispatcher, resetBillingStore, resetPayments, setBillingStore, setPayments, } from '../services/main.js';
3
+ import { FakePaymentsDriver } from './fake_payments_driver.js';
4
+ /**
5
+ * A real {@link PaymentsManager} over a {@link FakePaymentsDriver}.
6
+ *
7
+ * Until this existed `./testing` shipped the fake DRIVER and no way to build a manager
8
+ * around it, so every app wrote the same line:
9
+ *
10
+ * ```ts
11
+ * setPayments({ driver: () => fake } as never)
12
+ * ```
13
+ *
14
+ * `as never` is the tell. That object is not a manager: it has no `invoice()` and no
15
+ * `assertCapability()`, so a charge with `invoice: true` and a refund against a gateway
16
+ * that cannot refund both took a path the test could not exercise — the cast erased exactly
17
+ * the two methods whose absence would have been caught.
18
+ *
19
+ * No `methods` routing is configured on purpose: with one driver and no routing, `driver()`
20
+ * returns it unbound, which is what a test wants. Route explicitly if the test is ABOUT
21
+ * routing.
22
+ */
23
+ export function fakePayments(driver = new FakePaymentsDriver()) {
24
+ return new PaymentsManager({ drivers: new Map([[driver.provider, driver]]) });
25
+ }
26
+ /**
27
+ * Install a manager on the `services/main` singleton and hand back the restore.
28
+ *
29
+ * The restore works when NOTHING was set, which is the normal case in a test that never
30
+ * booted a provider — and the case the hand-rolled save/restore could not express, because
31
+ * saving meant calling a `getPayments()` that throws when nothing is set.
32
+ *
33
+ * ```ts
34
+ * const fake = new FakePaymentsDriver()
35
+ * const restore = swapPayments(fakePayments(fake))
36
+ * afterEach(restore)
37
+ * ```
38
+ */
39
+ export function swapPayments(manager) {
40
+ const previous = findPayments();
41
+ setPayments(manager);
42
+ return () => {
43
+ if (previous === undefined)
44
+ resetPayments();
45
+ else
46
+ setPayments(previous);
47
+ };
48
+ }
49
+ /** The same, for the billing store — `InMemoryBillingStore` is the usual argument. */
50
+ export function swapBillingStore(store) {
51
+ const previous = findBillingStore();
52
+ setBillingStore(store);
53
+ return () => {
54
+ if (previous === undefined)
55
+ resetBillingStore();
56
+ else
57
+ setBillingStore(previous);
58
+ };
59
+ }
60
+ /**
61
+ * Wait until every webhook this process accepted has finished processing.
62
+ *
63
+ * The gap it closes: with `billing.dispatcher: 'durable'` the delivery resolves when the
64
+ * event is ACCEPTED, not processed, so `await request(...)` returns before anything has
65
+ * happened. Apps papered over it with polling `waitFor` helpers — and could then write a
66
+ * NEGATIVE assertion only as a timed sleep, which is slow when it passes and wrong when the
67
+ * machine is busy.
68
+ *
69
+ * ```ts
70
+ * await client.post('/payments/webhook/asaas').json(payload)
71
+ * await flushWebhooks()
72
+ * expect(await grants.count()).toBe(0) // an assertion, not a sleep
73
+ * ```
74
+ *
75
+ * No-op when the billing layer is off (nothing dispatched, nothing to wait for). Throws on
76
+ * timeout rather than hanging — including the honest case where a separate worker process
77
+ * runs the events and no in-process wait can ever see them.
78
+ */
79
+ export async function flushWebhooks(options = {}) {
80
+ await findWebhookDispatcher()?.flushWebhooks(options);
81
+ }
82
+ //# sourceMappingURL=fake_payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake_payments.js","sourceRoot":"","sources":["../../../src/testing/fake_payments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAC1B,SAA6B,IAAI,kBAAkB,EAAE;IAErD,OAAO,IAAI,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,OAAwB;IACnD,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,WAAW,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ,KAAK,SAAS;YAAE,aAAa,EAAE,CAAC;;YACvC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,gBAAgB,CAAC,KAAmB;IAClD,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,eAAe,CAAC,KAAK,CAAC,CAAC;IACvB,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ,KAAK,SAAS;YAAE,iBAAiB,EAAE,CAAC;;YAC3C,eAAe,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAkC,EAAE;IACtE,MAAM,qBAAqB,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC"}
@@ -1,4 +1,18 @@
1
- import type { BillingStore } from '../billing/billing_store.js';
1
+ import { type AuditEventCountQuery, type AuditEventListItem, type AuditEventQuery, type BillingCountQuery, type BillingListQuery, type BillingStore, type CustomerListItem, type CustomerListQuery, type DisputeDeadlineQuery, type DisputeListItem, type OpenDisputeQuery, type PaymentListItem, type PaymentListQuery, type SubscriptionListItem, type WebhookEventBreakdownLine, type WebhookEventListItem, type WebhookEventListQuery } from '../billing/billing_store.js';
2
+ /** A plain in-memory customer-mapping row (mirrors the Lucid model's columns). */
3
+ export interface InMemoryCustomerRow {
4
+ id: string;
5
+ gatewayId: string;
6
+ provider: string;
7
+ ownerType: string | null;
8
+ ownerId: string | null;
9
+ email: string | null;
10
+ name: string | null;
11
+ taxId: string | null;
12
+ metadata: Record<string, unknown> | null;
13
+ /** Insertion timestamp — the Lucid rows have one, and the list query orders by it. */
14
+ createdAt: Date;
15
+ }
2
16
  /** A minimal in-memory row shape (mirrors the Lucid models' columns). */
3
17
  export interface InMemorySubscriptionRow {
4
18
  id: string;
@@ -10,6 +24,8 @@ export interface InMemorySubscriptionRow {
10
24
  trialEndsAt: Date | null;
11
25
  endsAt: Date | null;
12
26
  payload: Record<string, unknown>;
27
+ /** Insertion timestamp — the Lucid row has one, and the list query orders by it. */
28
+ createdAt: Date;
13
29
  }
14
30
  export interface InMemoryPaymentRow {
15
31
  id: string;
@@ -20,8 +36,14 @@ export interface InMemoryPaymentRow {
20
36
  currency: string;
21
37
  customerId: string | null;
22
38
  subscriptionId: string | null;
39
+ /** The app's own id for this charge, as the gateway echoed it back. */
40
+ externalReference: string | null;
41
+ /** Integer minor units refunded so far. See `BillingPayment.refundedAmount`. */
42
+ refundedAmount: number | null;
23
43
  paidAt: Date | null;
24
44
  payload: Record<string, unknown>;
45
+ /** Insertion timestamp — the Lucid rows have one, and the list queries order by it. */
46
+ createdAt: Date;
25
47
  }
26
48
  export interface InMemoryWebhookEventRow {
27
49
  id: string;
@@ -30,7 +52,47 @@ export interface InMemoryWebhookEventRow {
30
52
  type: string;
31
53
  status: 'received' | 'processed' | 'failed';
32
54
  payload: Record<string, unknown>;
55
+ /** The normalized event this delivery carried — what the dashboard's retry replays. */
56
+ normalized: Record<string, unknown> | null;
33
57
  error: string | null;
58
+ /** Insertion timestamp — the Lucid rows have one, and the list queries order by it. */
59
+ createdAt: Date;
60
+ /** Last-write timestamp, bumped by `markWebhookProcessed`/`markWebhookFailed`. */
61
+ updatedAt: Date;
62
+ }
63
+ /** A plain in-memory dispute row (mirrors the Lucid model's columns). */
64
+ export interface InMemoryDisputeRow {
65
+ id: string;
66
+ /** The DISPUTE's own gateway id — or the synthesized one, for a gateway that sends none. */
67
+ gatewayId: string;
68
+ /** The disputed payment's gateway id — the join back to the payments map. */
69
+ paymentGatewayId: string;
70
+ provider: string;
71
+ status: string;
72
+ reason: string | null;
73
+ amount: number | null;
74
+ currency: string | null;
75
+ evidenceDueBy: Date | null;
76
+ outcome: string | null;
77
+ openedAt: Date | null;
78
+ closedAt: Date | null;
79
+ payload: Record<string, unknown>;
80
+ /** Insertion timestamp — the Lucid row has one, and the list query orders by it. */
81
+ createdAt: Date;
82
+ }
83
+ /** A plain in-memory audit row (mirrors `billing_audit_events`). */
84
+ export interface InMemoryAuditEventRow {
85
+ id: string;
86
+ action: string;
87
+ actor: string | null;
88
+ provider: string | null;
89
+ subjectType: string | null;
90
+ subjectId: string | null;
91
+ amount: number | null;
92
+ currency: string | null;
93
+ message: string | null;
94
+ metadata: Record<string, unknown> | null;
95
+ createdAt: Date;
34
96
  }
35
97
  /** A plain in-memory metered-usage row (mirrors the Lucid model's columns). */
36
98
  export interface InMemoryUsageEventRow {
@@ -46,12 +108,33 @@ export interface InMemoryUsageEventRow {
46
108
  * In-memory {@link BillingStore} for tests — no database required. Mirrors the shape of
47
109
  * the Lucid models so the billing layer behaves identically.
48
110
  */
49
- export declare class InMemoryBillingStore implements BillingStore<InMemorySubscriptionRow, InMemoryPaymentRow, InMemoryWebhookEventRow, InMemoryUsageEventRow> {
111
+ export declare class InMemoryBillingStore implements BillingStore<InMemorySubscriptionRow, InMemoryPaymentRow, InMemoryWebhookEventRow, InMemoryUsageEventRow, InMemoryCustomerRow, InMemoryDisputeRow> {
50
112
  #private;
113
+ customers: Map<string, InMemoryCustomerRow>;
51
114
  subscriptions: Map<string, InMemorySubscriptionRow>;
52
115
  payments: Map<string, InMemoryPaymentRow>;
53
116
  webhookEvents: Map<string, InMemoryWebhookEventRow>;
54
117
  usageEvents: Map<string, InMemoryUsageEventRow>;
118
+ /** Keyed by the DISPUTE's gateway id, mirroring the table's unique column. */
119
+ disputes: Map<string, InMemoryDisputeRow>;
120
+ /** Append-only, like the table — keyed by the row's own id, because nothing looks one up. */
121
+ auditEvents: Map<string, InMemoryAuditEventRow>;
122
+ /** Overridable clock so a test can pin `createdAt`/`updatedAt`. Defaults to the wall clock. */
123
+ now: () => Date;
124
+ saveCustomer(customer: {
125
+ gatewayId: string;
126
+ provider: string;
127
+ ownerType?: string | null;
128
+ ownerId?: string | null;
129
+ email?: string | null;
130
+ name?: string | null;
131
+ taxId?: string | null;
132
+ metadata?: Record<string, unknown>;
133
+ }): Promise<InMemoryCustomerRow>;
134
+ findCustomerByGatewayId(gatewayId: string): Promise<InMemoryCustomerRow | null>;
135
+ findCustomerByOwner(ownerType: string, ownerId: string, provider: string): Promise<InMemoryCustomerRow | null>;
136
+ listCustomers(query: CustomerListQuery): Promise<CustomerListItem[]>;
137
+ listCustomersByGatewayIds(gatewayIds: readonly string[]): Promise<CustomerListItem[]>;
55
138
  saveSubscription(sub: {
56
139
  gatewayId: string;
57
140
  provider: string;
@@ -62,6 +145,8 @@ export declare class InMemoryBillingStore implements BillingStore<InMemorySubscr
62
145
  endsAt?: Date | null;
63
146
  payload?: Record<string, unknown>;
64
147
  }): Promise<InMemorySubscriptionRow>;
148
+ listSubscriptions(query: BillingListQuery): Promise<SubscriptionListItem[]>;
149
+ countSubscriptions(query: BillingCountQuery): Promise<number>;
65
150
  findSubscriptionByGatewayId(gatewayId: string): Promise<InMemorySubscriptionRow | null>;
66
151
  savePayment(payment: {
67
152
  gatewayId: string;
@@ -71,18 +156,69 @@ export declare class InMemoryBillingStore implements BillingStore<InMemorySubscr
71
156
  currency: string;
72
157
  customerId?: string | null;
73
158
  subscriptionId?: string | null;
159
+ externalReference?: string | null;
74
160
  paidAt?: Date | null;
161
+ refundedAmount?: number | null;
75
162
  payload?: Record<string, unknown>;
76
163
  }): Promise<InMemoryPaymentRow>;
77
164
  findPaymentByGatewayId(gatewayId: string): Promise<InMemoryPaymentRow | null>;
165
+ findPaymentByExternalReference(reference: string): Promise<InMemoryPaymentRow | null>;
166
+ listPayments(query: PaymentListQuery): Promise<PaymentListItem[]>;
167
+ countPayments(query: BillingCountQuery): Promise<number>;
168
+ saveDispute(dispute: {
169
+ gatewayId: string;
170
+ paymentGatewayId: string;
171
+ provider: string;
172
+ status: string;
173
+ reason?: string | null;
174
+ amount?: number | null;
175
+ currency?: string | null;
176
+ evidenceDueBy?: Date | null;
177
+ outcome?: string | null;
178
+ openedAt?: Date | null;
179
+ closedAt?: Date | null;
180
+ payload?: Record<string, unknown>;
181
+ }): Promise<InMemoryDisputeRow>;
182
+ findDisputeByGatewayId(gatewayId: string): Promise<InMemoryDisputeRow | null>;
183
+ findOpenDisputeByPayment(paymentGatewayId: string): Promise<InMemoryDisputeRow | null>;
184
+ listDisputes(query: BillingListQuery): Promise<DisputeListItem[]>;
185
+ countDisputes(query: BillingCountQuery): Promise<number>;
186
+ listDisputesDueWithin(query: DisputeDeadlineQuery): Promise<DisputeListItem[]>;
187
+ countDisputesDueWithin(query: Omit<DisputeDeadlineQuery, 'limit' | 'offset'>): Promise<number>;
188
+ listOpenDisputes(query: OpenDisputeQuery): Promise<DisputeListItem[]>;
189
+ countOpenDisputes(query: {
190
+ provider?: string;
191
+ }): Promise<number>;
192
+ recordAuditEvent(event: {
193
+ action: string;
194
+ actor?: string | null;
195
+ provider?: string | null;
196
+ subjectType?: string | null;
197
+ subjectId?: string | null;
198
+ amount?: number | null;
199
+ currency?: string | null;
200
+ message?: string | null;
201
+ metadata?: Record<string, unknown> | null;
202
+ createdAt?: Date;
203
+ }): Promise<AuditEventListItem>;
204
+ listAuditEvents(query: AuditEventQuery): Promise<AuditEventListItem[]>;
205
+ countAuditEvents(query: AuditEventCountQuery): Promise<number>;
78
206
  recordWebhookEvent(event: {
79
207
  gatewayEventId: string;
80
208
  provider: string;
81
209
  type: string;
82
210
  payload: Record<string, unknown>;
211
+ normalized?: unknown;
83
212
  }): Promise<InMemoryWebhookEventRow | null>;
84
213
  markWebhookProcessed(id: string): Promise<void>;
85
214
  markWebhookFailed(id: string, error: string): Promise<void>;
215
+ listWebhookEvents(query: WebhookEventListQuery): Promise<WebhookEventListItem[]>;
216
+ listWebhookEventsForPayment(paymentGatewayId: string, query?: {
217
+ limit?: number;
218
+ }): Promise<WebhookEventListItem[]>;
219
+ findWebhookEventByGatewayEventId(gatewayEventId: string): Promise<WebhookEventListItem | null>;
220
+ countWebhookEvents(query: BillingCountQuery): Promise<number>;
221
+ webhookEventBreakdown(query: BillingCountQuery): Promise<WebhookEventBreakdownLine[]>;
86
222
  recordUsage(event: {
87
223
  subscriptionId?: string | null;
88
224
  customerId?: string;
@@ -105,6 +241,19 @@ export declare class InMemoryBillingStore implements BillingStore<InMemorySubscr
105
241
  from?: Date;
106
242
  to?: Date;
107
243
  }): Promise<number>;
244
+ /**
245
+ * Gross minus what came back, on exactly the rows `revenue()` sums.
246
+ *
247
+ * A `null` `refundedAmount` — every row written before the column existed, and every row no
248
+ * refund has ever touched — reads as zero, mirroring the `COALESCE(refunded_amount, 0)` the
249
+ * Lucid store emits. Reading it as anything else here would make the in-memory store
250
+ * disagree with the database, which is the one thing a fake store must never do: a contract
251
+ * fixed in one implementation of two is not fixed.
252
+ */
253
+ netRevenue(query: {
254
+ from?: Date;
255
+ to?: Date;
256
+ }): Promise<number>;
108
257
  countActiveSubscriptions(): Promise<number>;
109
258
  }
110
259
  //# sourceMappingURL=in_memory_billing_store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"in_memory_billing_store.d.ts","sourceRoot":"","sources":["../../../src/testing/in_memory_billing_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,yEAAyE;AACzE,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,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