@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/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
  *
@@ -5436,6 +5462,76 @@ var Verification = class {
5436
5462
  }
5437
5463
  };
5438
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
+
5439
5535
  // src/resources/webhooks.ts
5440
5536
  function isSubscriptionLifecycleWebhook(object) {
5441
5537
  return typeof object.transition_id === "string";
@@ -7625,7 +7721,48 @@ var CheckoutMethods = class {
7625
7721
  query: { merchant_id: merchantId }
7626
7722
  });
7627
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
+ }
7628
7761
  };
7762
+ function entriesPath(profileId, environment) {
7763
+ const shop = `/checkout-methods/${encodeURIComponent(profileId)}`;
7764
+ return environment === "test" ? `${shop}/test/entries` : `${shop}/entries`;
7765
+ }
7629
7766
 
7630
7767
  // src/resources/subscriptions.ts
7631
7768
  var Subscriptions = class {
@@ -9643,6 +9780,7 @@ var Delopay = class {
9643
9780
  this.profileAcquirers = new ProfileAcquirers(request);
9644
9781
  this.authentication = new Authentication(request);
9645
9782
  this.verification = new Verification(request);
9783
+ this.identityVerifications = new IdentityVerifications(request);
9646
9784
  this.users = new Users(request);
9647
9785
  this.apiKeys = new ApiKeys(request);
9648
9786
  this.billing = new Billing(request);
@@ -13504,6 +13642,10 @@ var CheckoutSession = class {
13504
13642
  * `cardAccount` name that form's connector and account; absent or blank
13505
13643
  * matches any.
13506
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
+ *
13507
13649
  * `GET /payment-link/data/{merchantId}/{paymentId}`
13508
13650
  */
13509
13651
  async fetchCheckoutData(params, options) {
@@ -13517,7 +13659,8 @@ var CheckoutSession = class {
13517
13659
  country: country || void 0,
13518
13660
  card_only: params?.cardOnly || void 0,
13519
13661
  card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
13520
- 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
13521
13664
  },
13522
13665
  ...options,
13523
13666
  headers: {
@@ -13998,6 +14141,43 @@ var CheckoutSession = class {
13998
14141
  headers: this.bearerHeaders(options?.headers)
13999
14142
  });
14000
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
+ }
14001
14181
  /**
14002
14182
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
14003
14183
  * form's pre-submit hook.
@@ -14720,6 +14900,20 @@ function focusedCheckoutUrl(params) {
14720
14900
  if (params.customFieldsCollected) query.set("cf", "1");
14721
14901
  return `${path}?${query.toString()}`;
14722
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
+ }
14723
14917
  var CHECKOUT_EVENT_KINDS = [
14724
14918
  "native_pane_selected",
14725
14919
  "native_pane_tab_opened",
@@ -15475,6 +15669,19 @@ var AdminPortal = class {
15475
15669
  `/admin-portal/transactions/${encodeURIComponent(paymentId)}/recover`
15476
15670
  );
15477
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
+ }
15478
15685
  /**
15479
15686
  * Client/device observations captured while the buyer interacted with a
15480
15687
  * transaction of ANY merchant, oldest first.
@@ -16603,6 +16810,7 @@ var DelopayInternal = class extends Delopay {
16603
16810
  GOOGLE_PAY_BUTTON_COLORS,
16604
16811
  GOOGLE_PAY_BUTTON_TYPES,
16605
16812
  Gsm,
16813
+ IdentityVerifications,
16606
16814
  InvoiceSettingsResource,
16607
16815
  Invoices,
16608
16816
  LOCALIZABLE_COPY_FIELDS,
@@ -16699,6 +16907,7 @@ var DelopayInternal = class extends Delopay {
16699
16907
  cardFieldFontPx,
16700
16908
  cardFieldWeightValue,
16701
16909
  checkoutCopy,
16910
+ checkoutEntryUrl,
16702
16911
  checkoutLocaleDir,
16703
16912
  cloneBranding,
16704
16913
  cloneCustomField,
@@ -16745,6 +16954,7 @@ var DelopayInternal = class extends Delopay {
16745
16954
  fontWeightValue,
16746
16955
  inputPadValue,
16747
16956
  isCheckboxChecked,
16957
+ isCheckoutOpenEntryMessage,
16748
16958
  isConfirmedChild,
16749
16959
  isDarkSurface,
16750
16960
  isDefaultBadgeSet,