@theengineerscanvas/payment 0.0.0-stage → 0.1.0-rc.16
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/LICENSE +201 -0
- package/README.md +323 -2
- package/dist/adapters/nestjs/index.cjs +4979 -0
- package/dist/adapters/nestjs/index.cjs.map +1 -0
- package/dist/adapters/nestjs/index.d.cts +313 -0
- package/dist/adapters/nestjs/index.d.ts +313 -0
- package/dist/adapters/nestjs/index.js +4974 -0
- package/dist/adapters/nestjs/index.js.map +1 -0
- package/dist/index.cjs +4865 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +171 -0
- package/dist/index.d.ts +171 -0
- package/dist/index.js +4822 -0
- package/dist/index.js.map +1 -0
- package/dist/payment-client-DNhLWboh.d.cts +1257 -0
- package/dist/payment-client-DNhLWboh.d.ts +1257 -0
- package/docs/agents/cookbook.md +467 -0
- package/docs/api-stability.md +104 -0
- package/docs/architecture.md +119 -0
- package/docs/bachs-guide.md +359 -0
- package/docs/bachs-sandbox-validation.md +138 -0
- package/docs/concurrency.md +103 -0
- package/docs/extension-guide.md +156 -0
- package/docs/integration-checklist.md +209 -0
- package/docs/migration-guide.md +401 -0
- package/docs/performance.md +86 -0
- package/docs/provider-guide.md +150 -0
- package/docs/public-api.md +1108 -0
- package/docs/security.md +120 -0
- package/docs/versioning.md +95 -0
- package/llms.txt +97 -0
- package/package.json +141 -4
- package/public-api.json +452 -0
package/public-api.json
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@theengineerscanvas/payment",
|
|
3
|
+
"version": "0.1.0-rc.16",
|
|
4
|
+
"description": "Provider-agnostic payment SDK: payments, refunds, payouts, products, subscriptions, billing customers, verified webhooks. Paystack and Bachs adapters included.",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"invariants": [
|
|
7
|
+
"Money is minor units in the SDK; Bachs decimal strings are converted inside the adapter. Never use floating point for money.",
|
|
8
|
+
"Expected failures return Result<T, E>; branch on result.ok. Only programmer errors throw (ValidationError, ConfigurationError).",
|
|
9
|
+
"Webhooks are the fulfilment source of truth, never client redirects.",
|
|
10
|
+
"Webhook verification needs the exact raw body bytes; never re-serialise before verifying.",
|
|
11
|
+
"Payment references and idempotency keys are app-owned; the SDK never generates payment references.",
|
|
12
|
+
"Never log secrets or portal-session URLs; the SDK's logger redacts known secret fields.",
|
|
13
|
+
"Capability calls on an unsupported provider resolve to UnsupportedProviderError (code UNSUPPORTED) instead of throwing."
|
|
14
|
+
],
|
|
15
|
+
"client": [
|
|
16
|
+
{
|
|
17
|
+
"member": "payments",
|
|
18
|
+
"kind": "service",
|
|
19
|
+
"methods": [
|
|
20
|
+
"fetch",
|
|
21
|
+
"initialize",
|
|
22
|
+
"list",
|
|
23
|
+
"verify"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"member": "refunds",
|
|
28
|
+
"kind": "service",
|
|
29
|
+
"methods": [
|
|
30
|
+
"create",
|
|
31
|
+
"fetch"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"member": "transfers",
|
|
36
|
+
"kind": "service",
|
|
37
|
+
"methods": [
|
|
38
|
+
"createQuote",
|
|
39
|
+
"createRecipient",
|
|
40
|
+
"fetch",
|
|
41
|
+
"initiate",
|
|
42
|
+
"list",
|
|
43
|
+
"listBankCodes",
|
|
44
|
+
"resolveAccount"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"member": "webhooks",
|
|
49
|
+
"kind": "service",
|
|
50
|
+
"methods": [
|
|
51
|
+
"receive"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"member": "products",
|
|
56
|
+
"kind": "service",
|
|
57
|
+
"methods": [
|
|
58
|
+
"archive",
|
|
59
|
+
"create",
|
|
60
|
+
"fetch",
|
|
61
|
+
"list",
|
|
62
|
+
"unarchive",
|
|
63
|
+
"update"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"member": "subscriptions",
|
|
68
|
+
"kind": "service",
|
|
69
|
+
"methods": [
|
|
70
|
+
"cancel",
|
|
71
|
+
"emit",
|
|
72
|
+
"fetch",
|
|
73
|
+
"list",
|
|
74
|
+
"update"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"member": "customers",
|
|
79
|
+
"kind": "service",
|
|
80
|
+
"methods": [
|
|
81
|
+
"create",
|
|
82
|
+
"createPortalSession",
|
|
83
|
+
"fetch",
|
|
84
|
+
"list",
|
|
85
|
+
"update"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"member": "events",
|
|
90
|
+
"kind": "service",
|
|
91
|
+
"methods": [
|
|
92
|
+
"on",
|
|
93
|
+
"onAny"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"member": "providers",
|
|
98
|
+
"kind": "service",
|
|
99
|
+
"methods": [
|
|
100
|
+
"capabilities",
|
|
101
|
+
"get",
|
|
102
|
+
"health",
|
|
103
|
+
"list"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"member": "health",
|
|
108
|
+
"kind": "method",
|
|
109
|
+
"methods": []
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"providers": [
|
|
113
|
+
{
|
|
114
|
+
"id": "paystack",
|
|
115
|
+
"subscriptionCapability": false,
|
|
116
|
+
"capabilities": {
|
|
117
|
+
"supportsAuthorizationUrl": true,
|
|
118
|
+
"supportsRecurring": true,
|
|
119
|
+
"supportsPartialRefund": true,
|
|
120
|
+
"supportsWebhooks": true,
|
|
121
|
+
"supportsTransfers": true,
|
|
122
|
+
"supportsIdempotencyKey": false,
|
|
123
|
+
"supportedCurrencies": [
|
|
124
|
+
"NGN",
|
|
125
|
+
"GHS",
|
|
126
|
+
"ZAR",
|
|
127
|
+
"KES",
|
|
128
|
+
"USD"
|
|
129
|
+
],
|
|
130
|
+
"supportedChannels": [
|
|
131
|
+
"card",
|
|
132
|
+
"bank",
|
|
133
|
+
"ussd",
|
|
134
|
+
"qr",
|
|
135
|
+
"mobile_money",
|
|
136
|
+
"bank_transfer"
|
|
137
|
+
],
|
|
138
|
+
"supportedTransferCurrencies": [
|
|
139
|
+
"NGN",
|
|
140
|
+
"GHS",
|
|
141
|
+
"ZAR",
|
|
142
|
+
"KES"
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "bachs",
|
|
148
|
+
"subscriptionCapability": true,
|
|
149
|
+
"capabilities": {
|
|
150
|
+
"supportsAuthorizationUrl": true,
|
|
151
|
+
"supportsRecurring": true,
|
|
152
|
+
"supportsPartialRefund": true,
|
|
153
|
+
"supportsWebhooks": true,
|
|
154
|
+
"supportsTransfers": true,
|
|
155
|
+
"supportsIdempotencyKey": true,
|
|
156
|
+
"supportedCurrencies": [
|
|
157
|
+
"USD",
|
|
158
|
+
"NGN",
|
|
159
|
+
"GHS",
|
|
160
|
+
"KES",
|
|
161
|
+
"MWK",
|
|
162
|
+
"RWF",
|
|
163
|
+
"TZS",
|
|
164
|
+
"UGX",
|
|
165
|
+
"XAF",
|
|
166
|
+
"XOF",
|
|
167
|
+
"ZMW"
|
|
168
|
+
],
|
|
169
|
+
"supportedChannels": [
|
|
170
|
+
"card",
|
|
171
|
+
"bank_transfer",
|
|
172
|
+
"mobile_money",
|
|
173
|
+
"crypto"
|
|
174
|
+
],
|
|
175
|
+
"supportedTransferCurrencies": [
|
|
176
|
+
"NGN",
|
|
177
|
+
"GHS",
|
|
178
|
+
"KES",
|
|
179
|
+
"TZS",
|
|
180
|
+
"UGX",
|
|
181
|
+
"USD",
|
|
182
|
+
"GBP",
|
|
183
|
+
"EUR",
|
|
184
|
+
"CAD"
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"errors": [
|
|
190
|
+
{
|
|
191
|
+
"name": "CONFIGURATION",
|
|
192
|
+
"code": "CONFIGURATION"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "VALIDATION",
|
|
196
|
+
"code": "VALIDATION"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "PROVIDER_UNAVAILABLE",
|
|
200
|
+
"code": "PROVIDER_UNAVAILABLE"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "NETWORK",
|
|
204
|
+
"code": "NETWORK"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"name": "TIMEOUT",
|
|
208
|
+
"code": "TIMEOUT"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "WEBHOOK_VALIDATION",
|
|
212
|
+
"code": "WEBHOOK_VALIDATION"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"name": "VERIFICATION",
|
|
216
|
+
"code": "VERIFICATION"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "REFUND",
|
|
220
|
+
"code": "REFUND"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "PROVIDER",
|
|
224
|
+
"code": "PROVIDER"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "PROVIDER_BAD_REQUEST",
|
|
228
|
+
"code": "PROVIDER_BAD_REQUEST"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "PROVIDER_UNAUTHORIZED",
|
|
232
|
+
"code": "PROVIDER_UNAUTHORIZED"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "PROVIDER_NOT_FOUND",
|
|
236
|
+
"code": "PROVIDER_NOT_FOUND"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "PROVIDER_CONFLICT",
|
|
240
|
+
"code": "PROVIDER_CONFLICT"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "PROVIDER_RATE_LIMIT",
|
|
244
|
+
"code": "PROVIDER_RATE_LIMIT"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "UNSUPPORTED",
|
|
248
|
+
"code": "UNSUPPORTED"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "INTERNAL",
|
|
252
|
+
"code": "INTERNAL"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"errorCategories": [
|
|
256
|
+
"configuration",
|
|
257
|
+
"validation",
|
|
258
|
+
"provider",
|
|
259
|
+
"network",
|
|
260
|
+
"timeout",
|
|
261
|
+
"webhook",
|
|
262
|
+
"refund",
|
|
263
|
+
"verification",
|
|
264
|
+
"unsupported",
|
|
265
|
+
"internal"
|
|
266
|
+
],
|
|
267
|
+
"environmentVariables": [
|
|
268
|
+
"TEC_PAYMENT_DEFAULT_PROVIDER",
|
|
269
|
+
"TEC_PAYMENT_LOGGING_LEVEL",
|
|
270
|
+
"TEC_PAYMENT_PAYSTACK_SECRET_KEY",
|
|
271
|
+
"TEC_PAYMENT_PAYSTACK_WEBHOOK_SECRET",
|
|
272
|
+
"TEC_PAYMENT_PAYSTACK_BASE_URL",
|
|
273
|
+
"PAYSTACK_SECRET_KEY",
|
|
274
|
+
"PAYSTACK_WEBHOOK_SECRET",
|
|
275
|
+
"PAYSTACK_BASE_URL",
|
|
276
|
+
"TEC_PAYMENT_BACHS_SECRET_KEY",
|
|
277
|
+
"TEC_PAYMENT_BACHS_WEBHOOK_SECRET",
|
|
278
|
+
"TEC_PAYMENT_BACHS_BASE_URL",
|
|
279
|
+
"TEC_PAYMENT_BACHS_TIMEOUT_MS",
|
|
280
|
+
"BACHS_SECRET_KEY",
|
|
281
|
+
"BACHS_WEBHOOK_SECRET",
|
|
282
|
+
"BACHS_BASE_URL"
|
|
283
|
+
],
|
|
284
|
+
"webhookEvents": {
|
|
285
|
+
"normalized": [
|
|
286
|
+
"payment.initialized",
|
|
287
|
+
"payment.pending",
|
|
288
|
+
"payment.succeeded",
|
|
289
|
+
"payment.failed",
|
|
290
|
+
"payment.underpaid",
|
|
291
|
+
"checkout.completed",
|
|
292
|
+
"checkout.expired",
|
|
293
|
+
"refund.initiated",
|
|
294
|
+
"refund.succeeded",
|
|
295
|
+
"refund.failed",
|
|
296
|
+
"transfer.initiated",
|
|
297
|
+
"transfer.succeeded",
|
|
298
|
+
"transfer.failed",
|
|
299
|
+
"transfer.reversed",
|
|
300
|
+
"subscription.created",
|
|
301
|
+
"subscription.updated",
|
|
302
|
+
"subscription.canceled",
|
|
303
|
+
"invoice.created",
|
|
304
|
+
"invoice.paid",
|
|
305
|
+
"invoice.payment_failed",
|
|
306
|
+
"customer.created",
|
|
307
|
+
"customer.updated",
|
|
308
|
+
"dispute.created",
|
|
309
|
+
"dispute.updated",
|
|
310
|
+
"conversion.completed",
|
|
311
|
+
"conversion.failed",
|
|
312
|
+
"payment_method.saved",
|
|
313
|
+
"webhook.received",
|
|
314
|
+
"unknown"
|
|
315
|
+
],
|
|
316
|
+
"bachs": [
|
|
317
|
+
{
|
|
318
|
+
"providerEvent": "collection.succeeded",
|
|
319
|
+
"normalized": "payment.succeeded"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"providerEvent": "collection.failed",
|
|
323
|
+
"normalized": "payment.failed"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"providerEvent": "collection.underpaid",
|
|
327
|
+
"normalized": "payment.underpaid"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"providerEvent": "checkout.completed",
|
|
331
|
+
"normalized": "checkout.completed"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"providerEvent": "checkout.expired",
|
|
335
|
+
"normalized": "checkout.expired"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"providerEvent": "refund.created",
|
|
339
|
+
"normalized": "refund.initiated"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"providerEvent": "refund.paid",
|
|
343
|
+
"normalized": "refund.succeeded"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"providerEvent": "refund.failed",
|
|
347
|
+
"normalized": "refund.failed"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"providerEvent": "payout.created",
|
|
351
|
+
"normalized": "transfer.initiated"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"providerEvent": "payout.paid",
|
|
355
|
+
"normalized": "transfer.succeeded"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"providerEvent": "payout.failed",
|
|
359
|
+
"normalized": "transfer.failed"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"providerEvent": "customer.subscription.created",
|
|
363
|
+
"normalized": "subscription.created"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"providerEvent": "customer.subscription.updated",
|
|
367
|
+
"normalized": "subscription.updated"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"providerEvent": "customer.subscription.deleted",
|
|
371
|
+
"normalized": "subscription.canceled"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"providerEvent": "invoice.created",
|
|
375
|
+
"normalized": "invoice.created"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"providerEvent": "invoice.paid",
|
|
379
|
+
"normalized": "invoice.paid"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"providerEvent": "invoice.payment_failed",
|
|
383
|
+
"normalized": "invoice.payment_failed"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"providerEvent": "customer.created",
|
|
387
|
+
"normalized": "customer.created"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"providerEvent": "customer.updated",
|
|
391
|
+
"normalized": "customer.updated"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"providerEvent": "dispute.created",
|
|
395
|
+
"normalized": "dispute.created"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"providerEvent": "dispute.updated",
|
|
399
|
+
"normalized": "dispute.updated"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"providerEvent": "conversion.completed",
|
|
403
|
+
"normalized": "conversion.completed"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"providerEvent": "conversion.failed",
|
|
407
|
+
"normalized": "conversion.failed"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"providerEvent": "payment_method.saved",
|
|
411
|
+
"normalized": "payment_method.saved"
|
|
412
|
+
}
|
|
413
|
+
]
|
|
414
|
+
},
|
|
415
|
+
"docs": [
|
|
416
|
+
{
|
|
417
|
+
"title": "Agent cookbook",
|
|
418
|
+
"path": "docs/agents/cookbook.md",
|
|
419
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/docs/agents/cookbook.md"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"title": "Provider-neutral API reference",
|
|
423
|
+
"path": "docs/public-api.md",
|
|
424
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/docs/public-api.md"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"title": "Bachs integration guide",
|
|
428
|
+
"path": "docs/bachs-guide.md",
|
|
429
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/docs/bachs-guide.md"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"title": "Architecture",
|
|
433
|
+
"path": "docs/architecture.md",
|
|
434
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/docs/architecture.md"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"title": "Migration guide",
|
|
438
|
+
"path": "docs/migration-guide.md",
|
|
439
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/docs/migration-guide.md"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"title": "Provider guide (writing adapters)",
|
|
443
|
+
"path": "docs/provider-guide.md",
|
|
444
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/docs/provider-guide.md"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"title": "Agent index (llms.txt)",
|
|
448
|
+
"path": "llms.txt",
|
|
449
|
+
"url": "https://github.com/TheEngineersCanvas/payment/blob/master/llms.txt"
|
|
450
|
+
}
|
|
451
|
+
]
|
|
452
|
+
}
|