@venturekit/billing 0.0.50 → 0.0.52
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.
- package/README.md +30 -28
- package/dist/client.d.ts +7 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -9
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/events.d.ts +5 -5
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +3 -3
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +6 -6
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/{zazu → manza}/adapter.d.ts +15 -15
- package/dist/providers/manza/adapter.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/adapter.js +24 -24
- package/dist/providers/manza/adapter.js.map +1 -0
- package/dist/providers/manza/client.d.ts +76 -0
- package/dist/providers/manza/client.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/client.js +9 -9
- package/dist/providers/manza/client.js.map +1 -0
- package/dist/providers/{zazu → manza}/config.d.ts +21 -21
- package/dist/providers/manza/config.d.ts.map +1 -0
- package/dist/providers/manza/config.js +99 -0
- package/dist/providers/manza/config.js.map +1 -0
- package/dist/providers/{zazu → manza}/correlation.d.ts +7 -7
- package/dist/providers/manza/correlation.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/correlation.js +22 -22
- package/dist/providers/manza/correlation.js.map +1 -0
- package/dist/providers/manza/index.d.ts +19 -0
- package/dist/providers/manza/index.d.ts.map +1 -0
- package/dist/providers/manza/index.js +24 -0
- package/dist/providers/manza/index.js.map +1 -0
- package/dist/providers/manza/maps.d.ts +36 -0
- package/dist/providers/manza/maps.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/maps.js +4 -4
- package/dist/providers/manza/maps.js.map +1 -0
- package/dist/providers/{zazu → manza}/secrets.d.ts +15 -15
- package/dist/providers/manza/secrets.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/secrets.js +13 -13
- package/dist/providers/manza/secrets.js.map +1 -0
- package/dist/providers/{zazu → manza}/types.d.ts +65 -65
- package/dist/providers/manza/types.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/types.js +3 -3
- package/dist/providers/manza/types.js.map +1 -0
- package/dist/providers/{zazu → manza}/webhooks.d.ts +19 -19
- package/dist/providers/manza/webhooks.d.ts.map +1 -0
- package/dist/providers/{zazu → manza}/webhooks.js +57 -46
- package/dist/providers/manza/webhooks.js.map +1 -0
- package/dist/providers/mock.js +3 -3
- package/dist/providers/zazu.d.ts +9 -0
- package/dist/providers/zazu.d.ts.map +1 -0
- package/dist/providers/zazu.js +8 -0
- package/dist/providers/zazu.js.map +1 -0
- package/dist/types.d.ts +15 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/package.json +11 -7
- package/dist/providers/zazu/adapter.d.ts.map +0 -1
- package/dist/providers/zazu/adapter.js.map +0 -1
- package/dist/providers/zazu/client.d.ts +0 -76
- package/dist/providers/zazu/client.d.ts.map +0 -1
- package/dist/providers/zazu/client.js.map +0 -1
- package/dist/providers/zazu/config.d.ts.map +0 -1
- package/dist/providers/zazu/config.js +0 -90
- package/dist/providers/zazu/config.js.map +0 -1
- package/dist/providers/zazu/correlation.d.ts.map +0 -1
- package/dist/providers/zazu/correlation.js.map +0 -1
- package/dist/providers/zazu/index.d.ts +0 -19
- package/dist/providers/zazu/index.d.ts.map +0 -1
- package/dist/providers/zazu/index.js +0 -22
- package/dist/providers/zazu/index.js.map +0 -1
- package/dist/providers/zazu/maps.d.ts +0 -36
- package/dist/providers/zazu/maps.d.ts.map +0 -1
- package/dist/providers/zazu/maps.js.map +0 -1
- package/dist/providers/zazu/secrets.d.ts.map +0 -1
- package/dist/providers/zazu/secrets.js.map +0 -1
- package/dist/providers/zazu/types.d.ts.map +0 -1
- package/dist/providers/zazu/types.js.map +0 -1
- package/dist/providers/zazu/webhooks.d.ts.map +0 -1
- package/dist/providers/zazu/webhooks.js.map +0 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @venturekit/billing —
|
|
2
|
+
* @venturekit/billing — Manza raw API types
|
|
3
3
|
*
|
|
4
|
-
* These interfaces mirror the wire format of the
|
|
4
|
+
* These interfaces mirror the wire format of the Manza REST API exactly
|
|
5
5
|
* (see https://staging.zazu.ma/docs). They are intentionally separate
|
|
6
6
|
* from the domain types in `../../types.ts`: the `maps.ts` module is the
|
|
7
|
-
* only place that converts between the two, so a change in the
|
|
7
|
+
* only place that converts between the two, so a change in the Manza API
|
|
8
8
|
* never leaks into the rest of the application.
|
|
9
9
|
*
|
|
10
10
|
* Amounts are decimal strings (`"1500.000"`); timestamps are ISO 8601.
|
|
11
11
|
*/
|
|
12
12
|
/** Compact account projection embedded in payment links and transactions. */
|
|
13
|
-
export interface
|
|
13
|
+
export interface ManzaAccountProjection {
|
|
14
14
|
id: string;
|
|
15
15
|
name: string;
|
|
16
16
|
currency_code: string;
|
|
17
17
|
rib?: string;
|
|
18
18
|
}
|
|
19
|
-
export type
|
|
19
|
+
export type ManzaAccountStatus = 'open' | 'closed' | 'frozen';
|
|
20
20
|
/** Full account object from `GET /api/accounts`. */
|
|
21
|
-
export interface
|
|
21
|
+
export interface ManzaAccount {
|
|
22
22
|
id: string;
|
|
23
23
|
name: string;
|
|
24
|
-
status:
|
|
24
|
+
status: ManzaAccountStatus;
|
|
25
25
|
currency_code: string;
|
|
26
26
|
balance?: string;
|
|
27
27
|
rib?: string;
|
|
@@ -29,7 +29,7 @@ export interface ZazuAccount {
|
|
|
29
29
|
updated_at: string;
|
|
30
30
|
}
|
|
31
31
|
/** Ledger entry from `GET /api/accounts/:account_id/transactions`. */
|
|
32
|
-
export interface
|
|
32
|
+
export interface ManzaAccountTransaction {
|
|
33
33
|
id: string;
|
|
34
34
|
account_id: string;
|
|
35
35
|
operation: 'credit' | 'debit';
|
|
@@ -47,10 +47,10 @@ export interface ZazuAccountTransaction {
|
|
|
47
47
|
value_date?: string;
|
|
48
48
|
created_at: string;
|
|
49
49
|
updated_at: string;
|
|
50
|
-
account?:
|
|
50
|
+
account?: ManzaAccountProjection;
|
|
51
51
|
}
|
|
52
|
-
export type
|
|
53
|
-
export interface
|
|
52
|
+
export type ManzaCheckoutSessionStatus = 'open' | 'processing' | 'complete' | 'expired';
|
|
53
|
+
export interface ManzaCheckoutTransaction {
|
|
54
54
|
id: string;
|
|
55
55
|
status: string;
|
|
56
56
|
amount: string;
|
|
@@ -73,9 +73,9 @@ export interface ZazuCheckoutTransaction {
|
|
|
73
73
|
* here even though a `GET /api/checkout_sessions/:id` always returns them.
|
|
74
74
|
* See https://staging.zazu.ma/docs/webhooks.
|
|
75
75
|
*/
|
|
76
|
-
export interface
|
|
76
|
+
export interface ManzaCheckoutSession {
|
|
77
77
|
id: string;
|
|
78
|
-
status:
|
|
78
|
+
status: ManzaCheckoutSessionStatus;
|
|
79
79
|
amount: string;
|
|
80
80
|
currency_code: string;
|
|
81
81
|
/** Absent on webhook payloads. */
|
|
@@ -89,10 +89,10 @@ export interface ZazuCheckoutSession {
|
|
|
89
89
|
/** Absent on webhook payloads. */
|
|
90
90
|
expires_at?: string;
|
|
91
91
|
completed_at?: string | null;
|
|
92
|
-
transaction?:
|
|
92
|
+
transaction?: ManzaCheckoutTransaction | null;
|
|
93
93
|
created_at: string;
|
|
94
94
|
}
|
|
95
|
-
export interface
|
|
95
|
+
export interface ManzaCreateCheckoutSessionBody {
|
|
96
96
|
account_id: string;
|
|
97
97
|
amount: string;
|
|
98
98
|
success_url: string;
|
|
@@ -102,8 +102,8 @@ export interface ZazuCreateCheckoutSessionBody {
|
|
|
102
102
|
description?: string;
|
|
103
103
|
expires_at?: string;
|
|
104
104
|
}
|
|
105
|
-
export type
|
|
106
|
-
export type
|
|
105
|
+
export type ManzaPaymentLinkType = 'single' | 'multi';
|
|
106
|
+
export type ManzaPaymentLinkStatus = 'active' | 'paid' | 'expired' | 'cancelled';
|
|
107
107
|
/**
|
|
108
108
|
* A payment link as returned by the REST API **or** as projected into a
|
|
109
109
|
* `payment_link.paid` webhook. The webhook payload omits `url`,
|
|
@@ -111,11 +111,11 @@ export type ZazuPaymentLinkStatus = 'active' | 'paid' | 'expired' | 'cancelled';
|
|
|
111
111
|
* optionality from the REST resource.
|
|
112
112
|
* See https://staging.zazu.ma/docs/webhooks.
|
|
113
113
|
*/
|
|
114
|
-
export interface
|
|
114
|
+
export interface ManzaPaymentLink {
|
|
115
115
|
id: string;
|
|
116
116
|
slug: string;
|
|
117
|
-
status:
|
|
118
|
-
link_type:
|
|
117
|
+
status: ManzaPaymentLinkStatus;
|
|
118
|
+
link_type: ManzaPaymentLinkType;
|
|
119
119
|
amount: string;
|
|
120
120
|
currency_code: string;
|
|
121
121
|
/** Only present on webhook payloads. */
|
|
@@ -131,7 +131,7 @@ export interface ZazuPaymentLink {
|
|
|
131
131
|
url?: string;
|
|
132
132
|
invoice_id?: string | null;
|
|
133
133
|
/** Absent on webhook payloads. */
|
|
134
|
-
account?:
|
|
134
|
+
account?: ManzaAccountProjection;
|
|
135
135
|
client_reference_id?: string;
|
|
136
136
|
customer_email?: string;
|
|
137
137
|
customer_id?: string;
|
|
@@ -140,17 +140,17 @@ export interface ZazuPaymentLink {
|
|
|
140
140
|
/** Absent on webhook payloads. */
|
|
141
141
|
updated_at?: string;
|
|
142
142
|
}
|
|
143
|
-
export interface
|
|
143
|
+
export interface ManzaCreatePaymentLinkBody {
|
|
144
144
|
account_id: string;
|
|
145
145
|
amount: string;
|
|
146
146
|
description?: string;
|
|
147
147
|
payment_reference?: string;
|
|
148
|
-
link_type?:
|
|
148
|
+
link_type?: ManzaPaymentLinkType;
|
|
149
149
|
redirect_url?: string;
|
|
150
150
|
expires_at?: string;
|
|
151
151
|
max_payments?: number;
|
|
152
152
|
}
|
|
153
|
-
export interface
|
|
153
|
+
export interface ManzaBillingAddress {
|
|
154
154
|
street: string;
|
|
155
155
|
street2?: string;
|
|
156
156
|
city: string;
|
|
@@ -158,7 +158,7 @@ export interface ZazuBillingAddress {
|
|
|
158
158
|
country: string;
|
|
159
159
|
country_code: string;
|
|
160
160
|
}
|
|
161
|
-
export interface
|
|
161
|
+
export interface ManzaCustomer {
|
|
162
162
|
id: string;
|
|
163
163
|
customer_type: 'individual' | 'business';
|
|
164
164
|
person_name?: string;
|
|
@@ -168,12 +168,12 @@ export interface ZazuCustomer {
|
|
|
168
168
|
phone?: string;
|
|
169
169
|
tax_id?: string;
|
|
170
170
|
ice_number?: string;
|
|
171
|
-
billing_address?:
|
|
171
|
+
billing_address?: ManzaBillingAddress;
|
|
172
172
|
invoices_count?: number;
|
|
173
173
|
created_at: string;
|
|
174
174
|
updated_at: string;
|
|
175
175
|
}
|
|
176
|
-
export interface
|
|
176
|
+
export interface ManzaInvoiceItem {
|
|
177
177
|
id?: string;
|
|
178
178
|
description: string;
|
|
179
179
|
quantity: number;
|
|
@@ -182,7 +182,7 @@ export interface ZazuInvoiceItem {
|
|
|
182
182
|
amount: string;
|
|
183
183
|
position?: number;
|
|
184
184
|
}
|
|
185
|
-
export interface
|
|
185
|
+
export interface ManzaInvoiceDiscount {
|
|
186
186
|
id?: string;
|
|
187
187
|
description?: string;
|
|
188
188
|
discount_type: 'percentage' | 'fixed';
|
|
@@ -190,11 +190,11 @@ export interface ZazuInvoiceDiscount {
|
|
|
190
190
|
amount: string;
|
|
191
191
|
position?: number;
|
|
192
192
|
}
|
|
193
|
-
export type
|
|
194
|
-
export interface
|
|
193
|
+
export type ManzaInvoiceStatus = 'draft' | 'pending_approval' | 'approved' | 'sent' | 'paid' | 'overdue' | 'cancelled';
|
|
194
|
+
export interface ManzaInvoice {
|
|
195
195
|
id: string;
|
|
196
196
|
number: string;
|
|
197
|
-
status:
|
|
197
|
+
status: ManzaInvoiceStatus;
|
|
198
198
|
currency_code: string;
|
|
199
199
|
subtotal: string;
|
|
200
200
|
discount_total: string;
|
|
@@ -211,41 +211,41 @@ export interface ZazuInvoice {
|
|
|
211
211
|
credit_note?: boolean;
|
|
212
212
|
sent_at?: string;
|
|
213
213
|
paid_at?: string;
|
|
214
|
-
customer:
|
|
215
|
-
billing_address?:
|
|
216
|
-
items:
|
|
217
|
-
discounts:
|
|
214
|
+
customer: ManzaCustomer;
|
|
215
|
+
billing_address?: ManzaBillingAddress;
|
|
216
|
+
items: ManzaInvoiceItem[];
|
|
217
|
+
discounts: ManzaInvoiceDiscount[];
|
|
218
218
|
payment_link_url?: string;
|
|
219
219
|
created_at: string;
|
|
220
220
|
updated_at: string;
|
|
221
221
|
}
|
|
222
|
-
export interface
|
|
222
|
+
export interface ManzaCreateInvoiceItem {
|
|
223
223
|
description: string;
|
|
224
224
|
quantity: number;
|
|
225
225
|
unit_price: string;
|
|
226
226
|
tax_rate?: string;
|
|
227
227
|
position?: number;
|
|
228
228
|
}
|
|
229
|
-
export interface
|
|
229
|
+
export interface ManzaCreateInvoiceDiscount {
|
|
230
230
|
description?: string;
|
|
231
231
|
discount_type: 'percentage' | 'fixed';
|
|
232
232
|
value: string;
|
|
233
233
|
position?: number;
|
|
234
234
|
}
|
|
235
|
-
export interface
|
|
235
|
+
export interface ManzaCreateInvoiceBody {
|
|
236
236
|
customer_id: string;
|
|
237
237
|
issue_date: string;
|
|
238
238
|
due_date: string;
|
|
239
239
|
currency_code?: string;
|
|
240
|
-
items:
|
|
241
|
-
discounts?:
|
|
240
|
+
items: ManzaCreateInvoiceItem[];
|
|
241
|
+
discounts?: ManzaCreateInvoiceDiscount[];
|
|
242
242
|
delivery_date?: string;
|
|
243
243
|
reference?: string;
|
|
244
244
|
notes?: string;
|
|
245
245
|
payment_terms?: string;
|
|
246
246
|
send_to_email?: string;
|
|
247
247
|
}
|
|
248
|
-
export interface
|
|
248
|
+
export interface ManzaBillingAddressBody {
|
|
249
249
|
street: string;
|
|
250
250
|
street2?: string;
|
|
251
251
|
city: string;
|
|
@@ -253,7 +253,7 @@ export interface ZazuBillingAddressBody {
|
|
|
253
253
|
country: string;
|
|
254
254
|
country_code: string;
|
|
255
255
|
}
|
|
256
|
-
export interface
|
|
256
|
+
export interface ManzaCreateCustomerBody {
|
|
257
257
|
customer_type?: 'individual' | 'business';
|
|
258
258
|
person_name?: string;
|
|
259
259
|
company_name?: string;
|
|
@@ -261,12 +261,12 @@ export interface ZazuCreateCustomerBody {
|
|
|
261
261
|
phone?: string;
|
|
262
262
|
tax_id?: string;
|
|
263
263
|
ice_number?: string;
|
|
264
|
-
billing_address?:
|
|
264
|
+
billing_address?: ManzaBillingAddressBody;
|
|
265
265
|
}
|
|
266
|
-
export type
|
|
267
|
-
export interface
|
|
266
|
+
export type ManzaTransferStatus = 'requested' | 'processing' | 'completed' | 'failed';
|
|
267
|
+
export interface ManzaTransfer {
|
|
268
268
|
id: string;
|
|
269
|
-
status:
|
|
269
|
+
status: ManzaTransferStatus;
|
|
270
270
|
amount: string;
|
|
271
271
|
currency_code: string;
|
|
272
272
|
payment_reference?: string;
|
|
@@ -281,7 +281,7 @@ export interface ZazuTransfer {
|
|
|
281
281
|
created_at: string;
|
|
282
282
|
updated_at: string;
|
|
283
283
|
}
|
|
284
|
-
export interface
|
|
284
|
+
export interface ManzaCreateTransferBody {
|
|
285
285
|
account_id: string;
|
|
286
286
|
amount: string;
|
|
287
287
|
beneficiary_id?: string;
|
|
@@ -291,56 +291,56 @@ export interface ZazuCreateTransferBody {
|
|
|
291
291
|
payment_reference?: string;
|
|
292
292
|
internal_notes?: string;
|
|
293
293
|
}
|
|
294
|
-
export interface
|
|
294
|
+
export interface ManzaCursorPage<T> {
|
|
295
295
|
data: T[];
|
|
296
296
|
has_more: boolean;
|
|
297
297
|
next_cursor?: string | null;
|
|
298
298
|
}
|
|
299
|
-
export type
|
|
300
|
-
export interface
|
|
299
|
+
export type ManzaWebhookEndpointStatus = 'active' | 'disabled';
|
|
300
|
+
export interface ManzaWebhookEndpoint {
|
|
301
301
|
id: string;
|
|
302
302
|
url: string;
|
|
303
303
|
description?: string | null;
|
|
304
304
|
events: string[];
|
|
305
|
-
status:
|
|
305
|
+
status: ManzaWebhookEndpointStatus;
|
|
306
306
|
disabled_at?: string | null;
|
|
307
307
|
last_succeeded_at?: string | null;
|
|
308
308
|
created_at: string;
|
|
309
309
|
updated_at: string;
|
|
310
310
|
}
|
|
311
311
|
/** Create / regenerate_secret responses include the secret exactly once. */
|
|
312
|
-
export interface
|
|
312
|
+
export interface ManzaWebhookEndpointWithSecret extends ManzaWebhookEndpoint {
|
|
313
313
|
signing_secret: string;
|
|
314
314
|
}
|
|
315
|
-
export interface
|
|
315
|
+
export interface ManzaCreateWebhookEndpointBody {
|
|
316
316
|
url: string;
|
|
317
317
|
events: string[];
|
|
318
318
|
description?: string;
|
|
319
319
|
}
|
|
320
|
-
export interface
|
|
320
|
+
export interface ManzaUpdateWebhookEndpointBody {
|
|
321
321
|
url?: string;
|
|
322
322
|
events?: string[];
|
|
323
323
|
description?: string;
|
|
324
324
|
}
|
|
325
|
-
export interface
|
|
325
|
+
export interface ManzaTestWebhookEndpointResponse {
|
|
326
326
|
delivery_id: string;
|
|
327
327
|
status: string;
|
|
328
328
|
}
|
|
329
|
-
export interface
|
|
329
|
+
export interface ManzaWebhookHeaders {
|
|
330
330
|
'content-type'?: string;
|
|
331
331
|
'user-agent'?: string;
|
|
332
|
-
'x-
|
|
333
|
-
'x-
|
|
334
|
-
'x-
|
|
335
|
-
'x-
|
|
336
|
-
'x-
|
|
332
|
+
'x-manza-signature'?: string;
|
|
333
|
+
'x-manza-timestamp'?: string;
|
|
334
|
+
'x-manza-event'?: string;
|
|
335
|
+
'x-manza-event-id'?: string;
|
|
336
|
+
'x-manza-delivery-id'?: string;
|
|
337
337
|
}
|
|
338
|
-
export interface
|
|
338
|
+
export interface ManzaWebhookPayload {
|
|
339
339
|
event: string;
|
|
340
340
|
created_at: string;
|
|
341
341
|
data: {
|
|
342
|
-
checkout_session?:
|
|
343
|
-
payment_link?:
|
|
342
|
+
checkout_session?: ManzaCheckoutSession;
|
|
343
|
+
payment_link?: ManzaPaymentLink;
|
|
344
344
|
transfer?: {
|
|
345
345
|
id: string;
|
|
346
346
|
amount: string;
|
|
@@ -353,7 +353,7 @@ export interface ZazuWebhookPayload {
|
|
|
353
353
|
};
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
export interface
|
|
356
|
+
export interface ManzaErrorBody {
|
|
357
357
|
type?: string;
|
|
358
358
|
message?: string;
|
|
359
359
|
param?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/manza/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9D,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,QAAQ,GAAG,O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AMD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @venturekit/billing —
|
|
2
|
+
* @venturekit/billing — Manza raw API types
|
|
3
3
|
*
|
|
4
|
-
* These interfaces mirror the wire format of the
|
|
4
|
+
* These interfaces mirror the wire format of the Manza REST API exactly
|
|
5
5
|
* (see https://staging.zazu.ma/docs). They are intentionally separate
|
|
6
6
|
* from the domain types in `../../types.ts`: the `maps.ts` module is the
|
|
7
|
-
* only place that converts between the two, so a change in the
|
|
7
|
+
* only place that converts between the two, so a change in the Manza API
|
|
8
8
|
* never leaks into the rest of the application.
|
|
9
9
|
*
|
|
10
10
|
* Amounts are decimal strings (`"1500.000"`); timestamps are ISO 8601.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/providers/manza/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @venturekit/billing —
|
|
2
|
+
* @venturekit/billing — Manza webhook signature verification & parsing
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Manza signs every webhook with HMAC-SHA256 over
|
|
5
5
|
* `${timestamp}.${rawBody}` and sends the signature in the
|
|
6
|
-
* `X-
|
|
6
|
+
* `X-Manza-Signature` header. Verification uses a constant-time
|
|
7
7
|
* comparison to prevent timing attacks, and rejects signatures whose
|
|
8
8
|
* timestamp falls outside a tolerance window so a captured request
|
|
9
9
|
* can't be replayed indefinitely.
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
* After verification, the raw payload is parsed and normalized into a
|
|
12
12
|
* {@link PaymentEvent} (canonical, provider-agnostic shape) so the
|
|
13
13
|
* application can publish it to its event bus without knowing it came
|
|
14
|
-
* from
|
|
14
|
+
* from Manza.
|
|
15
15
|
*
|
|
16
16
|
* Failures are split by cause: {@link WebhookSignatureError} means the
|
|
17
|
-
* request isn't provably from
|
|
17
|
+
* request isn't provably from Manza (auth failure), while
|
|
18
18
|
* {@link WebhookPayloadError} means it is authentic but unusable.
|
|
19
19
|
* Callers must map them to different HTTP statuses — answering 401 to
|
|
20
|
-
* an authentic-but-unmapped event makes
|
|
20
|
+
* an authentic-but-unmapped event makes Manza redeliver it forever.
|
|
21
21
|
*/
|
|
22
22
|
import type { PaymentEvent } from '../../events.js';
|
|
23
23
|
import type { WebhookRequest } from '../../provider.js';
|
|
@@ -25,39 +25,39 @@ import type { WebhookRequest } from '../../provider.js';
|
|
|
25
25
|
* Default replay tolerance: a signature more than five minutes old (or
|
|
26
26
|
* five minutes in the future, allowing for clock skew) is rejected.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
28
|
+
* Manza's docs describe the HMAC construction but do not mandate a
|
|
29
29
|
* freshness check, so this is our own hardening — five minutes is the
|
|
30
|
-
* de-facto standard (Stripe, Slack, GitHub). Note that
|
|
30
|
+
* de-facto standard (Stripe, Slack, GitHub). Note that Manza retries a
|
|
31
31
|
* failed delivery for ~28 hours, so the window must stay comfortably
|
|
32
32
|
* wider than a single delivery attempt.
|
|
33
33
|
*/
|
|
34
34
|
export declare const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
|
|
35
35
|
/**
|
|
36
|
-
* Verify a
|
|
36
|
+
* Verify a Manza webhook signature. Throws {@link WebhookSignatureError}
|
|
37
37
|
* if the signature, timestamp, or secret is missing, the timestamp is
|
|
38
38
|
* outside the tolerance window, or the signature does not match.
|
|
39
39
|
*
|
|
40
40
|
* @param secret - The endpoint's signing secret.
|
|
41
|
-
* @param timestamp - `X-
|
|
41
|
+
* @param timestamp - `X-Manza-Timestamp` header value (Unix seconds).
|
|
42
42
|
* @param rawBody - The raw request body exactly as received.
|
|
43
|
-
* @param signature - `X-
|
|
43
|
+
* @param signature - `X-Manza-Signature` header value (hex digest).
|
|
44
44
|
* @param toleranceSeconds - Maximum accepted signature age. Pass `0` to
|
|
45
45
|
* disable the freshness check — only appropriate when replaying
|
|
46
46
|
* captured fixtures in tests.
|
|
47
47
|
*/
|
|
48
|
-
export declare function
|
|
48
|
+
export declare function verifyManzaSignature(secret: string, timestamp: string, rawBody: string, signature: string, toleranceSeconds?: number): void;
|
|
49
49
|
/**
|
|
50
|
-
* Parse and normalize a verified
|
|
50
|
+
* Parse and normalize a verified Manza webhook into a
|
|
51
51
|
* {@link PaymentEvent}. This does NOT verify the signature — call
|
|
52
|
-
* {@link
|
|
52
|
+
* {@link verifyManzaSignature} first (or use {@link handleManzaWebhook}
|
|
53
53
|
* which does both).
|
|
54
54
|
*
|
|
55
55
|
* Throws {@link WebhookPayloadError} if the payload is malformed, the
|
|
56
56
|
* event id is absent, or the event type is unknown.
|
|
57
57
|
*/
|
|
58
|
-
export declare function
|
|
59
|
-
/** Options for {@link
|
|
60
|
-
export interface
|
|
58
|
+
export declare function parseManzaWebhook(rawBody: string, headers: Record<string, string>): PaymentEvent;
|
|
59
|
+
/** Options for {@link handleManzaWebhook}. */
|
|
60
|
+
export interface HandleManzaWebhookOptions {
|
|
61
61
|
/**
|
|
62
62
|
* Maximum accepted signature age in seconds. Defaults to
|
|
63
63
|
* {@link DEFAULT_WEBHOOK_TOLERANCE_SECONDS}; `0` disables the check.
|
|
@@ -65,9 +65,9 @@ export interface HandleZazuWebhookOptions {
|
|
|
65
65
|
toleranceSeconds?: number;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Verify the
|
|
68
|
+
* Verify the Manza webhook signature and parse the payload into a
|
|
69
69
|
* normalized {@link PaymentEvent}. This is what the adapter's
|
|
70
70
|
* `handleWebhookEvent` calls.
|
|
71
71
|
*/
|
|
72
|
-
export declare function
|
|
72
|
+
export declare function handleManzaWebhook(secret: string | undefined, request: WebhookRequest, options?: HandleManzaWebhookOptions): PaymentEvent;
|
|
73
73
|
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/providers/manza/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiBxD;;;;;;;;;GASG;AACH,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,gBAAgB,GAAE,MAA0C,GAC3D,IAAI,CAoCN;AAgDD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CA+HhG;AAMD,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,yBAAyB,GAClC,YAAY,CAad"}
|