@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/index.cjs CHANGED
@@ -80,6 +80,7 @@ __export(index_exports, {
80
80
  Forex: () => Forex,
81
81
  GOOGLE_PAY_BUTTON_COLORS: () => GOOGLE_PAY_BUTTON_COLORS,
82
82
  GOOGLE_PAY_BUTTON_TYPES: () => GOOGLE_PAY_BUTTON_TYPES,
83
+ IdentityVerifications: () => IdentityVerifications,
83
84
  InvoiceSettingsResource: () => InvoiceSettingsResource,
84
85
  Invoices: () => Invoices,
85
86
  LOCALIZABLE_COPY_FIELDS: () => LOCALIZABLE_COPY_FIELDS,
@@ -171,6 +172,7 @@ __export(index_exports, {
171
172
  cardFieldFontPx: () => cardFieldFontPx,
172
173
  cardFieldWeightValue: () => cardFieldWeightValue,
173
174
  checkoutCopy: () => checkoutCopy,
175
+ checkoutEntryUrl: () => checkoutEntryUrl,
174
176
  checkoutLocaleDir: () => checkoutLocaleDir,
175
177
  cloneBranding: () => cloneBranding,
176
178
  cloneCustomField: () => cloneCustomField,
@@ -217,6 +219,7 @@ __export(index_exports, {
217
219
  fontWeightValue: () => fontWeightValue,
218
220
  inputPadValue: () => inputPadValue,
219
221
  isCheckboxChecked: () => isCheckboxChecked,
222
+ isCheckoutOpenEntryMessage: () => isCheckoutOpenEntryMessage,
220
223
  isConfirmedChild: () => isConfirmedChild,
221
224
  isDarkSurface: () => isDarkSurface,
222
225
  isDefaultBadgeSet: () => isDefaultBadgeSet,
@@ -3062,6 +3065,29 @@ var Payments = class {
3062
3065
  body: params ?? {}
3063
3066
  });
3064
3067
  }
3068
+ /**
3069
+ * Mark a payment as an integration test, or remove the mark.
3070
+ *
3071
+ * A marked payment stays live or test as it was; only analytics leave it
3072
+ * out, from their next refresh on. Every change is recorded in the
3073
+ * payment's status history with the person who made it. Needs a dashboard
3074
+ * JWT with write access to transactions. Asking for the mark the payment
3075
+ * already carries changes nothing (`changed: false`).
3076
+ *
3077
+ * `POST /payments/{paymentId}/integration-test`
3078
+ *
3079
+ * @example
3080
+ * ```typescript
3081
+ * const { is_integration_test } = await delopay.payments.setIntegrationTest('pay_123', {
3082
+ * is_integration_test: true,
3083
+ * });
3084
+ * ```
3085
+ */
3086
+ async setIntegrationTest(paymentId, params) {
3087
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/integration-test`, {
3088
+ body: params
3089
+ });
3090
+ }
3065
3091
  /**
3066
3092
  * List payment intents, optionally filtered by customer or date range.
3067
3093
  *
@@ -5198,6 +5224,33 @@ var Users = class {
5198
5224
  body: params
5199
5225
  });
5200
5226
  }
5227
+ /**
5228
+ * Which checkout payment methods a member may change in your merchant.
5229
+ * `GET /user/employees/{user_id}/method-access`
5230
+ *
5231
+ * Needs the *Users* read permission, and answers only for a member
5232
+ * `listUsersInLineage` shows you (any other id is a 404 `UR_68` with
5233
+ * `data.reason: 'member_not_found'`). `can_edit` says whether you may
5234
+ * change it; `grant_all` and `grantable` say which methods you may grant.
5235
+ */
5236
+ async getMemberMethodAccess(userId) {
5237
+ return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/method-access`);
5238
+ }
5239
+ /**
5240
+ * Limit a member to some checkout payment methods, or give every method
5241
+ * back. `PUT /user/employees/{user_id}/method-access`
5242
+ *
5243
+ * Needs the *Connectors* edit and *Payment methods* write permissions and a
5244
+ * member within your reach, other than yourself. A caller limited itself
5245
+ * grants only within its own limit. The change is audited and applies to
5246
+ * the member's next request. A refusal is a `UR_68` whose `data` is
5247
+ * `{ reason: 'method_access', refusal }` (see {@link MethodAccessRefusal}).
5248
+ */
5249
+ async updateMemberMethodAccess(userId, params) {
5250
+ return this.request("PUT", `/user/employees/${encodeURIComponent(userId)}/method-access`, {
5251
+ body: params
5252
+ });
5253
+ }
5201
5254
  /** Sign in via OIDC. `POST /user/oidc` */
5202
5255
  async signInOidc(params) {
5203
5256
  return this.request("POST", "/user/oidc", { body: params });
@@ -5392,6 +5445,76 @@ var Verification = class {
5392
5445
  }
5393
5446
  };
5394
5447
 
5448
+ // src/resources/identityVerifications.ts
5449
+ var IdentityVerifications = class {
5450
+ constructor(request) {
5451
+ this.request = request;
5452
+ }
5453
+ /**
5454
+ * Start a verification of a person or a business. The provider-side
5455
+ * workflow decides the checks. With a `return_url`, the provider's session
5456
+ * is created at once and its page returned in `verification_url`. With a
5457
+ * `payment_id` and no `return_url`, the payment's checkout starts it.
5458
+ *
5459
+ * `POST /identity-verifications`
5460
+ */
5461
+ async create(params, options) {
5462
+ return this.request("POST", "/identity-verifications", { body: params, ...options });
5463
+ }
5464
+ /**
5465
+ * The merchant's verifications, newest first. A caller limited to one shop
5466
+ * sees that shop's only.
5467
+ *
5468
+ * `GET /identity-verifications`
5469
+ */
5470
+ async list(query, options) {
5471
+ return this.request("GET", "/identity-verifications", {
5472
+ query,
5473
+ ...options
5474
+ });
5475
+ }
5476
+ /**
5477
+ * One verification. With `force_sync: true`, a verification the provider
5478
+ * can still change (pending or in review) is read from the provider first.
5479
+ *
5480
+ * `GET /identity-verifications/{verification_id}`
5481
+ */
5482
+ async retrieve(verificationId, query, options) {
5483
+ return this.request("GET", `/identity-verifications/${encodeURIComponent(verificationId)}`, {
5484
+ query,
5485
+ ...options
5486
+ });
5487
+ }
5488
+ /**
5489
+ * A subject's latest verification in one environment (live unless
5490
+ * `test_mode: true`), with its checks. This is what risk rules read.
5491
+ * `verification` is `null` when the subject has none.
5492
+ *
5493
+ * `GET /identity-verifications/subjects/{subject_reference}`
5494
+ */
5495
+ async subject(subjectReference, query, options) {
5496
+ return this.request(
5497
+ "GET",
5498
+ `/identity-verifications/subjects/${encodeURIComponent(subjectReference)}`,
5499
+ { query, ...options }
5500
+ );
5501
+ }
5502
+ /**
5503
+ * The provider-side workflows an account can run in one environment, read
5504
+ * from the provider with that environment's credentials. Pass a `flow_id`
5505
+ * as `provider_flow_id` to {@link IdentityVerifications.create}.
5506
+ *
5507
+ * `GET /identity-verifications/accounts/{merchant_connector_id}/flows`
5508
+ */
5509
+ async flows(merchantConnectorId, query, options) {
5510
+ return this.request(
5511
+ "GET",
5512
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/flows`,
5513
+ { query, ...options }
5514
+ );
5515
+ }
5516
+ };
5517
+
5395
5518
  // src/resources/webhooks.ts
5396
5519
  function isSubscriptionLifecycleWebhook(object) {
5397
5520
  return typeof object.transition_id === "string";
@@ -7581,7 +7704,48 @@ var CheckoutMethods = class {
7581
7704
  query: { merchant_id: merchantId }
7582
7705
  });
7583
7706
  }
7707
+ /**
7708
+ * The shop's checkout entries: separate ways into the hosted checkout of
7709
+ * one payment (`?entry=<key>`), such as a card form embedded in the shop's
7710
+ * page, a "Pay with crypto" checkout and an "Other payment methods"
7711
+ * checkout, each in its own named look. Live's by default; `environment:
7712
+ * 'test'` reads the Test checkout's, used by payments with `test_mode: true`.
7713
+ * Refused (403) to a caller that may not see or change every method.
7714
+ * `GET /checkout-methods/{profile_id}/entries` (`/test/entries`)
7715
+ */
7716
+ async entries(merchantId, profileId, params = {}) {
7717
+ return this.request("GET", entriesPath(profileId, params.environment), {
7718
+ query: { merchant_id: merchantId }
7719
+ });
7720
+ }
7721
+ /**
7722
+ * Replace the shop's entries of one environment. Refused when a key is
7723
+ * malformed or used twice, when an entry lists a method, group or card form
7724
+ * that environment's layout does not place, or when a card entry's
7725
+ * `other_entry` is not another `methods` entry.
7726
+ * `PUT /checkout-methods/{profile_id}/entries` (`/test/entries`)
7727
+ */
7728
+ async updateEntries(merchantId, profileId, body, params = {}) {
7729
+ return this.request("PUT", entriesPath(profileId, params.environment), {
7730
+ query: { merchant_id: merchantId },
7731
+ body
7732
+ });
7733
+ }
7734
+ /**
7735
+ * Delete every entry of one environment. A link that still names an entry
7736
+ * then offers nothing.
7737
+ * `DELETE /checkout-methods/{profile_id}/entries` (`/test/entries`)
7738
+ */
7739
+ async clearEntries(merchantId, profileId, params = {}) {
7740
+ return this.request("DELETE", entriesPath(profileId, params.environment), {
7741
+ query: { merchant_id: merchantId }
7742
+ });
7743
+ }
7584
7744
  };
7745
+ function entriesPath(profileId, environment) {
7746
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
7747
+ return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;
7748
+ }
7585
7749
 
7586
7750
  // src/resources/subscriptions.ts
7587
7751
  var Subscriptions = class {
@@ -9599,6 +9763,7 @@ var Delopay = class {
9599
9763
  this.profileAcquirers = new ProfileAcquirers(request);
9600
9764
  this.authentication = new Authentication(request);
9601
9765
  this.verification = new Verification(request);
9766
+ this.identityVerifications = new IdentityVerifications(request);
9602
9767
  this.users = new Users(request);
9603
9768
  this.apiKeys = new ApiKeys(request);
9604
9769
  this.billing = new Billing(request);
@@ -13460,6 +13625,10 @@ var CheckoutSession = class {
13460
13625
  * `cardAccount` name that form's connector and account; absent or blank
13461
13626
  * matches any.
13462
13627
  *
13628
+ * `entry` opens one of the shop's checkout entries (`?entry=`): the layout
13629
+ * holds only that entry's methods and is drawn in its named look, and
13630
+ * `entry` on the answer says whether it had anything to offer.
13631
+ *
13463
13632
  * `GET /payment-link/data/{merchantId}/{paymentId}`
13464
13633
  */
13465
13634
  async fetchCheckoutData(params, options) {
@@ -13473,7 +13642,8 @@ var CheckoutSession = class {
13473
13642
  country: country || void 0,
13474
13643
  card_only: params?.cardOnly || void 0,
13475
13644
  card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
13476
- card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0
13645
+ card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0,
13646
+ entry: params?.entry?.trim() || void 0
13477
13647
  },
13478
13648
  ...options,
13479
13649
  headers: {
@@ -13954,6 +14124,43 @@ var CheckoutSession = class {
13954
14124
  headers: this.bearerHeaders(options?.headers)
13955
14125
  });
13956
14126
  }
14127
+ /**
14128
+ * The payment's identity verification step: whether the payment asked for
14129
+ * one, its outcome, and the provider's page while it is pending. A pending
14130
+ * verification is read from the provider first, so call this when the buyer
14131
+ * comes back from the provider's page.
14132
+ *
14133
+ * `required` is `false` when the payment asked for no verification.
14134
+ * `can_retry` is `true` after an expired or abandoned attempt; start a new
14135
+ * one with {@link CheckoutSession.startIdentityVerification}.
14136
+ *
14137
+ * `GET /payment-link/{merchantId}/{paymentId}/identity-verification`
14138
+ */
14139
+ async identityVerification(options) {
14140
+ return this.client.request("GET", `${this.linkBase}/identity-verification`, {
14141
+ ...options,
14142
+ headers: this.bearerHeaders(options?.headers)
14143
+ });
14144
+ }
14145
+ /**
14146
+ * Resume the payment's pending identity verification, start it, or start a
14147
+ * new attempt after an expired or abandoned one. Send the buyer to the
14148
+ * returned `verification_url`; the provider sends them back to `return_url`,
14149
+ * which must be on the payment's checkout origin.
14150
+ *
14151
+ * Refusals throw a `DelopayError`: `400` when the return URL is not on the
14152
+ * payment's checkout or the verification is already decided, `404` when the
14153
+ * payment asked for no verification.
14154
+ *
14155
+ * `POST /payment-link/{merchantId}/{paymentId}/identity-verification`
14156
+ */
14157
+ async startIdentityVerification(params, options) {
14158
+ return this.client.request("POST", `${this.linkBase}/identity-verification`, {
14159
+ body: params,
14160
+ ...options,
14161
+ headers: this.bearerHeaders(options?.headers)
14162
+ });
14163
+ }
13957
14164
  /**
13958
14165
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
13959
14166
  * form's pre-submit hook.
@@ -14676,6 +14883,20 @@ function focusedCheckoutUrl(params) {
14676
14883
  if (params.customFieldsCollected) query.set("cf", "1");
14677
14884
  return `${path}?${query.toString()}`;
14678
14885
  }
14886
+ function checkoutEntryUrl(params) {
14887
+ const base = params.checkoutBaseUrl.replace(/\/+$/, "");
14888
+ const path = params.paymentLinkId && OPAQUE_PAYMENT_LINK_ID.test(params.paymentLinkId) ? `${base}/pay/${params.paymentLinkId}` : `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
14889
+ params.paymentId
14890
+ )}`;
14891
+ const query = new URLSearchParams({ entry: params.entry.trim() });
14892
+ if (params.locale) query.set("locale", params.locale);
14893
+ return `${path}?${query.toString()}`;
14894
+ }
14895
+ function isCheckoutOpenEntryMessage(data) {
14896
+ if (typeof data !== "object" || data === null) return false;
14897
+ const message = data;
14898
+ return message.type === "open_entry" && typeof message.source === "string" && typeof message.payment_id === "string" && typeof message.entry === "string" && typeof message.url === "string";
14899
+ }
14679
14900
  var CHECKOUT_EVENT_KINDS = [
14680
14901
  "native_pane_selected",
14681
14902
  "native_pane_tab_opened",
@@ -14764,6 +14985,7 @@ var encodeNativePanes = encodePanes;
14764
14985
  Forex,
14765
14986
  GOOGLE_PAY_BUTTON_COLORS,
14766
14987
  GOOGLE_PAY_BUTTON_TYPES,
14988
+ IdentityVerifications,
14767
14989
  InvoiceSettingsResource,
14768
14990
  Invoices,
14769
14991
  LOCALIZABLE_COPY_FIELDS,
@@ -14855,6 +15077,7 @@ var encodeNativePanes = encodePanes;
14855
15077
  cardFieldFontPx,
14856
15078
  cardFieldWeightValue,
14857
15079
  checkoutCopy,
15080
+ checkoutEntryUrl,
14858
15081
  checkoutLocaleDir,
14859
15082
  cloneBranding,
14860
15083
  cloneCustomField,
@@ -14901,6 +15124,7 @@ var encodeNativePanes = encodePanes;
14901
15124
  fontWeightValue,
14902
15125
  inputPadValue,
14903
15126
  isCheckboxChecked,
15127
+ isCheckoutOpenEntryMessage,
14904
15128
  isConfirmedChild,
14905
15129
  isDarkSurface,
14906
15130
  isDefaultBadgeSet,