@delopay/sdk 0.337.0 → 0.338.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(
@@ -14952,7 +14998,9 @@ var CheckoutSession = class {
14952
14998
  * The methods the buyer may pick for a subscription that waits for the
14953
14999
  * choice (`method_choice_pending`), judged for the buyer. Call it from the
14954
15000
  * buyer's browser: the sell-to country is read from this request's own
14955
- * connection. Authenticated with the subscription's client secret.
15001
+ * connection. A cancelled subscription answers 400, and one that already
15002
+ * bills on an account answers 409 (`DE_20`). Authenticated with the
15003
+ * subscription's client secret.
14956
15004
  *
14957
15005
  * `GET /subscriptions/method-options/{merchantId}/{subscriptionId}`
14958
15006
  */
@@ -14972,8 +15020,11 @@ var CheckoutSession = class {
14972
15020
  * again from this request; afterwards
14973
15021
  * {@link CheckoutSession.fetchSubscriptionData} describes the bound
14974
15022
  * 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.
15023
+ * for the others). Picking the same method again answers the bound
15024
+ * subscription. A subscription bound to another method already, or whose
15025
+ * billing account changed meanwhile, answers 409 (`DE_20`); a method not
15026
+ * offered to this buyer, or a cancelled subscription, answers 400.
15027
+ * Authenticated with the subscription's client secret.
14977
15028
  *
14978
15029
  * `POST /subscriptions/select-method/{merchantId}/{subscriptionId}`
14979
15030
  */
@@ -15263,7 +15314,8 @@ var CheckoutSession = class {
15263
15314
  * competing flow receives `false` and must reload; an unresolved provider
15264
15315
  * outcome stays reserved, regardless of elapsed time. A buyer-blocklist
15265
15316
  * refusal throws a `DelopayError` with code `DE_14`; a shop whose payments
15266
- * DeloPay stopped is refused with `DE_22`.
15317
+ * DeloPay stopped is refused with `DE_22`, and a shop whose payments the
15318
+ * merchant switched off with `DE_21`.
15267
15319
  *
15268
15320
  * `POST /payment-link/{merchantId}/{paymentId}/browser-card-claim`
15269
15321
  */
@@ -15289,8 +15341,11 @@ var CheckoutSession = class {
15289
15341
  * against the shop's sell-to restrictions before Stripe authorises, and a
15290
15342
  * refusal throws a `DelopayError` with code `DE_10`. A buyer on the
15291
15343
  * 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
15344
+ * `DE_14` (`buyer_blocked`, 422), which names no entry, a shop whose
15345
+ * payments DeloPay stopped with `DE_22`, and a shop whose payments the
15346
+ * merchant switched off with `DE_21`. A buyer the merchant's buyer risk
15347
+ * model refuses fails with `DE_23` (`buyer_risk_refused`, 422), which says
15348
+ * nothing about the signals. When the answer's
15294
15349
  * `status` is `requires_action`, run `stripe.handleNextAction` with its
15295
15350
  * `client_secret` — safe, because the intent is `confirmation_method=manual`
15296
15351
  * and that secret confirms nothing without the secret key — then call this