@delopay/sdk 0.337.0 → 0.342.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
@@ -2967,6 +2967,21 @@ var Payments = class {
2967
2967
  if (Object.keys(query).length === 0) return this.request("GET", path);
2968
2968
  return this.request("GET", path, { query });
2969
2969
  }
2970
+ /**
2971
+ * The payment's buyer risk evaluations, newest first (at most 50): each
2972
+ * one's score from 0 to 100, its band, the action the merchant's model asks
2973
+ * for that band and the action that was taken, the signals that fired with
2974
+ * the points each added, and the model version it was scored with.
2975
+ *
2976
+ * A payment is scored at every confirm that is about to reach a processor;
2977
+ * a payment never scored answers an empty list. A caller scoped to one shop
2978
+ * reads only that shop's payments.
2979
+ *
2980
+ * `GET /payments/{paymentId}/buyer-risk`
2981
+ */
2982
+ async buyerRisk(paymentId, options) {
2983
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);
2984
+ }
2970
2985
  /** Product names and prices as frozen when the payment was created. */
2971
2986
  async productLines(paymentId) {
2972
2987
  return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/lines`);
@@ -3130,6 +3145,12 @@ var Payments = class {
3130
3145
  * @param paymentId - The payment intent ID to confirm.
3131
3146
  * @param params - Confirmation parameters (payment method data, return URL, etc.).
3132
3147
  * @returns The updated payment intent.
3148
+ *
3149
+ * A buyer the merchant's buyer risk model refuses fails before any processor
3150
+ * is called, with a `DelopayError` of code `DE_23` (`buyer_risk_refused`,
3151
+ * HTTP 422). The error does not say which signal fired; read the evaluation
3152
+ * with {@link Payments.buyerRisk}. A shop whose payments are switched off is
3153
+ * refused with `DE_21`.
3133
3154
  */
3134
3155
  async confirm(paymentId, params) {
3135
3156
  return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/confirm`, {
@@ -3661,6 +3682,31 @@ var Profiles = class {
3661
3682
  { body: { is_archived: false } }
3662
3683
  );
3663
3684
  }
3685
+ /**
3686
+ * Switch a shop's payments off. While they are off the shop takes no new
3687
+ * payment: creating one, and confirming one no provider holds yet, is
3688
+ * refused with `DE_21`, and its hosted checkout does not render. A payment a
3689
+ * provider already holds is finished; refunds and disputes are unaffected.
3690
+ * Needs the `ShopPaymentsSwitch` area's `Write` and a signed-in user.
3691
+ * Repeating the same state is safe.
3692
+ *
3693
+ * `PUT /account/{accountId}/business-profile/{profileId}/payments-switch`
3694
+ */
3695
+ async disablePayments(accountId, profileId) {
3696
+ return this.request(
3697
+ "PUT",
3698
+ `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/payments-switch`,
3699
+ { body: { payments_disabled: true } }
3700
+ );
3701
+ }
3702
+ /** Switch a shop's payments on again after {@link Profiles.disablePayments}. */
3703
+ async enablePayments(accountId, profileId) {
3704
+ return this.request(
3705
+ "PUT",
3706
+ `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/payments-switch`,
3707
+ { body: { payments_disabled: false } }
3708
+ );
3709
+ }
3664
3710
  /** Archived shop identities in the caller's merchant and shop-read scope. */
3665
3711
  async listArchived(accountId) {
3666
3712
  return this.request(
@@ -4321,6 +4367,20 @@ var Routing = class {
4321
4367
  body: params
4322
4368
  });
4323
4369
  }
4370
+ /**
4371
+ * Reset one limit's usage for the window open now: what settled payments
4372
+ * spent stops counting, so the account takes payments again. Payments still
4373
+ * in flight keep their hold and count once they complete. The account's
4374
+ * other limit is untouched. Offered by a router that lists `usage_reset` in
4375
+ * `features`; refused (422) for an account with no limit in that unit.
4376
+ *
4377
+ * `POST /routing/connector-caps/{profileId}/reset`
4378
+ */
4379
+ async resetConnectorCapUsage(profileId, params) {
4380
+ return this.request("POST", `/routing/connector-caps/${encodeURIComponent(profileId)}/reset`, {
4381
+ body: params
4382
+ });
4383
+ }
4324
4384
  /**
4325
4385
  * List all routing algorithms for the current merchant.
4326
4386
  *
@@ -6859,12 +6919,44 @@ var BuyerBlocklist = class {
6859
6919
  /**
6860
6920
  * Block the buyer of a payment by the identifiers the payment carries:
6861
6921
  * its card (the Stripe fingerprint), email, IP, device or customer, in the
6862
- * payment's shop or in every shop.
6922
+ * payment's shop or in every shop. With `all_ips`, also every address the
6923
+ * buyer was seen paying from, one entry each, grouped under one
6924
+ * `group_id`; the answer then carries `ip_snapshot`.
6863
6925
  * `POST /buyer-blocklist/from-payment`
6864
6926
  */
6865
6927
  async createFromPayment(params) {
6866
6928
  return this.request("POST", "/buyer-blocklist/from-payment", { body: params });
6867
6929
  }
6930
+ /**
6931
+ * The addresses an "all IPs" block of a payment's buyer would take: the
6932
+ * payment's own, then those its device, email or card were seen at in the
6933
+ * last 90 days, newest first, at most 20. An address shared with two or
6934
+ * more other buyers is offered but not preselected. Writes nothing; needs
6935
+ * the same permissions as the block.
6936
+ * `POST /buyer-blocklist/from-payment/preview`
6937
+ */
6938
+ async previewFromPayment(params) {
6939
+ return this.request("POST", "/buyer-blocklist/from-payment/preview", { body: params });
6940
+ }
6941
+ /**
6942
+ * An entry's recorded refusals, newest first, with where each happened and
6943
+ * which identifier matched. A caller scoped to one shop reaches only its own
6944
+ * shop's entries.
6945
+ * `GET /buyer-blocklist/{entry_id}/events`
6946
+ */
6947
+ async listEvents(entryId, params) {
6948
+ return this.request("GET", `/buyer-blocklist/${encodeURIComponent(entryId)}/events`, {
6949
+ query: params
6950
+ });
6951
+ }
6952
+ /**
6953
+ * Which classes of network an `ip_class` entry can be judged by on this
6954
+ * deployment now, and by which sources.
6955
+ * `GET /buyer-blocklist/capabilities`
6956
+ */
6957
+ async capabilities() {
6958
+ return this.request("GET", "/buyer-blocklist/capabilities");
6959
+ }
6868
6960
  /**
6869
6961
  * Retry now every failed or pending Radar sync of an entry.
6870
6962
  * `POST /buyer-blocklist/{entry_id}/sync/retry`
@@ -14952,7 +15044,9 @@ var CheckoutSession = class {
14952
15044
  * The methods the buyer may pick for a subscription that waits for the
14953
15045
  * choice (`method_choice_pending`), judged for the buyer. Call it from the
14954
15046
  * buyer's browser: the sell-to country is read from this request's own
14955
- * connection. Authenticated with the subscription's client secret.
15047
+ * connection. A cancelled subscription answers 400, and one that already
15048
+ * bills on an account answers 409 (`DE_20`). Authenticated with the
15049
+ * subscription's client secret.
14956
15050
  *
14957
15051
  * `GET /subscriptions/method-options/{merchantId}/{subscriptionId}`
14958
15052
  */
@@ -14972,8 +15066,11 @@ var CheckoutSession = class {
14972
15066
  * again from this request; afterwards
14973
15067
  * {@link CheckoutSession.fetchSubscriptionData} describes the bound
14974
15068
  * subscription (Stripe's Payment Element for `card`, `confirmSubscription`
14975
- * for the others). A subscription that no longer waits answers 409
14976
- * (`DE_20`). Authenticated with the subscription's client secret.
15069
+ * for the others). Picking the same method again answers the bound
15070
+ * subscription. A subscription bound to another method already, or whose
15071
+ * billing account changed meanwhile, answers 409 (`DE_20`); a method not
15072
+ * offered to this buyer, or a cancelled subscription, answers 400.
15073
+ * Authenticated with the subscription's client secret.
14977
15074
  *
14978
15075
  * `POST /subscriptions/select-method/{merchantId}/{subscriptionId}`
14979
15076
  */
@@ -15263,7 +15360,8 @@ var CheckoutSession = class {
15263
15360
  * competing flow receives `false` and must reload; an unresolved provider
15264
15361
  * outcome stays reserved, regardless of elapsed time. A buyer-blocklist
15265
15362
  * refusal throws a `DelopayError` with code `DE_14`; a shop whose payments
15266
- * DeloPay stopped is refused with `DE_22`.
15363
+ * DeloPay stopped is refused with `DE_22`, and a shop whose payments the
15364
+ * merchant switched off with `DE_21`.
15267
15365
  *
15268
15366
  * `POST /payment-link/{merchantId}/{paymentId}/browser-card-claim`
15269
15367
  */
@@ -15289,8 +15387,11 @@ var CheckoutSession = class {
15289
15387
  * against the shop's sell-to restrictions before Stripe authorises, and a
15290
15388
  * refusal throws a `DelopayError` with code `DE_10`. A buyer on the
15291
15389
  * merchant's buyer blocklist is refused before any Stripe call with code
15292
- * `DE_14` (`buyer_blocked`, 422), which names no entry, and a shop whose
15293
- * payments DeloPay stopped with `DE_22`. When the answer's
15390
+ * `DE_14` (`buyer_blocked`, 422), which names no entry, a shop whose
15391
+ * payments DeloPay stopped with `DE_22`, and a shop whose payments the
15392
+ * merchant switched off with `DE_21`. A buyer the merchant's buyer risk
15393
+ * model refuses fails with `DE_23` (`buyer_risk_refused`, 422), which says
15394
+ * nothing about the signals. When the answer's
15294
15395
  * `status` is `requires_action`, run `stripe.handleNextAction` with its
15295
15396
  * `client_secret` — safe, because the intent is `confirmation_method=manual`
15296
15397
  * and that secret confirms nothing without the secret key — then call this