@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.
package/dist/internal.cjs CHANGED
@@ -92,6 +92,7 @@ __export(internal_exports, {
92
92
  GOOGLE_PAY_BUTTON_COLORS: () => GOOGLE_PAY_BUTTON_COLORS,
93
93
  GOOGLE_PAY_BUTTON_TYPES: () => GOOGLE_PAY_BUTTON_TYPES,
94
94
  Gsm: () => Gsm,
95
+ IdentityVerifications: () => IdentityVerifications,
95
96
  InvoiceSettingsResource: () => InvoiceSettingsResource,
96
97
  Invoices: () => Invoices,
97
98
  LOCALIZABLE_COPY_FIELDS: () => LOCALIZABLE_COPY_FIELDS,
@@ -188,6 +189,7 @@ __export(internal_exports, {
188
189
  cardFieldFontPx: () => cardFieldFontPx,
189
190
  cardFieldWeightValue: () => cardFieldWeightValue,
190
191
  checkoutCopy: () => checkoutCopy,
192
+ checkoutEntryUrl: () => checkoutEntryUrl,
191
193
  checkoutLocaleDir: () => checkoutLocaleDir,
192
194
  cloneBranding: () => cloneBranding,
193
195
  cloneCustomField: () => cloneCustomField,
@@ -234,6 +236,7 @@ __export(internal_exports, {
234
236
  fontWeightValue: () => fontWeightValue,
235
237
  inputPadValue: () => inputPadValue,
236
238
  isCheckboxChecked: () => isCheckboxChecked,
239
+ isCheckoutOpenEntryMessage: () => isCheckoutOpenEntryMessage,
237
240
  isConfirmedChild: () => isConfirmedChild,
238
241
  isDarkSurface: () => isDarkSurface,
239
242
  isDefaultBadgeSet: () => isDefaultBadgeSet,
@@ -3079,6 +3082,29 @@ var Payments = class {
3079
3082
  body: params ?? {}
3080
3083
  });
3081
3084
  }
3085
+ /**
3086
+ * Mark a payment as an integration test, or remove the mark.
3087
+ *
3088
+ * A marked payment stays live or test as it was; only analytics leave it
3089
+ * out, from their next refresh on. Every change is recorded in the
3090
+ * payment's status history with the person who made it. Needs a dashboard
3091
+ * JWT with write access to transactions. Asking for the mark the payment
3092
+ * already carries changes nothing (`changed: false`).
3093
+ *
3094
+ * `POST /payments/{paymentId}/integration-test`
3095
+ *
3096
+ * @example
3097
+ * ```typescript
3098
+ * const { is_integration_test } = await delopay.payments.setIntegrationTest('pay_123', {
3099
+ * is_integration_test: true,
3100
+ * });
3101
+ * ```
3102
+ */
3103
+ async setIntegrationTest(paymentId, params) {
3104
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/integration-test`, {
3105
+ body: params
3106
+ });
3107
+ }
3082
3108
  /**
3083
3109
  * List payment intents, optionally filtered by customer or date range.
3084
3110
  *
@@ -5215,6 +5241,33 @@ var Users = class {
5215
5241
  body: params
5216
5242
  });
5217
5243
  }
5244
+ /**
5245
+ * Which checkout payment methods a member may change in your merchant.
5246
+ * `GET /user/employees/{user_id}/method-access`
5247
+ *
5248
+ * Needs the *Users* read permission, and answers only for a member
5249
+ * `listUsersInLineage` shows you (any other id is a 404 `UR_68` with
5250
+ * `data.reason: 'member_not_found'`). `can_edit` says whether you may
5251
+ * change it; `grant_all` and `grantable` say which methods you may grant.
5252
+ */
5253
+ async getMemberMethodAccess(userId) {
5254
+ return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/method-access`);
5255
+ }
5256
+ /**
5257
+ * Limit a member to some checkout payment methods, or give every method
5258
+ * back. `PUT /user/employees/{user_id}/method-access`
5259
+ *
5260
+ * Needs the *Connectors* edit and *Payment methods* write permissions and a
5261
+ * member within your reach, other than yourself. A caller limited itself
5262
+ * grants only within its own limit. The change is audited and applies to
5263
+ * the member's next request. A refusal is a `UR_68` whose `data` is
5264
+ * `{ reason: 'method_access', refusal }` (see {@link MethodAccessRefusal}).
5265
+ */
5266
+ async updateMemberMethodAccess(userId, params) {
5267
+ return this.request("PUT", `/user/employees/${encodeURIComponent(userId)}/method-access`, {
5268
+ body: params
5269
+ });
5270
+ }
5218
5271
  /** Sign in via OIDC. `POST /user/oidc` */
5219
5272
  async signInOidc(params) {
5220
5273
  return this.request("POST", "/user/oidc", { body: params });
@@ -5409,6 +5462,76 @@ var Verification = class {
5409
5462
  }
5410
5463
  };
5411
5464
 
5465
+ // src/resources/identityVerifications.ts
5466
+ var IdentityVerifications = class {
5467
+ constructor(request) {
5468
+ this.request = request;
5469
+ }
5470
+ /**
5471
+ * Start a verification of a person or a business. The provider-side
5472
+ * workflow decides the checks. With a `return_url`, the provider's session
5473
+ * is created at once and its page returned in `verification_url`. With a
5474
+ * `payment_id` and no `return_url`, the payment's checkout starts it.
5475
+ *
5476
+ * `POST /identity-verifications`
5477
+ */
5478
+ async create(params, options) {
5479
+ return this.request("POST", "/identity-verifications", { body: params, ...options });
5480
+ }
5481
+ /**
5482
+ * The merchant's verifications, newest first. A caller limited to one shop
5483
+ * sees that shop's only.
5484
+ *
5485
+ * `GET /identity-verifications`
5486
+ */
5487
+ async list(query, options) {
5488
+ return this.request("GET", "/identity-verifications", {
5489
+ query,
5490
+ ...options
5491
+ });
5492
+ }
5493
+ /**
5494
+ * One verification. With `force_sync: true`, a verification the provider
5495
+ * can still change (pending or in review) is read from the provider first.
5496
+ *
5497
+ * `GET /identity-verifications/{verification_id}`
5498
+ */
5499
+ async retrieve(verificationId, query, options) {
5500
+ return this.request("GET", `/identity-verifications/${encodeURIComponent(verificationId)}`, {
5501
+ query,
5502
+ ...options
5503
+ });
5504
+ }
5505
+ /**
5506
+ * A subject's latest verification in one environment (live unless
5507
+ * `test_mode: true`), with its checks. This is what risk rules read.
5508
+ * `verification` is `null` when the subject has none.
5509
+ *
5510
+ * `GET /identity-verifications/subjects/{subject_reference}`
5511
+ */
5512
+ async subject(subjectReference, query, options) {
5513
+ return this.request(
5514
+ "GET",
5515
+ `/identity-verifications/subjects/${encodeURIComponent(subjectReference)}`,
5516
+ { query, ...options }
5517
+ );
5518
+ }
5519
+ /**
5520
+ * The provider-side workflows an account can run in one environment, read
5521
+ * from the provider with that environment's credentials. Pass a `flow_id`
5522
+ * as `provider_flow_id` to {@link IdentityVerifications.create}.
5523
+ *
5524
+ * `GET /identity-verifications/accounts/{merchant_connector_id}/flows`
5525
+ */
5526
+ async flows(merchantConnectorId, query, options) {
5527
+ return this.request(
5528
+ "GET",
5529
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/flows`,
5530
+ { query, ...options }
5531
+ );
5532
+ }
5533
+ };
5534
+
5412
5535
  // src/resources/webhooks.ts
5413
5536
  function isSubscriptionLifecycleWebhook(object) {
5414
5537
  return typeof object.transition_id === "string";
@@ -7598,7 +7721,48 @@ var CheckoutMethods = class {
7598
7721
  query: { merchant_id: merchantId }
7599
7722
  });
7600
7723
  }
7724
+ /**
7725
+ * The shop's checkout entries: separate ways into the hosted checkout of
7726
+ * one payment (`?entry=<key>`), such as a card form embedded in the shop's
7727
+ * page, a "Pay with crypto" checkout and an "Other payment methods"
7728
+ * checkout, each in its own named look. Live's by default; `environment:
7729
+ * 'test'` reads the Test checkout's, used by payments with `test_mode: true`.
7730
+ * Refused (403) to a caller that may not see or change every method.
7731
+ * `GET /checkout-methods/{profile_id}/entries` (`/test/entries`)
7732
+ */
7733
+ async entries(merchantId, profileId, params = {}) {
7734
+ return this.request("GET", entriesPath(profileId, params.environment), {
7735
+ query: { merchant_id: merchantId }
7736
+ });
7737
+ }
7738
+ /**
7739
+ * Replace the shop's entries of one environment. Refused when a key is
7740
+ * malformed or used twice, when an entry lists a method, group or card form
7741
+ * that environment's layout does not place, or when a card entry's
7742
+ * `other_entry` is not another `methods` entry.
7743
+ * `PUT /checkout-methods/{profile_id}/entries` (`/test/entries`)
7744
+ */
7745
+ async updateEntries(merchantId, profileId, body, params = {}) {
7746
+ return this.request("PUT", entriesPath(profileId, params.environment), {
7747
+ query: { merchant_id: merchantId },
7748
+ body
7749
+ });
7750
+ }
7751
+ /**
7752
+ * Delete every entry of one environment. A link that still names an entry
7753
+ * then offers nothing.
7754
+ * `DELETE /checkout-methods/{profile_id}/entries` (`/test/entries`)
7755
+ */
7756
+ async clearEntries(merchantId, profileId, params = {}) {
7757
+ return this.request("DELETE", entriesPath(profileId, params.environment), {
7758
+ query: { merchant_id: merchantId }
7759
+ });
7760
+ }
7601
7761
  };
7762
+ function entriesPath(profileId, environment) {
7763
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
7764
+ return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;
7765
+ }
7602
7766
 
7603
7767
  // src/resources/subscriptions.ts
7604
7768
  var Subscriptions = class {
@@ -9616,6 +9780,7 @@ var Delopay = class {
9616
9780
  this.profileAcquirers = new ProfileAcquirers(request);
9617
9781
  this.authentication = new Authentication(request);
9618
9782
  this.verification = new Verification(request);
9783
+ this.identityVerifications = new IdentityVerifications(request);
9619
9784
  this.users = new Users(request);
9620
9785
  this.apiKeys = new ApiKeys(request);
9621
9786
  this.billing = new Billing(request);
@@ -13477,6 +13642,10 @@ var CheckoutSession = class {
13477
13642
  * `cardAccount` name that form's connector and account; absent or blank
13478
13643
  * matches any.
13479
13644
  *
13645
+ * `entry` opens one of the shop's checkout entries (`?entry=`): the layout
13646
+ * holds only that entry's methods and is drawn in its named look, and
13647
+ * `entry` on the answer says whether it had anything to offer.
13648
+ *
13480
13649
  * `GET /payment-link/data/{merchantId}/{paymentId}`
13481
13650
  */
13482
13651
  async fetchCheckoutData(params, options) {
@@ -13490,7 +13659,8 @@ var CheckoutSession = class {
13490
13659
  country: country || void 0,
13491
13660
  card_only: params?.cardOnly || void 0,
13492
13661
  card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
13493
- card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0
13662
+ card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0,
13663
+ entry: params?.entry?.trim() || void 0
13494
13664
  },
13495
13665
  ...options,
13496
13666
  headers: {
@@ -13971,6 +14141,43 @@ var CheckoutSession = class {
13971
14141
  headers: this.bearerHeaders(options?.headers)
13972
14142
  });
13973
14143
  }
14144
+ /**
14145
+ * The payment's identity verification step: whether the payment asked for
14146
+ * one, its outcome, and the provider's page while it is pending. A pending
14147
+ * verification is read from the provider first, so call this when the buyer
14148
+ * comes back from the provider's page.
14149
+ *
14150
+ * `required` is `false` when the payment asked for no verification.
14151
+ * `can_retry` is `true` after an expired or abandoned attempt; start a new
14152
+ * one with {@link CheckoutSession.startIdentityVerification}.
14153
+ *
14154
+ * `GET /payment-link/{merchantId}/{paymentId}/identity-verification`
14155
+ */
14156
+ async identityVerification(options) {
14157
+ return this.client.request("GET", `${this.linkBase}/identity-verification`, {
14158
+ ...options,
14159
+ headers: this.bearerHeaders(options?.headers)
14160
+ });
14161
+ }
14162
+ /**
14163
+ * Resume the payment's pending identity verification, start it, or start a
14164
+ * new attempt after an expired or abandoned one. Send the buyer to the
14165
+ * returned `verification_url`; the provider sends them back to `return_url`,
14166
+ * which must be on the payment's checkout origin.
14167
+ *
14168
+ * Refusals throw a `DelopayError`: `400` when the return URL is not on the
14169
+ * payment's checkout or the verification is already decided, `404` when the
14170
+ * payment asked for no verification.
14171
+ *
14172
+ * `POST /payment-link/{merchantId}/{paymentId}/identity-verification`
14173
+ */
14174
+ async startIdentityVerification(params, options) {
14175
+ return this.client.request("POST", `${this.linkBase}/identity-verification`, {
14176
+ body: params,
14177
+ ...options,
14178
+ headers: this.bearerHeaders(options?.headers)
14179
+ });
14180
+ }
13974
14181
  /**
13975
14182
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
13976
14183
  * form's pre-submit hook.
@@ -14693,6 +14900,20 @@ function focusedCheckoutUrl(params) {
14693
14900
  if (params.customFieldsCollected) query.set("cf", "1");
14694
14901
  return `${path}?${query.toString()}`;
14695
14902
  }
14903
+ function checkoutEntryUrl(params) {
14904
+ const base = params.checkoutBaseUrl.replace(/\/+$/, "");
14905
+ const path = params.paymentLinkId && OPAQUE_PAYMENT_LINK_ID.test(params.paymentLinkId) ? `${base}/pay/${params.paymentLinkId}` : `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
14906
+ params.paymentId
14907
+ )}`;
14908
+ const query = new URLSearchParams({ entry: params.entry.trim() });
14909
+ if (params.locale) query.set("locale", params.locale);
14910
+ return `${path}?${query.toString()}`;
14911
+ }
14912
+ function isCheckoutOpenEntryMessage(data) {
14913
+ if (typeof data !== "object" || data === null) return false;
14914
+ const message = data;
14915
+ return message.type === "open_entry" && typeof message.source === "string" && typeof message.payment_id === "string" && typeof message.entry === "string" && typeof message.url === "string";
14916
+ }
14696
14917
  var CHECKOUT_EVENT_KINDS = [
14697
14918
  "native_pane_selected",
14698
14919
  "native_pane_tab_opened",
@@ -15349,6 +15570,31 @@ var AdminPortal = class {
15349
15570
  async updateUser(userId, body) {
15350
15571
  return this.request("PATCH", `/admin-portal/users/${encodeURIComponent(userId)}`, { body });
15351
15572
  }
15573
+ /**
15574
+ * Which checkout payment methods a member of `merchantId` may change.
15575
+ * `GET /admin-portal/accounts/{merchant_id}/members/{user_id}/method-access`
15576
+ *
15577
+ * Any internal role may read it; `can_edit` is `false` for one without
15578
+ * `UsersManage`. A user holding no role in the merchant is a 404 `UR_68`.
15579
+ */
15580
+ async getMemberMethodAccess(merchantId, userId) {
15581
+ return this.request(
15582
+ "GET",
15583
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/method-access`
15584
+ );
15585
+ }
15586
+ /**
15587
+ * Limit a member of `merchantId` to some checkout payment methods, or give
15588
+ * every method back. Needs `UsersManage`. Recorded in the merchant's audit
15589
+ * log. `PUT /admin-portal/accounts/{merchant_id}/members/{user_id}/method-access`
15590
+ */
15591
+ async updateMemberMethodAccess(merchantId, userId, body) {
15592
+ return this.request(
15593
+ "PUT",
15594
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/method-access`,
15595
+ { body }
15596
+ );
15597
+ }
15352
15598
  /**
15353
15599
  * Soft-delete a user globally: deactivates the row, blacklists existing
15354
15600
  * JWTs, and wipes credentials. Distinct from `deleteUserRole`, which
@@ -15423,6 +15669,19 @@ var AdminPortal = class {
15423
15669
  `/admin-portal/transactions/${encodeURIComponent(paymentId)}/recover`
15424
15670
  );
15425
15671
  }
15672
+ /**
15673
+ * Mark a transaction of ANY merchant as an integration test, or remove the
15674
+ * mark. Recorded in the payment's status history as an operator's change.
15675
+ *
15676
+ * `POST /admin-portal/transactions/{paymentId}/integration-test`
15677
+ */
15678
+ async setTransactionIntegrationTest(paymentId, params) {
15679
+ return this.request(
15680
+ "POST",
15681
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/integration-test`,
15682
+ { body: params }
15683
+ );
15684
+ }
15426
15685
  /**
15427
15686
  * Client/device observations captured while the buyer interacted with a
15428
15687
  * transaction of ANY merchant, oldest first.
@@ -16551,6 +16810,7 @@ var DelopayInternal = class extends Delopay {
16551
16810
  GOOGLE_PAY_BUTTON_COLORS,
16552
16811
  GOOGLE_PAY_BUTTON_TYPES,
16553
16812
  Gsm,
16813
+ IdentityVerifications,
16554
16814
  InvoiceSettingsResource,
16555
16815
  Invoices,
16556
16816
  LOCALIZABLE_COPY_FIELDS,
@@ -16647,6 +16907,7 @@ var DelopayInternal = class extends Delopay {
16647
16907
  cardFieldFontPx,
16648
16908
  cardFieldWeightValue,
16649
16909
  checkoutCopy,
16910
+ checkoutEntryUrl,
16650
16911
  checkoutLocaleDir,
16651
16912
  cloneBranding,
16652
16913
  cloneCustomField,
@@ -16693,6 +16954,7 @@ var DelopayInternal = class extends Delopay {
16693
16954
  fontWeightValue,
16694
16955
  inputPadValue,
16695
16956
  isCheckboxChecked,
16957
+ isCheckoutOpenEntryMessage,
16696
16958
  isConfirmedChild,
16697
16959
  isDarkSurface,
16698
16960
  isDefaultBadgeSet,