@moonpay/platform-sdk-core 1.11.0 → 1.13.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.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Customer } from '@moonpay/platform-protocol/api/customer';
2
- import { GetCustomerError, GetCustomerUploadUrlError, SubmitCustomerFilesError, SubmitCustomerKycError, DevPlatformApiError, GetAssetsError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError } from '@moonpay/platform-protocol/api/errors';
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 } from '@moonpay/platform-protocol/api';
5
+ import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, 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
 
@@ -103,6 +103,19 @@ declare function getPaymentMethods(ctx: ClientContext): Promise<Result<{
103
103
  }, GetPaymentMethodsError>>;
104
104
  declare function deletePaymentMethod(ctx: ClientContext, paymentMethodId: string): Promise<Result<void, DevPlatformApiError>>;
105
105
 
106
+ /** The API wraps the transaction in a `{ data: ... }` envelope. */
107
+ interface SimulateBankTransferApiResponse {
108
+ data: TransactionWithStages;
109
+ }
110
+ /**
111
+ * Simulate bank-transfer settlement for a test-mode transaction (sandbox only).
112
+ *
113
+ * Drives a waiting-payment bank-transfer transaction to a terminal outcome
114
+ * without real funds. Settlement is asynchronous, so the response reflects the
115
+ * transaction's current state — poll `getTransaction(id)` for the terminal state.
116
+ */
117
+ declare function simulateBankTransfer(ctx: ClientContext, id: string, params: SimulateBankTransferParams): Promise<Result<SimulateBankTransferApiResponse, SimulateBankTransferError>>;
118
+
106
119
  /** Options for creating a frame (iframe or WebView). */
107
120
  interface FrameOptions {
108
121
  /** Container to render the frame into. Platform-specific. */
@@ -217,6 +230,10 @@ interface CoreClient {
217
230
  getTransaction(id: string): Promise<Result<{
218
231
  data: TransactionWithStages;
219
232
  }, GetTransactionsError>>;
233
+ /** Simulate bank-transfer settlement for a test-mode transaction (sandbox only). */
234
+ simulateBankTransfer(id: string, params: SimulateBankTransferParams): Promise<Result<{
235
+ data: TransactionWithStages;
236
+ }, SimulateBankTransferError>>;
220
237
  deletePaymentMethod(id: string): Promise<Result<void, DevPlatformApiError>>;
221
238
  getCustomer(id: string): Promise<Result<{
222
239
  data: Customer;
@@ -332,4 +349,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
332
349
  */
333
350
  declare function isTrustedFrameUrl(value: string): boolean;
334
351
 
335
- export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
352
+ export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Customer } from '@moonpay/platform-protocol/api/customer';
2
- import { GetCustomerError, GetCustomerUploadUrlError, SubmitCustomerFilesError, SubmitCustomerKycError, DevPlatformApiError, GetAssetsError, GetQuoteError, GetTransactionsError, CreateIdentityError, GetIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError, UpdateIdentityError, VerifyIdentityError, GetPaymentMethodsError } from '@moonpay/platform-protocol/api/errors';
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 } from '@moonpay/platform-protocol/api';
5
+ import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, 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
 
@@ -103,6 +103,19 @@ declare function getPaymentMethods(ctx: ClientContext): Promise<Result<{
103
103
  }, GetPaymentMethodsError>>;
104
104
  declare function deletePaymentMethod(ctx: ClientContext, paymentMethodId: string): Promise<Result<void, DevPlatformApiError>>;
105
105
 
106
+ /** The API wraps the transaction in a `{ data: ... }` envelope. */
107
+ interface SimulateBankTransferApiResponse {
108
+ data: TransactionWithStages;
109
+ }
110
+ /**
111
+ * Simulate bank-transfer settlement for a test-mode transaction (sandbox only).
112
+ *
113
+ * Drives a waiting-payment bank-transfer transaction to a terminal outcome
114
+ * without real funds. Settlement is asynchronous, so the response reflects the
115
+ * transaction's current state — poll `getTransaction(id)` for the terminal state.
116
+ */
117
+ declare function simulateBankTransfer(ctx: ClientContext, id: string, params: SimulateBankTransferParams): Promise<Result<SimulateBankTransferApiResponse, SimulateBankTransferError>>;
118
+
106
119
  /** Options for creating a frame (iframe or WebView). */
107
120
  interface FrameOptions {
108
121
  /** Container to render the frame into. Platform-specific. */
@@ -217,6 +230,10 @@ interface CoreClient {
217
230
  getTransaction(id: string): Promise<Result<{
218
231
  data: TransactionWithStages;
219
232
  }, GetTransactionsError>>;
233
+ /** Simulate bank-transfer settlement for a test-mode transaction (sandbox only). */
234
+ simulateBankTransfer(id: string, params: SimulateBankTransferParams): Promise<Result<{
235
+ data: TransactionWithStages;
236
+ }, SimulateBankTransferError>>;
220
237
  deletePaymentMethod(id: string): Promise<Result<void, DevPlatformApiError>>;
221
238
  getCustomer(id: string): Promise<Result<{
222
239
  data: Customer;
@@ -332,4 +349,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
332
349
  */
333
350
  declare function isTrustedFrameUrl(value: string): boolean;
334
351
 
335
- export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
352
+ export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyPresentationParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
package/dist/index.js CHANGED
@@ -193,6 +193,18 @@ async function deletePaymentMethod(ctx, paymentMethodId) {
193
193
  return ok3(void 0);
194
194
  }
195
195
 
196
+ // src/api/simulate-bank-transfer.ts
197
+ async function simulateBankTransfer(ctx, id, params) {
198
+ return apiFetch(
199
+ ctx,
200
+ `/platform/v1/transactions/${encodeURIComponent(id)}/simulate-bank-transfer`,
201
+ {
202
+ method: "POST",
203
+ body: JSON.stringify(params)
204
+ }
205
+ );
206
+ }
207
+
196
208
  // src/client.ts
197
209
  function createClientCore(options) {
198
210
  const ctx = createClientContext({
@@ -211,6 +223,7 @@ function createClientCore(options) {
211
223
  getPaymentMethods: () => getPaymentMethods(ctx),
212
224
  listTransactions: (params) => listTransactions(ctx, params),
213
225
  getTransaction: (id) => getTransaction(ctx, id),
226
+ simulateBankTransfer: (id, params) => simulateBankTransfer(ctx, id, params),
214
227
  deletePaymentMethod: (id) => deletePaymentMethod(ctx, id),
215
228
  getCustomer: (id) => getCustomer(ctx, id),
216
229
  submitCustomerKyc: (id, body) => submitCustomerKyc(ctx, id, body),
@@ -1701,6 +1714,7 @@ export {
1701
1714
  isTrustedFrameUrl,
1702
1715
  listTransactions,
1703
1716
  presentationParams,
1717
+ simulateBankTransfer,
1704
1718
  submitCustomerFiles,
1705
1719
  submitCustomerKyc,
1706
1720
  submitIdentityFiles,