@moonpay/platform-sdk-core 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { Customer } from '@moonpay/platform-protocol/api/customer';
|
|
|
2
2
|
import { GetCustomerError, GetCustomerUploadUrlError, SubmitCustomerFilesError, SubmitCustomerKycError, DevPlatformApiError, GetAssetsError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError, SimulateBankTransferError } from '@moonpay/platform-protocol/api/errors';
|
|
3
3
|
import { IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, UpdateIdentityRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
4
4
|
import { Result } from '@moonpay/platform-protocol/result';
|
|
5
|
-
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsResponse, SimulateBankTransferParams } from '@moonpay/platform-protocol/api';
|
|
5
|
+
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsQuery, ListPaymentMethodsResponse, SimulateBankTransferParams } from '@moonpay/platform-protocol/api';
|
|
6
6
|
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
7
7
|
import { DecryptedCredentials } from '@moonpay/platform-protocol/models/connection';
|
|
8
8
|
|
|
@@ -98,7 +98,17 @@ declare function getIdentityUploadUrl(ctx: ClientContext, id: string, body: Iden
|
|
|
98
98
|
/** @deprecated Use `submitCustomerFiles` instead. */
|
|
99
99
|
declare function submitIdentityFiles(ctx: ClientContext, id: string, body: SubmitIdentityFilesRequestBody): Promise<Result<IdentityEnvelope, SubmitIdentityFilesError>>;
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
interface GetPaymentMethodsParams {
|
|
102
|
+
/**
|
|
103
|
+
* Filter payment method configs to a single fiat currency (ISO 4217, e.g.
|
|
104
|
+
* `USD`). When provided, each config's `supportedCurrencies` is narrowed to
|
|
105
|
+
* this currency. When omitted, the full regional catalog is returned.
|
|
106
|
+
*
|
|
107
|
+
* Typed from the generated OpenAPI query so it tracks the spec.
|
|
108
|
+
*/
|
|
109
|
+
currency?: ListPaymentMethodsQuery['currency'];
|
|
110
|
+
}
|
|
111
|
+
declare function getPaymentMethods(ctx: ClientContext, params?: GetPaymentMethodsParams): Promise<Result<{
|
|
102
112
|
data: ListPaymentMethodsResponse;
|
|
103
113
|
}, GetPaymentMethodsError>>;
|
|
104
114
|
declare function deletePaymentMethod(ctx: ClientContext, paymentMethodId: string): Promise<Result<void, DevPlatformApiError>>;
|
|
@@ -253,7 +263,7 @@ interface CoreClient {
|
|
|
253
263
|
data: Quote;
|
|
254
264
|
}, GetQuoteError>>;
|
|
255
265
|
getAssets(params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;
|
|
256
|
-
getPaymentMethods(): Promise<Result<{
|
|
266
|
+
getPaymentMethods(params?: GetPaymentMethodsParams): Promise<Result<{
|
|
257
267
|
data: ListPaymentMethodsResponse;
|
|
258
268
|
}, GetPaymentMethodsError>>;
|
|
259
269
|
listTransactions(params?: ListTransactionsParams): Promise<Result<{
|
|
@@ -389,4 +399,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
|
|
|
389
399
|
*/
|
|
390
400
|
declare function isTrustedFrameUrl(value: string): boolean;
|
|
391
401
|
|
|
392
|
-
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
|
402
|
+
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type GetPaymentMethodsParams, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Customer } from '@moonpay/platform-protocol/api/customer';
|
|
|
2
2
|
import { GetCustomerError, GetCustomerUploadUrlError, SubmitCustomerFilesError, SubmitCustomerKycError, DevPlatformApiError, GetAssetsError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError, SimulateBankTransferError } from '@moonpay/platform-protocol/api/errors';
|
|
3
3
|
import { IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, UpdateIdentityRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity';
|
|
4
4
|
import { Result } from '@moonpay/platform-protocol/result';
|
|
5
|
-
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsResponse, SimulateBankTransferParams } from '@moonpay/platform-protocol/api';
|
|
5
|
+
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsQuery, ListPaymentMethodsResponse, SimulateBankTransferParams } from '@moonpay/platform-protocol/api';
|
|
6
6
|
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
7
7
|
import { DecryptedCredentials } from '@moonpay/platform-protocol/models/connection';
|
|
8
8
|
|
|
@@ -98,7 +98,17 @@ declare function getIdentityUploadUrl(ctx: ClientContext, id: string, body: Iden
|
|
|
98
98
|
/** @deprecated Use `submitCustomerFiles` instead. */
|
|
99
99
|
declare function submitIdentityFiles(ctx: ClientContext, id: string, body: SubmitIdentityFilesRequestBody): Promise<Result<IdentityEnvelope, SubmitIdentityFilesError>>;
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
interface GetPaymentMethodsParams {
|
|
102
|
+
/**
|
|
103
|
+
* Filter payment method configs to a single fiat currency (ISO 4217, e.g.
|
|
104
|
+
* `USD`). When provided, each config's `supportedCurrencies` is narrowed to
|
|
105
|
+
* this currency. When omitted, the full regional catalog is returned.
|
|
106
|
+
*
|
|
107
|
+
* Typed from the generated OpenAPI query so it tracks the spec.
|
|
108
|
+
*/
|
|
109
|
+
currency?: ListPaymentMethodsQuery['currency'];
|
|
110
|
+
}
|
|
111
|
+
declare function getPaymentMethods(ctx: ClientContext, params?: GetPaymentMethodsParams): Promise<Result<{
|
|
102
112
|
data: ListPaymentMethodsResponse;
|
|
103
113
|
}, GetPaymentMethodsError>>;
|
|
104
114
|
declare function deletePaymentMethod(ctx: ClientContext, paymentMethodId: string): Promise<Result<void, DevPlatformApiError>>;
|
|
@@ -253,7 +263,7 @@ interface CoreClient {
|
|
|
253
263
|
data: Quote;
|
|
254
264
|
}, GetQuoteError>>;
|
|
255
265
|
getAssets(params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;
|
|
256
|
-
getPaymentMethods(): Promise<Result<{
|
|
266
|
+
getPaymentMethods(params?: GetPaymentMethodsParams): Promise<Result<{
|
|
257
267
|
data: ListPaymentMethodsResponse;
|
|
258
268
|
}, GetPaymentMethodsError>>;
|
|
259
269
|
listTransactions(params?: ListTransactionsParams): Promise<Result<{
|
|
@@ -389,4 +399,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
|
|
|
389
399
|
*/
|
|
390
400
|
declare function isTrustedFrameUrl(value: string): boolean;
|
|
391
401
|
|
|
392
|
-
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
|
402
|
+
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type GetPaymentMethodsParams, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
package/dist/index.js
CHANGED
|
@@ -175,8 +175,12 @@ async function submitIdentityFiles(ctx, id, body) {
|
|
|
175
175
|
|
|
176
176
|
// src/api/payment-methods.ts
|
|
177
177
|
import { err as err3, ok as ok3 } from "@moonpay/platform-protocol/result";
|
|
178
|
-
async function getPaymentMethods(ctx) {
|
|
179
|
-
|
|
178
|
+
async function getPaymentMethods(ctx, params = {}) {
|
|
179
|
+
const searchParams = new URLSearchParams();
|
|
180
|
+
if (params.currency) searchParams.set("currency", params.currency);
|
|
181
|
+
const query = searchParams.toString();
|
|
182
|
+
const path = `/platform/v1/payment-methods${query ? `?${query}` : ""}`;
|
|
183
|
+
return apiFetch(ctx, path);
|
|
180
184
|
}
|
|
181
185
|
async function deletePaymentMethod(ctx, paymentMethodId) {
|
|
182
186
|
const response = await ctx.fetch(
|
|
@@ -225,7 +229,7 @@ function createClientCore(options) {
|
|
|
225
229
|
}),
|
|
226
230
|
getQuote: (params) => getQuote(ctx, params),
|
|
227
231
|
getAssets: (params) => getAssets(ctx, params),
|
|
228
|
-
getPaymentMethods: () => getPaymentMethods(ctx),
|
|
232
|
+
getPaymentMethods: (params) => getPaymentMethods(ctx, params),
|
|
229
233
|
listTransactions: (params) => listTransactions(ctx, params),
|
|
230
234
|
getTransaction: (id) => getTransaction(ctx, id),
|
|
231
235
|
simulateBankTransfer: (id, params) => simulateBankTransfer(ctx, id, params),
|