@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.
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
  *
@@ -5419,6 +5445,76 @@ var Verification = class {
5419
5445
  }
5420
5446
  };
5421
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
+
5422
5518
  // src/resources/webhooks.ts
5423
5519
  function isSubscriptionLifecycleWebhook(object) {
5424
5520
  return typeof object.transition_id === "string";
@@ -7608,7 +7704,48 @@ var CheckoutMethods = class {
7608
7704
  query: { merchant_id: merchantId }
7609
7705
  });
7610
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
+ }
7611
7744
  };
7745
+ function entriesPath(profileId, environment) {
7746
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
7747
+ return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;
7748
+ }
7612
7749
 
7613
7750
  // src/resources/subscriptions.ts
7614
7751
  var Subscriptions = class {
@@ -9626,6 +9763,7 @@ var Delopay = class {
9626
9763
  this.profileAcquirers = new ProfileAcquirers(request);
9627
9764
  this.authentication = new Authentication(request);
9628
9765
  this.verification = new Verification(request);
9766
+ this.identityVerifications = new IdentityVerifications(request);
9629
9767
  this.users = new Users(request);
9630
9768
  this.apiKeys = new ApiKeys(request);
9631
9769
  this.billing = new Billing(request);
@@ -13487,6 +13625,10 @@ var CheckoutSession = class {
13487
13625
  * `cardAccount` name that form's connector and account; absent or blank
13488
13626
  * matches any.
13489
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
+ *
13490
13632
  * `GET /payment-link/data/{merchantId}/{paymentId}`
13491
13633
  */
13492
13634
  async fetchCheckoutData(params, options) {
@@ -13500,7 +13642,8 @@ var CheckoutSession = class {
13500
13642
  country: country || void 0,
13501
13643
  card_only: params?.cardOnly || void 0,
13502
13644
  card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
13503
- 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
13504
13647
  },
13505
13648
  ...options,
13506
13649
  headers: {
@@ -13981,6 +14124,43 @@ var CheckoutSession = class {
13981
14124
  headers: this.bearerHeaders(options?.headers)
13982
14125
  });
13983
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
+ }
13984
14164
  /**
13985
14165
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
13986
14166
  * form's pre-submit hook.
@@ -14703,6 +14883,20 @@ function focusedCheckoutUrl(params) {
14703
14883
  if (params.customFieldsCollected) query.set("cf", "1");
14704
14884
  return `${path}?${query.toString()}`;
14705
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
+ }
14706
14900
  var CHECKOUT_EVENT_KINDS = [
14707
14901
  "native_pane_selected",
14708
14902
  "native_pane_tab_opened",
@@ -14791,6 +14985,7 @@ var encodeNativePanes = encodePanes;
14791
14985
  Forex,
14792
14986
  GOOGLE_PAY_BUTTON_COLORS,
14793
14987
  GOOGLE_PAY_BUTTON_TYPES,
14988
+ IdentityVerifications,
14794
14989
  InvoiceSettingsResource,
14795
14990
  Invoices,
14796
14991
  LOCALIZABLE_COPY_FIELDS,
@@ -14882,6 +15077,7 @@ var encodeNativePanes = encodePanes;
14882
15077
  cardFieldFontPx,
14883
15078
  cardFieldWeightValue,
14884
15079
  checkoutCopy,
15080
+ checkoutEntryUrl,
14885
15081
  checkoutLocaleDir,
14886
15082
  cloneBranding,
14887
15083
  cloneCustomField,
@@ -14928,6 +15124,7 @@ var encodeNativePanes = encodePanes;
14928
15124
  fontWeightValue,
14929
15125
  inputPadValue,
14930
15126
  isCheckboxChecked,
15127
+ isCheckoutOpenEntryMessage,
14931
15128
  isConfirmedChild,
14932
15129
  isDarkSurface,
14933
15130
  isDefaultBadgeSet,