@antelopejs/interface-payment 0.0.0-stage → 0.0.1

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 ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright (c) 2025-present - AntelopeJS Team
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,128 @@
1
- # Temporary Holding Version
1
+ # @antelopejs/interface-payment
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/@antelopejs/interface-payment.svg)](https://www.npmjs.com/package/@antelopejs/interface-payment)
4
+ [![license](https://img.shields.io/npm/l/@antelopejs/interface-payment.svg)](./LICENSE)
5
+
6
+ Provider-agnostic payment interface for AntelopeJS. Take payments, refund them,
7
+ save payment methods and react to settlement events without naming a provider —
8
+ and change provider by swapping the module wired underneath.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pnpm add @antelopejs/interface-payment
14
+ ```
15
+
16
+ This package declares the contract and ships no provider logic. Wire a module
17
+ that implements it — `@antelopejs/stripe` — in your Antelope config.
18
+
19
+ ## What it covers
20
+
21
+ | Area | Functions |
22
+ | --------------------------- | ---------------------------------------------------------------------------------------------- |
23
+ | Hosted checkout | `CreateCheckoutSession`, `GetCheckoutSession` |
24
+ | Direct payments | `CreatePayment`, `GetPayment`, `CapturePayment`, `CancelPayment` |
25
+ | Refunds | `RefundPayment`, `GetRefund` |
26
+ | Customers and saved methods | `CreateCustomer`, `GetCustomer`, `DeleteCustomer`, `ListPaymentMethods`, `DetachPaymentMethod` |
27
+ | Webhooks | `VerifyWebhook` |
28
+
29
+ Subscriptions, marketplace split payments, dispute management, payment links and
30
+ in-person terminals are deliberately out of scope — they are where providers
31
+ diverge most. For anything beyond this contract, use the provider's own interface
32
+ (`@antelopejs/interface-stripe`) alongside this one.
33
+
34
+ ## Quick start
35
+
36
+ ```ts docs-check
37
+ import { CreateCheckoutSession } from "@antelopejs/interface-payment";
38
+
39
+ export async function startCheckout(orderId: string, idempotencyKey: string) {
40
+ return CreateCheckoutSession(
41
+ {
42
+ amount: { value: 4999, currency: "EUR" },
43
+ reference: orderId,
44
+ successUrl: "https://shop.example/thanks",
45
+ cancelUrl: "https://shop.example/cart",
46
+ },
47
+ idempotencyKey,
48
+ );
49
+ }
50
+ ```
51
+
52
+ Generate and persist one idempotency key per checkout attempt, and reuse it on
53
+ retries. Call `startCheckout` from your authenticated checkout route, persist the
54
+ returned session ID against the order, and redirect the payer to `redirectUrl`.
55
+ Use your own return URLs and configure the provider credentials and webhook route.
56
+
57
+ Fulfil the order from the `payment.succeeded` webhook, not from the payer's
58
+ return — the browser is not a trustworthy reporter.
59
+
60
+ Replay protection lasts only for the provider-defined replay window. Persist
61
+ operation keys and provider IDs; after expiration, reconcile uncertain payments
62
+ with provider records before retrying. A reused key can otherwise charge again.
63
+
64
+ ## Choose a task
65
+
66
+ - Take a payment: [checkout and direct payments](./docs/2.payments.md).
67
+ - Save a method or charge off-session: [customers and methods](./docs/3.customers-and-methods.md).
68
+ - Confirm settlement safely: [webhooks](./docs/4.webhooks.md).
69
+ - Add a provider: [capabilities and conformance](./docs/5.provider-capability-matrix.md).
70
+ - Add recurring billing: use Stripe's native subscriptions through
71
+ `@antelopejs/interface-subscriptions` when using Stripe. Choose
72
+ `@antelopejs/payment-subscriptions` explicitly when you want a generic renewal
73
+ clock instead; do not run both clocks for the same subscription.
74
+
75
+ ## Compatibility
76
+
77
+ <!-- docs-compat: ./package.json#peerDependencies -->
78
+
79
+ | Package | Range |
80
+ | ---------------------------- | ---------------- |
81
+ | `@antelopejs/interface-core` | `>=0.0.3 <1.0.0` |
82
+
83
+ These are the peer requirements in `package.json`, not development or test-tool
84
+ ranges. The implementing module may impose additional requirements.
85
+
86
+ ## Conventions
87
+
88
+ - **Integer minor units.** `{ value: 1050, currency: "EUR" }` is €10.50, never a float.
89
+ - **An idempotency key on every mutating call**, positionally after the request.
90
+ - **Opaque provider identifiers.** Do not parse them.
91
+ - **A decline is a result, not an exception.** `CreatePayment` resolves with
92
+ `status: "failed"`; it rejects only when the call could not be made.
93
+ - **An optional trailing `provider`** selects between configured accounts.
94
+
95
+ ## Documentation
96
+
97
+ | Document | Contents |
98
+ | -------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
99
+ | [Introduction](./docs/1.introduction.md) | Scope, conventions, installation |
100
+ | [Payments](./docs/2.payments.md) | Checkout, direct payments, authorize/capture, errors |
101
+ | [Customers and methods](./docs/3.customers-and-methods.md) | Saved methods, off-session and recurring charges |
102
+ | [Webhooks](./docs/4.webhooks.md) | Verification, the event set, handling |
103
+ | [Provider capability matrix](./docs/5.provider-capability-matrix.md) | What each provider family does behind each call, and why the scope is what it is |
104
+
105
+ ## Conformance suite
106
+
107
+ `src/tests/payment.test.ts` ships in the package and runs against whichever
108
+ provider module is wired in. It is written against the contract, not against any
109
+ one provider's behaviour, and it is what a new provider implementation is held
110
+ to.
111
+
112
+ Session creation, customer lifecycle, idempotency replay, unknown-identifier
113
+ errors and webhook rejection need no fixture and cannot pass without a live
114
+ provider — with nothing implementing the interface the proxies queue and the
115
+ suite times out rather than reporting green.
116
+
117
+ The charge tests need a provider test token, because there is no portable way to
118
+ mint a chargeable payment method:
119
+
120
+ | Variable | Purpose |
121
+ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
122
+ | `ANTELOPE_PAYMENT_TEST_METHOD` | A token `CreatePayment` charges successfully. Without it the charge, capture and refund blocks skip by name. |
123
+ | `ANTELOPE_PAYMENT_TEST_METHOD_DECLINED` | A token the provider declines. Without it the decline block skips. |
124
+ | `ANTELOPE_PAYMENT_TEST_CURRENCY` | ISO-4217 code to run against. Defaults to `EUR`. |
125
+
126
+ ## License
127
+
128
+ Apache-2.0
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@antelopejs/interface-core/config").ConfigInput;
2
+ export default _default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("@antelopejs/interface-core/config");
4
+ exports.default = (0, config_1.defineConfig)({
5
+ name: "interface-payment-test",
6
+ cacheFolder: ".antelope/cache",
7
+ modules: {},
8
+ test: { folder: "test" },
9
+ });
10
+ //# sourceMappingURL=antelope.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antelope.test.js","sourceRoot":"","sources":["../src/antelope.test.ts"],"names":[],"mappings":";;AAAA,8DAAiE;AAEjE,kBAAe,IAAA,qBAAY,EAAC;IAC1B,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;CACzB,CAAC,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { PaymentStatus } from "./types";
2
+ /**
3
+ * Base class for every error this interface raises.
4
+ *
5
+ * A failed *payment* is not an error: {@link CreatePayment} resolves with a
6
+ * {@link Payment} whose status is `failed`. These errors mean the call itself
7
+ * did not happen.
8
+ */
9
+ export declare class PaymentError extends Error {
10
+ /** The provider's own error code, verbatim and opaque. */
11
+ readonly providerCode?: string | undefined;
12
+ constructor(message: string,
13
+ /** The provider's own error code, verbatim and opaque. */
14
+ providerCode?: string | undefined);
15
+ }
16
+ /** What a not-found error was looking for, for the message alone. */
17
+ export type PaymentEntity = "payment" | "refund" | "checkout session";
18
+ /**
19
+ * No payment, refund or checkout session exists under that identifier.
20
+ *
21
+ * Also raised for an identifier that cannot be parsed at all, which a caller
22
+ * holding opaque identifiers cannot distinguish from one that is merely absent.
23
+ */
24
+ export declare class PaymentNotFoundError extends PaymentError {
25
+ constructor(id: string,
26
+ /** Which kind of record was looked for. Names it in the message only. */
27
+ entity?: PaymentEntity, providerCode?: string);
28
+ }
29
+ /** What a customer-side not-found error was looking for. */
30
+ export type CustomerEntity = "customer" | "payment method";
31
+ /**
32
+ * No customer or payment method exists under that identifier.
33
+ *
34
+ * As {@link PaymentNotFoundError}, this also covers an unparseable identifier.
35
+ */
36
+ export declare class CustomerNotFoundError extends PaymentError {
37
+ constructor(id: string,
38
+ /** Which kind of record was looked for. Names it in the message only. */
39
+ entity?: CustomerEntity, providerCode?: string);
40
+ }
41
+ /**
42
+ * A webhook delivery could not be established as genuine.
43
+ *
44
+ * Respond 403 and do not act on the body.
45
+ *
46
+ * Distinct from a genuine delivery this interface does not model, which
47
+ * {@link VerifyWebhook} reports by resolving `undefined`.
48
+ */
49
+ export declare class WebhookVerificationError extends PaymentError {
50
+ constructor(message: string, providerCode?: string);
51
+ }
52
+ /**
53
+ * The request was well-formed but does not apply to the payment's current
54
+ * state.
55
+ *
56
+ * Capturing a payment that is not `authorized`, refunding more than was
57
+ * captured, cancelling something already captured.
58
+ */
59
+ export declare class InvalidPaymentStateError extends PaymentError {
60
+ /** The status the payment was actually in. */
61
+ readonly status?: PaymentStatus | undefined;
62
+ constructor(message: string,
63
+ /** The status the payment was actually in. */
64
+ status?: PaymentStatus | undefined, providerCode?: string);
65
+ }
66
+ /**
67
+ * The implementation behind this interface does not offer the operation at all.
68
+ *
69
+ * Unconditional: an implementation that raises this raises it for every call to
70
+ * that function, and says so in its README.
71
+ */
72
+ export declare class UnsupportedOperationError extends PaymentError {
73
+ /** The interface function that is unavailable, e.g. `"CapturePayment"`. */
74
+ readonly operation: string;
75
+ constructor(
76
+ /** The interface function that is unavailable, e.g. `"CapturePayment"`. */
77
+ operation: string, providerCode?: string);
78
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedOperationError = exports.InvalidPaymentStateError = exports.WebhookVerificationError = exports.CustomerNotFoundError = exports.PaymentNotFoundError = exports.PaymentError = void 0;
4
+ /**
5
+ * Base class for every error this interface raises.
6
+ *
7
+ * A failed *payment* is not an error: {@link CreatePayment} resolves with a
8
+ * {@link Payment} whose status is `failed`. These errors mean the call itself
9
+ * did not happen.
10
+ */
11
+ class PaymentError extends Error {
12
+ providerCode;
13
+ constructor(message,
14
+ /** The provider's own error code, verbatim and opaque. */
15
+ providerCode) {
16
+ super(message);
17
+ this.providerCode = providerCode;
18
+ this.name = "PaymentError";
19
+ }
20
+ }
21
+ exports.PaymentError = PaymentError;
22
+ /**
23
+ * No payment, refund or checkout session exists under that identifier.
24
+ *
25
+ * Also raised for an identifier that cannot be parsed at all, which a caller
26
+ * holding opaque identifiers cannot distinguish from one that is merely absent.
27
+ */
28
+ class PaymentNotFoundError extends PaymentError {
29
+ constructor(id,
30
+ /** Which kind of record was looked for. Names it in the message only. */
31
+ entity = "payment", providerCode) {
32
+ super(`No such ${entity}: ${id}`, providerCode);
33
+ this.name = "PaymentNotFoundError";
34
+ }
35
+ }
36
+ exports.PaymentNotFoundError = PaymentNotFoundError;
37
+ /**
38
+ * No customer or payment method exists under that identifier.
39
+ *
40
+ * As {@link PaymentNotFoundError}, this also covers an unparseable identifier.
41
+ */
42
+ class CustomerNotFoundError extends PaymentError {
43
+ constructor(id,
44
+ /** Which kind of record was looked for. Names it in the message only. */
45
+ entity = "customer", providerCode) {
46
+ super(`No such ${entity}: ${id}`, providerCode);
47
+ this.name = "CustomerNotFoundError";
48
+ }
49
+ }
50
+ exports.CustomerNotFoundError = CustomerNotFoundError;
51
+ /**
52
+ * A webhook delivery could not be established as genuine.
53
+ *
54
+ * Respond 403 and do not act on the body.
55
+ *
56
+ * Distinct from a genuine delivery this interface does not model, which
57
+ * {@link VerifyWebhook} reports by resolving `undefined`.
58
+ */
59
+ class WebhookVerificationError extends PaymentError {
60
+ constructor(message, providerCode) {
61
+ super(message, providerCode);
62
+ this.name = "WebhookVerificationError";
63
+ }
64
+ }
65
+ exports.WebhookVerificationError = WebhookVerificationError;
66
+ /**
67
+ * The request was well-formed but does not apply to the payment's current
68
+ * state.
69
+ *
70
+ * Capturing a payment that is not `authorized`, refunding more than was
71
+ * captured, cancelling something already captured.
72
+ */
73
+ class InvalidPaymentStateError extends PaymentError {
74
+ status;
75
+ constructor(message,
76
+ /** The status the payment was actually in. */
77
+ status, providerCode) {
78
+ super(message, providerCode);
79
+ this.status = status;
80
+ this.name = "InvalidPaymentStateError";
81
+ }
82
+ }
83
+ exports.InvalidPaymentStateError = InvalidPaymentStateError;
84
+ /**
85
+ * The implementation behind this interface does not offer the operation at all.
86
+ *
87
+ * Unconditional: an implementation that raises this raises it for every call to
88
+ * that function, and says so in its README.
89
+ */
90
+ class UnsupportedOperationError extends PaymentError {
91
+ operation;
92
+ constructor(
93
+ /** The interface function that is unavailable, e.g. `"CapturePayment"`. */
94
+ operation, providerCode) {
95
+ super(`Operation not supported by this payment provider: ${operation}`, providerCode);
96
+ this.operation = operation;
97
+ this.name = "UnsupportedOperationError";
98
+ }
99
+ }
100
+ exports.UnsupportedOperationError = UnsupportedOperationError;
101
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAa,YAAa,SAAQ,KAAK;IAInB;IAHlB,YACE,OAAe;IACf,0DAA0D;IAC1C,YAAqB;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,iBAAY,GAAZ,YAAY,CAAS;QAGrC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AATD,oCASC;AAKD;;;;;GAKG;AACH,MAAa,oBAAqB,SAAQ,YAAY;IACpD,YACE,EAAU;IACV,yEAAyE;IACzE,SAAwB,SAAS,EACjC,YAAqB;QAErB,KAAK,CAAC,WAAW,MAAM,KAAK,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAVD,oDAUC;AAKD;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,YAAY;IACrD,YACE,EAAU;IACV,yEAAyE;IACzE,SAAyB,UAAU,EACnC,YAAqB;QAErB,KAAK,CAAC,WAAW,MAAM,KAAK,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAVD,sDAUC;AAED;;;;;;;GAOG;AACH,MAAa,wBAAyB,SAAQ,YAAY;IACxD,YAAY,OAAe,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AALD,4DAKC;AAED;;;;;;GAMG;AACH,MAAa,wBAAyB,SAAQ,YAAY;IAItC;IAHlB,YACE,OAAe;IACf,8CAA8C;IAC9B,MAAsB,EACtC,YAAqB;QAErB,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAHb,WAAM,GAAN,MAAM,CAAgB;QAItC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAVD,4DAUC;AAED;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,YAAY;IAGvC;IAFlB;IACE,2EAA2E;IAC3D,SAAiB,EACjC,YAAqB;QAErB,KAAK,CACH,qDAAqD,SAAS,EAAE,EAChE,YAAY,CACb,CAAC;QANc,cAAS,GAAT,SAAS,CAAQ;QAOjC,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAZD,8DAYC"}