@adonis-agora/payments 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2347 -0
- package/dist/assets/spa/assets/index-CT5Zon6P.css +1 -0
- package/dist/assets/spa/assets/index-CvEbJEnq.js +41 -0
- package/dist/assets/spa/assets/index-CvEbJEnq.js.map +1 -0
- package/dist/assets/spa/index.html +20 -0
- package/dist/commands/main.d.ts +4 -3
- package/dist/commands/main.d.ts.map +1 -1
- package/dist/commands/main.js +9 -2
- package/dist/commands/main.js.map +1 -1
- package/dist/commands/payments_health.d.ts +31 -0
- package/dist/commands/payments_health.d.ts.map +1 -0
- package/dist/commands/payments_health.js +113 -0
- package/dist/commands/payments_health.js.map +1 -0
- package/dist/commands/payments_sync.d.ts +18 -4
- package/dist/commands/payments_sync.d.ts.map +1 -1
- package/dist/commands/payments_sync.js +136 -40
- package/dist/commands/payments_sync.js.map +1 -1
- package/dist/configure.d.ts +12 -5
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +18 -5
- package/dist/configure.js.map +1 -1
- package/dist/providers/dashboard_provider.d.ts +97 -0
- package/dist/providers/dashboard_provider.d.ts.map +1 -0
- package/dist/providers/dashboard_provider.js +430 -0
- package/dist/providers/dashboard_provider.js.map +1 -0
- package/dist/providers/payments_client_provider.d.ts +41 -0
- package/dist/providers/payments_client_provider.d.ts.map +1 -0
- package/dist/providers/payments_client_provider.js +95 -0
- package/dist/providers/payments_client_provider.js.map +1 -0
- package/dist/providers/payments_provider.d.ts +35 -0
- package/dist/providers/payments_provider.d.ts.map +1 -1
- package/dist/providers/payments_provider.js +250 -36
- package/dist/providers/payments_provider.js.map +1 -1
- package/dist/src/billing/billing_health.d.ts +85 -0
- package/dist/src/billing/billing_health.d.ts.map +1 -0
- package/dist/src/billing/billing_health.js +155 -0
- package/dist/src/billing/billing_health.js.map +1 -0
- package/dist/src/billing/billing_overview.d.ts +4 -3
- package/dist/src/billing/billing_overview.d.ts.map +1 -1
- package/dist/src/billing/billing_overview.js +14 -5
- package/dist/src/billing/billing_overview.js.map +1 -1
- package/dist/src/billing/billing_store.d.ts +634 -5
- package/dist/src/billing/billing_store.d.ts.map +1 -1
- package/dist/src/billing/billing_store.js +18 -1
- package/dist/src/billing/billing_store.js.map +1 -1
- package/dist/src/billing/index.d.ts +2 -1
- package/dist/src/billing/index.d.ts.map +1 -1
- package/dist/src/billing/index.js +1 -0
- package/dist/src/billing/index.js.map +1 -1
- package/dist/src/billing/list_query.d.ts +16 -0
- package/dist/src/billing/list_query.d.ts.map +1 -0
- package/dist/src/billing/list_query.js +28 -0
- package/dist/src/billing/list_query.js.map +1 -0
- package/dist/src/billing/lucid_billing_store.d.ts +122 -4
- package/dist/src/billing/lucid_billing_store.d.ts.map +1 -1
- package/dist/src/billing/lucid_billing_store.js +811 -13
- package/dist/src/billing/lucid_billing_store.js.map +1 -1
- package/dist/src/billing/mixins/index.d.ts +3 -0
- package/dist/src/billing/mixins/index.d.ts.map +1 -1
- package/dist/src/billing/mixins/index.js +3 -0
- package/dist/src/billing/mixins/index.js.map +1 -1
- package/dist/src/billing/mixins/with_audit_event.d.ts +48 -0
- package/dist/src/billing/mixins/with_audit_event.d.ts.map +1 -0
- package/dist/src/billing/mixins/with_audit_event.js +77 -0
- package/dist/src/billing/mixins/with_audit_event.js.map +1 -0
- package/dist/src/billing/mixins/with_customer.d.ts +39 -0
- package/dist/src/billing/mixins/with_customer.d.ts.map +1 -0
- package/dist/src/billing/mixins/with_customer.js +68 -0
- package/dist/src/billing/mixins/with_customer.js.map +1 -0
- package/dist/src/billing/mixins/with_dispute.d.ts +68 -0
- package/dist/src/billing/mixins/with_dispute.d.ts.map +1 -0
- package/dist/src/billing/mixins/with_dispute.js +83 -0
- package/dist/src/billing/mixins/with_dispute.js.map +1 -0
- package/dist/src/billing/mixins/with_payment.d.ts +42 -0
- package/dist/src/billing/mixins/with_payment.d.ts.map +1 -1
- package/dist/src/billing/mixins/with_payment.js +29 -3
- package/dist/src/billing/mixins/with_payment.js.map +1 -1
- package/dist/src/billing/mixins/with_subscription.d.ts +7 -0
- package/dist/src/billing/mixins/with_subscription.d.ts.map +1 -1
- package/dist/src/billing/mixins/with_subscription.js +15 -1
- package/dist/src/billing/mixins/with_subscription.js.map +1 -1
- package/dist/src/billing/mixins/with_usage_event.d.ts +7 -0
- package/dist/src/billing/mixins/with_usage_event.d.ts.map +1 -1
- package/dist/src/billing/mixins/with_usage_event.js +15 -1
- package/dist/src/billing/mixins/with_usage_event.js.map +1 -1
- package/dist/src/billing/mixins/with_webhook_event.d.ts +18 -0
- package/dist/src/billing/mixins/with_webhook_event.d.ts.map +1 -1
- package/dist/src/billing/mixins/with_webhook_event.js +18 -1
- package/dist/src/billing/mixins/with_webhook_event.js.map +1 -1
- package/dist/src/billing/resolve_dispatch.d.ts +22 -0
- package/dist/src/billing/resolve_dispatch.d.ts.map +1 -0
- package/dist/src/billing/resolve_dispatch.js +44 -0
- package/dist/src/billing/resolve_dispatch.js.map +1 -0
- package/dist/src/billing/resolve_store.d.ts +18 -0
- package/dist/src/billing/resolve_store.d.ts.map +1 -0
- package/dist/src/billing/resolve_store.js +35 -0
- package/dist/src/billing/resolve_store.js.map +1 -0
- package/dist/src/billing/schema.d.ts +108 -0
- package/dist/src/billing/schema.d.ts.map +1 -0
- package/dist/src/billing/schema.js +350 -0
- package/dist/src/billing/schema.js.map +1 -0
- package/dist/src/billing/webhook_dispatcher.d.ts +95 -16
- package/dist/src/billing/webhook_dispatcher.d.ts.map +1 -1
- package/dist/src/billing/webhook_dispatcher.js +186 -33
- package/dist/src/billing/webhook_dispatcher.js.map +1 -1
- package/dist/src/billing/webhook_events.d.ts +67 -1
- package/dist/src/billing/webhook_events.d.ts.map +1 -1
- package/dist/src/billing/webhook_events.js +15 -0
- package/dist/src/billing/webhook_events.js.map +1 -1
- package/dist/src/billing/webhook_processor.d.ts.map +1 -1
- package/dist/src/billing/webhook_processor.js +325 -5
- package/dist/src/billing/webhook_processor.js.map +1 -1
- package/dist/src/client/define_config.d.ts +150 -0
- package/dist/src/client/define_config.d.ts.map +1 -0
- package/dist/src/client/define_config.js +98 -0
- package/dist/src/client/define_config.js.map +1 -0
- package/dist/src/client/handlers.d.ts +71 -0
- package/dist/src/client/handlers.d.ts.map +1 -0
- package/dist/src/client/handlers.js +119 -0
- package/dist/src/client/handlers.js.map +1 -0
- package/dist/src/client/index.d.ts +16 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +13 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/statuses.d.ts +38 -0
- package/dist/src/client/statuses.d.ts.map +1 -0
- package/dist/src/client/statuses.js +42 -0
- package/dist/src/client/statuses.js.map +1 -0
- package/dist/src/dashboard/actions.d.ts +143 -0
- package/dist/src/dashboard/actions.d.ts.map +1 -0
- package/dist/src/dashboard/actions.js +112 -0
- package/dist/src/dashboard/actions.js.map +1 -0
- package/dist/src/dashboard/auth.d.ts +136 -0
- package/dist/src/dashboard/auth.d.ts.map +1 -0
- package/dist/src/dashboard/auth.js +152 -0
- package/dist/src/dashboard/auth.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +80 -0
- package/dist/src/dashboard/define_config.d.ts.map +1 -0
- package/dist/src/dashboard/define_config.js +83 -0
- package/dist/src/dashboard/define_config.js.map +1 -0
- package/dist/src/dashboard/handlers.d.ts +281 -0
- package/dist/src/dashboard/handlers.d.ts.map +1 -0
- package/dist/src/dashboard/handlers.js +960 -0
- package/dist/src/dashboard/handlers.js.map +1 -0
- package/dist/src/dashboard/index.d.ts +18 -0
- package/dist/src/dashboard/index.d.ts.map +1 -0
- package/dist/src/dashboard/index.js +14 -0
- package/dist/src/dashboard/index.js.map +1 -0
- package/dist/src/dashboard/login_page.d.ts +23 -0
- package/dist/src/dashboard/login_page.d.ts.map +1 -0
- package/dist/src/dashboard/login_page.js +170 -0
- package/dist/src/dashboard/login_page.js.map +1 -0
- package/dist/src/dashboard/period.d.ts +31 -0
- package/dist/src/dashboard/period.d.ts.map +1 -0
- package/dist/src/dashboard/period.js +44 -0
- package/dist/src/dashboard/period.js.map +1 -0
- package/dist/src/dashboard/session_cookie.d.ts +42 -0
- package/dist/src/dashboard/session_cookie.d.ts.map +1 -0
- package/dist/src/dashboard/session_cookie.js +97 -0
- package/dist/src/dashboard/session_cookie.js.map +1 -0
- package/dist/src/dashboard/spa.d.ts +24 -0
- package/dist/src/dashboard/spa.d.ts.map +1 -0
- package/dist/src/dashboard/spa.js +52 -0
- package/dist/src/dashboard/spa.js.map +1 -0
- package/dist/src/define_config.d.ts +244 -9
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +97 -1
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/diagnostics.d.ts +287 -7
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +317 -1
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/driver.d.ts +139 -5
- package/dist/src/driver.d.ts.map +1 -1
- package/dist/src/drivers/abacate.d.ts +12 -2
- package/dist/src/drivers/abacate.d.ts.map +1 -1
- package/dist/src/drivers/abacate.js +112 -19
- package/dist/src/drivers/abacate.js.map +1 -1
- package/dist/src/drivers/adyen.d.ts +164 -0
- package/dist/src/drivers/adyen.d.ts.map +1 -0
- package/dist/src/drivers/adyen.js +678 -0
- package/dist/src/drivers/adyen.js.map +1 -0
- package/dist/src/drivers/asaas.d.ts +52 -2
- package/dist/src/drivers/asaas.d.ts.map +1 -1
- package/dist/src/drivers/asaas.js +364 -29
- package/dist/src/drivers/asaas.js.map +1 -1
- package/dist/src/drivers/dodo.d.ts +135 -0
- package/dist/src/drivers/dodo.d.ts.map +1 -0
- package/dist/src/drivers/dodo.js +864 -0
- package/dist/src/drivers/dodo.js.map +1 -0
- package/dist/src/drivers/efi.d.ts +98 -0
- package/dist/src/drivers/efi.d.ts.map +1 -0
- package/dist/src/drivers/efi.js +628 -0
- package/dist/src/drivers/efi.js.map +1 -0
- package/dist/src/drivers/infinitepay.d.ts +156 -0
- package/dist/src/drivers/infinitepay.d.ts.map +1 -0
- package/dist/src/drivers/infinitepay.js +321 -0
- package/dist/src/drivers/infinitepay.js.map +1 -0
- package/dist/src/drivers/lemonsqueezy.d.ts +125 -0
- package/dist/src/drivers/lemonsqueezy.d.ts.map +1 -0
- package/dist/src/drivers/lemonsqueezy.js +632 -0
- package/dist/src/drivers/lemonsqueezy.js.map +1 -0
- package/dist/src/drivers/mercadopago.d.ts +97 -0
- package/dist/src/drivers/mercadopago.d.ts.map +1 -0
- package/dist/src/drivers/mercadopago.js +844 -0
- package/dist/src/drivers/mercadopago.js.map +1 -0
- package/dist/src/drivers/mollie.d.ts +125 -0
- package/dist/src/drivers/mollie.d.ts.map +1 -0
- package/dist/src/drivers/mollie.js +812 -0
- package/dist/src/drivers/mollie.js.map +1 -0
- package/dist/src/drivers/paddle.d.ts +148 -0
- package/dist/src/drivers/paddle.d.ts.map +1 -0
- package/dist/src/drivers/paddle.js +738 -0
- package/dist/src/drivers/paddle.js.map +1 -0
- package/dist/src/drivers/pagarme.d.ts +97 -0
- package/dist/src/drivers/pagarme.d.ts.map +1 -0
- package/dist/src/drivers/pagarme.js +829 -0
- package/dist/src/drivers/pagarme.js.map +1 -0
- package/dist/src/drivers/pagbank.d.ts +57 -0
- package/dist/src/drivers/pagbank.d.ts.map +1 -0
- package/dist/src/drivers/pagbank.js +499 -0
- package/dist/src/drivers/pagbank.js.map +1 -0
- package/dist/src/drivers/paypal.d.ts +120 -0
- package/dist/src/drivers/paypal.d.ts.map +1 -0
- package/dist/src/drivers/paypal.js +891 -0
- package/dist/src/drivers/paypal.js.map +1 -0
- package/dist/src/drivers/polar.d.ts +118 -0
- package/dist/src/drivers/polar.d.ts.map +1 -0
- package/dist/src/drivers/polar.js +604 -0
- package/dist/src/drivers/polar.js.map +1 -0
- package/dist/src/drivers/razorpay.d.ts +103 -0
- package/dist/src/drivers/razorpay.d.ts.map +1 -0
- package/dist/src/drivers/razorpay.js +867 -0
- package/dist/src/drivers/razorpay.js.map +1 -0
- package/dist/src/drivers/shared.d.ts +33 -0
- package/dist/src/drivers/shared.d.ts.map +1 -0
- package/dist/src/drivers/shared.js +37 -0
- package/dist/src/drivers/shared.js.map +1 -0
- package/dist/src/drivers/square.d.ts +133 -0
- package/dist/src/drivers/square.d.ts.map +1 -0
- package/dist/src/drivers/square.js +905 -0
- package/dist/src/drivers/square.js.map +1 -0
- package/dist/src/drivers/stripe.d.ts +40 -3
- package/dist/src/drivers/stripe.d.ts.map +1 -1
- package/dist/src/drivers/stripe.js +806 -25
- package/dist/src/drivers/stripe.js.map +1 -1
- package/dist/src/drivers/woovi.d.ts +10 -3
- package/dist/src/drivers/woovi.d.ts.map +1 -1
- package/dist/src/drivers/woovi.js +162 -29
- package/dist/src/drivers/woovi.js.map +1 -1
- package/dist/src/ensure_customer.d.ts +34 -1
- package/dist/src/ensure_customer.d.ts.map +1 -1
- package/dist/src/ensure_customer.js +29 -4
- package/dist/src/ensure_customer.js.map +1 -1
- package/dist/src/http.d.ts +37 -3
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +69 -5
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +40 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +22 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/invoice/emit_invoice.d.ts.map +1 -1
- package/dist/src/invoice/emit_invoice.js +31 -11
- package/dist/src/invoice/emit_invoice.js.map +1 -1
- package/dist/src/money.d.ts +23 -5
- package/dist/src/money.d.ts.map +1 -1
- package/dist/src/money.js +72 -7
- package/dist/src/money.js.map +1 -1
- package/dist/src/payments_manager.d.ts +8 -1
- package/dist/src/payments_manager.d.ts.map +1 -1
- package/dist/src/payments_manager.js +168 -6
- package/dist/src/payments_manager.js.map +1 -1
- package/dist/src/services/main.d.ts +38 -0
- package/dist/src/services/main.d.ts.map +1 -1
- package/dist/src/services/main.js +130 -0
- package/dist/src/services/main.js.map +1 -1
- package/dist/src/telescope/index.d.ts +2 -0
- package/dist/src/telescope/index.d.ts.map +1 -1
- package/dist/src/telescope/index.js +1 -0
- package/dist/src/telescope/index.js.map +1 -1
- package/dist/src/telescope/payments_watcher.d.ts +10 -4
- package/dist/src/telescope/payments_watcher.d.ts.map +1 -1
- package/dist/src/telescope/payments_watcher.js +65 -13
- package/dist/src/telescope/payments_watcher.js.map +1 -1
- package/dist/src/telescope/register.d.ts +62 -0
- package/dist/src/telescope/register.d.ts.map +1 -0
- package/dist/src/telescope/register.js +48 -0
- package/dist/src/telescope/register.js.map +1 -0
- package/dist/src/testing/fake_payments.d.ts +62 -0
- package/dist/src/testing/fake_payments.d.ts.map +1 -0
- package/dist/src/testing/fake_payments.js +82 -0
- package/dist/src/testing/fake_payments.js.map +1 -0
- package/dist/src/testing/in_memory_billing_store.d.ts +151 -2
- package/dist/src/testing/in_memory_billing_store.d.ts.map +1 -1
- package/dist/src/testing/in_memory_billing_store.js +517 -4
- package/dist/src/testing/in_memory_billing_store.js.map +1 -1
- package/dist/src/testing/index.d.ts +2 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -0
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/types.d.ts +161 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +30 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/webhook_handlers.d.ts +96 -2
- package/dist/src/webhook_handlers.d.ts.map +1 -1
- package/dist/src/webhook_handlers.js +91 -10
- package/dist/src/webhook_handlers.js.map +1 -1
- package/dist/src/webhook_security.d.ts +94 -3
- package/dist/src/webhook_security.d.ts.map +1 -1
- package/dist/src/webhook_security.js +173 -9
- package/dist/src/webhook_security.js.map +1 -1
- package/dist/stubs/config/payments.stub +13 -0
- package/dist/stubs/config/payments_client.stub +42 -0
- package/dist/stubs/config/payments_dashboard.stub +38 -0
- package/dist/stubs/database/migrations/create_billing_tables.stub +35 -77
- package/dist/stubs/make/webhook_handler/main.stub +29 -11
- package/package.json +60 -25
package/dist/src/http.d.ts
CHANGED
|
@@ -8,13 +8,47 @@ export interface HttpRequestOptions {
|
|
|
8
8
|
name: string;
|
|
9
9
|
value: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Extra request headers (e.g. PagBank's `x-idempotency-key`). Merged last, so a driver
|
|
13
|
+
* can also override `Content-Type` when a gateway wants something else.
|
|
14
|
+
*/
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* The `fetch` implementation to call. Defaults to the global one.
|
|
18
|
+
*
|
|
19
|
+
* This is the seam a gateway that requires **mutual TLS** needs: a client certificate
|
|
20
|
+
* cannot be expressed as a header, only as the connection's TLS identity, which in Node
|
|
21
|
+
* means a custom undici dispatcher. Rather than teach this helper about undici (a
|
|
22
|
+
* dependency it does not have), the driver that needs mTLS — Efí's Pix API — builds its
|
|
23
|
+
* own certificate-bearing `fetch` and passes it here, so it still gets the shared error
|
|
24
|
+
* normalization every other driver relies on.
|
|
25
|
+
*/
|
|
26
|
+
fetch?: typeof globalThis.fetch;
|
|
11
27
|
/** Base URL the path is resolved against. */
|
|
12
28
|
baseUrl: string;
|
|
29
|
+
/**
|
|
30
|
+
* The driver's provider name (`'asaas'`, `'woovi'`, …), recorded on the
|
|
31
|
+
* `gateway.request` diagnostic so a Telescope entry names the gateway it belongs to.
|
|
32
|
+
*
|
|
33
|
+
* Optional, because the host of {@link baseUrl} already identifies the gateway and no
|
|
34
|
+
* driver is obliged to pass it. Drivers that pass it get the friendlier label.
|
|
35
|
+
*/
|
|
36
|
+
provider?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Milliseconds before the request is aborted. Defaults to 30s; pass `0` to disable.
|
|
39
|
+
*
|
|
40
|
+
* `fetch` has no timeout of its own, so without this a gateway that accepts the
|
|
41
|
+
* connection and then stops talking holds the call open indefinitely. That is bad in a
|
|
42
|
+
* charge and worse inside the webhook route, where the gateway on the other side is
|
|
43
|
+
* waiting to decide whether to redeliver — and where the request that never returns also
|
|
44
|
+
* never releases its slot.
|
|
45
|
+
*/
|
|
46
|
+
timeoutMs?: number;
|
|
13
47
|
}
|
|
14
48
|
/**
|
|
15
|
-
* Thin `fetch` wrapper shared by the fetch-based drivers (Asaas, AbacatePay, Woovi
|
|
16
|
-
* Normalizes errors into an `Error` with a `status` property so
|
|
17
|
-
* it uniformly.
|
|
49
|
+
* Thin `fetch` wrapper shared by the fetch-based drivers (Asaas, AbacatePay, Woovi,
|
|
50
|
+
* PagBank, Efí). Normalizes errors into an `Error` with a `status` property so
|
|
51
|
+
* `isNotFound` can check it uniformly.
|
|
18
52
|
*/
|
|
19
53
|
export declare function httpRequest<T>(path: string, options: HttpRequestOptions): Promise<T>;
|
|
20
54
|
/** Read a header value (handles arrays, case variants and multiple spellings). */
|
package/dist/src/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAwF1F;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAWpB;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOlD"}
|
package/dist/src/http.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { paymentsDiagnosticsEnabled, publishGatewayRequest, redactText, } from './diagnostics.js';
|
|
2
|
+
/** 30 seconds: long enough for a slow gateway, short enough that a hung one is not forever. */
|
|
3
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
1
4
|
/**
|
|
2
|
-
* Thin `fetch` wrapper shared by the fetch-based drivers (Asaas, AbacatePay, Woovi
|
|
3
|
-
* Normalizes errors into an `Error` with a `status` property so
|
|
4
|
-
* it uniformly.
|
|
5
|
+
* Thin `fetch` wrapper shared by the fetch-based drivers (Asaas, AbacatePay, Woovi,
|
|
6
|
+
* PagBank, Efí). Normalizes errors into an `Error` with a `status` property so
|
|
7
|
+
* `isNotFound` can check it uniformly.
|
|
5
8
|
*/
|
|
6
9
|
export async function httpRequest(path, options) {
|
|
10
|
+
// Built once, used by every publish below. Cheap: `paymentsDiagnosticsEnabled()` is a
|
|
11
|
+
// symbol lookup, and when nothing listens the whole diagnostics path costs that alone.
|
|
12
|
+
const observed = paymentsDiagnosticsEnabled();
|
|
7
13
|
const headers = { 'Content-Type': 'application/json' };
|
|
8
14
|
if (options.bearerToken !== undefined) {
|
|
9
15
|
headers.Authorization = `Bearer ${options.bearerToken}`;
|
|
@@ -11,6 +17,9 @@ export async function httpRequest(path, options) {
|
|
|
11
17
|
if (options.authHeader !== undefined) {
|
|
12
18
|
headers[options.authHeader.name] = options.authHeader.value;
|
|
13
19
|
}
|
|
20
|
+
if (options.headers !== undefined) {
|
|
21
|
+
Object.assign(headers, options.headers);
|
|
22
|
+
}
|
|
14
23
|
const requestInit = {
|
|
15
24
|
method: options.method ?? 'GET',
|
|
16
25
|
headers,
|
|
@@ -18,15 +27,70 @@ export async function httpRequest(path, options) {
|
|
|
18
27
|
if (options.body !== undefined) {
|
|
19
28
|
requestInit.body = JSON.stringify(options.body);
|
|
20
29
|
}
|
|
21
|
-
const
|
|
30
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
31
|
+
const controller = timeoutMs > 0 ? new AbortController() : undefined;
|
|
32
|
+
const timer = controller !== undefined ? setTimeout(() => controller.abort(), timeoutMs) : undefined;
|
|
33
|
+
if (controller !== undefined)
|
|
34
|
+
requestInit.signal = controller.signal;
|
|
35
|
+
const doFetch = options.fetch ?? globalThis.fetch;
|
|
36
|
+
const call = {
|
|
37
|
+
...(options.provider !== undefined ? { provider: options.provider } : {}),
|
|
38
|
+
method: requestInit.method ?? 'GET',
|
|
39
|
+
baseUrl: options.baseUrl,
|
|
40
|
+
path,
|
|
41
|
+
startedAt: Date.now(),
|
|
42
|
+
...(options.body !== undefined ? { requestBody: options.body } : {}),
|
|
43
|
+
};
|
|
44
|
+
/** Record the call, then let the original error through untouched. */
|
|
45
|
+
const record = (outcome) => {
|
|
46
|
+
if (observed)
|
|
47
|
+
publishGatewayRequest(call, outcome);
|
|
48
|
+
};
|
|
49
|
+
let response;
|
|
50
|
+
try {
|
|
51
|
+
response = await doFetch(`${options.baseUrl}${path}`, requestInit);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
// An abort is indistinguishable from a network error to the caller unless it is named.
|
|
55
|
+
// A driver that reports "fetch failed" for a timeout sends whoever is debugging it
|
|
56
|
+
// looking for a connectivity problem that is not there.
|
|
57
|
+
if (controller?.signal.aborted) {
|
|
58
|
+
// The diagnostic's message is built here rather than reused from the thrown Error:
|
|
59
|
+
// that one names the full URL, query string included, and this entry is meant to be
|
|
60
|
+
// pasted into a bug report.
|
|
61
|
+
record({ ok: false, outcome: 'timeout', error: `timed out after ${timeoutMs}ms` });
|
|
62
|
+
throw new Error(`[payments] HTTP request to ${options.baseUrl}${path} timed out after ${timeoutMs}ms.`);
|
|
63
|
+
}
|
|
64
|
+
record({
|
|
65
|
+
ok: false,
|
|
66
|
+
outcome: 'network_error',
|
|
67
|
+
error: redactText(error instanceof Error ? error.message : String(error)),
|
|
68
|
+
});
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
if (timer !== undefined)
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
}
|
|
22
75
|
if (!response.ok) {
|
|
23
76
|
const text = await response.text();
|
|
24
77
|
const status = response.status;
|
|
78
|
+
// `error` stays a bare status line; the gateway's own explanation of a 422 lives in
|
|
79
|
+
// `responseBody`, which is opt-in because the echoed request is in there too.
|
|
80
|
+
record({
|
|
81
|
+
ok: false,
|
|
82
|
+
outcome: 'http_error',
|
|
83
|
+
status,
|
|
84
|
+
error: `HTTP ${status}`,
|
|
85
|
+
responseBody: text,
|
|
86
|
+
});
|
|
25
87
|
throw Object.assign(new Error(`[payments] HTTP request failed (${status}): ${text}`), {
|
|
26
88
|
status,
|
|
27
89
|
});
|
|
28
90
|
}
|
|
29
|
-
|
|
91
|
+
const parsed = (await response.json());
|
|
92
|
+
record({ ok: true, status: response.status, responseBody: parsed });
|
|
93
|
+
return parsed;
|
|
30
94
|
}
|
|
31
95
|
/** Read a header value (handles arrays, case variants and multiple spellings). */
|
|
32
96
|
export function headerValue(headers, name) {
|
package/dist/src/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAC1B,qBAAqB,EACrB,UAAU,GACX,MAAM,kBAAkB,CAAC;AA+C1B,+FAA+F;AAC/F,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAI,IAAY,EAAE,OAA2B;IAC5E,sFAAsF;IACtF,uFAAuF;IACvF,MAAM,QAAQ,GAAG,0BAA0B,EAAE,CAAC;IAC9C,MAAM,OAAO,GAA2B,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;IAC/E,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,CAAC,aAAa,GAAG,UAAU,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1D,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,WAAW,GAAgB;QAC/B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,OAAO;KACR,CAAC;IACF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kB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AQ,CAAC,IAAI,EAAE,CAAM,CAAC;IAC5C,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,WAAW,CACzB,OAAsD,EACtD,IAAY;IAEZ,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5E,mDAAmD;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QAChB,KAA6B,CAAC,MAAM,KAAK,GAAG,CAC9C,CAAC;AACJ,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,29 +1,59 @@
|
|
|
1
|
-
export { defineConfig, payments, invoice } from './define_config.js';
|
|
2
|
-
export type { PaymentsConfig, PaymentsContext, PaymentsDriverFactory, InvoiceContext, InvoiceProviderFactory, StripeDriverConfig, AbacateDriverConfig, AsaasDriverConfig, WooviDriverConfig, FocusInvoiceConfig, ENotasInvoiceConfig, PlugNotasInvoiceConfig, AsaasInvoiceConfig, TecnospeedInvoiceConfig, } from './define_config.js';
|
|
1
|
+
export { defineConfig, payments, invoice, billingStores } from './define_config.js';
|
|
2
|
+
export type { PaymentsConfig, PaymentsContext, PaymentsDriverFactory, InvoiceContext, InvoiceProviderFactory, BillingStoreContext, BillingStoreFactory, StripeDriverConfig, AbacateDriverConfig, AsaasDriverConfig, WooviDriverConfig, PagBankDriverConfig, EfiDriverConfig, PagarmeDriverConfig, InfinitePayDriverConfig, MercadoPagoDriverConfig, AdyenDriverConfig, MollieDriverConfig, PayPalDriverConfig, PaddleDriverConfig, LemonSqueezyDriverConfig, PolarDriverConfig, DodoDriverConfig, RazorpayDriverConfig, SquareDriverConfig, FocusInvoiceConfig, ENotasInvoiceConfig, PlugNotasInvoiceConfig, AsaasInvoiceConfig, TecnospeedInvoiceConfig, } from './define_config.js';
|
|
3
3
|
export { PaymentsManager, resolveDrivers } from './payments_manager.js';
|
|
4
4
|
export type { WooviSubAccount } from './drivers/woovi.js';
|
|
5
|
-
export type {
|
|
5
|
+
export type { InfinitePayItem, InfinitePayCheckInput, InfinitePayCustomerInput, InfinitePayAddressInput, } from './drivers/infinitepay.js';
|
|
6
|
+
export type { PaymentsDriver, WebhookVerificationState, CreateCustomerInput, UpdateCustomerInput, ChargeInput, CheckoutInput, CreateSubscriptionInput, UpdateSubscriptionInput, } from './driver.js';
|
|
6
7
|
export { InvoiceManager, resolveInvoiceProviders } from './invoice/invoice_manager.js';
|
|
7
8
|
export type { InvoiceProvider, InvoiceEmitInput } from './invoice/invoice_provider.js';
|
|
8
9
|
export { emitInvoice, emitInvoiceIfRequested } from './invoice/emit_invoice.js';
|
|
9
10
|
export type { EmitInvoiceContext, EmitInvoiceData } from './invoice/emit_invoice.js';
|
|
10
11
|
export { httpRequest, headerValue, isNotFound } from './http.js';
|
|
11
12
|
export type { HttpRequestOptions } from './http.js';
|
|
12
|
-
export { toDecimal, fromDecimal } from './money.js';
|
|
13
|
+
export { toDecimal, fromDecimal, formatDecimal, currencyExponent } from './money.js';
|
|
13
14
|
export { ensureCustomer } from './ensure_customer.js';
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export
|
|
15
|
+
export type { EnsureCustomerOptions } from './ensure_customer.js';
|
|
16
|
+
export { isWebhookHandlerService, resolveWebhookHandler, normalizeWebhookHandlerModule, discoverWebhookHandlers, loadWebhookHandlersFromBarrel, pickModuleExt, defineWebhookHandler, assertWebhookHandlerTypes, } from './webhook_handlers.js';
|
|
17
|
+
export type { WebhookHandlerService, WebhookHandlerModule, DiscoveredWebhookHandler, WebhookHandlersBarrel, WebhookHandlerDefinition, WebhookHandlerRegistration, WebhookEventDataMap, WebhookEventDataFor, WebhookEventFor, TypedWebhookHandler, } from './webhook_handlers.js';
|
|
18
|
+
export { PAYMENTS_DIAGNOSTIC_EVENTS, publishPayments, publishPaymentDiagnostics, publishRefundDiagnostics, publishSubscriptionDiagnostics, publishInvoiceEmittedDiagnostics, publishGatewayRequest, publishWebhookVerification, webhookVerificationOutcome, claimPaymentsDiagnostics, isPaymentsDiagnosticClaimed, tracePayments, configurePaymentsDiagnostics, paymentsDiagnosticsOptions, resetPaymentsDiagnosticsOptions, paymentsDiagnosticsEnabled, currentPaymentsTrace, newPaymentsTraceId, runWithPaymentsTrace, reportWebhookVerification, redactBody, redactQueryString, redactText, REDACTED, } from './diagnostics.js';
|
|
19
|
+
export type { PaymentsDiagnosticEvent, PaymentsDiagnosticPayloads, PaymentDisputedPayload, PaymentsDiagnosticsOptions, PaymentsTraceFrame, GatewayRequestPayload, GatewayRequestFailedPayload, WebhookVerificationPayload, } from './diagnostics.js';
|
|
18
20
|
export { WebhookProcessor } from './billing/webhook_processor.js';
|
|
19
21
|
export type { WebhookHandler } from './billing/webhook_processor.js';
|
|
22
|
+
/**
|
|
23
|
+
* The shapes a driver normalizes `event.data` onto. Exported because an app's own webhook
|
|
24
|
+
* handler receives a `WebhookEvent` and needs to read `externalReference` off its payload —
|
|
25
|
+
* without these it has to re-declare the shape as an inline cast, which is a type that
|
|
26
|
+
* agrees with nothing and drifts silently when a field is added here.
|
|
27
|
+
*/
|
|
28
|
+
export type { PaymentWebhookData, SubscriptionWebhookData, DisputeWebhookData, } from './billing/webhook_events.js';
|
|
29
|
+
export { isPaymentWebhookData, isDisputeWebhookData, isSubscriptionWebhookData, isWebhookEventType, } from './billing/webhook_events.js';
|
|
30
|
+
/**
|
|
31
|
+
* The canonical event types, as a value and as a type.
|
|
32
|
+
*
|
|
33
|
+
* They existed from the start and were not exported, so an app typed its handler keys as a
|
|
34
|
+
* bare `string` — and `'payment.suceeded'` compiled, registered a handler nothing ever
|
|
35
|
+
* called, and the ledger still recorded the delivery as processed.
|
|
36
|
+
*/
|
|
37
|
+
export { WEBHOOK_EVENT_TYPES } from './billing/webhook_events.js';
|
|
38
|
+
export type { WebhookEventType } from './billing/webhook_events.js';
|
|
39
|
+
export { withBillable, withSubscription, withPayment, } from './billing/index.js';
|
|
20
40
|
export { LucidBillingStore, lucidBillingStore } from './billing/lucid_billing_store.js';
|
|
41
|
+
export { createBillingTables, dropBillingTables, truncateBillingTables, BILLING_TABLES, } from './billing/schema.js';
|
|
42
|
+
export type { LucidDatabase, LucidQueryClient, LucidQueryBindings, } from './billing/schema.js';
|
|
43
|
+
export { resolveBillingStore } from './billing/resolve_store.js';
|
|
21
44
|
export type { BillingModels } from './billing/lucid_billing_store.js';
|
|
22
|
-
export type { BillingStore } from './billing/billing_store.js';
|
|
45
|
+
export type { AuditEventCountQuery, AuditEventListItem, AuditEventQuery, BillingStore, BillingCountQuery, BillingListQuery, CustomerListItem, CustomerListQuery, DisputeListItem, DisputeDeadlineQuery, OpenDisputeQuery, PaymentListItem, PaymentListQuery, SubscriptionListItem, WebhookEventListItem, WebhookEventListQuery, WebhookEventBreakdownLine, } from './billing/billing_store.js';
|
|
46
|
+
export { AUDIT_ACTIONS, OPEN_DISPUTE_STATUSES } from './billing/billing_store.js';
|
|
47
|
+
export { BILLING_LIST_DEFAULT_LIMIT, BILLING_LIST_MAX_LIMIT, } from './billing/list_query.js';
|
|
23
48
|
export { BillingUsageEvent } from './billing/mixins/with_usage_event.js';
|
|
49
|
+
export { BillingCustomer } from './billing/mixins/with_customer.js';
|
|
50
|
+
export { BillingDispute } from './billing/mixins/with_dispute.js';
|
|
51
|
+
export { BillingAuditEvent } from './billing/mixins/with_audit_event.js';
|
|
24
52
|
export { billingOverview } from './billing/billing_overview.js';
|
|
25
53
|
export type { BillingOverview, BillingOverviewMetric } from './billing/billing_overview.js';
|
|
54
|
+
export { billingHealth } from './billing/billing_health.js';
|
|
55
|
+
export type { BillingHealth, BillingHealthCheck, BillingHealthOptions, } from './billing/billing_health.js';
|
|
26
56
|
export { meteredBill, meteredBillForSubscription } from './billing/metered_bill.js';
|
|
27
57
|
export type { MeterRate, MeteredBill, MeteredBillLine } from './billing/metered_bill.js';
|
|
28
|
-
export type { Money, Currency, BillingStatus, SubscriptionStatus, PaymentMethodType, PaymentMethodName, MoneyAmount, Customer, Payment, Refund, CheckoutSession, Subscription, Invoice, InvoiceOptions, WebhookEvent, } from './types.js';
|
|
58
|
+
export type { Money, Currency, BillingStatus, SubscriptionStatus, PaymentMethodType, PaymentMethodName, MoneyAmount, Customer, Payment, Refund, CheckoutSession, Subscription, Invoice, InvoiceOptions, WebhookEvent, Dispute, DisputeStatus, DisputeEvidence, DisputeDocument, DisputeDocumentKind, PriorUndisputedPayment, } from './types.js';
|
|
29
59
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpF,YAAY,EACV,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAChF,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CA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M,sCAAsC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACpF,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzF,YAAY,EACV,KAAK,EACL,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,OAAO,EACP,MAAM,EACN,eAAe,EACf,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,aAAa,EACb,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
export { defineConfig, payments, invoice } from './define_config.js';
|
|
1
|
+
export { defineConfig, payments, invoice, billingStores } from './define_config.js';
|
|
2
2
|
export { PaymentsManager, resolveDrivers } from './payments_manager.js';
|
|
3
3
|
export { InvoiceManager, resolveInvoiceProviders } from './invoice/invoice_manager.js';
|
|
4
4
|
export { emitInvoice, emitInvoiceIfRequested } from './invoice/emit_invoice.js';
|
|
5
5
|
export { httpRequest, headerValue, isNotFound } from './http.js';
|
|
6
|
-
export { toDecimal, fromDecimal } from './money.js';
|
|
6
|
+
export { toDecimal, fromDecimal, formatDecimal, currencyExponent } from './money.js';
|
|
7
7
|
export { ensureCustomer } from './ensure_customer.js';
|
|
8
|
-
export { isWebhookHandlerService, resolveWebhookHandler, normalizeWebhookHandlerModule, discoverWebhookHandlers, loadWebhookHandlersFromBarrel, pickModuleExt, } from './webhook_handlers.js';
|
|
9
|
-
export { PAYMENTS_DIAGNOSTIC_EVENTS, publishPayments, publishPaymentDiagnostics, publishRefundDiagnostics, publishSubscriptionDiagnostics, publishInvoiceEmittedDiagnostics, claimPaymentsDiagnostics, isPaymentsDiagnosticClaimed, tracePayments, } from './diagnostics.js';
|
|
8
|
+
export { isWebhookHandlerService, resolveWebhookHandler, normalizeWebhookHandlerModule, discoverWebhookHandlers, loadWebhookHandlersFromBarrel, pickModuleExt, defineWebhookHandler, assertWebhookHandlerTypes, } from './webhook_handlers.js';
|
|
9
|
+
export { PAYMENTS_DIAGNOSTIC_EVENTS, publishPayments, publishPaymentDiagnostics, publishRefundDiagnostics, publishSubscriptionDiagnostics, publishInvoiceEmittedDiagnostics, publishGatewayRequest, publishWebhookVerification, webhookVerificationOutcome, claimPaymentsDiagnostics, isPaymentsDiagnosticClaimed, tracePayments, configurePaymentsDiagnostics, paymentsDiagnosticsOptions, resetPaymentsDiagnosticsOptions, paymentsDiagnosticsEnabled, currentPaymentsTrace, newPaymentsTraceId, runWithPaymentsTrace, reportWebhookVerification, redactBody, redactQueryString, redactText, REDACTED, } from './diagnostics.js';
|
|
10
10
|
export { WebhookProcessor } from './billing/webhook_processor.js';
|
|
11
|
+
export { isPaymentWebhookData, isDisputeWebhookData, isSubscriptionWebhookData, isWebhookEventType, } from './billing/webhook_events.js';
|
|
12
|
+
/**
|
|
13
|
+
* The canonical event types, as a value and as a type.
|
|
14
|
+
*
|
|
15
|
+
* They existed from the start and were not exported, so an app typed its handler keys as a
|
|
16
|
+
* bare `string` — and `'payment.suceeded'` compiled, registered a handler nothing ever
|
|
17
|
+
* called, and the ledger still recorded the delivery as processed.
|
|
18
|
+
*/
|
|
19
|
+
export { WEBHOOK_EVENT_TYPES } from './billing/webhook_events.js';
|
|
20
|
+
export { withBillable, withSubscription, withPayment, } from './billing/index.js';
|
|
11
21
|
export { LucidBillingStore, lucidBillingStore } from './billing/lucid_billing_store.js';
|
|
22
|
+
export { createBillingTables, dropBillingTables, truncateBillingTables, BILLING_TABLES, } from './billing/schema.js';
|
|
23
|
+
export { resolveBillingStore } from './billing/resolve_store.js';
|
|
24
|
+
export { AUDIT_ACTIONS, OPEN_DISPUTE_STATUSES } from './billing/billing_store.js';
|
|
25
|
+
export { BILLING_LIST_DEFAULT_LIMIT, BILLING_LIST_MAX_LIMIT, } from './billing/list_query.js';
|
|
12
26
|
export { BillingUsageEvent } from './billing/mixins/with_usage_event.js';
|
|
27
|
+
export { BillingCustomer } from './billing/mixins/with_customer.js';
|
|
28
|
+
export { BillingDispute } from './billing/mixins/with_dispute.js';
|
|
29
|
+
export { BillingAuditEvent } from './billing/mixins/with_audit_event.js';
|
|
13
30
|
export { billingOverview } from './billing/billing_overview.js';
|
|
31
|
+
export { billingHealth } from './billing/billing_health.js';
|
|
14
32
|
export { meteredBill, meteredBillForSubscription } from './billing/metered_bill.js';
|
|
15
33
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAiCpF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAkBxE,OAAO,EAAE,cAAc,EAAE,uBAAu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B,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAqBjE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAM5D,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit_invoice.d.ts","sourceRoot":"","sources":["../../../src/invoice/emit_invoice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emit_invoice.d.ts","sourceRoot":"","sources":["../../../src/invoice/emit_invoice.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,uFAAuF;AACvF,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,QAAQ,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;IACF,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,OAAO,CAAC,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,EACrD,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,CA6B1D;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC,EACzD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CA8Cf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { publishInvoiceEmittedDiagnostics } from '../diagnostics.js';
|
|
1
|
+
import { publishInvoiceEmittedDiagnostics, publishInvoiceFailedDiagnostics, } from '../diagnostics.js';
|
|
2
2
|
/**
|
|
3
3
|
* Emit an invoice for a charge when the call asked for one. The `invoice` option on a
|
|
4
4
|
* charge/subscription/checkout resolves the provider by NAME, independent of the payment
|
|
@@ -49,16 +49,36 @@ export async function emitInvoiceIfRequested(ctx, input, payment, driver) {
|
|
|
49
49
|
const taxId = input.customer?.taxId ?? holder?.cpfCnpj ?? '';
|
|
50
50
|
const name = input.customer?.name ?? holder?.name;
|
|
51
51
|
const email = input.customer?.email ?? holder?.email;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
// The charge already exists at the gateway by the time this runs. A throwing invoice
|
|
53
|
+
// provider used to propagate straight out of `charge()`, so the caller saw a rejected call
|
|
54
|
+
// over money that had been taken and could only conclude nothing happened — then charged
|
|
55
|
+
// again. The charge and the invoice are two different facts and the return value now tells
|
|
56
|
+
// the true one.
|
|
57
|
+
//
|
|
58
|
+
// Swallowed, but never silent: in Brazil an NFS-e is a legal obligation, so this publishes
|
|
59
|
+
// `invoice.failed` with the payment's gateway id. Subscribe to it — a missing fiscal
|
|
60
|
+
// invoice is something a human has to fix, and nothing else will tell you.
|
|
61
|
+
let invoice;
|
|
62
|
+
try {
|
|
63
|
+
invoice = await emitInvoice(ctx, input.invoice, {
|
|
64
|
+
customer: {
|
|
65
|
+
taxId,
|
|
66
|
+
...(name !== undefined ? { name } : {}),
|
|
67
|
+
...(email !== undefined ? { email } : {}),
|
|
68
|
+
},
|
|
69
|
+
amount: payment.amount.amount,
|
|
70
|
+
currency: payment.amount.currency,
|
|
71
|
+
payment: { gatewayId: payment.gatewayId, provider: driver.provider },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
publishInvoiceFailedDiagnostics({
|
|
76
|
+
gatewayId: payment.gatewayId,
|
|
77
|
+
provider: driver.provider,
|
|
78
|
+
error: error instanceof Error ? error.message : String(error),
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
62
82
|
if (invoice) {
|
|
63
83
|
payment.invoice = invoice;
|
|
64
84
|
publishInvoiceEmittedDiagnostics({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit_invoice.js","sourceRoot":"","sources":["../../../src/invoice/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AC,CAAC,EAAE,CAAC;SAC7E,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/src/money.d.ts
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import type { Money } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* How many decimal places a currency has. Defaults to 2 — the case for every currency not
|
|
4
|
+
* listed above, including BRL, USD and EUR.
|
|
5
|
+
*/
|
|
6
|
+
export declare function currencyExponent(currency: string | undefined): number;
|
|
2
7
|
/**
|
|
3
8
|
* Money helpers shared by the fetch-based drivers.
|
|
4
9
|
*
|
|
5
|
-
* The billing layer and the `PaymentsDriver` contract work in the currency's smallest
|
|
6
|
-
*
|
|
7
|
-
*
|
|
10
|
+
* The billing layer and the `PaymentsDriver` contract work in the currency's smallest unit;
|
|
11
|
+
* many gateway APIs (the Brazilian ones, Mollie, PayPal, Mercado Pago) want a decimal. This
|
|
12
|
+
* is the only place that mapping lives.
|
|
13
|
+
*
|
|
14
|
+
* `currency` is optional so the BRL-only drivers can keep calling these with one argument —
|
|
15
|
+
* but a **multi-currency** driver that omits it is asking for the ¥ bug above. Prefer
|
|
16
|
+
* {@link formatDecimal} when the gateway wants a string.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toDecimal(amount: Money, currency?: string): number;
|
|
19
|
+
export declare function fromDecimal(value: number, currency?: string): Money;
|
|
20
|
+
/**
|
|
21
|
+
* The decimal string a gateway's JSON wants — `"19.90"`, `"1990"`, `"19.900"` — built from
|
|
22
|
+
* the integer without ever dividing.
|
|
23
|
+
*
|
|
24
|
+
* `toDecimal(x).toFixed(2)` goes through a binary float on the way to a decimal string,
|
|
25
|
+
* which is the classic way to ship `"19.89"`. Shifting the digits of an integer cannot
|
|
26
|
+
* round anywhere, so this is what drivers should use on the wire.
|
|
8
27
|
*/
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function fromDecimal(value: number): Money;
|
|
28
|
+
export declare function formatDecimal(amount: Money, currency?: string): string;
|
|
11
29
|
//# sourceMappingURL=money.d.ts.map
|
package/dist/src/money.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../src/money.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../src/money.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAqCxC;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAGnE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAOtE"}
|
package/dist/src/money.js
CHANGED
|
@@ -1,14 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ISO 4217 minor units, for the currencies where it is not 2.
|
|
3
|
+
*
|
|
4
|
+
* Dividing by 100 is right for most of the world and wrong in a way that succeeds for the
|
|
5
|
+
* rest: a ¥1990 charge sent as `19.90` is accepted by the gateway and bills a hundredth of
|
|
6
|
+
* what it should. Lowercase keys, because currencies travel lowercase through this package.
|
|
7
|
+
*/
|
|
8
|
+
const MINOR_UNITS = {
|
|
9
|
+
// Zero-decimal — the amount IS the integer; there is nothing to shift.
|
|
10
|
+
bif: 0,
|
|
11
|
+
clp: 0,
|
|
12
|
+
djf: 0,
|
|
13
|
+
gnf: 0,
|
|
14
|
+
isk: 0,
|
|
15
|
+
jpy: 0,
|
|
16
|
+
kmf: 0,
|
|
17
|
+
krw: 0,
|
|
18
|
+
pyg: 0,
|
|
19
|
+
rwf: 0,
|
|
20
|
+
ugx: 0,
|
|
21
|
+
vnd: 0,
|
|
22
|
+
vuv: 0,
|
|
23
|
+
xaf: 0,
|
|
24
|
+
xof: 0,
|
|
25
|
+
xpf: 0,
|
|
26
|
+
// Three-decimal.
|
|
27
|
+
bhd: 3,
|
|
28
|
+
iqd: 3,
|
|
29
|
+
jod: 3,
|
|
30
|
+
kwd: 3,
|
|
31
|
+
lyd: 3,
|
|
32
|
+
omr: 3,
|
|
33
|
+
tnd: 3,
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* How many decimal places a currency has. Defaults to 2 — the case for every currency not
|
|
37
|
+
* listed above, including BRL, USD and EUR.
|
|
38
|
+
*/
|
|
39
|
+
export function currencyExponent(currency) {
|
|
40
|
+
if (currency === undefined)
|
|
41
|
+
return 2;
|
|
42
|
+
return MINOR_UNITS[currency.toLowerCase()] ?? 2;
|
|
43
|
+
}
|
|
1
44
|
/**
|
|
2
45
|
* Money helpers shared by the fetch-based drivers.
|
|
3
46
|
*
|
|
4
|
-
* The billing layer and the `PaymentsDriver` contract work in the currency's smallest
|
|
5
|
-
*
|
|
6
|
-
*
|
|
47
|
+
* The billing layer and the `PaymentsDriver` contract work in the currency's smallest unit;
|
|
48
|
+
* many gateway APIs (the Brazilian ones, Mollie, PayPal, Mercado Pago) want a decimal. This
|
|
49
|
+
* is the only place that mapping lives.
|
|
50
|
+
*
|
|
51
|
+
* `currency` is optional so the BRL-only drivers can keep calling these with one argument —
|
|
52
|
+
* but a **multi-currency** driver that omits it is asking for the ¥ bug above. Prefer
|
|
53
|
+
* {@link formatDecimal} when the gateway wants a string.
|
|
7
54
|
*/
|
|
8
|
-
export function toDecimal(amount) {
|
|
9
|
-
|
|
55
|
+
export function toDecimal(amount, currency) {
|
|
56
|
+
const exponent = currencyExponent(currency);
|
|
57
|
+
return exponent === 0 ? amount : amount / 10 ** exponent;
|
|
58
|
+
}
|
|
59
|
+
export function fromDecimal(value, currency) {
|
|
60
|
+
const exponent = currencyExponent(currency);
|
|
61
|
+
return exponent === 0 ? Math.round(value) : Math.round(value * 10 ** exponent);
|
|
10
62
|
}
|
|
11
|
-
|
|
12
|
-
|
|
63
|
+
/**
|
|
64
|
+
* The decimal string a gateway's JSON wants — `"19.90"`, `"1990"`, `"19.900"` — built from
|
|
65
|
+
* the integer without ever dividing.
|
|
66
|
+
*
|
|
67
|
+
* `toDecimal(x).toFixed(2)` goes through a binary float on the way to a decimal string,
|
|
68
|
+
* which is the classic way to ship `"19.89"`. Shifting the digits of an integer cannot
|
|
69
|
+
* round anywhere, so this is what drivers should use on the wire.
|
|
70
|
+
*/
|
|
71
|
+
export function formatDecimal(amount, currency) {
|
|
72
|
+
const exponent = currencyExponent(currency);
|
|
73
|
+
const negative = amount < 0;
|
|
74
|
+
const digits = String(Math.abs(Math.trunc(amount))).padStart(exponent + 1, '0');
|
|
75
|
+
const whole = digits.slice(0, digits.length - exponent);
|
|
76
|
+
const fraction = exponent === 0 ? '' : `.${digits.slice(digits.length - exponent)}`;
|
|
77
|
+
return `${negative ? '-' : ''}${whole}${fraction}`;
|
|
13
78
|
}
|
|
14
79
|
//# sourceMappingURL=money.js.map
|
package/dist/src/money.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.js","sourceRoot":"","sources":["../../src/money.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"money.js","sourceRoot":"","sources":["../../src/money.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,WAAW,GAA2B;IAC1C,uEAAuE;IACvE,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,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AQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAChF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC;IACpF,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -13,6 +13,13 @@ export interface PaymentsManagerOptions {
|
|
|
13
13
|
export declare class PaymentsManager {
|
|
14
14
|
#private;
|
|
15
15
|
constructor(options: PaymentsManagerOptions);
|
|
16
|
+
/**
|
|
17
|
+
* Every configured driver, by the name it was configured under.
|
|
18
|
+
*
|
|
19
|
+
* Read-only, and there for the checks that have to look at all of them at once — the
|
|
20
|
+
* boot-time webhook-verification refusal is the one that needed it.
|
|
21
|
+
*/
|
|
22
|
+
get drivers(): ReadonlyMap<string, PaymentsDriver>;
|
|
16
23
|
/**
|
|
17
24
|
* Resolve a driver by payment method (e.g. `'pix'`), by provider name, or by the
|
|
18
25
|
* configured default when nothing is given.
|
|
@@ -33,7 +40,7 @@ export declare class PaymentsManager {
|
|
|
33
40
|
* Check a driver capability before delegating, so callers discover the limitation
|
|
34
41
|
* early (e.g. Woovi/OpenPix has no refunds) instead of at the gateway.
|
|
35
42
|
*/
|
|
36
|
-
assertCapability(driver: PaymentsDriver, capability: 'refunds' | 'invoices' | 'subscriptions'): void;
|
|
43
|
+
assertCapability(driver: PaymentsDriver, capability: 'refunds' | 'invoices' | 'subscriptions' | 'disputes'): void;
|
|
37
44
|
}
|
|
38
45
|
/** Build the driver map from config, resolving every configured factory. */
|
|
39
46
|
export declare function resolveDrivers(config: PaymentsConfig, invoices?: InvoiceManager): Promise<Map<string, PaymentsDriver>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments_manager.d.ts","sourceRoot":"","sources":["../../src/payments_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"payments_manager.d.ts","sourceRoot":"","sources":["../../src/payments_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,eAAe;;gBAad,OAAO,EAAE,sBAAsB;IAW3C;;;;;OAKG;IACH,IAAI,OAAO,IA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