@delopay/sdk 0.279.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
  *
@@ -4918,6 +4941,33 @@ var Users = class {
4918
4941
  body: params
4919
4942
  });
4920
4943
  }
4944
+ /**
4945
+ * Which checkout payment methods a member may change in your merchant.
4946
+ * `GET /user/employees/{user_id}/method-access`
4947
+ *
4948
+ * Needs the *Users* read permission, and answers only for a member
4949
+ * `listUsersInLineage` shows you (any other id is a 404 `UR_68` with
4950
+ * `data.reason: 'member_not_found'`). `can_edit` says whether you may
4951
+ * change it; `grant_all` and `grantable` say which methods you may grant.
4952
+ */
4953
+ async getMemberMethodAccess(userId) {
4954
+ return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/method-access`);
4955
+ }
4956
+ /**
4957
+ * Limit a member to some checkout payment methods, or give every method
4958
+ * back. `PUT /user/employees/{user_id}/method-access`
4959
+ *
4960
+ * Needs the *Connectors* edit and *Payment methods* write permissions and a
4961
+ * member within your reach, other than yourself. A caller limited itself
4962
+ * grants only within its own limit. The change is audited and applies to
4963
+ * the member's next request. A refusal is a `UR_68` whose `data` is
4964
+ * `{ reason: 'method_access', refusal }` (see {@link MethodAccessRefusal}).
4965
+ */
4966
+ async updateMemberMethodAccess(userId, params) {
4967
+ return this.request("PUT", `/user/employees/${encodeURIComponent(userId)}/method-access`, {
4968
+ body: params
4969
+ });
4970
+ }
4921
4971
  /** Sign in via OIDC. `POST /user/oidc` */
4922
4972
  async signInOidc(params) {
4923
4973
  return this.request("POST", "/user/oidc", { body: params });
@@ -5112,6 +5162,76 @@ var Verification = class {
5112
5162
  }
5113
5163
  };
5114
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
+
5115
5235
  // src/resources/webhooks.ts
5116
5236
  function isSubscriptionLifecycleWebhook(object) {
5117
5237
  return typeof object.transition_id === "string";
@@ -7301,7 +7421,48 @@ var CheckoutMethods = class {
7301
7421
  query: { merchant_id: merchantId }
7302
7422
  });
7303
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
+ }
7304
7461
  };
7462
+ function entriesPath(profileId, environment) {
7463
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
7464
+ return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;
7465
+ }
7305
7466
 
7306
7467
  // src/resources/subscriptions.ts
7307
7468
  var Subscriptions = class {
@@ -9319,6 +9480,7 @@ var Delopay = class {
9319
9480
  this.profileAcquirers = new ProfileAcquirers(request);
9320
9481
  this.authentication = new Authentication(request);
9321
9482
  this.verification = new Verification(request);
9483
+ this.identityVerifications = new IdentityVerifications(request);
9322
9484
  this.users = new Users(request);
9323
9485
  this.apiKeys = new ApiKeys(request);
9324
9486
  this.billing = new Billing(request);
@@ -13180,6 +13342,10 @@ var CheckoutSession = class {
13180
13342
  * `cardAccount` name that form's connector and account; absent or blank
13181
13343
  * matches any.
13182
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
+ *
13183
13349
  * `GET /payment-link/data/{merchantId}/{paymentId}`
13184
13350
  */
13185
13351
  async fetchCheckoutData(params, options) {
@@ -13193,7 +13359,8 @@ var CheckoutSession = class {
13193
13359
  country: country || void 0,
13194
13360
  card_only: params?.cardOnly || void 0,
13195
13361
  card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
13196
- 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
13197
13364
  },
13198
13365
  ...options,
13199
13366
  headers: {
@@ -13674,6 +13841,43 @@ var CheckoutSession = class {
13674
13841
  headers: this.bearerHeaders(options?.headers)
13675
13842
  });
13676
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
+ }
13677
13881
  /**
13678
13882
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
13679
13883
  * form's pre-submit hook.
@@ -14396,6 +14600,20 @@ function focusedCheckoutUrl(params) {
14396
14600
  if (params.customFieldsCollected) query.set("cf", "1");
14397
14601
  return `${path}?${query.toString()}`;
14398
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
+ }
14399
14617
  var CHECKOUT_EVENT_KINDS = [
14400
14618
  "native_pane_selected",
14401
14619
  "native_pane_tab_opened",
@@ -14430,6 +14648,7 @@ export {
14430
14648
  PaypalDisputes,
14431
14649
  WhopResolutionCases,
14432
14650
  Search,
14651
+ IdentityVerifications,
14433
14652
  isSubscriptionLifecycleWebhook,
14434
14653
  isSubscriptionDisputeWebhook,
14435
14654
  Webhooks,
@@ -14671,6 +14890,8 @@ export {
14671
14890
  decodePanes,
14672
14891
  encodePanes,
14673
14892
  focusedCheckoutUrl,
14893
+ checkoutEntryUrl,
14894
+ isCheckoutOpenEntryMessage,
14674
14895
  CHECKOUT_EVENT_KINDS,
14675
14896
  STRIPE_NATIVE_PANE_METHODS,
14676
14897
  NATIVE_PANE_ICON_KEYS,
@@ -14682,4 +14903,4 @@ export {
14682
14903
  decodeNativePanes,
14683
14904
  encodeNativePanes
14684
14905
  };
14685
- //# sourceMappingURL=chunk-5FGSME7D.js.map
14906
+ //# sourceMappingURL=chunk-CEYQMVOJ.js.map