@hed-hog/billing 0.0.2

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 (232) hide show
  1. package/dist/adapters/billing-gateway-registry.d.ts +8 -0
  2. package/dist/adapters/billing-gateway-registry.d.ts.map +1 -0
  3. package/dist/adapters/billing-gateway-registry.js +33 -0
  4. package/dist/adapters/billing-gateway-registry.js.map +1 -0
  5. package/dist/adapters/mercadopago.adapter.d.ts +44 -0
  6. package/dist/adapters/mercadopago.adapter.d.ts.map +1 -0
  7. package/dist/adapters/mercadopago.adapter.js +68 -0
  8. package/dist/adapters/mercadopago.adapter.js.map +1 -0
  9. package/dist/adapters/pagarme.adapter.d.ts +44 -0
  10. package/dist/adapters/pagarme.adapter.d.ts.map +1 -0
  11. package/dist/adapters/pagarme.adapter.js +68 -0
  12. package/dist/adapters/pagarme.adapter.js.map +1 -0
  13. package/dist/adapters/payment-gateway.adapter.d.ts +15 -0
  14. package/dist/adapters/payment-gateway.adapter.d.ts.map +1 -0
  15. package/dist/adapters/payment-gateway.adapter.js +3 -0
  16. package/dist/adapters/payment-gateway.adapter.js.map +1 -0
  17. package/dist/adapters/stripe.adapter.d.ts +44 -0
  18. package/dist/adapters/stripe.adapter.d.ts.map +1 -0
  19. package/dist/adapters/stripe.adapter.js +69 -0
  20. package/dist/adapters/stripe.adapter.js.map +1 -0
  21. package/dist/billing-contracts.controller.d.ts +22 -0
  22. package/dist/billing-contracts.controller.d.ts.map +1 -0
  23. package/dist/billing-contracts.controller.js +84 -0
  24. package/dist/billing-contracts.controller.js.map +1 -0
  25. package/dist/billing-coupons.controller.d.ts +22 -0
  26. package/dist/billing-coupons.controller.d.ts.map +1 -0
  27. package/dist/billing-coupons.controller.js +84 -0
  28. package/dist/billing-coupons.controller.js.map +1 -0
  29. package/dist/billing-dashboard.controller.d.ts +13 -0
  30. package/dist/billing-dashboard.controller.d.ts.map +1 -0
  31. package/dist/billing-dashboard.controller.js +36 -0
  32. package/dist/billing-dashboard.controller.js.map +1 -0
  33. package/dist/billing-entitlements.controller.d.ts +19 -0
  34. package/dist/billing-entitlements.controller.d.ts.map +1 -0
  35. package/dist/billing-entitlements.controller.js +62 -0
  36. package/dist/billing-entitlements.controller.js.map +1 -0
  37. package/dist/billing-gateways.controller.d.ts +8 -0
  38. package/dist/billing-gateways.controller.d.ts.map +1 -0
  39. package/dist/billing-gateways.controller.js +50 -0
  40. package/dist/billing-gateways.controller.js.map +1 -0
  41. package/dist/billing-invoices.controller.d.ts +18 -0
  42. package/dist/billing-invoices.controller.d.ts.map +1 -0
  43. package/dist/billing-invoices.controller.js +61 -0
  44. package/dist/billing-invoices.controller.js.map +1 -0
  45. package/dist/billing-offers.controller.d.ts +22 -0
  46. package/dist/billing-offers.controller.d.ts.map +1 -0
  47. package/dist/billing-offers.controller.js +84 -0
  48. package/dist/billing-offers.controller.js.map +1 -0
  49. package/dist/billing-orders.controller.d.ts +19 -0
  50. package/dist/billing-orders.controller.d.ts.map +1 -0
  51. package/dist/billing-orders.controller.js +62 -0
  52. package/dist/billing-orders.controller.js.map +1 -0
  53. package/dist/billing-payments.controller.d.ts +17 -0
  54. package/dist/billing-payments.controller.d.ts.map +1 -0
  55. package/dist/billing-payments.controller.js +51 -0
  56. package/dist/billing-payments.controller.js.map +1 -0
  57. package/dist/billing-prices.controller.d.ts +22 -0
  58. package/dist/billing-prices.controller.d.ts.map +1 -0
  59. package/dist/billing-prices.controller.js +84 -0
  60. package/dist/billing-prices.controller.js.map +1 -0
  61. package/dist/billing-products.controller.d.ts +22 -0
  62. package/dist/billing-products.controller.d.ts.map +1 -0
  63. package/dist/billing-products.controller.js +84 -0
  64. package/dist/billing-products.controller.js.map +1 -0
  65. package/dist/billing-refunds.controller.d.ts +16 -0
  66. package/dist/billing-refunds.controller.d.ts.map +1 -0
  67. package/dist/billing-refunds.controller.js +41 -0
  68. package/dist/billing-refunds.controller.js.map +1 -0
  69. package/dist/billing-subscriptions.controller.d.ts +22 -0
  70. package/dist/billing-subscriptions.controller.d.ts.map +1 -0
  71. package/dist/billing-subscriptions.controller.js +92 -0
  72. package/dist/billing-subscriptions.controller.js.map +1 -0
  73. package/dist/billing-webhooks.controller.d.ts +16 -0
  74. package/dist/billing-webhooks.controller.d.ts.map +1 -0
  75. package/dist/billing-webhooks.controller.js +41 -0
  76. package/dist/billing-webhooks.controller.js.map +1 -0
  77. package/dist/billing.module.d.ts +3 -0
  78. package/dist/billing.module.d.ts.map +1 -0
  79. package/dist/billing.module.js +61 -0
  80. package/dist/billing.module.js.map +1 -0
  81. package/dist/billing.service.d.ts +169 -0
  82. package/dist/billing.service.d.ts.map +1 -0
  83. package/dist/billing.service.js +290 -0
  84. package/dist/billing.service.js.map +1 -0
  85. package/dist/dto/create-contract.dto.d.ts +11 -0
  86. package/dist/dto/create-contract.dto.d.ts.map +1 -0
  87. package/dist/dto/create-contract.dto.js +52 -0
  88. package/dist/dto/create-contract.dto.js.map +1 -0
  89. package/dist/dto/create-coupon.dto.d.ts +12 -0
  90. package/dist/dto/create-coupon.dto.d.ts.map +1 -0
  91. package/dist/dto/create-coupon.dto.js +60 -0
  92. package/dist/dto/create-coupon.dto.js.map +1 -0
  93. package/dist/dto/create-entitlement.dto.d.ts +12 -0
  94. package/dist/dto/create-entitlement.dto.d.ts.map +1 -0
  95. package/dist/dto/create-entitlement.dto.js +54 -0
  96. package/dist/dto/create-entitlement.dto.js.map +1 -0
  97. package/dist/dto/create-offer.dto.d.ts +7 -0
  98. package/dist/dto/create-offer.dto.d.ts.map +1 -0
  99. package/dist/dto/create-offer.dto.js +35 -0
  100. package/dist/dto/create-offer.dto.js.map +1 -0
  101. package/dist/dto/create-order.dto.d.ts +12 -0
  102. package/dist/dto/create-order.dto.d.ts.map +1 -0
  103. package/dist/dto/create-order.dto.js +65 -0
  104. package/dist/dto/create-order.dto.js.map +1 -0
  105. package/dist/dto/create-price.dto.d.ts +15 -0
  106. package/dist/dto/create-price.dto.d.ts.map +1 -0
  107. package/dist/dto/create-price.dto.js +76 -0
  108. package/dist/dto/create-price.dto.js.map +1 -0
  109. package/dist/dto/create-product.dto.d.ts +9 -0
  110. package/dist/dto/create-product.dto.d.ts.map +1 -0
  111. package/dist/dto/create-product.dto.js +45 -0
  112. package/dist/dto/create-product.dto.js.map +1 -0
  113. package/dist/dto/create-subscription.dto.d.ts +14 -0
  114. package/dist/dto/create-subscription.dto.d.ts.map +1 -0
  115. package/dist/dto/create-subscription.dto.js +67 -0
  116. package/dist/dto/create-subscription.dto.js.map +1 -0
  117. package/dist/dto/update-contract.dto.d.ts +6 -0
  118. package/dist/dto/update-contract.dto.d.ts.map +1 -0
  119. package/dist/dto/update-contract.dto.js +9 -0
  120. package/dist/dto/update-contract.dto.js.map +1 -0
  121. package/dist/dto/update-coupon.dto.d.ts +6 -0
  122. package/dist/dto/update-coupon.dto.d.ts.map +1 -0
  123. package/dist/dto/update-coupon.dto.js +9 -0
  124. package/dist/dto/update-coupon.dto.js.map +1 -0
  125. package/dist/dto/update-offer.dto.d.ts +6 -0
  126. package/dist/dto/update-offer.dto.d.ts.map +1 -0
  127. package/dist/dto/update-offer.dto.js +9 -0
  128. package/dist/dto/update-offer.dto.js.map +1 -0
  129. package/dist/dto/update-order.dto.d.ts +6 -0
  130. package/dist/dto/update-order.dto.d.ts.map +1 -0
  131. package/dist/dto/update-order.dto.js +9 -0
  132. package/dist/dto/update-order.dto.js.map +1 -0
  133. package/dist/dto/update-price.dto.d.ts +6 -0
  134. package/dist/dto/update-price.dto.d.ts.map +1 -0
  135. package/dist/dto/update-price.dto.js +9 -0
  136. package/dist/dto/update-price.dto.js.map +1 -0
  137. package/dist/dto/update-product.dto.d.ts +6 -0
  138. package/dist/dto/update-product.dto.d.ts.map +1 -0
  139. package/dist/dto/update-product.dto.js +9 -0
  140. package/dist/dto/update-product.dto.js.map +1 -0
  141. package/dist/dto/update-subscription.dto.d.ts +6 -0
  142. package/dist/dto/update-subscription.dto.d.ts.map +1 -0
  143. package/dist/dto/update-subscription.dto.js +9 -0
  144. package/dist/dto/update-subscription.dto.js.map +1 -0
  145. package/dist/index.d.ts +32 -0
  146. package/dist/index.d.ts.map +1 -0
  147. package/dist/index.js +48 -0
  148. package/dist/index.js.map +1 -0
  149. package/hedhog/data/menu.yaml +284 -0
  150. package/hedhog/data/role.yaml +7 -0
  151. package/hedhog/data/route.yaml +422 -0
  152. package/hedhog/frontend/app/_lib/billing-mocks.ts.ejs +270 -0
  153. package/hedhog/frontend/app/contracts/page.tsx.ejs +562 -0
  154. package/hedhog/frontend/app/coupons/page.tsx.ejs +669 -0
  155. package/hedhog/frontend/app/entitlements/page.tsx.ejs +526 -0
  156. package/hedhog/frontend/app/gateways/page.tsx.ejs +308 -0
  157. package/hedhog/frontend/app/invoices/page.tsx.ejs +179 -0
  158. package/hedhog/frontend/app/offers/page.tsx.ejs +483 -0
  159. package/hedhog/frontend/app/orders/page.tsx.ejs +424 -0
  160. package/hedhog/frontend/app/page.tsx.ejs +186 -0
  161. package/hedhog/frontend/app/payments/page.tsx.ejs +187 -0
  162. package/hedhog/frontend/app/prices/page.tsx.ejs +704 -0
  163. package/hedhog/frontend/app/products/page.tsx.ejs +568 -0
  164. package/hedhog/frontend/app/refunds/page.tsx.ejs +174 -0
  165. package/hedhog/frontend/app/reports/page.tsx.ejs +177 -0
  166. package/hedhog/frontend/app/subscriptions/page.tsx.ejs +283 -0
  167. package/hedhog/frontend/app/webhooks/page.tsx.ejs +172 -0
  168. package/hedhog/frontend/messages/en.json +551 -0
  169. package/hedhog/frontend/messages/pt.json +563 -0
  170. package/hedhog/table/billing_contract.yaml +37 -0
  171. package/hedhog/table/billing_contract_seat.yaml +28 -0
  172. package/hedhog/table/billing_coupon.yaml +42 -0
  173. package/hedhog/table/billing_entitlement.yaml +41 -0
  174. package/hedhog/table/billing_entitlement_event.yaml +20 -0
  175. package/hedhog/table/billing_invoice.yaml +60 -0
  176. package/hedhog/table/billing_invoice_item.yaml +25 -0
  177. package/hedhog/table/billing_offer.yaml +22 -0
  178. package/hedhog/table/billing_offer_price.yaml +23 -0
  179. package/hedhog/table/billing_order.yaml +50 -0
  180. package/hedhog/table/billing_order_item.yaml +35 -0
  181. package/hedhog/table/billing_payment.yaml +66 -0
  182. package/hedhog/table/billing_payment_method.yaml +49 -0
  183. package/hedhog/table/billing_payment_provider.yaml +21 -0
  184. package/hedhog/table/billing_price.yaml +53 -0
  185. package/hedhog/table/billing_product.yaml +31 -0
  186. package/hedhog/table/billing_product_item.yaml +24 -0
  187. package/hedhog/table/billing_provider_event.yaml +31 -0
  188. package/hedhog/table/billing_refund.yaml +41 -0
  189. package/hedhog/table/billing_seat_allocation.yaml +42 -0
  190. package/hedhog/table/billing_subscription.yaml +66 -0
  191. package/hedhog/table/billing_subscription_event.yaml +20 -0
  192. package/hedhog/table/billing_subscription_item.yaml +29 -0
  193. package/package.json +37 -0
  194. package/src/adapters/billing-gateway-registry.ts +23 -0
  195. package/src/adapters/mercadopago.adapter.ts +66 -0
  196. package/src/adapters/pagarme.adapter.ts +66 -0
  197. package/src/adapters/payment-gateway.adapter.ts +14 -0
  198. package/src/adapters/stripe.adapter.ts +67 -0
  199. package/src/billing-contracts.controller.ts +46 -0
  200. package/src/billing-coupons.controller.ts +46 -0
  201. package/src/billing-dashboard.controller.ts +14 -0
  202. package/src/billing-entitlements.controller.ts +34 -0
  203. package/src/billing-gateways.controller.ts +19 -0
  204. package/src/billing-invoices.controller.ts +32 -0
  205. package/src/billing-offers.controller.ts +46 -0
  206. package/src/billing-orders.controller.ts +33 -0
  207. package/src/billing-payments.controller.ts +20 -0
  208. package/src/billing-prices.controller.ts +46 -0
  209. package/src/billing-products.controller.ts +46 -0
  210. package/src/billing-refunds.controller.ts +15 -0
  211. package/src/billing-subscriptions.controller.ts +49 -0
  212. package/src/billing-webhooks.controller.ts +15 -0
  213. package/src/billing.module.ts +48 -0
  214. package/src/billing.service.ts +391 -0
  215. package/src/dto/create-contract.dto.ts +30 -0
  216. package/src/dto/create-coupon.dto.ts +37 -0
  217. package/src/dto/create-entitlement.dto.ts +31 -0
  218. package/src/dto/create-offer.dto.ts +17 -0
  219. package/src/dto/create-order.dto.ts +42 -0
  220. package/src/dto/create-price.dto.ts +50 -0
  221. package/src/dto/create-product.dto.ts +25 -0
  222. package/src/dto/create-subscription.dto.ts +42 -0
  223. package/src/dto/update-contract.dto.ts +4 -0
  224. package/src/dto/update-coupon.dto.ts +4 -0
  225. package/src/dto/update-offer.dto.ts +4 -0
  226. package/src/dto/update-order.dto.ts +4 -0
  227. package/src/dto/update-price.dto.ts +4 -0
  228. package/src/dto/update-product.dto.ts +4 -0
  229. package/src/dto/update-subscription.dto.ts +4 -0
  230. package/src/index.ts +32 -0
  231. package/src/language/en.json +8 -0
  232. package/src/language/pt.json +8 -0
@@ -0,0 +1,422 @@
1
+ - url: /billing/dashboard
2
+ method: GET
3
+ relations:
4
+ role:
5
+ - where:
6
+ slug: admin
7
+ - where:
8
+ slug: admin-billing
9
+
10
+ - url: /billing/products
11
+ method: GET
12
+ relations:
13
+ role:
14
+ - where:
15
+ slug: admin
16
+ - where:
17
+ slug: admin-billing
18
+
19
+ - url: /billing/products
20
+ method: POST
21
+ relations:
22
+ role:
23
+ - where:
24
+ slug: admin
25
+ - where:
26
+ slug: admin-billing
27
+
28
+ - url: /billing/products/:id
29
+ method: GET
30
+ relations:
31
+ role:
32
+ - where:
33
+ slug: admin
34
+ - where:
35
+ slug: admin-billing
36
+
37
+ - url: /billing/products/:id
38
+ method: PATCH
39
+ relations:
40
+ role:
41
+ - where:
42
+ slug: admin
43
+ - where:
44
+ slug: admin-billing
45
+
46
+ - url: /billing/products/:id
47
+ method: DELETE
48
+ relations:
49
+ role:
50
+ - where:
51
+ slug: admin
52
+ - where:
53
+ slug: admin-billing
54
+
55
+ - url: /billing/prices
56
+ method: GET
57
+ relations:
58
+ role:
59
+ - where:
60
+ slug: admin
61
+ - where:
62
+ slug: admin-billing
63
+
64
+ - url: /billing/prices
65
+ method: POST
66
+ relations:
67
+ role:
68
+ - where:
69
+ slug: admin
70
+ - where:
71
+ slug: admin-billing
72
+
73
+ - url: /billing/prices/:id
74
+ method: GET
75
+ relations:
76
+ role:
77
+ - where:
78
+ slug: admin
79
+ - where:
80
+ slug: admin-billing
81
+
82
+ - url: /billing/prices/:id
83
+ method: PATCH
84
+ relations:
85
+ role:
86
+ - where:
87
+ slug: admin
88
+ - where:
89
+ slug: admin-billing
90
+
91
+ - url: /billing/prices/:id
92
+ method: DELETE
93
+ relations:
94
+ role:
95
+ - where:
96
+ slug: admin
97
+ - where:
98
+ slug: admin-billing
99
+
100
+ - url: /billing/offers
101
+ method: GET
102
+ relations:
103
+ role:
104
+ - where:
105
+ slug: admin
106
+ - where:
107
+ slug: admin-billing
108
+
109
+ - url: /billing/offers
110
+ method: POST
111
+ relations:
112
+ role:
113
+ - where:
114
+ slug: admin
115
+ - where:
116
+ slug: admin-billing
117
+
118
+ - url: /billing/offers/:id
119
+ method: GET
120
+ relations:
121
+ role:
122
+ - where:
123
+ slug: admin
124
+ - where:
125
+ slug: admin-billing
126
+
127
+ - url: /billing/offers/:id
128
+ method: PATCH
129
+ relations:
130
+ role:
131
+ - where:
132
+ slug: admin
133
+ - where:
134
+ slug: admin-billing
135
+
136
+ - url: /billing/offers/:id
137
+ method: DELETE
138
+ relations:
139
+ role:
140
+ - where:
141
+ slug: admin
142
+ - where:
143
+ slug: admin-billing
144
+
145
+ - url: /billing/coupons
146
+ method: GET
147
+ relations:
148
+ role:
149
+ - where:
150
+ slug: admin
151
+ - where:
152
+ slug: admin-billing
153
+
154
+ - url: /billing/coupons
155
+ method: POST
156
+ relations:
157
+ role:
158
+ - where:
159
+ slug: admin
160
+ - where:
161
+ slug: admin-billing
162
+
163
+ - url: /billing/coupons/:id
164
+ method: GET
165
+ relations:
166
+ role:
167
+ - where:
168
+ slug: admin
169
+ - where:
170
+ slug: admin-billing
171
+
172
+ - url: /billing/coupons/:id
173
+ method: PATCH
174
+ relations:
175
+ role:
176
+ - where:
177
+ slug: admin
178
+ - where:
179
+ slug: admin-billing
180
+
181
+ - url: /billing/coupons/:id
182
+ method: DELETE
183
+ relations:
184
+ role:
185
+ - where:
186
+ slug: admin
187
+ - where:
188
+ slug: admin-billing
189
+
190
+ - url: /billing/orders
191
+ method: GET
192
+ relations:
193
+ role:
194
+ - where:
195
+ slug: admin
196
+ - where:
197
+ slug: admin-billing
198
+
199
+ - url: /billing/orders
200
+ method: POST
201
+ relations:
202
+ role:
203
+ - where:
204
+ slug: admin
205
+ - where:
206
+ slug: admin-billing
207
+
208
+ - url: /billing/orders/:id
209
+ method: GET
210
+ relations:
211
+ role:
212
+ - where:
213
+ slug: admin
214
+ - where:
215
+ slug: admin-billing
216
+
217
+ - url: /billing/subscriptions
218
+ method: GET
219
+ relations:
220
+ role:
221
+ - where:
222
+ slug: admin
223
+ - where:
224
+ slug: admin-billing
225
+
226
+ - url: /billing/subscriptions
227
+ method: POST
228
+ relations:
229
+ role:
230
+ - where:
231
+ slug: admin
232
+ - where:
233
+ slug: admin-billing
234
+
235
+ - url: /billing/subscriptions/:id
236
+ method: GET
237
+ relations:
238
+ role:
239
+ - where:
240
+ slug: admin
241
+ - where:
242
+ slug: admin-billing
243
+
244
+ - url: /billing/subscriptions/:id/cancel
245
+ method: PATCH
246
+ relations:
247
+ role:
248
+ - where:
249
+ slug: admin
250
+ - where:
251
+ slug: admin-billing
252
+
253
+ - url: /billing/subscriptions/:id/pause
254
+ method: PATCH
255
+ relations:
256
+ role:
257
+ - where:
258
+ slug: admin
259
+ - where:
260
+ slug: admin-billing
261
+
262
+ - url: /billing/subscriptions/:id/resume
263
+ method: PATCH
264
+ relations:
265
+ role:
266
+ - where:
267
+ slug: admin
268
+ - where:
269
+ slug: admin-billing
270
+
271
+ - url: /billing/invoices
272
+ method: GET
273
+ relations:
274
+ role:
275
+ - where:
276
+ slug: admin
277
+ - where:
278
+ slug: admin-billing
279
+
280
+ - url: /billing/invoices
281
+ method: POST
282
+ relations:
283
+ role:
284
+ - where:
285
+ slug: admin
286
+ - where:
287
+ slug: admin-billing
288
+
289
+ - url: /billing/invoices/:id
290
+ method: GET
291
+ relations:
292
+ role:
293
+ - where:
294
+ slug: admin
295
+ - where:
296
+ slug: admin-billing
297
+
298
+ - url: /billing/payments
299
+ method: GET
300
+ relations:
301
+ role:
302
+ - where:
303
+ slug: admin
304
+ - where:
305
+ slug: admin-billing
306
+
307
+ - url: /billing/payments/:id
308
+ method: GET
309
+ relations:
310
+ role:
311
+ - where:
312
+ slug: admin
313
+ - where:
314
+ slug: admin-billing
315
+
316
+ - url: /billing/refunds
317
+ method: GET
318
+ relations:
319
+ role:
320
+ - where:
321
+ slug: admin
322
+ - where:
323
+ slug: admin-billing
324
+
325
+ - url: /billing/entitlements
326
+ method: GET
327
+ relations:
328
+ role:
329
+ - where:
330
+ slug: admin
331
+ - where:
332
+ slug: admin-billing
333
+
334
+ - url: /billing/entitlements
335
+ method: POST
336
+ relations:
337
+ role:
338
+ - where:
339
+ slug: admin
340
+ - where:
341
+ slug: admin-billing
342
+
343
+ - url: /billing/entitlements/:id
344
+ method: DELETE
345
+ relations:
346
+ role:
347
+ - where:
348
+ slug: admin
349
+ - where:
350
+ slug: admin-billing
351
+
352
+ - url: /billing/contracts
353
+ method: GET
354
+ relations:
355
+ role:
356
+ - where:
357
+ slug: admin
358
+ - where:
359
+ slug: admin-billing
360
+
361
+ - url: /billing/contracts
362
+ method: POST
363
+ relations:
364
+ role:
365
+ - where:
366
+ slug: admin
367
+ - where:
368
+ slug: admin-billing
369
+
370
+ - url: /billing/contracts/:id
371
+ method: GET
372
+ relations:
373
+ role:
374
+ - where:
375
+ slug: admin
376
+ - where:
377
+ slug: admin-billing
378
+
379
+ - url: /billing/contracts/:id
380
+ method: PATCH
381
+ relations:
382
+ role:
383
+ - where:
384
+ slug: admin
385
+ - where:
386
+ slug: admin-billing
387
+
388
+ - url: /billing/contracts/:id
389
+ method: DELETE
390
+ relations:
391
+ role:
392
+ - where:
393
+ slug: admin
394
+ - where:
395
+ slug: admin-billing
396
+
397
+ - url: /billing/gateways
398
+ method: GET
399
+ relations:
400
+ role:
401
+ - where:
402
+ slug: admin
403
+ - where:
404
+ slug: admin-billing
405
+
406
+ - url: /billing/gateways/:slug
407
+ method: PATCH
408
+ relations:
409
+ role:
410
+ - where:
411
+ slug: admin
412
+ - where:
413
+ slug: admin-billing
414
+
415
+ - url: /billing/webhooks
416
+ method: GET
417
+ relations:
418
+ role:
419
+ - where:
420
+ slug: admin
421
+ - where:
422
+ slug: admin-billing
@@ -0,0 +1,270 @@
1
+ export type BillingProduct = {
2
+ id: number;
3
+ name: string;
4
+ code: string;
5
+ product_type: 'saas' | 'service' | 'addon' | 'physical';
6
+ is_active: boolean;
7
+ created_at: string;
8
+ };
9
+
10
+ export type BillingPrice = {
11
+ id: number;
12
+ product_id: number;
13
+ product_name: string;
14
+ name: string;
15
+ billing_type: 'one_time' | 'recurring' | 'usage';
16
+ currency: string;
17
+ amount_cents: number;
18
+ interval_unit: 'day' | 'week' | 'month' | 'year' | null;
19
+ interval_count: number | null;
20
+ trial_days: number;
21
+ is_active: boolean;
22
+ };
23
+
24
+ export type BillingSubscription = {
25
+ id: number;
26
+ product_name: string;
27
+ price_name: string;
28
+ status: 'active' | 'trialing' | 'canceled' | 'paused';
29
+ gateway: 'stripe' | 'pagarme' | 'mercadopago';
30
+ current_period_end: string;
31
+ created_at: string;
32
+ };
33
+
34
+ export type BillingInvoice = {
35
+ id: number;
36
+ invoice_number: string;
37
+ status: 'paid' | 'open' | 'overdue';
38
+ currency: string;
39
+ total_cents: number;
40
+ due_date: string;
41
+ paid_at: string | null;
42
+ };
43
+
44
+ export type BillingPayment = {
45
+ id: number;
46
+ provider: 'stripe' | 'pagarme' | 'mercadopago';
47
+ method_type: 'card' | 'pix' | 'boleto';
48
+ status: 'paid' | 'failed';
49
+ amount_cents: number;
50
+ currency: string;
51
+ paid_at: string;
52
+ };
53
+
54
+ export const MOCK_PRODUCTS: BillingProduct[] = [
55
+ {
56
+ id: 1,
57
+ name: 'SaaS Basic',
58
+ code: 'SAAS-BASIC',
59
+ product_type: 'saas',
60
+ is_active: true,
61
+ created_at: '2025-01-05T10:00:00.000Z',
62
+ },
63
+ {
64
+ id: 2,
65
+ name: 'SaaS Pro',
66
+ code: 'SAAS-PRO',
67
+ product_type: 'saas',
68
+ is_active: true,
69
+ created_at: '2025-01-05T10:00:00.000Z',
70
+ },
71
+ {
72
+ id: 3,
73
+ name: 'SaaS Enterprise',
74
+ code: 'SAAS-ENT',
75
+ product_type: 'saas',
76
+ is_active: true,
77
+ created_at: '2025-01-05T10:00:00.000Z',
78
+ },
79
+ {
80
+ id: 4,
81
+ name: 'API Add-on',
82
+ code: 'API-ADDON',
83
+ product_type: 'addon',
84
+ is_active: true,
85
+ created_at: '2025-01-08T10:00:00.000Z',
86
+ },
87
+ {
88
+ id: 5,
89
+ name: 'Support Package',
90
+ code: 'SUPPORT-PKG',
91
+ product_type: 'service',
92
+ is_active: true,
93
+ created_at: '2025-01-10T10:00:00.000Z',
94
+ },
95
+ ];
96
+
97
+ const billingTypes = ['recurring', 'one_time'] as const;
98
+ const recurringIntervals = ['month', 'year'] as const;
99
+
100
+ export const MOCK_PRICES: BillingPrice[] = MOCK_PRODUCTS.flatMap((product) => {
101
+ return [
102
+ {
103
+ id: product.id * 10 + 1,
104
+ product_id: product.id,
105
+ product_name: product.name,
106
+ name: `${product.name} Monthly`,
107
+ billing_type: billingTypes[0],
108
+ currency: 'BRL',
109
+ amount_cents: 9900 + product.id * 1400,
110
+ interval_unit: recurringIntervals[0],
111
+ interval_count: 1,
112
+ trial_days: 14,
113
+ is_active: true,
114
+ },
115
+ {
116
+ id: product.id * 10 + 2,
117
+ product_id: product.id,
118
+ product_name: product.name,
119
+ name: `${product.name} Annual`,
120
+ billing_type: billingTypes[0],
121
+ currency: 'BRL',
122
+ amount_cents: 99900 + product.id * 14000,
123
+ interval_unit: recurringIntervals[1],
124
+ interval_count: 1,
125
+ trial_days: 30,
126
+ is_active: true,
127
+ },
128
+ {
129
+ id: product.id * 10 + 3,
130
+ product_id: product.id,
131
+ product_name: product.name,
132
+ name: `${product.name} Setup`,
133
+ billing_type: billingTypes[1],
134
+ currency: 'BRL',
135
+ amount_cents: 24900 + product.id * 5000,
136
+ interval_unit: null,
137
+ interval_count: null,
138
+ trial_days: 0,
139
+ is_active: product.id !== 5,
140
+ },
141
+ ];
142
+ });
143
+
144
+ const subscriptionStatuses = [
145
+ 'active',
146
+ 'active',
147
+ 'trialing',
148
+ 'active',
149
+ 'paused',
150
+ 'active',
151
+ 'canceled',
152
+ 'active',
153
+ 'trialing',
154
+ 'active',
155
+ 'active',
156
+ 'paused',
157
+ 'active',
158
+ 'active',
159
+ 'canceled',
160
+ 'active',
161
+ 'trialing',
162
+ 'active',
163
+ 'active',
164
+ 'paused',
165
+ 'active',
166
+ ] as const satisfies BillingSubscription['status'][];
167
+
168
+ const gateways = [
169
+ 'stripe',
170
+ 'pagarme',
171
+ 'mercadopago',
172
+ ] as const satisfies BillingSubscription['gateway'][];
173
+
174
+ export const MOCK_SUBSCRIPTIONS: BillingSubscription[] = Array.from(
175
+ { length: 20 },
176
+ (_, index) => {
177
+ const fallbackProduct: BillingProduct = {
178
+ id: 1,
179
+ name: 'SaaS Basic',
180
+ code: 'SAAS-BASIC',
181
+ product_type: 'saas',
182
+ is_active: true,
183
+ created_at: '2025-01-05T10:00:00.000Z',
184
+ };
185
+ const product =
186
+ MOCK_PRODUCTS[index % MOCK_PRODUCTS.length] ?? fallbackProduct;
187
+ const price = MOCK_PRICES.find(
188
+ (item) =>
189
+ item.product_id === product.id && item.billing_type === 'recurring'
190
+ );
191
+
192
+ return {
193
+ id: 2000 + index + 1,
194
+ product_name: product.name,
195
+ price_name: price?.name ?? `${product.name} Monthly`,
196
+ status: subscriptionStatuses[index] ?? 'active',
197
+ gateway: gateways[index % gateways.length] ?? 'stripe',
198
+ current_period_end: `2025-${String((index % 6) + 7).padStart(2, '0')}-28T00:00:00.000Z`,
199
+ created_at: `2025-${String((index % 6) + 1).padStart(2, '0')}-10T09:00:00.000Z`,
200
+ };
201
+ }
202
+ );
203
+
204
+ export const MOCK_INVOICES: BillingInvoice[] = [
205
+ ...Array.from({ length: 10 }, (_, index) => ({
206
+ id: 5000 + index + 1,
207
+ invoice_number: `INV-2025-${String(index + 1).padStart(4, '0')}`,
208
+ status: 'paid' as const,
209
+ currency: 'BRL',
210
+ total_cents: 15900 + index * 1200,
211
+ due_date: `2025-0${(index % 6) + 1}-10T00:00:00.000Z`,
212
+ paid_at: `2025-0${(index % 6) + 1}-09T10:00:00.000Z`,
213
+ })),
214
+ ...Array.from({ length: 3 }, (_, index) => ({
215
+ id: 5100 + index + 1,
216
+ invoice_number: `INV-2025-OPEN-${String(index + 1).padStart(2, '0')}`,
217
+ status: 'open' as const,
218
+ currency: 'BRL',
219
+ total_cents: 23900 + index * 3000,
220
+ due_date: `2025-07-${String(index + 10).padStart(2, '0')}T00:00:00.000Z`,
221
+ paid_at: null,
222
+ })),
223
+ ...Array.from({ length: 2 }, (_, index) => ({
224
+ id: 5200 + index + 1,
225
+ invoice_number: `INV-2025-OVD-${String(index + 1).padStart(2, '0')}`,
226
+ status: 'overdue' as const,
227
+ currency: 'BRL',
228
+ total_cents: 29900 + index * 5000,
229
+ due_date: `2025-06-${String(index + 12).padStart(2, '0')}T00:00:00.000Z`,
230
+ paid_at: null,
231
+ })),
232
+ ];
233
+
234
+ export const MOCK_PAYMENTS: BillingPayment[] = [
235
+ ...Array.from({ length: 15 }, (_, index) => ({
236
+ id: 7000 + index + 1,
237
+ provider: gateways[index % gateways.length] ?? 'stripe',
238
+ method_type: (['card', 'pix', 'boleto'] as const)[index % 3] ?? 'card',
239
+ status: 'paid' as const,
240
+ amount_cents: 18900 + index * 900,
241
+ currency: 'BRL',
242
+ paid_at: `2025-06-${String((index % 20) + 1).padStart(2, '0')}T14:00:00.000Z`,
243
+ })),
244
+ ...Array.from({ length: 3 }, (_, index) => ({
245
+ id: 7100 + index + 1,
246
+ provider: gateways[(index + 1) % gateways.length] ?? 'stripe',
247
+ method_type:
248
+ (['card', 'pix', 'boleto'] as const)[(index + 1) % 3] ?? 'card',
249
+ status: 'failed' as const,
250
+ amount_cents: 21900 + index * 1400,
251
+ currency: 'BRL',
252
+ paid_at: `2025-06-${String(index + 21).padStart(2, '0')}T16:00:00.000Z`,
253
+ })),
254
+ ];
255
+
256
+ export const MOCK_DASHBOARD_STATS = {
257
+ mrr: 2_845_000,
258
+ activeSubscriptions: 247,
259
+ failedPayments: 8,
260
+ overdueInvoices: 5,
261
+ };
262
+
263
+ export const MOCK_REVENUE_CHART = [
264
+ { month: 'Jan/2025', revenue_cents: 1_920_000 },
265
+ { month: 'Feb/2025', revenue_cents: 2_080_000 },
266
+ { month: 'Mar/2025', revenue_cents: 2_260_000 },
267
+ { month: 'Apr/2025', revenue_cents: 2_480_000 },
268
+ { month: 'May/2025', revenue_cents: 2_660_000 },
269
+ { month: 'Jun/2025', revenue_cents: 2_845_000 },
270
+ ];