@amos.com/node 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/dist/index.d.mts +11 -17
- package/dist/index.d.ts +11 -17
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/openapi/schema.ts +2 -8
- package/package.json +2 -1
- package/src/index.ts +8 -8
package/README.md
CHANGED
|
@@ -15,15 +15,15 @@ npm install @amos.com/node
|
|
|
15
15
|
```ts
|
|
16
16
|
import {
|
|
17
17
|
createPayApiClient,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
AMOS_API_BASE_URL_PRODUCTION,
|
|
19
|
+
AMOS_API_VERSION,
|
|
20
20
|
} from "@amos.com/node";
|
|
21
21
|
|
|
22
22
|
const pay = createPayApiClient({
|
|
23
|
-
baseUrl:
|
|
23
|
+
baseUrl: AMOS_API_BASE_URL_PRODUCTION,
|
|
24
24
|
headers: {
|
|
25
25
|
"X-Api-Key": process.env.AMOS_API_KEY!,
|
|
26
|
-
"X-Api-Version":
|
|
26
|
+
"X-Api-Version": AMOS_API_VERSION,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -45,15 +45,15 @@ Swap the base URL constant:
|
|
|
45
45
|
```ts
|
|
46
46
|
import {
|
|
47
47
|
createPayApiClient,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
AMOS_API_BASE_URL_SANDBOX,
|
|
49
|
+
AMOS_API_VERSION,
|
|
50
50
|
} from "@amos.com/node";
|
|
51
51
|
|
|
52
52
|
const pay = createPayApiClient({
|
|
53
|
-
baseUrl:
|
|
53
|
+
baseUrl: AMOS_API_BASE_URL_SANDBOX,
|
|
54
54
|
headers: {
|
|
55
55
|
"X-Api-Key": process.env.AMOS_API_KEY!,
|
|
56
|
-
"X-Api-Version":
|
|
56
|
+
"X-Api-Version": AMOS_API_VERSION,
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
```
|
|
@@ -68,7 +68,7 @@ const pay = createPayApiClient({
|
|
|
68
68
|
fetch: customFetchImpl,
|
|
69
69
|
headers: {
|
|
70
70
|
"X-Api-Key": process.env.AMOS_API_KEY!,
|
|
71
|
-
"X-Api-Version":
|
|
71
|
+
"X-Api-Version": AMOS_API_VERSION,
|
|
72
72
|
"X-Trace-Id": "abc123",
|
|
73
73
|
},
|
|
74
74
|
});
|
|
@@ -96,16 +96,16 @@ pay.use(idempotencyKey);
|
|
|
96
96
|
```ts
|
|
97
97
|
import {
|
|
98
98
|
createPayApiClient,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
AMOS_API_BASE_URL_PRODUCTION,
|
|
100
|
+
AMOS_API_BASE_URL_SANDBOX,
|
|
101
|
+
AMOS_API_VERSION,
|
|
102
102
|
} from "@amos.com/node";
|
|
103
103
|
import type { PayApiClient, ClientOptions, Middleware } from "@amos.com/node";
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
- `createPayApiClient(options)` — returns a typed [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch) client. Exposes the full `openapi-fetch` interface: `GET`, `POST`, `PUT`, `DELETE`, `OPTIONS`, `HEAD`, `PATCH`, `TRACE`, `use`, `eject`.
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
107
|
+
- `AMOS_API_BASE_URL_PRODUCTION` / `AMOS_API_BASE_URL_SANDBOX` — base URLs for the two environments.
|
|
108
|
+
- `AMOS_API_VERSION` — the wire-level `X-Api-Version` this build targets. Pass it as the `X-Api-Version` header on every request (most easily as a default in `headers`, as shown above).
|
|
109
109
|
- `PayApiClient` — the type returned by `createPayApiClient`.
|
|
110
110
|
- `ClientOptions`, `Middleware` — re-exported from `openapi-fetch` for convenience.
|
|
111
111
|
|
|
@@ -128,7 +128,7 @@ We follow **SemVer** for the npm package, with one extra rule: **the major versi
|
|
|
128
128
|
| `@amos.com/node@1.x` | `1` |
|
|
129
129
|
| `@amos.com/node@2.x` | `2` (hypothetical) |
|
|
130
130
|
|
|
131
|
-
So bumping `
|
|
131
|
+
So bumping `AMOS_API_VERSION` is always a major release, and consumers who pin to `@amos.com/node@^1` know they will never be transparently upgraded onto a new wire contract.
|
|
132
132
|
|
|
133
133
|
The mental rule for bumps: _"would a program that typechecked against the previous `dist/index.d.ts` still typecheck against the new one?"_ If no, it's a major.
|
|
134
134
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1265,21 +1265,15 @@ interface components {
|
|
|
1265
1265
|
exp_year?: number;
|
|
1266
1266
|
moto?: boolean;
|
|
1267
1267
|
};
|
|
1268
|
-
/** @description Apple Pay card profile for embed confirm. Clients
|
|
1268
|
+
/** @description Apple Pay card profile for embed confirm. Clients only send wallet_payload (the raw JSON-encoded PKPaymentToken). Brand, last4, expiration, pan_type, wallet_provider, and cryptogram are set from the Vault response. Encrypted PAN and client-supplied cryptogram are not supported. */
|
|
1269
1269
|
ApplePayCardProfileInput: {
|
|
1270
|
-
wallet_brand?: string;
|
|
1271
|
-
/** @description Display last4 from the Apple Pay payment method. */
|
|
1272
|
-
wallet_last4?: string;
|
|
1273
1270
|
/** @description The unmodified JSON-encoded PKPaymentToken. */
|
|
1274
1271
|
wallet_payload: string;
|
|
1275
|
-
wallet_provider?: components["schemas"]["WalletProviderType"];
|
|
1276
1272
|
};
|
|
1273
|
+
/** @description Google Pay card profile for embed confirm. Clients only send wallet_payload. Brand, last4, expiration, pan_type, wallet_provider, and cryptogram are set from the Vault response. Encrypted PAN is not supported. */
|
|
1277
1274
|
GooglePayCardProfileInput: {
|
|
1278
|
-
wallet_brand?: string;
|
|
1279
|
-
wallet_last4?: string;
|
|
1280
1275
|
/** @description The unmodified Google Pay payment token payload. */
|
|
1281
1276
|
wallet_payload: string;
|
|
1282
|
-
wallet_provider?: components["schemas"]["WalletProviderType"];
|
|
1283
1277
|
};
|
|
1284
1278
|
CardProfile: {
|
|
1285
1279
|
avs_check?: string;
|
|
@@ -5262,9 +5256,9 @@ declare const refundAllowed_reverse_actionValues: ReadonlyArray<FlattenedDeepReq
|
|
|
5262
5256
|
declare const setupIntentStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["SetupIntent"]["state"]>;
|
|
5263
5257
|
declare const subscriptionStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["Subscription"]["state"]>;
|
|
5264
5258
|
|
|
5265
|
-
declare const
|
|
5266
|
-
declare const
|
|
5267
|
-
declare const
|
|
5259
|
+
declare const AMOS_API_BASE_URL_PRODUCTION = "https://api.amos.com";
|
|
5260
|
+
declare const AMOS_API_BASE_URL_SANDBOX = "https://api-sandbox.amos.com";
|
|
5261
|
+
declare const AMOS_API_VERSION = "1";
|
|
5268
5262
|
/**
|
|
5269
5263
|
* Create a typed `openapi-fetch` client for the Amos Pay API.
|
|
5270
5264
|
*
|
|
@@ -5281,20 +5275,20 @@ declare const PAY_API_VERSION = "1";
|
|
|
5281
5275
|
* ```ts
|
|
5282
5276
|
* import {
|
|
5283
5277
|
* createPayApiClient,
|
|
5284
|
-
*
|
|
5285
|
-
*
|
|
5278
|
+
* AMOS_API_BASE_URL_SANDBOX,
|
|
5279
|
+
* AMOS_API_VERSION,
|
|
5286
5280
|
* } from "@amos.com/node";
|
|
5287
5281
|
*
|
|
5288
5282
|
* const pay = createPayApiClient({
|
|
5289
|
-
* baseUrl:
|
|
5283
|
+
* baseUrl: AMOS_API_BASE_URL_SANDBOX,
|
|
5290
5284
|
* headers: {
|
|
5291
5285
|
* "X-Api-Key": process.env.AMOS_API_KEY!,
|
|
5292
|
-
* "X-Api-Version":
|
|
5286
|
+
* "X-Api-Version": AMOS_API_VERSION,
|
|
5293
5287
|
* },
|
|
5294
5288
|
* });
|
|
5295
5289
|
*
|
|
5296
5290
|
* const { data, error } = await pay.POST("/customers", {
|
|
5297
|
-
* params: { header: { "X-Api-Version":
|
|
5291
|
+
* params: { header: { "X-Api-Version": AMOS_API_VERSION } },
|
|
5298
5292
|
* body: { customer: { email: "alex@example.com" } },
|
|
5299
5293
|
* });
|
|
5300
5294
|
* ```
|
|
@@ -5303,4 +5297,4 @@ declare function createPayApiClient(options: ClientOptions): openapi_fetch.Clien
|
|
|
5303
5297
|
/** A configured Amos Pay API client returned by {@link createPayApiClient}. */
|
|
5304
5298
|
type PayApiClient = ReturnType<typeof createPayApiClient>;
|
|
5305
5299
|
|
|
5306
|
-
export { type $defs,
|
|
5300
|
+
export { type $defs, AMOS_API_BASE_URL_PRODUCTION, AMOS_API_BASE_URL_SANDBOX, AMOS_API_VERSION, type PayApiClient, achVerificationTypeValues, allowedApplePayPaymentMethodInputTypeValues, allowedApplePayPaymentMethodTypeValues, allowedBankAccountPaymentMethodInputTypeValues, allowedBankAccountPaymentMethodTypeValues, allowedCardPaymentMethodInputTypeValues, allowedCardPaymentMethodTypeValues, allowedGooglePayPaymentMethodInputTypeValues, allowedGooglePayPaymentMethodTypeValues, bankAccountProfileFailure_reasonValues, cardProfileFailure_reasonValues, chargeAllowed_reverse_actionValues, chargeStateValues, type components, createPayApiClient, embedConfirmApplePayPaymentMethodInputTypeValues, embedConfirmBankAccountPaymentMethodInputTypeValues, embedConfirmCardPaymentMethodInputTypeValues, embedConfirmGooglePayPaymentMethodInputTypeValues, externalAccountTypeValues, internationalBillingAddressOptionsModeValues, legalEntityDocumentTypeValues, legalEntityEntityTypeValues, legalEntityOwnershipTypeValues, merchantBusinessCategoryTypeValues, type operations, type paths, pathsEmbedPayment_intentsIdGetParametersQueryPayment_method_typeValues, paymentIntentCaptureMethodTypeValues, paymentIntentStateValues, paymentLinkAmountTypeValues, paymentMethodTypeValues, payoutDirectionTypeValues, payoutStateTypeValues, processorTransactionPayment_transaction_typeValues, processorTransactionTransaction_typeValues, refundAllowed_reverse_actionValues, refundStateTypeValues, setupIntentStateValues, subscriptionIntervalTypeValues, subscriptionPlanTypeValues, subscriptionStateValues, transactionSourceTypeValues, usOnlyBillingAddressOptionsModeValues, usStateTypeValues, walletProviderTypeValues, webhookEventTypeValues, type webhooks };
|
package/dist/index.d.ts
CHANGED
|
@@ -1265,21 +1265,15 @@ interface components {
|
|
|
1265
1265
|
exp_year?: number;
|
|
1266
1266
|
moto?: boolean;
|
|
1267
1267
|
};
|
|
1268
|
-
/** @description Apple Pay card profile for embed confirm. Clients
|
|
1268
|
+
/** @description Apple Pay card profile for embed confirm. Clients only send wallet_payload (the raw JSON-encoded PKPaymentToken). Brand, last4, expiration, pan_type, wallet_provider, and cryptogram are set from the Vault response. Encrypted PAN and client-supplied cryptogram are not supported. */
|
|
1269
1269
|
ApplePayCardProfileInput: {
|
|
1270
|
-
wallet_brand?: string;
|
|
1271
|
-
/** @description Display last4 from the Apple Pay payment method. */
|
|
1272
|
-
wallet_last4?: string;
|
|
1273
1270
|
/** @description The unmodified JSON-encoded PKPaymentToken. */
|
|
1274
1271
|
wallet_payload: string;
|
|
1275
|
-
wallet_provider?: components["schemas"]["WalletProviderType"];
|
|
1276
1272
|
};
|
|
1273
|
+
/** @description Google Pay card profile for embed confirm. Clients only send wallet_payload. Brand, last4, expiration, pan_type, wallet_provider, and cryptogram are set from the Vault response. Encrypted PAN is not supported. */
|
|
1277
1274
|
GooglePayCardProfileInput: {
|
|
1278
|
-
wallet_brand?: string;
|
|
1279
|
-
wallet_last4?: string;
|
|
1280
1275
|
/** @description The unmodified Google Pay payment token payload. */
|
|
1281
1276
|
wallet_payload: string;
|
|
1282
|
-
wallet_provider?: components["schemas"]["WalletProviderType"];
|
|
1283
1277
|
};
|
|
1284
1278
|
CardProfile: {
|
|
1285
1279
|
avs_check?: string;
|
|
@@ -5262,9 +5256,9 @@ declare const refundAllowed_reverse_actionValues: ReadonlyArray<FlattenedDeepReq
|
|
|
5262
5256
|
declare const setupIntentStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["SetupIntent"]["state"]>;
|
|
5263
5257
|
declare const subscriptionStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["Subscription"]["state"]>;
|
|
5264
5258
|
|
|
5265
|
-
declare const
|
|
5266
|
-
declare const
|
|
5267
|
-
declare const
|
|
5259
|
+
declare const AMOS_API_BASE_URL_PRODUCTION = "https://api.amos.com";
|
|
5260
|
+
declare const AMOS_API_BASE_URL_SANDBOX = "https://api-sandbox.amos.com";
|
|
5261
|
+
declare const AMOS_API_VERSION = "1";
|
|
5268
5262
|
/**
|
|
5269
5263
|
* Create a typed `openapi-fetch` client for the Amos Pay API.
|
|
5270
5264
|
*
|
|
@@ -5281,20 +5275,20 @@ declare const PAY_API_VERSION = "1";
|
|
|
5281
5275
|
* ```ts
|
|
5282
5276
|
* import {
|
|
5283
5277
|
* createPayApiClient,
|
|
5284
|
-
*
|
|
5285
|
-
*
|
|
5278
|
+
* AMOS_API_BASE_URL_SANDBOX,
|
|
5279
|
+
* AMOS_API_VERSION,
|
|
5286
5280
|
* } from "@amos.com/node";
|
|
5287
5281
|
*
|
|
5288
5282
|
* const pay = createPayApiClient({
|
|
5289
|
-
* baseUrl:
|
|
5283
|
+
* baseUrl: AMOS_API_BASE_URL_SANDBOX,
|
|
5290
5284
|
* headers: {
|
|
5291
5285
|
* "X-Api-Key": process.env.AMOS_API_KEY!,
|
|
5292
|
-
* "X-Api-Version":
|
|
5286
|
+
* "X-Api-Version": AMOS_API_VERSION,
|
|
5293
5287
|
* },
|
|
5294
5288
|
* });
|
|
5295
5289
|
*
|
|
5296
5290
|
* const { data, error } = await pay.POST("/customers", {
|
|
5297
|
-
* params: { header: { "X-Api-Version":
|
|
5291
|
+
* params: { header: { "X-Api-Version": AMOS_API_VERSION } },
|
|
5298
5292
|
* body: { customer: { email: "alex@example.com" } },
|
|
5299
5293
|
* });
|
|
5300
5294
|
* ```
|
|
@@ -5303,4 +5297,4 @@ declare function createPayApiClient(options: ClientOptions): openapi_fetch.Clien
|
|
|
5303
5297
|
/** A configured Amos Pay API client returned by {@link createPayApiClient}. */
|
|
5304
5298
|
type PayApiClient = ReturnType<typeof createPayApiClient>;
|
|
5305
5299
|
|
|
5306
|
-
export { type $defs,
|
|
5300
|
+
export { type $defs, AMOS_API_BASE_URL_PRODUCTION, AMOS_API_BASE_URL_SANDBOX, AMOS_API_VERSION, type PayApiClient, achVerificationTypeValues, allowedApplePayPaymentMethodInputTypeValues, allowedApplePayPaymentMethodTypeValues, allowedBankAccountPaymentMethodInputTypeValues, allowedBankAccountPaymentMethodTypeValues, allowedCardPaymentMethodInputTypeValues, allowedCardPaymentMethodTypeValues, allowedGooglePayPaymentMethodInputTypeValues, allowedGooglePayPaymentMethodTypeValues, bankAccountProfileFailure_reasonValues, cardProfileFailure_reasonValues, chargeAllowed_reverse_actionValues, chargeStateValues, type components, createPayApiClient, embedConfirmApplePayPaymentMethodInputTypeValues, embedConfirmBankAccountPaymentMethodInputTypeValues, embedConfirmCardPaymentMethodInputTypeValues, embedConfirmGooglePayPaymentMethodInputTypeValues, externalAccountTypeValues, internationalBillingAddressOptionsModeValues, legalEntityDocumentTypeValues, legalEntityEntityTypeValues, legalEntityOwnershipTypeValues, merchantBusinessCategoryTypeValues, type operations, type paths, pathsEmbedPayment_intentsIdGetParametersQueryPayment_method_typeValues, paymentIntentCaptureMethodTypeValues, paymentIntentStateValues, paymentLinkAmountTypeValues, paymentMethodTypeValues, payoutDirectionTypeValues, payoutStateTypeValues, processorTransactionPayment_transaction_typeValues, processorTransactionTransaction_typeValues, refundAllowed_reverse_actionValues, refundStateTypeValues, setupIntentStateValues, subscriptionIntervalTypeValues, subscriptionPlanTypeValues, subscriptionStateValues, transactionSourceTypeValues, usOnlyBillingAddressOptionsModeValues, usStateTypeValues, walletProviderTypeValues, webhookEventTypeValues, type webhooks };
|
package/dist/index.js
CHANGED
|
@@ -30,9 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
AMOS_API_BASE_URL_PRODUCTION: () => AMOS_API_BASE_URL_PRODUCTION,
|
|
34
|
+
AMOS_API_BASE_URL_SANDBOX: () => AMOS_API_BASE_URL_SANDBOX,
|
|
35
|
+
AMOS_API_VERSION: () => AMOS_API_VERSION,
|
|
36
36
|
achVerificationTypeValues: () => achVerificationTypeValues,
|
|
37
37
|
allowedApplePayPaymentMethodInputTypeValues: () => allowedApplePayPaymentMethodInputTypeValues,
|
|
38
38
|
allowedApplePayPaymentMethodTypeValues: () => allowedApplePayPaymentMethodTypeValues,
|
|
@@ -127,17 +127,17 @@ var setupIntentStateValues = ["requires_payment_method", "requires_confirmation"
|
|
|
127
127
|
var subscriptionStateValues = ["active", "paused", "past_due", "cancelled"];
|
|
128
128
|
|
|
129
129
|
// src/index.ts
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
var
|
|
130
|
+
var AMOS_API_BASE_URL_PRODUCTION = "https://api.amos.com";
|
|
131
|
+
var AMOS_API_BASE_URL_SANDBOX = "https://api-sandbox.amos.com";
|
|
132
|
+
var AMOS_API_VERSION = "1";
|
|
133
133
|
function createPayApiClient(options) {
|
|
134
134
|
return (0, import_openapi_fetch.default)(options);
|
|
135
135
|
}
|
|
136
136
|
// Annotate the CommonJS export names for ESM import in node:
|
|
137
137
|
0 && (module.exports = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
AMOS_API_BASE_URL_PRODUCTION,
|
|
139
|
+
AMOS_API_BASE_URL_SANDBOX,
|
|
140
|
+
AMOS_API_VERSION,
|
|
141
141
|
achVerificationTypeValues,
|
|
142
142
|
allowedApplePayPaymentMethodInputTypeValues,
|
|
143
143
|
allowedApplePayPaymentMethodTypeValues,
|