@delopay/sdk 0.280.0 → 0.285.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.
@@ -2782,6 +2782,29 @@ var Payments = class {
2782
2782
  body: params ?? {}
2783
2783
  });
2784
2784
  }
2785
+ /**
2786
+ * Mark a payment as an integration test, or remove the mark.
2787
+ *
2788
+ * A marked payment stays live or test as it was; only analytics leave it
2789
+ * out, from their next refresh on. Every change is recorded in the
2790
+ * payment's status history with the person who made it. Needs a dashboard
2791
+ * JWT with write access to transactions. Asking for the mark the payment
2792
+ * already carries changes nothing (`changed: false`).
2793
+ *
2794
+ * `POST /payments/{paymentId}/integration-test`
2795
+ *
2796
+ * @example
2797
+ * ```typescript
2798
+ * const { is_integration_test } = await delopay.payments.setIntegrationTest('pay_123', {
2799
+ * is_integration_test: true,
2800
+ * });
2801
+ * ```
2802
+ */
2803
+ async setIntegrationTest(paymentId, params) {
2804
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/integration-test`, {
2805
+ body: params
2806
+ });
2807
+ }
2785
2808
  /**
2786
2809
  * List payment intents, optionally filtered by customer or date range.
2787
2810
  *
@@ -5139,6 +5162,76 @@ var Verification = class {
5139
5162
  }
5140
5163
  };
5141
5164
 
5165
+ // src/resources/identityVerifications.ts
5166
+ var IdentityVerifications = class {
5167
+ constructor(request) {
5168
+ this.request = request;
5169
+ }
5170
+ /**
5171
+ * Start a verification of a person or a business. The provider-side
5172
+ * workflow decides the checks. With a `return_url`, the provider's session
5173
+ * is created at once and its page returned in `verification_url`. With a
5174
+ * `payment_id` and no `return_url`, the payment's checkout starts it.
5175
+ *
5176
+ * `POST /identity-verifications`
5177
+ */
5178
+ async create(params, options) {
5179
+ return this.request("POST", "/identity-verifications", { body: params, ...options });
5180
+ }
5181
+ /**
5182
+ * The merchant's verifications, newest first. A caller limited to one shop
5183
+ * sees that shop's only.
5184
+ *
5185
+ * `GET /identity-verifications`
5186
+ */
5187
+ async list(query, options) {
5188
+ return this.request("GET", "/identity-verifications", {
5189
+ query,
5190
+ ...options
5191
+ });
5192
+ }
5193
+ /**
5194
+ * One verification. With `force_sync: true`, a verification the provider
5195
+ * can still change (pending or in review) is read from the provider first.
5196
+ *
5197
+ * `GET /identity-verifications/{verification_id}`
5198
+ */
5199
+ async retrieve(verificationId, query, options) {
5200
+ return this.request("GET", `/identity-verifications/${encodeURIComponent(verificationId)}`, {
5201
+ query,
5202
+ ...options
5203
+ });
5204
+ }
5205
+ /**
5206
+ * A subject's latest verification in one environment (live unless
5207
+ * `test_mode: true`), with its checks. This is what risk rules read.
5208
+ * `verification` is `null` when the subject has none.
5209
+ *
5210
+ * `GET /identity-verifications/subjects/{subject_reference}`
5211
+ */
5212
+ async subject(subjectReference, query, options) {
5213
+ return this.request(
5214
+ "GET",
5215
+ `/identity-verifications/subjects/${encodeURIComponent(subjectReference)}`,
5216
+ { query, ...options }
5217
+ );
5218
+ }
5219
+ /**
5220
+ * The provider-side workflows an account can run in one environment, read
5221
+ * from the provider with that environment's credentials. Pass a `flow_id`
5222
+ * as `provider_flow_id` to {@link IdentityVerifications.create}.
5223
+ *
5224
+ * `GET /identity-verifications/accounts/{merchant_connector_id}/flows`
5225
+ */
5226
+ async flows(merchantConnectorId, query, options) {
5227
+ return this.request(
5228
+ "GET",
5229
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/flows`,
5230
+ { query, ...options }
5231
+ );
5232
+ }
5233
+ };
5234
+
5142
5235
  // src/resources/webhooks.ts
5143
5236
  function isSubscriptionLifecycleWebhook(object) {
5144
5237
  return typeof object.transition_id === "string";
@@ -7328,7 +7421,48 @@ var CheckoutMethods = class {
7328
7421
  query: { merchant_id: merchantId }
7329
7422
  });
7330
7423
  }
7424
+ /**
7425
+ * The shop's checkout entries: separate ways into the hosted checkout of
7426
+ * one payment (`?entry=<key>`), such as a card form embedded in the shop's
7427
+ * page, a "Pay with crypto" checkout and an "Other payment methods"
7428
+ * checkout, each in its own named look. Live's by default; `environment:
7429
+ * 'test'` reads the Test checkout's, used by payments with `test_mode: true`.
7430
+ * Refused (403) to a caller that may not see or change every method.
7431
+ * `GET /checkout-methods/{profile_id}/entries` (`/test/entries`)
7432
+ */
7433
+ async entries(merchantId, profileId, params = {}) {
7434
+ return this.request("GET", entriesPath(profileId, params.environment), {
7435
+ query: { merchant_id: merchantId }
7436
+ });
7437
+ }
7438
+ /**
7439
+ * Replace the shop's entries of one environment. Refused when a key is
7440
+ * malformed or used twice, when an entry lists a method, group or card form
7441
+ * that environment's layout does not place, or when a card entry's
7442
+ * `other_entry` is not another `methods` entry.
7443
+ * `PUT /checkout-methods/{profile_id}/entries` (`/test/entries`)
7444
+ */
7445
+ async updateEntries(merchantId, profileId, body, params = {}) {
7446
+ return this.request("PUT", entriesPath(profileId, params.environment), {
7447
+ query: { merchant_id: merchantId },
7448
+ body
7449
+ });
7450
+ }
7451
+ /**
7452
+ * Delete every entry of one environment. A link that still names an entry
7453
+ * then offers nothing.
7454
+ * `DELETE /checkout-methods/{profile_id}/entries` (`/test/entries`)
7455
+ */
7456
+ async clearEntries(merchantId, profileId, params = {}) {
7457
+ return this.request("DELETE", entriesPath(profileId, params.environment), {
7458
+ query: { merchant_id: merchantId }
7459
+ });
7460
+ }
7331
7461
  };
7462
+ function entriesPath(profileId, environment) {
7463
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
7464
+ return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;
7465
+ }
7332
7466
 
7333
7467
  // src/resources/subscriptions.ts
7334
7468
  var Subscriptions = class {
@@ -9346,6 +9480,7 @@ var Delopay = class {
9346
9480
  this.profileAcquirers = new ProfileAcquirers(request);
9347
9481
  this.authentication = new Authentication(request);
9348
9482
  this.verification = new Verification(request);
9483
+ this.identityVerifications = new IdentityVerifications(request);
9349
9484
  this.users = new Users(request);
9350
9485
  this.apiKeys = new ApiKeys(request);
9351
9486
  this.billing = new Billing(request);
@@ -13207,6 +13342,10 @@ var CheckoutSession = class {
13207
13342
  * `cardAccount` name that form's connector and account; absent or blank
13208
13343
  * matches any.
13209
13344
  *
13345
+ * `entry` opens one of the shop's checkout entries (`?entry=`): the layout
13346
+ * holds only that entry's methods and is drawn in its named look, and
13347
+ * `entry` on the answer says whether it had anything to offer.
13348
+ *
13210
13349
  * `GET /payment-link/data/{merchantId}/{paymentId}`
13211
13350
  */
13212
13351
  async fetchCheckoutData(params, options) {
@@ -13220,7 +13359,8 @@ var CheckoutSession = class {
13220
13359
  country: country || void 0,
13221
13360
  card_only: params?.cardOnly || void 0,
13222
13361
  card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
13223
- card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0
13362
+ card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0,
13363
+ entry: params?.entry?.trim() || void 0
13224
13364
  },
13225
13365
  ...options,
13226
13366
  headers: {
@@ -13701,6 +13841,43 @@ var CheckoutSession = class {
13701
13841
  headers: this.bearerHeaders(options?.headers)
13702
13842
  });
13703
13843
  }
13844
+ /**
13845
+ * The payment's identity verification step: whether the payment asked for
13846
+ * one, its outcome, and the provider's page while it is pending. A pending
13847
+ * verification is read from the provider first, so call this when the buyer
13848
+ * comes back from the provider's page.
13849
+ *
13850
+ * `required` is `false` when the payment asked for no verification.
13851
+ * `can_retry` is `true` after an expired or abandoned attempt; start a new
13852
+ * one with {@link CheckoutSession.startIdentityVerification}.
13853
+ *
13854
+ * `GET /payment-link/{merchantId}/{paymentId}/identity-verification`
13855
+ */
13856
+ async identityVerification(options) {
13857
+ return this.client.request("GET", `${this.linkBase}/identity-verification`, {
13858
+ ...options,
13859
+ headers: this.bearerHeaders(options?.headers)
13860
+ });
13861
+ }
13862
+ /**
13863
+ * Resume the payment's pending identity verification, start it, or start a
13864
+ * new attempt after an expired or abandoned one. Send the buyer to the
13865
+ * returned `verification_url`; the provider sends them back to `return_url`,
13866
+ * which must be on the payment's checkout origin.
13867
+ *
13868
+ * Refusals throw a `DelopayError`: `400` when the return URL is not on the
13869
+ * payment's checkout or the verification is already decided, `404` when the
13870
+ * payment asked for no verification.
13871
+ *
13872
+ * `POST /payment-link/{merchantId}/{paymentId}/identity-verification`
13873
+ */
13874
+ async startIdentityVerification(params, options) {
13875
+ return this.client.request("POST", `${this.linkBase}/identity-verification`, {
13876
+ body: params,
13877
+ ...options,
13878
+ headers: this.bearerHeaders(options?.headers)
13879
+ });
13880
+ }
13704
13881
  /**
13705
13882
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
13706
13883
  * form's pre-submit hook.
@@ -14423,6 +14600,20 @@ function focusedCheckoutUrl(params) {
14423
14600
  if (params.customFieldsCollected) query.set("cf", "1");
14424
14601
  return `${path}?${query.toString()}`;
14425
14602
  }
14603
+ function checkoutEntryUrl(params) {
14604
+ const base = params.checkoutBaseUrl.replace(/\/+$/, "");
14605
+ const path = params.paymentLinkId && OPAQUE_PAYMENT_LINK_ID.test(params.paymentLinkId) ? `${base}/pay/${params.paymentLinkId}` : `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
14606
+ params.paymentId
14607
+ )}`;
14608
+ const query = new URLSearchParams({ entry: params.entry.trim() });
14609
+ if (params.locale) query.set("locale", params.locale);
14610
+ return `${path}?${query.toString()}`;
14611
+ }
14612
+ function isCheckoutOpenEntryMessage(data) {
14613
+ if (typeof data !== "object" || data === null) return false;
14614
+ const message = data;
14615
+ return message.type === "open_entry" && typeof message.source === "string" && typeof message.payment_id === "string" && typeof message.entry === "string" && typeof message.url === "string";
14616
+ }
14426
14617
  var CHECKOUT_EVENT_KINDS = [
14427
14618
  "native_pane_selected",
14428
14619
  "native_pane_tab_opened",
@@ -14457,6 +14648,7 @@ export {
14457
14648
  PaypalDisputes,
14458
14649
  WhopResolutionCases,
14459
14650
  Search,
14651
+ IdentityVerifications,
14460
14652
  isSubscriptionLifecycleWebhook,
14461
14653
  isSubscriptionDisputeWebhook,
14462
14654
  Webhooks,
@@ -14698,6 +14890,8 @@ export {
14698
14890
  decodePanes,
14699
14891
  encodePanes,
14700
14892
  focusedCheckoutUrl,
14893
+ checkoutEntryUrl,
14894
+ isCheckoutOpenEntryMessage,
14701
14895
  CHECKOUT_EVENT_KINDS,
14702
14896
  STRIPE_NATIVE_PANE_METHODS,
14703
14897
  NATIVE_PANE_ICON_KEYS,
@@ -14709,4 +14903,4 @@ export {
14709
14903
  decodeNativePanes,
14710
14904
  encodeNativePanes
14711
14905
  };
14712
- //# sourceMappingURL=chunk-3CHJT5YW.js.map
14906
+ //# sourceMappingURL=chunk-CEYQMVOJ.js.map