@natrave/shared-entities 7.5.0 → 7.7.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 (43) hide show
  1. package/dist/billing/billing-invoice-line-items/billing-invoice-line-item.entity.d.ts +15 -0
  2. package/dist/billing/billing-invoice-line-items/billing-invoice-line-item.entity.d.ts.map +1 -0
  3. package/dist/billing/billing-invoice-line-items/billing-invoice-line-item.entity.js +99 -0
  4. package/dist/billing/billing-invoice-line-items/index.d.ts +2 -0
  5. package/dist/billing/billing-invoice-line-items/index.d.ts.map +1 -0
  6. package/dist/billing/billing-invoice-line-items/index.js +1 -0
  7. package/dist/billing/billing-invoices/billing-invoice.entity.d.ts +38 -0
  8. package/dist/billing/billing-invoices/billing-invoice.entity.d.ts.map +1 -0
  9. package/dist/billing/billing-invoices/billing-invoice.entity.js +285 -0
  10. package/dist/billing/billing-invoices/enums/billing-invoice-status.enum.d.ts +7 -0
  11. package/dist/billing/billing-invoices/enums/billing-invoice-status.enum.d.ts.map +1 -0
  12. package/dist/billing/billing-invoices/enums/billing-invoice-status.enum.js +10 -0
  13. package/dist/billing/billing-invoices/index.d.ts +3 -0
  14. package/dist/billing/billing-invoices/index.d.ts.map +1 -0
  15. package/dist/billing/billing-invoices/index.js +2 -0
  16. package/dist/billing/billing-payments/billing-payment.entity.d.ts +25 -0
  17. package/dist/billing/billing-payments/billing-payment.entity.d.ts.map +1 -0
  18. package/dist/billing/billing-payments/billing-payment.entity.js +162 -0
  19. package/dist/billing/billing-payments/enums/billing-payment-method.enum.d.ts +8 -0
  20. package/dist/billing/billing-payments/enums/billing-payment-method.enum.d.ts.map +1 -0
  21. package/dist/billing/billing-payments/enums/billing-payment-method.enum.js +11 -0
  22. package/dist/billing/billing-payments/enums/billing-payment-provider-name.enum.d.ts +5 -0
  23. package/dist/billing/billing-payments/enums/billing-payment-provider-name.enum.d.ts.map +1 -0
  24. package/dist/billing/billing-payments/enums/billing-payment-provider-name.enum.js +8 -0
  25. package/dist/billing/billing-payments/enums/billing-payment-status.enum.d.ts +9 -0
  26. package/dist/billing/billing-payments/enums/billing-payment-status.enum.d.ts.map +1 -0
  27. package/dist/billing/billing-payments/enums/billing-payment-status.enum.js +12 -0
  28. package/dist/billing/billing-payments/index.d.ts +5 -0
  29. package/dist/billing/billing-payments/index.d.ts.map +1 -0
  30. package/dist/billing/billing-payments/index.js +4 -0
  31. package/dist/billing/billing-provider-webhook-events/billing-provider-webhook-event.entity.d.ts +16 -0
  32. package/dist/billing/billing-provider-webhook-events/billing-provider-webhook-event.entity.d.ts.map +1 -0
  33. package/dist/billing/billing-provider-webhook-events/billing-provider-webhook-event.entity.js +108 -0
  34. package/dist/billing/billing-provider-webhook-events/enums/billing-provider-webhook-status.enum.d.ts +6 -0
  35. package/dist/billing/billing-provider-webhook-events/enums/billing-provider-webhook-status.enum.d.ts.map +1 -0
  36. package/dist/billing/billing-provider-webhook-events/enums/billing-provider-webhook-status.enum.js +9 -0
  37. package/dist/billing/billing-provider-webhook-events/index.d.ts +3 -0
  38. package/dist/billing/billing-provider-webhook-events/index.d.ts.map +1 -0
  39. package/dist/billing/billing-provider-webhook-events/index.js +2 -0
  40. package/dist/billing/index.d.ts +4 -0
  41. package/dist/billing/index.d.ts.map +1 -1
  42. package/dist/billing/index.js +4 -0
  43. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ import { BillingInvoice } from '../billing-invoices';
2
+ import { BillingPlan } from '../billing-plans';
3
+ export declare class BillingInvoiceLineItem {
4
+ id: string;
5
+ invoiceId: string;
6
+ planId: string | null;
7
+ description: string;
8
+ quantity: number;
9
+ unitAmount: number;
10
+ amount: number;
11
+ createdAt: Date;
12
+ invoice: BillingInvoice;
13
+ plan: BillingPlan | null;
14
+ }
15
+ //# sourceMappingURL=billing-invoice-line-item.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-invoice-line-item.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-invoice-line-items/billing-invoice-line-item.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAa/C,qBAIa,sBAAsB;IAIjC,EAAE,EAAE,MAAM,CAAC;IAOX,SAAS,EAAE,MAAM,CAAC;IAQlB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAQtB,WAAW,EAAE,MAAM,CAAC;IAOpB,QAAQ,EAAE,MAAM,CAAC;IAOjB,UAAU,EAAE,MAAM,CAAC;IAOnB,MAAM,EAAE,MAAM,CAAC;IAOf,SAAS,EAAE,IAAI,CAAC;IAYhB,OAAO,EAAE,cAAc,CAAC;IAQxB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,99 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn
20
+ } from "typeorm";
21
+ import { BillingInvoice } from "../billing-invoices/index.js";
22
+ import { BillingPlan } from "../billing-plans/index.js";
23
+ let BillingInvoiceLineItem = class {
24
+ };
25
+ __decorateClass([
26
+ PrimaryGeneratedColumn("uuid", {
27
+ comment: "Identificador \xFAnico da linha."
28
+ })
29
+ ], BillingInvoiceLineItem.prototype, "id", 2);
30
+ __decorateClass([
31
+ Column({
32
+ name: "invoice_id",
33
+ type: "uuid",
34
+ comment: "Identificador da fatura \xE0 qual a linha pertence."
35
+ })
36
+ ], BillingInvoiceLineItem.prototype, "invoiceId", 2);
37
+ __decorateClass([
38
+ Column({
39
+ name: "plan_id",
40
+ type: "uuid",
41
+ nullable: true,
42
+ comment: "Vers\xE3o de plano cobrada. Nulo em linha de desconto/cupom."
43
+ })
44
+ ], BillingInvoiceLineItem.prototype, "planId", 2);
45
+ __decorateClass([
46
+ Column({
47
+ name: "description",
48
+ type: "varchar",
49
+ length: 255,
50
+ comment: 'Descri\xE7\xE3o da linha (ex.: "Licen\xE7a de campeonato", "Cupom LANC10").'
51
+ })
52
+ ], BillingInvoiceLineItem.prototype, "description", 2);
53
+ __decorateClass([
54
+ Column({
55
+ type: "int",
56
+ default: 1,
57
+ comment: "Quantidade cobrada nesta linha."
58
+ })
59
+ ], BillingInvoiceLineItem.prototype, "quantity", 2);
60
+ __decorateClass([
61
+ Column({
62
+ name: "unit_amount",
63
+ type: "int",
64
+ comment: "Pre\xE7o unit\xE1rio congelado, em centavos. Negativo em desconto."
65
+ })
66
+ ], BillingInvoiceLineItem.prototype, "unitAmount", 2);
67
+ __decorateClass([
68
+ Column({
69
+ name: "amount",
70
+ type: "int",
71
+ comment: "Total da linha (unitAmount \xD7 quantity), em centavos. Negativo em desconto."
72
+ })
73
+ ], BillingInvoiceLineItem.prototype, "amount", 2);
74
+ __decorateClass([
75
+ CreateDateColumn({
76
+ name: "created_at",
77
+ type: "timestamptz",
78
+ comment: "Data de cria\xE7\xE3o do registro."
79
+ })
80
+ ], BillingInvoiceLineItem.prototype, "createdAt", 2);
81
+ __decorateClass([
82
+ ManyToOne(() => BillingInvoice, (invoice) => invoice.lineItems, {
83
+ onDelete: "RESTRICT"
84
+ }),
85
+ JoinColumn({ name: "invoice_id" })
86
+ ], BillingInvoiceLineItem.prototype, "invoice", 2);
87
+ __decorateClass([
88
+ ManyToOne(() => BillingPlan, { onDelete: "RESTRICT", nullable: true }),
89
+ JoinColumn({ name: "plan_id" })
90
+ ], BillingInvoiceLineItem.prototype, "plan", 2);
91
+ BillingInvoiceLineItem = __decorateClass([
92
+ Entity("billing_invoice_line_items"),
93
+ Check("CHK_billing_invoice_line_items_quantity_positive", '"quantity" >= 1'),
94
+ Index("idx_billing_invoice_line_items_invoice", ["invoiceId"]),
95
+ Index("idx_billing_invoice_line_items_plan", ["planId"])
96
+ ], BillingInvoiceLineItem);
97
+ export {
98
+ BillingInvoiceLineItem
99
+ };
@@ -0,0 +1,2 @@
1
+ export * from './billing-invoice-line-item.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-invoice-line-items/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./billing-invoice-line-item.entity.js";
@@ -0,0 +1,38 @@
1
+ import { BillingAccount } from '../billing-accounts';
2
+ import { BillingInvoiceLineItem } from '../billing-invoice-line-items';
3
+ import { BillingSubscription } from '../billing-subscriptions';
4
+ import { BillingInvoiceStatus } from './enums/billing-invoice-status.enum';
5
+ export declare class BillingInvoice {
6
+ id: string;
7
+ invoiceNumber: string;
8
+ billingAccountId: string;
9
+ subscriptionId: string | null;
10
+ status: BillingInvoiceStatus;
11
+ subtotalAmount: number;
12
+ discountAmount: number;
13
+ totalAmount: number;
14
+ amountPaid: number;
15
+ billingPersonType: string | null;
16
+ billingDocument: string | null;
17
+ billingLegalName: string | null;
18
+ billingEmail: string | null;
19
+ billingPhone: string | null;
20
+ billingAddressPostalCode: string | null;
21
+ billingAddressStreet: string | null;
22
+ billingAddressNumber: string | null;
23
+ billingAddressComplement: string | null;
24
+ billingAddressNeighborhood: string | null;
25
+ billingAddressCity: string | null;
26
+ billingAddressState: string | null;
27
+ billingAddressCountry: string | null;
28
+ issuedAt: Date | null;
29
+ dueAt: Date | null;
30
+ paidAt: Date | null;
31
+ voidedAt: Date | null;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ billingAccount: BillingAccount;
35
+ subscription: BillingSubscription | null;
36
+ lineItems: BillingInvoiceLineItem[];
37
+ }
38
+ //# sourceMappingURL=billing-invoice.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-invoice.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-invoices/billing-invoice.entity.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAmB3E,qBASa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IAQX,aAAa,EAAE,MAAM,CAAC;IAOtB,gBAAgB,EAAE,MAAM,CAAC;IAQzB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAS9B,MAAM,EAAE,oBAAoB,CAAC;IAS7B,cAAc,EAAE,MAAM,CAAC;IAQvB,cAAc,EAAE,MAAM,CAAC;IAOvB,WAAW,EAAE,MAAM,CAAC;IAQpB,UAAU,EAAE,MAAM,CAAC;IAWnB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IASjC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAS/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAShC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAS5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAS5B,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IASxC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IASpC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IASpC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IASxC,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAS1C,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IASlC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IASnC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAUrC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IAQtB,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IAQnB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAQpB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IAOtB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAShB,cAAc,EAAE,cAAc,CAAC;IAO/B,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAMzC,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC"}
@@ -0,0 +1,285 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Generated,
17
+ Index,
18
+ JoinColumn,
19
+ ManyToOne,
20
+ OneToMany,
21
+ PrimaryGeneratedColumn,
22
+ Unique,
23
+ UpdateDateColumn
24
+ } from "typeorm";
25
+ import { BillingAccount } from "../billing-accounts/index.js";
26
+ import { BillingInvoiceLineItem } from "../billing-invoice-line-items/index.js";
27
+ import { BillingSubscription } from "../billing-subscriptions/index.js";
28
+ import { BillingInvoiceStatus } from "./enums/billing-invoice-status.enum.js";
29
+ let BillingInvoice = class {
30
+ };
31
+ __decorateClass([
32
+ PrimaryGeneratedColumn("uuid", {
33
+ comment: "Identificador \xFAnico (opaco) da fatura."
34
+ })
35
+ ], BillingInvoice.prototype, "id", 2);
36
+ __decorateClass([
37
+ Column({
38
+ name: "invoice_number",
39
+ type: "bigint",
40
+ comment: "N\xFAmero sequencial leg\xEDvel da fatura (refer\xEAncia interna, n\xE3o \xE9 NF-e)."
41
+ }),
42
+ Generated("increment")
43
+ ], BillingInvoice.prototype, "invoiceNumber", 2);
44
+ __decorateClass([
45
+ Column({
46
+ name: "billing_account_id",
47
+ type: "uuid",
48
+ comment: "Identificador da conta de billing respons\xE1vel pela fatura."
49
+ })
50
+ ], BillingInvoice.prototype, "billingAccountId", 2);
51
+ __decorateClass([
52
+ Column({
53
+ name: "subscription_id",
54
+ type: "uuid",
55
+ nullable: true,
56
+ comment: "Assinatura de origem. Nulo em fatura avulsa."
57
+ })
58
+ ], BillingInvoice.prototype, "subscriptionId", 2);
59
+ __decorateClass([
60
+ Column({
61
+ type: "enum",
62
+ enum: BillingInvoiceStatus,
63
+ enumName: "billing_invoices_status_enum",
64
+ default: BillingInvoiceStatus.DRAFT,
65
+ comment: "Estado da fatura (DRAFT \u2192 OPEN \u2192 PAID | VOID)."
66
+ })
67
+ ], BillingInvoice.prototype, "status", 2);
68
+ __decorateClass([
69
+ Column({
70
+ name: "subtotal_amount",
71
+ type: "int",
72
+ comment: "Soma das linhas positivas, em centavos."
73
+ })
74
+ ], BillingInvoice.prototype, "subtotalAmount", 2);
75
+ __decorateClass([
76
+ Column({
77
+ name: "discount_amount",
78
+ type: "int",
79
+ default: 0,
80
+ comment: "Total de descontos (agregado das linhas negativas), em centavos."
81
+ })
82
+ ], BillingInvoice.prototype, "discountAmount", 2);
83
+ __decorateClass([
84
+ Column({
85
+ name: "total_amount",
86
+ type: "int",
87
+ comment: "Valor devido = subtotal \u2212 desconto, em centavos."
88
+ })
89
+ ], BillingInvoice.prototype, "totalAmount", 2);
90
+ __decorateClass([
91
+ Column({
92
+ name: "amount_paid",
93
+ type: "int",
94
+ default: 0,
95
+ comment: "Total j\xE1 alocado a esta fatura (camada de pagamento), em centavos."
96
+ })
97
+ ], BillingInvoice.prototype, "amountPaid", 2);
98
+ __decorateClass([
99
+ Column({
100
+ name: "billing_person_type",
101
+ type: "varchar",
102
+ length: 20,
103
+ nullable: true,
104
+ comment: "Natureza jur\xEDdica congelada (individual/company)."
105
+ })
106
+ ], BillingInvoice.prototype, "billingPersonType", 2);
107
+ __decorateClass([
108
+ Column({
109
+ name: "billing_document",
110
+ type: "varchar",
111
+ length: 14,
112
+ nullable: true,
113
+ comment: "Documento fiscal congelado (CPF/CNPJ, s\xF3 d\xEDgitos)."
114
+ })
115
+ ], BillingInvoice.prototype, "billingDocument", 2);
116
+ __decorateClass([
117
+ Column({
118
+ name: "billing_legal_name",
119
+ type: "varchar",
120
+ length: 255,
121
+ nullable: true,
122
+ comment: "Nome/raz\xE3o social congelado."
123
+ })
124
+ ], BillingInvoice.prototype, "billingLegalName", 2);
125
+ __decorateClass([
126
+ Column({
127
+ name: "billing_email",
128
+ type: "varchar",
129
+ length: 255,
130
+ nullable: true,
131
+ comment: "E-mail de cobran\xE7a congelado."
132
+ })
133
+ ], BillingInvoice.prototype, "billingEmail", 2);
134
+ __decorateClass([
135
+ Column({
136
+ name: "billing_phone",
137
+ type: "varchar",
138
+ length: 20,
139
+ nullable: true,
140
+ comment: "Telefone congelado."
141
+ })
142
+ ], BillingInvoice.prototype, "billingPhone", 2);
143
+ __decorateClass([
144
+ Column({
145
+ name: "billing_address_postal_code",
146
+ type: "varchar",
147
+ length: 8,
148
+ nullable: true,
149
+ comment: "CEP congelado."
150
+ })
151
+ ], BillingInvoice.prototype, "billingAddressPostalCode", 2);
152
+ __decorateClass([
153
+ Column({
154
+ name: "billing_address_street",
155
+ type: "varchar",
156
+ length: 255,
157
+ nullable: true,
158
+ comment: "Logradouro congelado."
159
+ })
160
+ ], BillingInvoice.prototype, "billingAddressStreet", 2);
161
+ __decorateClass([
162
+ Column({
163
+ name: "billing_address_number",
164
+ type: "varchar",
165
+ length: 20,
166
+ nullable: true,
167
+ comment: "N\xFAmero congelado."
168
+ })
169
+ ], BillingInvoice.prototype, "billingAddressNumber", 2);
170
+ __decorateClass([
171
+ Column({
172
+ name: "billing_address_complement",
173
+ type: "varchar",
174
+ length: 100,
175
+ nullable: true,
176
+ comment: "Complemento congelado."
177
+ })
178
+ ], BillingInvoice.prototype, "billingAddressComplement", 2);
179
+ __decorateClass([
180
+ Column({
181
+ name: "billing_address_neighborhood",
182
+ type: "varchar",
183
+ length: 100,
184
+ nullable: true,
185
+ comment: "Bairro congelado."
186
+ })
187
+ ], BillingInvoice.prototype, "billingAddressNeighborhood", 2);
188
+ __decorateClass([
189
+ Column({
190
+ name: "billing_address_city",
191
+ type: "varchar",
192
+ length: 100,
193
+ nullable: true,
194
+ comment: "Cidade congelada."
195
+ })
196
+ ], BillingInvoice.prototype, "billingAddressCity", 2);
197
+ __decorateClass([
198
+ Column({
199
+ name: "billing_address_state",
200
+ type: "char",
201
+ length: 2,
202
+ nullable: true,
203
+ comment: "UF congelada."
204
+ })
205
+ ], BillingInvoice.prototype, "billingAddressState", 2);
206
+ __decorateClass([
207
+ Column({
208
+ name: "billing_address_country",
209
+ type: "char",
210
+ length: 2,
211
+ nullable: true,
212
+ comment: "Pa\xEDs congelado (ISO alpha-2)."
213
+ })
214
+ ], BillingInvoice.prototype, "billingAddressCountry", 2);
215
+ __decorateClass([
216
+ Column({
217
+ name: "issued_at",
218
+ type: "timestamptz",
219
+ nullable: true,
220
+ comment: "Momento da emiss\xE3o (DRAFT \u2192 OPEN). Nulo enquanto rascunho."
221
+ })
222
+ ], BillingInvoice.prototype, "issuedAt", 2);
223
+ __decorateClass([
224
+ Column({
225
+ name: "due_at",
226
+ type: "timestamptz",
227
+ nullable: true,
228
+ comment: "Vencimento. O job de suspens\xE3o l\xEA o prazo de gra\xE7a daqui."
229
+ })
230
+ ], BillingInvoice.prototype, "dueAt", 2);
231
+ __decorateClass([
232
+ Column({
233
+ name: "paid_at",
234
+ type: "timestamptz",
235
+ nullable: true,
236
+ comment: "Momento da quita\xE7\xE3o. Nulo enquanto n\xE3o paga."
237
+ })
238
+ ], BillingInvoice.prototype, "paidAt", 2);
239
+ __decorateClass([
240
+ Column({
241
+ name: "voided_at",
242
+ type: "timestamptz",
243
+ nullable: true,
244
+ comment: "Momento da anula\xE7\xE3o. Nulo enquanto n\xE3o anulada."
245
+ })
246
+ ], BillingInvoice.prototype, "voidedAt", 2);
247
+ __decorateClass([
248
+ CreateDateColumn({
249
+ name: "created_at",
250
+ type: "timestamptz",
251
+ comment: "Data de cria\xE7\xE3o do registro."
252
+ })
253
+ ], BillingInvoice.prototype, "createdAt", 2);
254
+ __decorateClass([
255
+ UpdateDateColumn({
256
+ name: "updated_at",
257
+ type: "timestamptz",
258
+ comment: "Data da \xFAltima atualiza\xE7\xE3o do registro."
259
+ })
260
+ ], BillingInvoice.prototype, "updatedAt", 2);
261
+ __decorateClass([
262
+ ManyToOne(() => BillingAccount, { onDelete: "RESTRICT" }),
263
+ JoinColumn({ name: "billing_account_id" })
264
+ ], BillingInvoice.prototype, "billingAccount", 2);
265
+ __decorateClass([
266
+ ManyToOne(() => BillingSubscription, { onDelete: "RESTRICT", nullable: true }),
267
+ JoinColumn({ name: "subscription_id" })
268
+ ], BillingInvoice.prototype, "subscription", 2);
269
+ __decorateClass([
270
+ OneToMany(() => BillingInvoiceLineItem, (lineItem) => lineItem.invoice)
271
+ ], BillingInvoice.prototype, "lineItems", 2);
272
+ BillingInvoice = __decorateClass([
273
+ Entity("billing_invoices"),
274
+ Unique("UQ_billing_invoices_number", ["invoiceNumber"]),
275
+ Check("CHK_billing_invoices_subtotal_non_negative", '"subtotal_amount" >= 0'),
276
+ Check("CHK_billing_invoices_discount_non_negative", '"discount_amount" >= 0'),
277
+ Check("CHK_billing_invoices_total_non_negative", '"total_amount" >= 0'),
278
+ Check("CHK_billing_invoices_amount_paid_non_negative", '"amount_paid" >= 0'),
279
+ Index("idx_billing_invoices_account", ["billingAccountId"]),
280
+ Index("idx_billing_invoices_subscription", ["subscriptionId"]),
281
+ Index("idx_billing_invoices_status", ["status"])
282
+ ], BillingInvoice);
283
+ export {
284
+ BillingInvoice
285
+ };
@@ -0,0 +1,7 @@
1
+ export declare enum BillingInvoiceStatus {
2
+ DRAFT = "draft",
3
+ OPEN = "open",
4
+ PAID = "paid",
5
+ VOID = "void"
6
+ }
7
+ //# sourceMappingURL=billing-invoice-status.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-invoice-status.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-invoices/enums/billing-invoice-status.enum.ts"],"names":[],"mappings":"AAkBA,oBAAY,oBAAoB;IAC9B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;CACd"}
@@ -0,0 +1,10 @@
1
+ var BillingInvoiceStatus = /* @__PURE__ */ ((BillingInvoiceStatus2) => {
2
+ BillingInvoiceStatus2["DRAFT"] = "draft";
3
+ BillingInvoiceStatus2["OPEN"] = "open";
4
+ BillingInvoiceStatus2["PAID"] = "paid";
5
+ BillingInvoiceStatus2["VOID"] = "void";
6
+ return BillingInvoiceStatus2;
7
+ })(BillingInvoiceStatus || {});
8
+ export {
9
+ BillingInvoiceStatus
10
+ };
@@ -0,0 +1,3 @@
1
+ export * from './billing-invoice.entity';
2
+ export * from './enums/billing-invoice-status.enum';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-invoices/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./billing-invoice.entity.js";
2
+ export * from "./enums/billing-invoice-status.enum.js";
@@ -0,0 +1,25 @@
1
+ import { BillingAccount } from '../billing-accounts';
2
+ import { BillingInvoice } from '../billing-invoices';
3
+ import { BillingPaymentMethod } from './enums/billing-payment-method.enum';
4
+ import { BillingPaymentProviderName } from './enums/billing-payment-provider-name.enum';
5
+ import { BillingPaymentStatus } from './enums/billing-payment-status.enum';
6
+ export declare class BillingPayment {
7
+ id: string;
8
+ billingAccountId: string;
9
+ invoiceId: string;
10
+ amount: number;
11
+ method: BillingPaymentMethod;
12
+ status: BillingPaymentStatus;
13
+ provider: BillingPaymentProviderName;
14
+ externalId: string | null;
15
+ providerResponse: Record<string, unknown> | null;
16
+ qrCode: string | null;
17
+ checkoutUrl: string | null;
18
+ expiresAt: Date | null;
19
+ paidAt: Date | null;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ billingAccount: BillingAccount;
23
+ invoice: BillingInvoice;
24
+ }
25
+ //# sourceMappingURL=billing-payment.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-payment.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-payments/billing-payment.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAgB3E,qBAKa,cAAc;IAIzB,EAAE,EAAE,MAAM,CAAC;IAOX,gBAAgB,EAAE,MAAM,CAAC;IAOzB,SAAS,EAAE,MAAM,CAAC;IAMlB,MAAM,EAAE,MAAM,CAAC;IAUf,MAAM,EAAE,oBAAoB,CAAC;IAS7B,MAAM,EAAE,oBAAoB,CAAC;IAS7B,QAAQ,EAAE,0BAA0B,CAAC;IASrC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ1B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAQjD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAQtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAQvB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAOpB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAShB,cAAc,EAAE,cAAc,CAAC;IAO/B,OAAO,EAAE,cAAc,CAAC;CACzB"}
@@ -0,0 +1,162 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn,
20
+ UpdateDateColumn
21
+ } from "typeorm";
22
+ import { BillingAccount } from "../billing-accounts/index.js";
23
+ import { BillingInvoice } from "../billing-invoices/index.js";
24
+ import { BillingPaymentMethod } from "./enums/billing-payment-method.enum.js";
25
+ import { BillingPaymentProviderName } from "./enums/billing-payment-provider-name.enum.js";
26
+ import { BillingPaymentStatus } from "./enums/billing-payment-status.enum.js";
27
+ let BillingPayment = class {
28
+ };
29
+ __decorateClass([
30
+ PrimaryGeneratedColumn("uuid", {
31
+ comment: "Identificador \xFAnico do pagamento."
32
+ })
33
+ ], BillingPayment.prototype, "id", 2);
34
+ __decorateClass([
35
+ Column({
36
+ name: "billing_account_id",
37
+ type: "uuid",
38
+ comment: "Identificador da conta de billing que paga."
39
+ })
40
+ ], BillingPayment.prototype, "billingAccountId", 2);
41
+ __decorateClass([
42
+ Column({
43
+ name: "invoice_id",
44
+ type: "uuid",
45
+ comment: "Identificador da fatura sendo paga."
46
+ })
47
+ ], BillingPayment.prototype, "invoiceId", 2);
48
+ __decorateClass([
49
+ Column({
50
+ type: "int",
51
+ comment: "Valor do pagamento em centavos."
52
+ })
53
+ ], BillingPayment.prototype, "amount", 2);
54
+ __decorateClass([
55
+ Column({
56
+ name: "method",
57
+ type: "enum",
58
+ enum: BillingPaymentMethod,
59
+ enumName: "billing_payments_method_enum",
60
+ default: BillingPaymentMethod.UNSPECIFIED,
61
+ comment: "M\xE9todo do pagamento (definido no checkout do provider)."
62
+ })
63
+ ], BillingPayment.prototype, "method", 2);
64
+ __decorateClass([
65
+ Column({
66
+ type: "enum",
67
+ enum: BillingPaymentStatus,
68
+ enumName: "billing_payments_status_enum",
69
+ default: BillingPaymentStatus.PENDING,
70
+ comment: "Estado atual do pagamento."
71
+ })
72
+ ], BillingPayment.prototype, "status", 2);
73
+ __decorateClass([
74
+ Column({
75
+ name: "provider",
76
+ type: "enum",
77
+ enum: BillingPaymentProviderName,
78
+ enumName: "billing_payment_provider_name_enum",
79
+ comment: "Provider (gateway) usado neste pagamento."
80
+ })
81
+ ], BillingPayment.prototype, "provider", 2);
82
+ __decorateClass([
83
+ Column({
84
+ name: "external_id",
85
+ type: "varchar",
86
+ length: 255,
87
+ nullable: true,
88
+ comment: "Identificador do pagamento no provider."
89
+ })
90
+ ], BillingPayment.prototype, "externalId", 2);
91
+ __decorateClass([
92
+ Column({
93
+ name: "provider_response",
94
+ type: "jsonb",
95
+ nullable: true,
96
+ comment: "Resposta crua do provider."
97
+ })
98
+ ], BillingPayment.prototype, "providerResponse", 2);
99
+ __decorateClass([
100
+ Column({
101
+ name: "qr_code",
102
+ type: "text",
103
+ nullable: true,
104
+ comment: "C\xF3digo PIX copia-e-cola (quando aplic\xE1vel)."
105
+ })
106
+ ], BillingPayment.prototype, "qrCode", 2);
107
+ __decorateClass([
108
+ Column({
109
+ name: "checkout_url",
110
+ type: "text",
111
+ nullable: true,
112
+ comment: "URL de checkout do provider (quando aplic\xE1vel)."
113
+ })
114
+ ], BillingPayment.prototype, "checkoutUrl", 2);
115
+ __decorateClass([
116
+ Column({
117
+ name: "expires_at",
118
+ type: "timestamptz",
119
+ nullable: true,
120
+ comment: "Expira\xE7\xE3o da cobran\xE7a (quando aplic\xE1vel)."
121
+ })
122
+ ], BillingPayment.prototype, "expiresAt", 2);
123
+ __decorateClass([
124
+ Column({
125
+ name: "paid_at",
126
+ type: "timestamptz",
127
+ nullable: true,
128
+ comment: "Momento da confirma\xE7\xE3o do pagamento. Nulo enquanto n\xE3o pago."
129
+ })
130
+ ], BillingPayment.prototype, "paidAt", 2);
131
+ __decorateClass([
132
+ CreateDateColumn({
133
+ name: "created_at",
134
+ type: "timestamptz",
135
+ comment: "Data de cria\xE7\xE3o do registro."
136
+ })
137
+ ], BillingPayment.prototype, "createdAt", 2);
138
+ __decorateClass([
139
+ UpdateDateColumn({
140
+ name: "updated_at",
141
+ type: "timestamptz",
142
+ comment: "Data da \xFAltima atualiza\xE7\xE3o do registro."
143
+ })
144
+ ], BillingPayment.prototype, "updatedAt", 2);
145
+ __decorateClass([
146
+ ManyToOne(() => BillingAccount, { onDelete: "RESTRICT" }),
147
+ JoinColumn({ name: "billing_account_id" })
148
+ ], BillingPayment.prototype, "billingAccount", 2);
149
+ __decorateClass([
150
+ ManyToOne(() => BillingInvoice, { onDelete: "RESTRICT" }),
151
+ JoinColumn({ name: "invoice_id" })
152
+ ], BillingPayment.prototype, "invoice", 2);
153
+ BillingPayment = __decorateClass([
154
+ Entity("billing_payments"),
155
+ Check("CHK_billing_payments_amount_positive", '"amount" >= 1'),
156
+ Index("idx_billing_payments_account", ["billingAccountId"]),
157
+ Index("idx_billing_payments_invoice", ["invoiceId"]),
158
+ Index("idx_billing_payments_status", ["status"])
159
+ ], BillingPayment);
160
+ export {
161
+ BillingPayment
162
+ };
@@ -0,0 +1,8 @@
1
+ export declare enum BillingPaymentMethod {
2
+ UNSPECIFIED = "unspecified",
3
+ PIX = "pix",
4
+ CREDIT_CARD = "credit_card",
5
+ DEBIT_CARD = "debit_card",
6
+ BOLETO = "boleto"
7
+ }
8
+ //# sourceMappingURL=billing-payment-method.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-payment-method.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-payments/enums/billing-payment-method.enum.ts"],"names":[],"mappings":"AASA,oBAAY,oBAAoB;IAC9B,WAAW,gBAAgB;IAC3B,GAAG,QAAQ;IACX,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB"}
@@ -0,0 +1,11 @@
1
+ var BillingPaymentMethod = /* @__PURE__ */ ((BillingPaymentMethod2) => {
2
+ BillingPaymentMethod2["UNSPECIFIED"] = "unspecified";
3
+ BillingPaymentMethod2["PIX"] = "pix";
4
+ BillingPaymentMethod2["CREDIT_CARD"] = "credit_card";
5
+ BillingPaymentMethod2["DEBIT_CARD"] = "debit_card";
6
+ BillingPaymentMethod2["BOLETO"] = "boleto";
7
+ return BillingPaymentMethod2;
8
+ })(BillingPaymentMethod || {});
9
+ export {
10
+ BillingPaymentMethod
11
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum BillingPaymentProviderName {
2
+ PAGARME = "pagarme",
3
+ MERCADO_PAGO = "mercado_pago"
4
+ }
5
+ //# sourceMappingURL=billing-payment-provider-name.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-payment-provider-name.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-payments/enums/billing-payment-provider-name.enum.ts"],"names":[],"mappings":"AAUA,oBAAY,0BAA0B;IACpC,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B"}
@@ -0,0 +1,8 @@
1
+ var BillingPaymentProviderName = /* @__PURE__ */ ((BillingPaymentProviderName2) => {
2
+ BillingPaymentProviderName2["PAGARME"] = "pagarme";
3
+ BillingPaymentProviderName2["MERCADO_PAGO"] = "mercado_pago";
4
+ return BillingPaymentProviderName2;
5
+ })(BillingPaymentProviderName || {});
6
+ export {
7
+ BillingPaymentProviderName
8
+ };
@@ -0,0 +1,9 @@
1
+ export declare enum BillingPaymentStatus {
2
+ PENDING = "pending",
3
+ PAID = "paid",
4
+ FAILED = "failed",
5
+ EXPIRED = "expired",
6
+ CANCELED = "canceled",
7
+ REFUNDED = "refunded"
8
+ }
9
+ //# sourceMappingURL=billing-payment-status.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-payment-status.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-payments/enums/billing-payment-status.enum.ts"],"names":[],"mappings":"AAUA,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,12 @@
1
+ var BillingPaymentStatus = /* @__PURE__ */ ((BillingPaymentStatus2) => {
2
+ BillingPaymentStatus2["PENDING"] = "pending";
3
+ BillingPaymentStatus2["PAID"] = "paid";
4
+ BillingPaymentStatus2["FAILED"] = "failed";
5
+ BillingPaymentStatus2["EXPIRED"] = "expired";
6
+ BillingPaymentStatus2["CANCELED"] = "canceled";
7
+ BillingPaymentStatus2["REFUNDED"] = "refunded";
8
+ return BillingPaymentStatus2;
9
+ })(BillingPaymentStatus || {});
10
+ export {
11
+ BillingPaymentStatus
12
+ };
@@ -0,0 +1,5 @@
1
+ export * from './billing-payment.entity';
2
+ export * from './enums/billing-payment-method.enum';
3
+ export * from './enums/billing-payment-provider-name.enum';
4
+ export * from './enums/billing-payment-status.enum';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-payments/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qCAAqC,CAAC;AACpD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./billing-payment.entity.js";
2
+ export * from "./enums/billing-payment-method.enum.js";
3
+ export * from "./enums/billing-payment-provider-name.enum.js";
4
+ export * from "./enums/billing-payment-status.enum.js";
@@ -0,0 +1,16 @@
1
+ import { BillingPaymentProviderName } from '../billing-payments';
2
+ import { BillingProviderWebhookStatus } from './enums/billing-provider-webhook-status.enum';
3
+ export declare class BillingProviderWebhookEvent {
4
+ id: string;
5
+ provider: BillingPaymentProviderName;
6
+ externalEventId: string;
7
+ eventType: string;
8
+ payload: Record<string, unknown>;
9
+ status: BillingProviderWebhookStatus;
10
+ attempts: number;
11
+ availableAt: Date;
12
+ lastError: string | null;
13
+ processedAt: Date | null;
14
+ createdAt: Date;
15
+ }
16
+ //# sourceMappingURL=billing-provider-webhook-event.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-provider-webhook-event.entity.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-provider-webhook-events/billing-provider-webhook-event.entity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAe5F,qBAMa,2BAA2B;IAItC,EAAE,EAAE,MAAM,CAAC;IASX,QAAQ,EAAE,0BAA0B,CAAC;IAQrC,eAAe,EAAE,MAAM,CAAC;IAQxB,SAAS,EAAE,MAAM,CAAC;IAMlB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IASjC,MAAM,EAAE,4BAA4B,CAAC;IAOrC,QAAQ,EAAE,MAAM,CAAC;IAQjB,WAAW,EAAE,IAAI,CAAC;IAQlB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAOzB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,108 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, Unique } from "typeorm";
12
+ import { BillingPaymentProviderName } from "../billing-payments/index.js";
13
+ import { BillingProviderWebhookStatus } from "./enums/billing-provider-webhook-status.enum.js";
14
+ let BillingProviderWebhookEvent = class {
15
+ };
16
+ __decorateClass([
17
+ PrimaryGeneratedColumn("uuid", {
18
+ comment: "Identificador \xFAnico do evento."
19
+ })
20
+ ], BillingProviderWebhookEvent.prototype, "id", 2);
21
+ __decorateClass([
22
+ Column({
23
+ name: "provider",
24
+ type: "enum",
25
+ enum: BillingPaymentProviderName,
26
+ enumName: "billing_payment_provider_name_enum",
27
+ comment: "Provider que emitiu o webhook."
28
+ })
29
+ ], BillingProviderWebhookEvent.prototype, "provider", 2);
30
+ __decorateClass([
31
+ Column({
32
+ name: "external_event_id",
33
+ type: "varchar",
34
+ length: 255,
35
+ comment: "Identificador do evento no provider (idempot\xEAncia)."
36
+ })
37
+ ], BillingProviderWebhookEvent.prototype, "externalEventId", 2);
38
+ __decorateClass([
39
+ Column({
40
+ name: "event_type",
41
+ type: "varchar",
42
+ length: 80,
43
+ comment: "Tipo do evento no provider (ex.: payment.paid)."
44
+ })
45
+ ], BillingProviderWebhookEvent.prototype, "eventType", 2);
46
+ __decorateClass([
47
+ Column({
48
+ type: "jsonb",
49
+ comment: "Payload cru do evento."
50
+ })
51
+ ], BillingProviderWebhookEvent.prototype, "payload", 2);
52
+ __decorateClass([
53
+ Column({
54
+ type: "enum",
55
+ enum: BillingProviderWebhookStatus,
56
+ enumName: "billing_provider_webhook_events_status_enum",
57
+ default: BillingProviderWebhookStatus.PENDING,
58
+ comment: "Estado de processamento do evento."
59
+ })
60
+ ], BillingProviderWebhookEvent.prototype, "status", 2);
61
+ __decorateClass([
62
+ Column({
63
+ type: "int",
64
+ default: 0,
65
+ comment: "N\xFAmero de tentativas de processamento."
66
+ })
67
+ ], BillingProviderWebhookEvent.prototype, "attempts", 2);
68
+ __decorateClass([
69
+ Column({
70
+ name: "available_at",
71
+ type: "timestamptz",
72
+ default: () => "now()",
73
+ comment: "Momento a partir do qual o evento pode ser processado (backoff)."
74
+ })
75
+ ], BillingProviderWebhookEvent.prototype, "availableAt", 2);
76
+ __decorateClass([
77
+ Column({
78
+ name: "last_error",
79
+ type: "text",
80
+ nullable: true,
81
+ comment: "\xDAltima mensagem de erro no processamento."
82
+ })
83
+ ], BillingProviderWebhookEvent.prototype, "lastError", 2);
84
+ __decorateClass([
85
+ Column({
86
+ name: "processed_at",
87
+ type: "timestamptz",
88
+ nullable: true,
89
+ comment: "Momento em que o evento foi processado com sucesso."
90
+ })
91
+ ], BillingProviderWebhookEvent.prototype, "processedAt", 2);
92
+ __decorateClass([
93
+ CreateDateColumn({
94
+ name: "created_at",
95
+ type: "timestamptz",
96
+ comment: "Data de recebimento do evento."
97
+ })
98
+ ], BillingProviderWebhookEvent.prototype, "createdAt", 2);
99
+ BillingProviderWebhookEvent = __decorateClass([
100
+ Entity("billing_provider_webhook_events"),
101
+ Unique("UQ_billing_provider_webhook_events_external", ["provider", "externalEventId"]),
102
+ Index("idx_billing_provider_webhook_events_pending", ["availableAt"], {
103
+ where: `"status" = 'pending'`
104
+ })
105
+ ], BillingProviderWebhookEvent);
106
+ export {
107
+ BillingProviderWebhookEvent
108
+ };
@@ -0,0 +1,6 @@
1
+ export declare enum BillingProviderWebhookStatus {
2
+ PENDING = "pending",
3
+ PROCESSED = "processed",
4
+ FAILED = "failed"
5
+ }
6
+ //# sourceMappingURL=billing-provider-webhook-status.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-provider-webhook-status.enum.d.ts","sourceRoot":"","sources":["../../../../src/billing/billing-provider-webhook-events/enums/billing-provider-webhook-status.enum.ts"],"names":[],"mappings":"AAUA,oBAAY,4BAA4B;IACtC,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB"}
@@ -0,0 +1,9 @@
1
+ var BillingProviderWebhookStatus = /* @__PURE__ */ ((BillingProviderWebhookStatus2) => {
2
+ BillingProviderWebhookStatus2["PENDING"] = "pending";
3
+ BillingProviderWebhookStatus2["PROCESSED"] = "processed";
4
+ BillingProviderWebhookStatus2["FAILED"] = "failed";
5
+ return BillingProviderWebhookStatus2;
6
+ })(BillingProviderWebhookStatus || {});
7
+ export {
8
+ BillingProviderWebhookStatus
9
+ };
@@ -0,0 +1,3 @@
1
+ export * from './billing-provider-webhook-event.entity';
2
+ export * from './enums/billing-provider-webhook-status.enum';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/billing-provider-webhook-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./billing-provider-webhook-event.entity.js";
2
+ export * from "./enums/billing-provider-webhook-status.enum.js";
@@ -1,6 +1,10 @@
1
1
  export * from './billing-accounts';
2
+ export * from './billing-invoice-line-items';
3
+ export * from './billing-invoices';
4
+ export * from './billing-payments';
2
5
  export * from './billing-plans';
3
6
  export * from './billing-products';
7
+ export * from './billing-provider-webhook-events';
4
8
  export * from './billing-subscription-items';
5
9
  export * from './billing-subscriptions';
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC"}
@@ -1,5 +1,9 @@
1
1
  export * from "./billing-accounts/index.js";
2
+ export * from "./billing-invoice-line-items/index.js";
3
+ export * from "./billing-invoices/index.js";
4
+ export * from "./billing-payments/index.js";
2
5
  export * from "./billing-plans/index.js";
3
6
  export * from "./billing-products/index.js";
7
+ export * from "./billing-provider-webhook-events/index.js";
4
8
  export * from "./billing-subscription-items/index.js";
5
9
  export * from "./billing-subscriptions/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "7.5.0",
3
+ "version": "7.7.0",
4
4
  "description": "Entidades compartilhadass da NaTrave",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",