@moonpay/platform-protocol 0.3.0 → 1.0.2
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 +45 -0
- package/dist/{index.cjs → api/errors.cjs} +7 -51
- package/dist/api/errors.cjs.map +1 -0
- package/dist/api/errors.d.cts +46 -0
- package/dist/api/errors.d.ts +46 -0
- package/dist/api/errors.js +27 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/identity.cjs +19 -0
- package/dist/api/identity.cjs.map +1 -0
- package/dist/api/identity.d.cts +156 -0
- package/dist/api/identity.d.ts +156 -0
- package/dist/api/identity.js +1 -0
- package/dist/api/identity.js.map +1 -0
- package/dist/api/index.cjs +19 -0
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +466 -0
- package/dist/api/index.d.ts +466 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -0
- package/dist/frames/add-card.cjs +19 -0
- package/dist/frames/add-card.cjs.map +1 -0
- package/dist/frames/add-card.d.cts +24 -0
- package/dist/frames/add-card.d.ts +24 -0
- package/dist/frames/add-card.js +1 -0
- package/dist/frames/add-card.js.map +1 -0
- package/dist/frames/apple-pay.cjs +19 -0
- package/dist/frames/apple-pay.cjs.map +1 -0
- package/dist/frames/apple-pay.d.cts +22 -0
- package/dist/frames/apple-pay.d.ts +22 -0
- package/dist/frames/apple-pay.js +1 -0
- package/dist/frames/apple-pay.js.map +1 -0
- package/dist/frames/auth.cjs +19 -0
- package/dist/frames/auth.cjs.map +1 -0
- package/dist/frames/auth.d.cts +15 -0
- package/dist/frames/auth.d.ts +15 -0
- package/dist/frames/auth.js +1 -0
- package/dist/frames/auth.js.map +1 -0
- package/dist/frames/buy-button.cjs +19 -0
- package/dist/frames/buy-button.cjs.map +1 -0
- package/dist/frames/buy-button.d.cts +21 -0
- package/dist/frames/buy-button.d.ts +21 -0
- package/dist/frames/buy-button.js +1 -0
- package/dist/frames/buy-button.js.map +1 -0
- package/dist/frames/buy.cjs +19 -0
- package/dist/frames/buy.cjs.map +1 -0
- package/dist/frames/buy.d.cts +22 -0
- package/dist/frames/buy.d.ts +22 -0
- package/dist/frames/buy.js +1 -0
- package/dist/frames/buy.js.map +1 -0
- package/dist/frames/challenge.cjs +19 -0
- package/dist/frames/challenge.cjs.map +1 -0
- package/dist/frames/challenge.d.cts +30 -0
- package/dist/frames/challenge.d.ts +30 -0
- package/dist/frames/challenge.js +1 -0
- package/dist/frames/challenge.js.map +1 -0
- package/dist/frames/connect.cjs +19 -0
- package/dist/frames/connect.cjs.map +1 -0
- package/dist/frames/connect.d.cts +9 -0
- package/dist/frames/connect.d.ts +9 -0
- package/dist/frames/connect.js +1 -0
- package/dist/frames/connect.js.map +1 -0
- package/dist/frames/google-pay.cjs +19 -0
- package/dist/frames/google-pay.cjs.map +1 -0
- package/dist/frames/google-pay.d.cts +22 -0
- package/dist/frames/google-pay.d.ts +22 -0
- package/dist/frames/google-pay.js +1 -0
- package/dist/frames/google-pay.js.map +1 -0
- package/dist/frames/reset.cjs +19 -0
- package/dist/frames/reset.cjs.map +1 -0
- package/dist/frames/reset.d.cts +12 -0
- package/dist/frames/reset.d.ts +12 -0
- package/dist/frames/reset.js +1 -0
- package/dist/frames/reset.js.map +1 -0
- package/dist/frames/widget.cjs +19 -0
- package/dist/frames/widget.cjs.map +1 -0
- package/dist/frames/widget.d.cts +19 -0
- package/dist/frames/widget.d.ts +19 -0
- package/dist/frames/widget.js +1 -0
- package/dist/frames/widget.js.map +1 -0
- package/dist/models/challenge.cjs +19 -0
- package/dist/models/challenge.cjs.map +1 -0
- package/dist/models/challenge.d.cts +12 -0
- package/dist/models/challenge.d.ts +12 -0
- package/dist/models/challenge.js +1 -0
- package/dist/models/challenge.js.map +1 -0
- package/dist/models/connection.cjs +46 -0
- package/dist/models/connection.cjs.map +1 -0
- package/dist/models/connection.d.cts +154 -0
- package/dist/models/connection.d.ts +154 -0
- package/dist/models/connection.js +20 -0
- package/dist/models/connection.js.map +1 -0
- package/dist/models/transaction.cjs +19 -0
- package/dist/models/transaction.cjs.map +1 -0
- package/dist/models/transaction.d.cts +15 -0
- package/dist/models/transaction.d.ts +15 -0
- package/dist/models/transaction.js +1 -0
- package/dist/models/transaction.js.map +1 -0
- package/dist/protocol.cjs +34 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +30 -0
- package/dist/protocol.d.ts +30 -0
- package/dist/protocol.js +8 -0
- package/dist/protocol.js.map +1 -0
- package/dist/result.cjs +40 -0
- package/dist/result.cjs.map +1 -0
- package/dist/result.d.cts +30 -0
- package/dist/result.d.ts +30 -0
- package/dist/result.js +14 -0
- package/dist/result.js.map +1 -0
- package/dist/sdks/add-card.cjs +19 -0
- package/dist/sdks/add-card.cjs.map +1 -0
- package/dist/sdks/add-card.d.cts +20 -0
- package/dist/sdks/add-card.d.ts +20 -0
- package/dist/sdks/add-card.js +1 -0
- package/dist/sdks/add-card.js.map +1 -0
- package/dist/sdks/apple-pay.cjs +19 -0
- package/dist/sdks/apple-pay.cjs.map +1 -0
- package/dist/sdks/apple-pay.d.cts +36 -0
- package/dist/sdks/apple-pay.d.ts +36 -0
- package/dist/sdks/apple-pay.js +1 -0
- package/dist/sdks/apple-pay.js.map +1 -0
- package/dist/sdks/auth.cjs +19 -0
- package/dist/sdks/auth.cjs.map +1 -0
- package/dist/sdks/auth.d.cts +18 -0
- package/dist/sdks/auth.d.ts +18 -0
- package/dist/sdks/auth.js +1 -0
- package/dist/sdks/auth.js.map +1 -0
- package/dist/sdks/buy-button.cjs +19 -0
- package/dist/sdks/buy-button.cjs.map +1 -0
- package/dist/sdks/buy-button.d.cts +21 -0
- package/dist/sdks/buy-button.d.ts +21 -0
- package/dist/sdks/buy-button.js +1 -0
- package/dist/sdks/buy-button.js.map +1 -0
- package/dist/sdks/buy.cjs +19 -0
- package/dist/sdks/buy.cjs.map +1 -0
- package/dist/sdks/buy.d.cts +23 -0
- package/dist/sdks/buy.d.ts +23 -0
- package/dist/sdks/buy.js +1 -0
- package/dist/sdks/buy.js.map +1 -0
- package/dist/sdks/challenge.cjs +19 -0
- package/dist/sdks/challenge.cjs.map +1 -0
- package/dist/sdks/challenge.d.cts +22 -0
- package/dist/sdks/challenge.d.ts +22 -0
- package/dist/sdks/challenge.js +1 -0
- package/dist/sdks/challenge.js.map +1 -0
- package/dist/sdks/connect.cjs +19 -0
- package/dist/sdks/connect.cjs.map +1 -0
- package/dist/sdks/connect.d.cts +20 -0
- package/dist/sdks/connect.d.ts +20 -0
- package/dist/sdks/connect.js +1 -0
- package/dist/sdks/connect.js.map +1 -0
- package/dist/sdks/google-pay.cjs +19 -0
- package/dist/sdks/google-pay.cjs.map +1 -0
- package/dist/sdks/google-pay.d.cts +36 -0
- package/dist/sdks/google-pay.d.ts +36 -0
- package/dist/sdks/google-pay.js +1 -0
- package/dist/sdks/google-pay.js.map +1 -0
- package/dist/sdks/reset.cjs +19 -0
- package/dist/sdks/reset.cjs.map +1 -0
- package/dist/sdks/reset.d.cts +5 -0
- package/dist/sdks/reset.d.ts +5 -0
- package/dist/sdks/reset.js +1 -0
- package/dist/sdks/reset.js.map +1 -0
- package/dist/sdks/widget.cjs +19 -0
- package/dist/sdks/widget.cjs.map +1 -0
- package/dist/sdks/widget.d.cts +26 -0
- package/dist/sdks/widget.d.ts +26 -0
- package/dist/sdks/widget.js +1 -0
- package/dist/sdks/widget.js.map +1 -0
- package/package.json +278 -11
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1289
- package/dist/index.d.ts +0 -1289
- package/dist/index.js +0 -63
- package/dist/index.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @moonpay/platform-protocol
|
|
2
|
+
|
|
3
|
+
Shared protocol and API types for the [MoonPay Developer Platform](https://dev.moonpay.com) SDKs. This package is the single source of truth for the contract between MoonPay frames and partner integrations: wire protocol primitives, per-frame message maps, domain models, REST API types, and the `Result` type all SDK methods return.
|
|
4
|
+
|
|
5
|
+
It contains types only, plus the tiny `ok()` / `err()` helpers for constructing `Result` values — there is no other runtime code.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
This package ships as a dependency of the platform SDKs (`@moonpay/platform-sdk-web`, `@moonpay/platform-sdk-react-native`, `@moonpay/platform-sdk-node`), so most integrations don't install it directly. Install it standalone when you need the types on their own:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @moonpay/platform-protocol
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
There is no barrel export — import from subpaths:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { Result } from '@moonpay/platform-protocol/result';
|
|
21
|
+
import type { Quote, Transaction } from '@moonpay/platform-protocol/api';
|
|
22
|
+
import { ConnectionStatus } from '@moonpay/platform-protocol/models/connection';
|
|
23
|
+
import type { Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Subpath exports
|
|
27
|
+
|
|
28
|
+
| Subpath | Contents |
|
|
29
|
+
|---------|----------|
|
|
30
|
+
| `./protocol` | Wire format primitives: message envelope, handshake/ack, `FrameError` |
|
|
31
|
+
| `./result` | `Result<T, E>`, `EmptyResult<E>`, `ok()`, `err()` |
|
|
32
|
+
| `./frames/*` | Per-frame message maps (`widget`, `apple-pay`, `google-pay`, `buy`, `buy-button`, `connect`, `auth`, `add-card`, `challenge`, `reset`) |
|
|
33
|
+
| `./sdks/*` | SDK-facing event and setup error types per frame |
|
|
34
|
+
| `./models/*` | Cross-frame domain models (`connection`, `transaction`, `challenge`) |
|
|
35
|
+
| `./api` | REST API types (quotes, transactions, payment methods) |
|
|
36
|
+
| `./api/identity` | Identity API types |
|
|
37
|
+
| `./api/errors` | API error types |
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
Full guides and API reference: [dev.moonpay.com](https://dev.moonpay.com)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
|
@@ -17,36 +17,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
24
|
-
ConnectionStatus: () => ConnectionStatus,
|
|
25
|
-
DevPlatformApiErrorCodes: () => DevPlatformApiErrorCodes,
|
|
26
|
-
HANDSHAKE_ACK_KIND: () => HANDSHAKE_ACK_KIND,
|
|
27
|
-
HANDSHAKE_REQUEST_KIND: () => HANDSHAKE_REQUEST_KIND,
|
|
28
|
-
err: () => err,
|
|
29
|
-
ok: () => ok
|
|
20
|
+
// src/api/errors.ts
|
|
21
|
+
var errors_exports = {};
|
|
22
|
+
__export(errors_exports, {
|
|
23
|
+
DevPlatformApiErrorCodes: () => DevPlatformApiErrorCodes
|
|
30
24
|
});
|
|
31
|
-
module.exports = __toCommonJS(
|
|
32
|
-
|
|
33
|
-
// src/connection.ts
|
|
34
|
-
var ConnectionStatus = /* @__PURE__ */ ((ConnectionStatus2) => {
|
|
35
|
-
ConnectionStatus2["connectionRequired"] = "connectionRequired";
|
|
36
|
-
ConnectionStatus2["active"] = "active";
|
|
37
|
-
ConnectionStatus2["unavailable"] = "unavailable";
|
|
38
|
-
ConnectionStatus2["pending"] = "pending";
|
|
39
|
-
ConnectionStatus2["failed"] = "failed";
|
|
40
|
-
ConnectionStatus2["termsAcceptanceRequired"] = "termsAcceptanceRequired";
|
|
41
|
-
return ConnectionStatus2;
|
|
42
|
-
})(ConnectionStatus || {});
|
|
43
|
-
|
|
44
|
-
// src/errors.ts
|
|
45
|
-
var ConnectionErrorCode = /* @__PURE__ */ ((ConnectionErrorCode2) => {
|
|
46
|
-
ConnectionErrorCode2["validationError"] = "validationError";
|
|
47
|
-
ConnectionErrorCode2["connectionFailedGeneric"] = "generic";
|
|
48
|
-
return ConnectionErrorCode2;
|
|
49
|
-
})(ConnectionErrorCode || {});
|
|
25
|
+
module.exports = __toCommonJS(errors_exports);
|
|
50
26
|
var DevPlatformApiErrorCodes = {
|
|
51
27
|
unknownError: "unknown_error",
|
|
52
28
|
unauthorized: "unauthorized",
|
|
@@ -69,28 +45,8 @@ var DevPlatformApiErrorCodes = {
|
|
|
69
45
|
countryMismatch: "country_mismatch",
|
|
70
46
|
unsupportedCountry: "unsupported_country"
|
|
71
47
|
};
|
|
72
|
-
|
|
73
|
-
// src/message.ts
|
|
74
|
-
var HANDSHAKE_REQUEST_KIND = "handshake";
|
|
75
|
-
var HANDSHAKE_ACK_KIND = "ack";
|
|
76
|
-
|
|
77
|
-
// src/result.ts
|
|
78
|
-
var ok = (value) => ({
|
|
79
|
-
ok: true,
|
|
80
|
-
value
|
|
81
|
-
});
|
|
82
|
-
var err = (error) => ({
|
|
83
|
-
ok: false,
|
|
84
|
-
error
|
|
85
|
-
});
|
|
86
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
49
|
0 && (module.exports = {
|
|
88
|
-
|
|
89
|
-
ConnectionStatus,
|
|
90
|
-
DevPlatformApiErrorCodes,
|
|
91
|
-
HANDSHAKE_ACK_KIND,
|
|
92
|
-
HANDSHAKE_REQUEST_KIND,
|
|
93
|
-
err,
|
|
94
|
-
ok
|
|
50
|
+
DevPlatformApiErrorCodes
|
|
95
51
|
});
|
|
96
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=errors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/errors.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// API errors\n// ---------------------------------------------------------------------------\n\nexport const DevPlatformApiErrorCodes = {\n unknownError: 'unknown_error',\n unauthorized: 'unauthorized',\n forbidden: 'forbidden',\n notFound: 'not_found',\n invalidRequest: 'invalid_request',\n notImplemented: 'not_implemented',\n tooManyRequests: 'too_many_requests',\n notAllowed: 'not_allowed',\n conflict: 'conflict',\n unprocessableEntity: 'unprocessable_entity',\n sseTimeout: 'sse_timeout',\n sseError: 'sse_error',\n connectionRequired: 'connection_required',\n connectionPending: 'connection_pending',\n connectionUnavailable: 'connection_unavailable',\n serviceUnavailable: 'service_unavailable',\n requirementsIncomplete: 'requirements_incomplete',\n verificationRejected: 'verification_rejected',\n countryMismatch: 'country_mismatch',\n unsupportedCountry: 'unsupported_country',\n} as const;\n\nexport type DevPlatformApiErrorCode =\n (typeof DevPlatformApiErrorCodes)[keyof typeof DevPlatformApiErrorCodes];\n\nexport interface DevPlatformApiErrorDetail {\n field?: string;\n message: string;\n}\n\n/** Shape returned by the MoonPay Platform API on error responses. */\nexport interface DevPlatformApiError {\n code: DevPlatformApiErrorCode;\n message: string;\n errors?: DevPlatformApiErrorDetail[];\n}\n\n// ---------------------------------------------------------------------------\n// API call result errors (all alias DevPlatformApiError)\n// ---------------------------------------------------------------------------\n\nexport type GetQuoteError = DevPlatformApiError;\nexport type GetPaymentMethodsError = DevPlatformApiError;\nexport type GetTransactionsError = DevPlatformApiError;\nexport type CreateSessionError = DevPlatformApiError;\nexport type RevokeSessionError = DevPlatformApiError;\nexport type CreateIdentityError = DevPlatformApiError;\nexport type GetIdentityError = DevPlatformApiError;\nexport type UpdateIdentityError = DevPlatformApiError;\nexport type VerifyIdentityError = DevPlatformApiError;\nexport type GetIdentityUploadUrlError = DevPlatformApiError;\nexport type SubmitIdentityFilesError = DevPlatformApiError;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,2BAA2B;AAAA,EACtC,cAAc;AAAA,EACd,cAAc;AAAA,EACd,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,oBAAoB;AACtB;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare const DevPlatformApiErrorCodes: {
|
|
2
|
+
readonly unknownError: "unknown_error";
|
|
3
|
+
readonly unauthorized: "unauthorized";
|
|
4
|
+
readonly forbidden: "forbidden";
|
|
5
|
+
readonly notFound: "not_found";
|
|
6
|
+
readonly invalidRequest: "invalid_request";
|
|
7
|
+
readonly notImplemented: "not_implemented";
|
|
8
|
+
readonly tooManyRequests: "too_many_requests";
|
|
9
|
+
readonly notAllowed: "not_allowed";
|
|
10
|
+
readonly conflict: "conflict";
|
|
11
|
+
readonly unprocessableEntity: "unprocessable_entity";
|
|
12
|
+
readonly sseTimeout: "sse_timeout";
|
|
13
|
+
readonly sseError: "sse_error";
|
|
14
|
+
readonly connectionRequired: "connection_required";
|
|
15
|
+
readonly connectionPending: "connection_pending";
|
|
16
|
+
readonly connectionUnavailable: "connection_unavailable";
|
|
17
|
+
readonly serviceUnavailable: "service_unavailable";
|
|
18
|
+
readonly requirementsIncomplete: "requirements_incomplete";
|
|
19
|
+
readonly verificationRejected: "verification_rejected";
|
|
20
|
+
readonly countryMismatch: "country_mismatch";
|
|
21
|
+
readonly unsupportedCountry: "unsupported_country";
|
|
22
|
+
};
|
|
23
|
+
type DevPlatformApiErrorCode = (typeof DevPlatformApiErrorCodes)[keyof typeof DevPlatformApiErrorCodes];
|
|
24
|
+
interface DevPlatformApiErrorDetail {
|
|
25
|
+
field?: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
/** Shape returned by the MoonPay Platform API on error responses. */
|
|
29
|
+
interface DevPlatformApiError {
|
|
30
|
+
code: DevPlatformApiErrorCode;
|
|
31
|
+
message: string;
|
|
32
|
+
errors?: DevPlatformApiErrorDetail[];
|
|
33
|
+
}
|
|
34
|
+
type GetQuoteError = DevPlatformApiError;
|
|
35
|
+
type GetPaymentMethodsError = DevPlatformApiError;
|
|
36
|
+
type GetTransactionsError = DevPlatformApiError;
|
|
37
|
+
type CreateSessionError = DevPlatformApiError;
|
|
38
|
+
type RevokeSessionError = DevPlatformApiError;
|
|
39
|
+
type CreateIdentityError = DevPlatformApiError;
|
|
40
|
+
type GetIdentityError = DevPlatformApiError;
|
|
41
|
+
type UpdateIdentityError = DevPlatformApiError;
|
|
42
|
+
type VerifyIdentityError = DevPlatformApiError;
|
|
43
|
+
type GetIdentityUploadUrlError = DevPlatformApiError;
|
|
44
|
+
type SubmitIdentityFilesError = DevPlatformApiError;
|
|
45
|
+
|
|
46
|
+
export { type CreateIdentityError, type CreateSessionError, type DevPlatformApiError, type DevPlatformApiErrorCode, DevPlatformApiErrorCodes, type DevPlatformApiErrorDetail, type GetIdentityError, type GetIdentityUploadUrlError, type GetPaymentMethodsError, type GetQuoteError, type GetTransactionsError, type RevokeSessionError, type SubmitIdentityFilesError, type UpdateIdentityError, type VerifyIdentityError };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare const DevPlatformApiErrorCodes: {
|
|
2
|
+
readonly unknownError: "unknown_error";
|
|
3
|
+
readonly unauthorized: "unauthorized";
|
|
4
|
+
readonly forbidden: "forbidden";
|
|
5
|
+
readonly notFound: "not_found";
|
|
6
|
+
readonly invalidRequest: "invalid_request";
|
|
7
|
+
readonly notImplemented: "not_implemented";
|
|
8
|
+
readonly tooManyRequests: "too_many_requests";
|
|
9
|
+
readonly notAllowed: "not_allowed";
|
|
10
|
+
readonly conflict: "conflict";
|
|
11
|
+
readonly unprocessableEntity: "unprocessable_entity";
|
|
12
|
+
readonly sseTimeout: "sse_timeout";
|
|
13
|
+
readonly sseError: "sse_error";
|
|
14
|
+
readonly connectionRequired: "connection_required";
|
|
15
|
+
readonly connectionPending: "connection_pending";
|
|
16
|
+
readonly connectionUnavailable: "connection_unavailable";
|
|
17
|
+
readonly serviceUnavailable: "service_unavailable";
|
|
18
|
+
readonly requirementsIncomplete: "requirements_incomplete";
|
|
19
|
+
readonly verificationRejected: "verification_rejected";
|
|
20
|
+
readonly countryMismatch: "country_mismatch";
|
|
21
|
+
readonly unsupportedCountry: "unsupported_country";
|
|
22
|
+
};
|
|
23
|
+
type DevPlatformApiErrorCode = (typeof DevPlatformApiErrorCodes)[keyof typeof DevPlatformApiErrorCodes];
|
|
24
|
+
interface DevPlatformApiErrorDetail {
|
|
25
|
+
field?: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
/** Shape returned by the MoonPay Platform API on error responses. */
|
|
29
|
+
interface DevPlatformApiError {
|
|
30
|
+
code: DevPlatformApiErrorCode;
|
|
31
|
+
message: string;
|
|
32
|
+
errors?: DevPlatformApiErrorDetail[];
|
|
33
|
+
}
|
|
34
|
+
type GetQuoteError = DevPlatformApiError;
|
|
35
|
+
type GetPaymentMethodsError = DevPlatformApiError;
|
|
36
|
+
type GetTransactionsError = DevPlatformApiError;
|
|
37
|
+
type CreateSessionError = DevPlatformApiError;
|
|
38
|
+
type RevokeSessionError = DevPlatformApiError;
|
|
39
|
+
type CreateIdentityError = DevPlatformApiError;
|
|
40
|
+
type GetIdentityError = DevPlatformApiError;
|
|
41
|
+
type UpdateIdentityError = DevPlatformApiError;
|
|
42
|
+
type VerifyIdentityError = DevPlatformApiError;
|
|
43
|
+
type GetIdentityUploadUrlError = DevPlatformApiError;
|
|
44
|
+
type SubmitIdentityFilesError = DevPlatformApiError;
|
|
45
|
+
|
|
46
|
+
export { type CreateIdentityError, type CreateSessionError, type DevPlatformApiError, type DevPlatformApiErrorCode, DevPlatformApiErrorCodes, type DevPlatformApiErrorDetail, type GetIdentityError, type GetIdentityUploadUrlError, type GetPaymentMethodsError, type GetQuoteError, type GetTransactionsError, type RevokeSessionError, type SubmitIdentityFilesError, type UpdateIdentityError, type VerifyIdentityError };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/api/errors.ts
|
|
2
|
+
var DevPlatformApiErrorCodes = {
|
|
3
|
+
unknownError: "unknown_error",
|
|
4
|
+
unauthorized: "unauthorized",
|
|
5
|
+
forbidden: "forbidden",
|
|
6
|
+
notFound: "not_found",
|
|
7
|
+
invalidRequest: "invalid_request",
|
|
8
|
+
notImplemented: "not_implemented",
|
|
9
|
+
tooManyRequests: "too_many_requests",
|
|
10
|
+
notAllowed: "not_allowed",
|
|
11
|
+
conflict: "conflict",
|
|
12
|
+
unprocessableEntity: "unprocessable_entity",
|
|
13
|
+
sseTimeout: "sse_timeout",
|
|
14
|
+
sseError: "sse_error",
|
|
15
|
+
connectionRequired: "connection_required",
|
|
16
|
+
connectionPending: "connection_pending",
|
|
17
|
+
connectionUnavailable: "connection_unavailable",
|
|
18
|
+
serviceUnavailable: "service_unavailable",
|
|
19
|
+
requirementsIncomplete: "requirements_incomplete",
|
|
20
|
+
verificationRejected: "verification_rejected",
|
|
21
|
+
countryMismatch: "country_mismatch",
|
|
22
|
+
unsupportedCountry: "unsupported_country"
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
DevPlatformApiErrorCodes
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/errors.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// API errors\n// ---------------------------------------------------------------------------\n\nexport const DevPlatformApiErrorCodes = {\n unknownError: 'unknown_error',\n unauthorized: 'unauthorized',\n forbidden: 'forbidden',\n notFound: 'not_found',\n invalidRequest: 'invalid_request',\n notImplemented: 'not_implemented',\n tooManyRequests: 'too_many_requests',\n notAllowed: 'not_allowed',\n conflict: 'conflict',\n unprocessableEntity: 'unprocessable_entity',\n sseTimeout: 'sse_timeout',\n sseError: 'sse_error',\n connectionRequired: 'connection_required',\n connectionPending: 'connection_pending',\n connectionUnavailable: 'connection_unavailable',\n serviceUnavailable: 'service_unavailable',\n requirementsIncomplete: 'requirements_incomplete',\n verificationRejected: 'verification_rejected',\n countryMismatch: 'country_mismatch',\n unsupportedCountry: 'unsupported_country',\n} as const;\n\nexport type DevPlatformApiErrorCode =\n (typeof DevPlatformApiErrorCodes)[keyof typeof DevPlatformApiErrorCodes];\n\nexport interface DevPlatformApiErrorDetail {\n field?: string;\n message: string;\n}\n\n/** Shape returned by the MoonPay Platform API on error responses. */\nexport interface DevPlatformApiError {\n code: DevPlatformApiErrorCode;\n message: string;\n errors?: DevPlatformApiErrorDetail[];\n}\n\n// ---------------------------------------------------------------------------\n// API call result errors (all alias DevPlatformApiError)\n// ---------------------------------------------------------------------------\n\nexport type GetQuoteError = DevPlatformApiError;\nexport type GetPaymentMethodsError = DevPlatformApiError;\nexport type GetTransactionsError = DevPlatformApiError;\nexport type CreateSessionError = DevPlatformApiError;\nexport type RevokeSessionError = DevPlatformApiError;\nexport type CreateIdentityError = DevPlatformApiError;\nexport type GetIdentityError = DevPlatformApiError;\nexport type UpdateIdentityError = DevPlatformApiError;\nexport type VerifyIdentityError = DevPlatformApiError;\nexport type GetIdentityUploadUrlError = DevPlatformApiError;\nexport type SubmitIdentityFilesError = DevPlatformApiError;\n"],"mappings":";AAIO,IAAM,2BAA2B;AAAA,EACtC,cAAc;AAAA,EACd,cAAc;AAAA,EACd,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,oBAAoB;AACtB;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/api/identity.ts
|
|
17
|
+
var identity_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(identity_exports);
|
|
19
|
+
//# sourceMappingURL=identity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/identity.ts"],"sourcesContent":["/**\n * Identity API types.\n *\n * Sourced from `moonpay-api/packages/dev-platform/modules/identity/main.tsp`.\n * The TypeSpec is marked `@vnext` and is not yet emitted into the public\n * OpenAPI spec, so these types are hand-rolled. Once the spec ships, replace\n * with aliases re-exported from `./gen/` (same pattern as `Quote`, `Identity`,\n * etc. in `api.ts`).\n */\n\n/** A platform capability a partner wants the customer to unlock. */\nexport type CapabilityProduct = 'ramps';\n\n/** A requested capability scoped to an identity. */\nexport interface IdentityCapability {\n product: CapabilityProduct;\n}\n\n/** The state of an identity across the KYC lifecycle. */\nexport type IdentityStatus =\n | 'created'\n | 'collecting'\n | 'verifying'\n | 'challengeRequired'\n | 'approved'\n | 'rejected'\n | 'manualReview'\n | 'blocked';\n\n/** The completion state of a requirement item. */\nexport type RequirementItemStatus = 'incomplete' | 'complete';\n\n/** A field a customer must provide to fulfil a requirement. */\nexport type RequirementFieldName =\n | 'firstName'\n | 'lastName'\n | 'dateOfBirth'\n | 'nationality'\n | 'street'\n | 'locality'\n | 'postalCode'\n | 'country'\n | 'administrativeArea'\n | 'ssn'\n | 'cpf'\n | 'tin';\n\n/** Status of a single requirement group on an identity. */\nexport interface RequirementEntry {\n status: RequirementItemStatus;\n requiredFields?: RequirementFieldName[];\n}\n\n/** Outstanding and completed requirements for the identity, keyed by category. */\nexport interface Requirements {\n basicDetails?: RequirementEntry;\n residentialAddress?: RequirementEntry;\n identityDocuments?: RequirementEntry;\n selfie?: RequirementEntry;\n taxIdentifiers?: RequirementEntry;\n proofOfAddress?: RequirementEntry;\n phoneNumber?: RequirementEntry;\n}\n\n/** Residential-address fields accepted at identity creation. */\nexport interface CreateIdentityResidentialAddress {\n /** ISO 3166-1 alpha-3 country code declared by the partner. */\n country: string;\n}\n\n/** Request body for creating an identity. */\nexport interface CreateIdentityRequestBody {\n residentialAddress: CreateIdentityResidentialAddress;\n /** Capabilities the partner wants the customer to unlock. Must contain at least one value. */\n capabilities: IdentityCapability[];\n}\n\n/** Customer's basic personal details. */\nexport interface IdentityBasicDetailsSubmission {\n firstName?: string;\n lastName?: string;\n nationality?: string;\n /** YYYY-MM-DD. */\n dateOfBirth?: string;\n}\n\n/** Customer's residential address. */\nexport interface IdentityResidentialAddressSubmission {\n country?: string;\n administrativeArea?: string;\n locality?: string;\n street?: string;\n subStreet?: string;\n postalCode?: string;\n}\n\n/** Customer's phone number in E.164 format. */\nexport interface IdentityPhoneNumberSubmission {\n number: string;\n}\n\n/** Type of tax identifier the customer is submitting. */\nexport type IdentityTaxIdentifierType = 'tin' | 'ssn' | 'cpf';\n\n/** Tax Identification Number — country must be supplied. */\nexport interface IdentityTaxIdentifierGenericSubmission {\n type: 'tin';\n country: string;\n value: string;\n}\n\n/** Country-specific tax identifier (SSN/CPF). */\nexport interface IdentityTaxIdentifierSchemeSubmission {\n type: 'ssn' | 'cpf';\n value: string;\n}\n\nexport type IdentityTaxIdentifierSubmission =\n | IdentityTaxIdentifierGenericSubmission\n | IdentityTaxIdentifierSchemeSubmission;\n\n/** Request body for updating an identity by submitting one or more requirements. */\nexport interface UpdateIdentityRequestBody {\n residentialAddress?: IdentityResidentialAddressSubmission;\n basicDetails?: IdentityBasicDetailsSubmission;\n phoneNumber?: IdentityPhoneNumberSubmission;\n taxIdentifiers?: IdentityTaxIdentifierSubmission[];\n}\n\n/** A MoonPay-hosted challenge a partner must surface to the customer. */\nexport interface IdentityVerificationChallenge {\n /** Fully-formed challenge URL. */\n url: string;\n /** ISO 8601 expiry. */\n expiresAt: string;\n}\n\n/** The state of an identity verification request. */\nexport type IdentityVerificationStatus = 'approved' | 'processing' | 'challengeRequired';\n\n/** Outcome of `POST /platform/v1/identities/{id}/verifications`. */\nexport type IdentityVerificationResponse =\n | { status: 'approved' }\n | { status: 'processing' }\n | { status: 'challengeRequired'; challenge: IdentityVerificationChallenge };\n\n/** Type of identity-related file the customer is uploading. */\nexport type IdentityFileType =\n | 'drivingLicence'\n | 'nationalIdentityCard'\n | 'passport'\n | 'residencePermit'\n | 'selfie'\n | 'proofOfAddress';\n\n/** Side of a two-sided identity document. */\nexport type IdentityFileSide = 'front' | 'back';\n\n/** MIME type of the file being uploaded. */\nexport type IdentityFileMimeType = 'image/jpeg' | 'image/png' | 'application/pdf';\n\n/** Request body for issuing a presigned upload URL. */\nexport interface IdentityFileUploadUrlRequestBody {\n fileType: IdentityFileType;\n /** Required for two-sided file types (`drivingLicence`, `nationalIdentityCard`, `residencePermit`); omit for single-sided. */\n side?: IdentityFileSide;\n /** Must match the `Content-Type` header used on the subsequent upload request. */\n mimeType: IdentityFileMimeType;\n}\n\n/** Headers the partner must send when uploading the file to the presigned URL. */\nexport interface IdentityFileUploadUrlHeaders {\n 'Content-Type': string;\n}\n\n/** Presigned URL the partner uses to upload an identity-related file. */\nexport interface IdentityFileUploadUrl {\n uploadId: string;\n url: string;\n /** ISO 8601 expiry. */\n expiresAt: string;\n headers: IdentityFileUploadUrlHeaders;\n}\n\n/** A single uploaded file the partner is confirming for submission. */\nexport interface IdentityFileSubmission {\n uploadId: string;\n fileType: IdentityFileType;\n side?: IdentityFileSide;\n}\n\n/** Request body for confirming one or more uploaded identity-related files. */\nexport interface SubmitIdentityFilesRequestBody {\n files: IdentityFileSubmission[];\n}\n\n/** A KYC identity. */\nexport interface Identity {\n id: string;\n status: IdentityStatus;\n capabilities: IdentityCapability[];\n requirements: Requirements;\n /** Present only when `status` is `challengeRequired`. */\n challenge?: IdentityVerificationChallenge;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity API types.
|
|
3
|
+
*
|
|
4
|
+
* Sourced from `moonpay-api/packages/dev-platform/modules/identity/main.tsp`.
|
|
5
|
+
* The TypeSpec is marked `@vnext` and is not yet emitted into the public
|
|
6
|
+
* OpenAPI spec, so these types are hand-rolled. Once the spec ships, replace
|
|
7
|
+
* with aliases re-exported from `./gen/` (same pattern as `Quote`, `Identity`,
|
|
8
|
+
* etc. in `api.ts`).
|
|
9
|
+
*/
|
|
10
|
+
/** A platform capability a partner wants the customer to unlock. */
|
|
11
|
+
type CapabilityProduct = 'ramps';
|
|
12
|
+
/** A requested capability scoped to an identity. */
|
|
13
|
+
interface IdentityCapability {
|
|
14
|
+
product: CapabilityProduct;
|
|
15
|
+
}
|
|
16
|
+
/** The state of an identity across the KYC lifecycle. */
|
|
17
|
+
type IdentityStatus = 'created' | 'collecting' | 'verifying' | 'challengeRequired' | 'approved' | 'rejected' | 'manualReview' | 'blocked';
|
|
18
|
+
/** The completion state of a requirement item. */
|
|
19
|
+
type RequirementItemStatus = 'incomplete' | 'complete';
|
|
20
|
+
/** A field a customer must provide to fulfil a requirement. */
|
|
21
|
+
type RequirementFieldName = 'firstName' | 'lastName' | 'dateOfBirth' | 'nationality' | 'street' | 'locality' | 'postalCode' | 'country' | 'administrativeArea' | 'ssn' | 'cpf' | 'tin';
|
|
22
|
+
/** Status of a single requirement group on an identity. */
|
|
23
|
+
interface RequirementEntry {
|
|
24
|
+
status: RequirementItemStatus;
|
|
25
|
+
requiredFields?: RequirementFieldName[];
|
|
26
|
+
}
|
|
27
|
+
/** Outstanding and completed requirements for the identity, keyed by category. */
|
|
28
|
+
interface Requirements {
|
|
29
|
+
basicDetails?: RequirementEntry;
|
|
30
|
+
residentialAddress?: RequirementEntry;
|
|
31
|
+
identityDocuments?: RequirementEntry;
|
|
32
|
+
selfie?: RequirementEntry;
|
|
33
|
+
taxIdentifiers?: RequirementEntry;
|
|
34
|
+
proofOfAddress?: RequirementEntry;
|
|
35
|
+
phoneNumber?: RequirementEntry;
|
|
36
|
+
}
|
|
37
|
+
/** Residential-address fields accepted at identity creation. */
|
|
38
|
+
interface CreateIdentityResidentialAddress {
|
|
39
|
+
/** ISO 3166-1 alpha-3 country code declared by the partner. */
|
|
40
|
+
country: string;
|
|
41
|
+
}
|
|
42
|
+
/** Request body for creating an identity. */
|
|
43
|
+
interface CreateIdentityRequestBody {
|
|
44
|
+
residentialAddress: CreateIdentityResidentialAddress;
|
|
45
|
+
/** Capabilities the partner wants the customer to unlock. Must contain at least one value. */
|
|
46
|
+
capabilities: IdentityCapability[];
|
|
47
|
+
}
|
|
48
|
+
/** Customer's basic personal details. */
|
|
49
|
+
interface IdentityBasicDetailsSubmission {
|
|
50
|
+
firstName?: string;
|
|
51
|
+
lastName?: string;
|
|
52
|
+
nationality?: string;
|
|
53
|
+
/** YYYY-MM-DD. */
|
|
54
|
+
dateOfBirth?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Customer's residential address. */
|
|
57
|
+
interface IdentityResidentialAddressSubmission {
|
|
58
|
+
country?: string;
|
|
59
|
+
administrativeArea?: string;
|
|
60
|
+
locality?: string;
|
|
61
|
+
street?: string;
|
|
62
|
+
subStreet?: string;
|
|
63
|
+
postalCode?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Customer's phone number in E.164 format. */
|
|
66
|
+
interface IdentityPhoneNumberSubmission {
|
|
67
|
+
number: string;
|
|
68
|
+
}
|
|
69
|
+
/** Type of tax identifier the customer is submitting. */
|
|
70
|
+
type IdentityTaxIdentifierType = 'tin' | 'ssn' | 'cpf';
|
|
71
|
+
/** Tax Identification Number — country must be supplied. */
|
|
72
|
+
interface IdentityTaxIdentifierGenericSubmission {
|
|
73
|
+
type: 'tin';
|
|
74
|
+
country: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}
|
|
77
|
+
/** Country-specific tax identifier (SSN/CPF). */
|
|
78
|
+
interface IdentityTaxIdentifierSchemeSubmission {
|
|
79
|
+
type: 'ssn' | 'cpf';
|
|
80
|
+
value: string;
|
|
81
|
+
}
|
|
82
|
+
type IdentityTaxIdentifierSubmission = IdentityTaxIdentifierGenericSubmission | IdentityTaxIdentifierSchemeSubmission;
|
|
83
|
+
/** Request body for updating an identity by submitting one or more requirements. */
|
|
84
|
+
interface UpdateIdentityRequestBody {
|
|
85
|
+
residentialAddress?: IdentityResidentialAddressSubmission;
|
|
86
|
+
basicDetails?: IdentityBasicDetailsSubmission;
|
|
87
|
+
phoneNumber?: IdentityPhoneNumberSubmission;
|
|
88
|
+
taxIdentifiers?: IdentityTaxIdentifierSubmission[];
|
|
89
|
+
}
|
|
90
|
+
/** A MoonPay-hosted challenge a partner must surface to the customer. */
|
|
91
|
+
interface IdentityVerificationChallenge {
|
|
92
|
+
/** Fully-formed challenge URL. */
|
|
93
|
+
url: string;
|
|
94
|
+
/** ISO 8601 expiry. */
|
|
95
|
+
expiresAt: string;
|
|
96
|
+
}
|
|
97
|
+
/** The state of an identity verification request. */
|
|
98
|
+
type IdentityVerificationStatus = 'approved' | 'processing' | 'challengeRequired';
|
|
99
|
+
/** Outcome of `POST /platform/v1/identities/{id}/verifications`. */
|
|
100
|
+
type IdentityVerificationResponse = {
|
|
101
|
+
status: 'approved';
|
|
102
|
+
} | {
|
|
103
|
+
status: 'processing';
|
|
104
|
+
} | {
|
|
105
|
+
status: 'challengeRequired';
|
|
106
|
+
challenge: IdentityVerificationChallenge;
|
|
107
|
+
};
|
|
108
|
+
/** Type of identity-related file the customer is uploading. */
|
|
109
|
+
type IdentityFileType = 'drivingLicence' | 'nationalIdentityCard' | 'passport' | 'residencePermit' | 'selfie' | 'proofOfAddress';
|
|
110
|
+
/** Side of a two-sided identity document. */
|
|
111
|
+
type IdentityFileSide = 'front' | 'back';
|
|
112
|
+
/** MIME type of the file being uploaded. */
|
|
113
|
+
type IdentityFileMimeType = 'image/jpeg' | 'image/png' | 'application/pdf';
|
|
114
|
+
/** Request body for issuing a presigned upload URL. */
|
|
115
|
+
interface IdentityFileUploadUrlRequestBody {
|
|
116
|
+
fileType: IdentityFileType;
|
|
117
|
+
/** Required for two-sided file types (`drivingLicence`, `nationalIdentityCard`, `residencePermit`); omit for single-sided. */
|
|
118
|
+
side?: IdentityFileSide;
|
|
119
|
+
/** Must match the `Content-Type` header used on the subsequent upload request. */
|
|
120
|
+
mimeType: IdentityFileMimeType;
|
|
121
|
+
}
|
|
122
|
+
/** Headers the partner must send when uploading the file to the presigned URL. */
|
|
123
|
+
interface IdentityFileUploadUrlHeaders {
|
|
124
|
+
'Content-Type': string;
|
|
125
|
+
}
|
|
126
|
+
/** Presigned URL the partner uses to upload an identity-related file. */
|
|
127
|
+
interface IdentityFileUploadUrl {
|
|
128
|
+
uploadId: string;
|
|
129
|
+
url: string;
|
|
130
|
+
/** ISO 8601 expiry. */
|
|
131
|
+
expiresAt: string;
|
|
132
|
+
headers: IdentityFileUploadUrlHeaders;
|
|
133
|
+
}
|
|
134
|
+
/** A single uploaded file the partner is confirming for submission. */
|
|
135
|
+
interface IdentityFileSubmission {
|
|
136
|
+
uploadId: string;
|
|
137
|
+
fileType: IdentityFileType;
|
|
138
|
+
side?: IdentityFileSide;
|
|
139
|
+
}
|
|
140
|
+
/** Request body for confirming one or more uploaded identity-related files. */
|
|
141
|
+
interface SubmitIdentityFilesRequestBody {
|
|
142
|
+
files: IdentityFileSubmission[];
|
|
143
|
+
}
|
|
144
|
+
/** A KYC identity. */
|
|
145
|
+
interface Identity {
|
|
146
|
+
id: string;
|
|
147
|
+
status: IdentityStatus;
|
|
148
|
+
capabilities: IdentityCapability[];
|
|
149
|
+
requirements: Requirements;
|
|
150
|
+
/** Present only when `status` is `challengeRequired`. */
|
|
151
|
+
challenge?: IdentityVerificationChallenge;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export type { CapabilityProduct, CreateIdentityRequestBody, CreateIdentityResidentialAddress, Identity, IdentityBasicDetailsSubmission, IdentityCapability, IdentityFileMimeType, IdentityFileSide, IdentityFileSubmission, IdentityFileType, IdentityFileUploadUrl, IdentityFileUploadUrlHeaders, IdentityFileUploadUrlRequestBody, IdentityPhoneNumberSubmission, IdentityResidentialAddressSubmission, IdentityStatus, IdentityTaxIdentifierGenericSubmission, IdentityTaxIdentifierSchemeSubmission, IdentityTaxIdentifierSubmission, IdentityTaxIdentifierType, IdentityVerificationChallenge, IdentityVerificationResponse, IdentityVerificationStatus, RequirementEntry, RequirementFieldName, RequirementItemStatus, Requirements, SubmitIdentityFilesRequestBody, UpdateIdentityRequestBody };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity API types.
|
|
3
|
+
*
|
|
4
|
+
* Sourced from `moonpay-api/packages/dev-platform/modules/identity/main.tsp`.
|
|
5
|
+
* The TypeSpec is marked `@vnext` and is not yet emitted into the public
|
|
6
|
+
* OpenAPI spec, so these types are hand-rolled. Once the spec ships, replace
|
|
7
|
+
* with aliases re-exported from `./gen/` (same pattern as `Quote`, `Identity`,
|
|
8
|
+
* etc. in `api.ts`).
|
|
9
|
+
*/
|
|
10
|
+
/** A platform capability a partner wants the customer to unlock. */
|
|
11
|
+
type CapabilityProduct = 'ramps';
|
|
12
|
+
/** A requested capability scoped to an identity. */
|
|
13
|
+
interface IdentityCapability {
|
|
14
|
+
product: CapabilityProduct;
|
|
15
|
+
}
|
|
16
|
+
/** The state of an identity across the KYC lifecycle. */
|
|
17
|
+
type IdentityStatus = 'created' | 'collecting' | 'verifying' | 'challengeRequired' | 'approved' | 'rejected' | 'manualReview' | 'blocked';
|
|
18
|
+
/** The completion state of a requirement item. */
|
|
19
|
+
type RequirementItemStatus = 'incomplete' | 'complete';
|
|
20
|
+
/** A field a customer must provide to fulfil a requirement. */
|
|
21
|
+
type RequirementFieldName = 'firstName' | 'lastName' | 'dateOfBirth' | 'nationality' | 'street' | 'locality' | 'postalCode' | 'country' | 'administrativeArea' | 'ssn' | 'cpf' | 'tin';
|
|
22
|
+
/** Status of a single requirement group on an identity. */
|
|
23
|
+
interface RequirementEntry {
|
|
24
|
+
status: RequirementItemStatus;
|
|
25
|
+
requiredFields?: RequirementFieldName[];
|
|
26
|
+
}
|
|
27
|
+
/** Outstanding and completed requirements for the identity, keyed by category. */
|
|
28
|
+
interface Requirements {
|
|
29
|
+
basicDetails?: RequirementEntry;
|
|
30
|
+
residentialAddress?: RequirementEntry;
|
|
31
|
+
identityDocuments?: RequirementEntry;
|
|
32
|
+
selfie?: RequirementEntry;
|
|
33
|
+
taxIdentifiers?: RequirementEntry;
|
|
34
|
+
proofOfAddress?: RequirementEntry;
|
|
35
|
+
phoneNumber?: RequirementEntry;
|
|
36
|
+
}
|
|
37
|
+
/** Residential-address fields accepted at identity creation. */
|
|
38
|
+
interface CreateIdentityResidentialAddress {
|
|
39
|
+
/** ISO 3166-1 alpha-3 country code declared by the partner. */
|
|
40
|
+
country: string;
|
|
41
|
+
}
|
|
42
|
+
/** Request body for creating an identity. */
|
|
43
|
+
interface CreateIdentityRequestBody {
|
|
44
|
+
residentialAddress: CreateIdentityResidentialAddress;
|
|
45
|
+
/** Capabilities the partner wants the customer to unlock. Must contain at least one value. */
|
|
46
|
+
capabilities: IdentityCapability[];
|
|
47
|
+
}
|
|
48
|
+
/** Customer's basic personal details. */
|
|
49
|
+
interface IdentityBasicDetailsSubmission {
|
|
50
|
+
firstName?: string;
|
|
51
|
+
lastName?: string;
|
|
52
|
+
nationality?: string;
|
|
53
|
+
/** YYYY-MM-DD. */
|
|
54
|
+
dateOfBirth?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Customer's residential address. */
|
|
57
|
+
interface IdentityResidentialAddressSubmission {
|
|
58
|
+
country?: string;
|
|
59
|
+
administrativeArea?: string;
|
|
60
|
+
locality?: string;
|
|
61
|
+
street?: string;
|
|
62
|
+
subStreet?: string;
|
|
63
|
+
postalCode?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Customer's phone number in E.164 format. */
|
|
66
|
+
interface IdentityPhoneNumberSubmission {
|
|
67
|
+
number: string;
|
|
68
|
+
}
|
|
69
|
+
/** Type of tax identifier the customer is submitting. */
|
|
70
|
+
type IdentityTaxIdentifierType = 'tin' | 'ssn' | 'cpf';
|
|
71
|
+
/** Tax Identification Number — country must be supplied. */
|
|
72
|
+
interface IdentityTaxIdentifierGenericSubmission {
|
|
73
|
+
type: 'tin';
|
|
74
|
+
country: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}
|
|
77
|
+
/** Country-specific tax identifier (SSN/CPF). */
|
|
78
|
+
interface IdentityTaxIdentifierSchemeSubmission {
|
|
79
|
+
type: 'ssn' | 'cpf';
|
|
80
|
+
value: string;
|
|
81
|
+
}
|
|
82
|
+
type IdentityTaxIdentifierSubmission = IdentityTaxIdentifierGenericSubmission | IdentityTaxIdentifierSchemeSubmission;
|
|
83
|
+
/** Request body for updating an identity by submitting one or more requirements. */
|
|
84
|
+
interface UpdateIdentityRequestBody {
|
|
85
|
+
residentialAddress?: IdentityResidentialAddressSubmission;
|
|
86
|
+
basicDetails?: IdentityBasicDetailsSubmission;
|
|
87
|
+
phoneNumber?: IdentityPhoneNumberSubmission;
|
|
88
|
+
taxIdentifiers?: IdentityTaxIdentifierSubmission[];
|
|
89
|
+
}
|
|
90
|
+
/** A MoonPay-hosted challenge a partner must surface to the customer. */
|
|
91
|
+
interface IdentityVerificationChallenge {
|
|
92
|
+
/** Fully-formed challenge URL. */
|
|
93
|
+
url: string;
|
|
94
|
+
/** ISO 8601 expiry. */
|
|
95
|
+
expiresAt: string;
|
|
96
|
+
}
|
|
97
|
+
/** The state of an identity verification request. */
|
|
98
|
+
type IdentityVerificationStatus = 'approved' | 'processing' | 'challengeRequired';
|
|
99
|
+
/** Outcome of `POST /platform/v1/identities/{id}/verifications`. */
|
|
100
|
+
type IdentityVerificationResponse = {
|
|
101
|
+
status: 'approved';
|
|
102
|
+
} | {
|
|
103
|
+
status: 'processing';
|
|
104
|
+
} | {
|
|
105
|
+
status: 'challengeRequired';
|
|
106
|
+
challenge: IdentityVerificationChallenge;
|
|
107
|
+
};
|
|
108
|
+
/** Type of identity-related file the customer is uploading. */
|
|
109
|
+
type IdentityFileType = 'drivingLicence' | 'nationalIdentityCard' | 'passport' | 'residencePermit' | 'selfie' | 'proofOfAddress';
|
|
110
|
+
/** Side of a two-sided identity document. */
|
|
111
|
+
type IdentityFileSide = 'front' | 'back';
|
|
112
|
+
/** MIME type of the file being uploaded. */
|
|
113
|
+
type IdentityFileMimeType = 'image/jpeg' | 'image/png' | 'application/pdf';
|
|
114
|
+
/** Request body for issuing a presigned upload URL. */
|
|
115
|
+
interface IdentityFileUploadUrlRequestBody {
|
|
116
|
+
fileType: IdentityFileType;
|
|
117
|
+
/** Required for two-sided file types (`drivingLicence`, `nationalIdentityCard`, `residencePermit`); omit for single-sided. */
|
|
118
|
+
side?: IdentityFileSide;
|
|
119
|
+
/** Must match the `Content-Type` header used on the subsequent upload request. */
|
|
120
|
+
mimeType: IdentityFileMimeType;
|
|
121
|
+
}
|
|
122
|
+
/** Headers the partner must send when uploading the file to the presigned URL. */
|
|
123
|
+
interface IdentityFileUploadUrlHeaders {
|
|
124
|
+
'Content-Type': string;
|
|
125
|
+
}
|
|
126
|
+
/** Presigned URL the partner uses to upload an identity-related file. */
|
|
127
|
+
interface IdentityFileUploadUrl {
|
|
128
|
+
uploadId: string;
|
|
129
|
+
url: string;
|
|
130
|
+
/** ISO 8601 expiry. */
|
|
131
|
+
expiresAt: string;
|
|
132
|
+
headers: IdentityFileUploadUrlHeaders;
|
|
133
|
+
}
|
|
134
|
+
/** A single uploaded file the partner is confirming for submission. */
|
|
135
|
+
interface IdentityFileSubmission {
|
|
136
|
+
uploadId: string;
|
|
137
|
+
fileType: IdentityFileType;
|
|
138
|
+
side?: IdentityFileSide;
|
|
139
|
+
}
|
|
140
|
+
/** Request body for confirming one or more uploaded identity-related files. */
|
|
141
|
+
interface SubmitIdentityFilesRequestBody {
|
|
142
|
+
files: IdentityFileSubmission[];
|
|
143
|
+
}
|
|
144
|
+
/** A KYC identity. */
|
|
145
|
+
interface Identity {
|
|
146
|
+
id: string;
|
|
147
|
+
status: IdentityStatus;
|
|
148
|
+
capabilities: IdentityCapability[];
|
|
149
|
+
requirements: Requirements;
|
|
150
|
+
/** Present only when `status` is `challengeRequired`. */
|
|
151
|
+
challenge?: IdentityVerificationChallenge;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export type { CapabilityProduct, CreateIdentityRequestBody, CreateIdentityResidentialAddress, Identity, IdentityBasicDetailsSubmission, IdentityCapability, IdentityFileMimeType, IdentityFileSide, IdentityFileSubmission, IdentityFileType, IdentityFileUploadUrl, IdentityFileUploadUrlHeaders, IdentityFileUploadUrlRequestBody, IdentityPhoneNumberSubmission, IdentityResidentialAddressSubmission, IdentityStatus, IdentityTaxIdentifierGenericSubmission, IdentityTaxIdentifierSchemeSubmission, IdentityTaxIdentifierSubmission, IdentityTaxIdentifierType, IdentityVerificationChallenge, IdentityVerificationResponse, IdentityVerificationStatus, RequirementEntry, RequirementFieldName, RequirementItemStatus, Requirements, SubmitIdentityFilesRequestBody, UpdateIdentityRequestBody };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/api/index.ts
|
|
17
|
+
var api_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(api_exports);
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/index.ts"],"sourcesContent":["/**\n * Partner-friendly type aliases re-exported from the generated OpenAPI types.\n * These drop namespace prefixes and provide consistent names across SDK versions.\n */\nexport type {\n // Assets\n Asset,\n AssetBase,\n // Session\n CreateSessionTokenRequestBody,\n CreateSessionTokenResponse as CreateSessionTokenReturnType,\n // Fees / wallet\n Fees,\n // Quotes\n GetQuoteBody as GetQuoteParams,\n GetQuoteResponse as Quote,\n LimitWithAsset,\n MonetaryFeeAmount,\n MoonPayCorePaginationInfo as PaginationInfo,\n // Payment methods — config catalog\n MoonPayPaymentsListPaymentMethodsResponse as ListPaymentMethodsResponse,\n MoonPayPaymentsPaymentMethod as PaymentMethodConfig,\n MoonPayPaymentsPaymentMethodAvailability as PaymentMethodAvailability,\n MoonPayPaymentsPaymentMethodCapabilities as PaymentMethodCapabilities,\n MoonPayPaymentsStoredCardPaymentMethod as StoredCardPaymentMethod,\n // Payment methods — stored cards\n MoonPayPaymentsStoredPaymentMethod as StoredPaymentMethod,\n PaymentMethodType,\n QuoteLimitEntry,\n QuoteLimits,\n QuotePaymentMethod,\n // Stages\n Stage,\n StageKind,\n StageStatus,\n // Terms\n TermsAttestation,\n // Transactions\n Transaction,\n TransactionCustomer,\n TransactionPaymentMethod,\n TransactionStatus,\n TransactionWithStages,\n Wallet,\n} from './gen/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|