@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.
@@ -2679,6 +2679,21 @@ var Payments = class {
2679
2679
  if (Object.keys(query).length === 0) return this.request("GET", path);
2680
2680
  return this.request("GET", path, { query });
2681
2681
  }
2682
+ /**
2683
+ * The payment's buyer risk evaluations, newest first (at most 50): each
2684
+ * one's score from 0 to 100, its band, the action the merchant's model asks
2685
+ * for that band and the action that was taken, the signals that fired with
2686
+ * the points each added, and the model version it was scored with.
2687
+ *
2688
+ * A payment is scored at every confirm that is about to reach a processor;
2689
+ * a payment never scored answers an empty list. A caller scoped to one shop
2690
+ * reads only that shop's payments.
2691
+ *
2692
+ * `GET /payments/{paymentId}/buyer-risk`
2693
+ */
2694
+ async buyerRisk(paymentId, options) {
2695
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);
2696
+ }
2682
2697
  /** Product names and prices as frozen when the payment was created. */
2683
2698
  async productLines(paymentId) {
2684
2699
  return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/lines`);
@@ -2842,6 +2857,12 @@ var Payments = class {
2842
2857
  * @param paymentId - The payment intent ID to confirm.
2843
2858
  * @param params - Confirmation parameters (payment method data, return URL, etc.).
2844
2859
  * @returns The updated payment intent.
2860
+ *
2861
+ * A buyer the merchant's buyer risk model refuses fails before any processor
2862
+ * is called, with a `DelopayError` of code `DE_23` (`buyer_risk_refused`,
2863
+ * HTTP 422). The error does not say which signal fired; read the evaluation
2864
+ * with {@link Payments.buyerRisk}. A shop whose payments are switched off is
2865
+ * refused with `DE_21`.
2845
2866
  */
2846
2867
  async confirm(paymentId, params) {
2847
2868
  return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/confirm`, {
@@ -3373,6 +3394,31 @@ var Profiles = class {
3373
3394
  { body: { is_archived: false } }
3374
3395
  );
3375
3396
  }
3397
+ /**
3398
+ * Switch a shop's payments off. While they are off the shop takes no new
3399
+ * payment: creating one, and confirming one no provider holds yet, is
3400
+ * refused with `DE_21`, and its hosted checkout does not render. A payment a
3401
+ * provider already holds is finished; refunds and disputes are unaffected.
3402
+ * Needs the `ShopPaymentsSwitch` area's `Write` and a signed-in user.
3403
+ * Repeating the same state is safe.
3404
+ *
3405
+ * `PUT /account/{accountId}/business-profile/{profileId}/payments-switch`
3406
+ */
3407
+ async disablePayments(accountId, profileId) {
3408
+ return this.request(
3409
+ "PUT",
3410
+ `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/payments-switch`,
3411
+ { body: { payments_disabled: true } }
3412
+ );
3413
+ }
3414
+ /** Switch a shop's payments on again after {@link Profiles.disablePayments}. */
3415
+ async enablePayments(accountId, profileId) {
3416
+ return this.request(
3417
+ "PUT",
3418
+ `/account/${encodeURIComponent(accountId)}/business-profile/${encodeURIComponent(profileId)}/payments-switch`,
3419
+ { body: { payments_disabled: false } }
3420
+ );
3421
+ }
3376
3422
  /** Archived shop identities in the caller's merchant and shop-read scope. */
3377
3423
  async listArchived(accountId) {
3378
3424
  return this.request(
@@ -14664,7 +14710,9 @@ var CheckoutSession = class {
14664
14710
  * The methods the buyer may pick for a subscription that waits for the
14665
14711
  * choice (`method_choice_pending`), judged for the buyer. Call it from the
14666
14712
  * buyer's browser: the sell-to country is read from this request's own
14667
- * connection. Authenticated with the subscription's client secret.
14713
+ * connection. A cancelled subscription answers 400, and one that already
14714
+ * bills on an account answers 409 (`DE_20`). Authenticated with the
14715
+ * subscription's client secret.
14668
14716
  *
14669
14717
  * `GET /subscriptions/method-options/{merchantId}/{subscriptionId}`
14670
14718
  */
@@ -14684,8 +14732,11 @@ var CheckoutSession = class {
14684
14732
  * again from this request; afterwards
14685
14733
  * {@link CheckoutSession.fetchSubscriptionData} describes the bound
14686
14734
  * subscription (Stripe's Payment Element for `card`, `confirmSubscription`
14687
- * for the others). A subscription that no longer waits answers 409
14688
- * (`DE_20`). Authenticated with the subscription's client secret.
14735
+ * for the others). Picking the same method again answers the bound
14736
+ * subscription. A subscription bound to another method already, or whose
14737
+ * billing account changed meanwhile, answers 409 (`DE_20`); a method not
14738
+ * offered to this buyer, or a cancelled subscription, answers 400.
14739
+ * Authenticated with the subscription's client secret.
14689
14740
  *
14690
14741
  * `POST /subscriptions/select-method/{merchantId}/{subscriptionId}`
14691
14742
  */
@@ -14975,7 +15026,8 @@ var CheckoutSession = class {
14975
15026
  * competing flow receives `false` and must reload; an unresolved provider
14976
15027
  * outcome stays reserved, regardless of elapsed time. A buyer-blocklist
14977
15028
  * refusal throws a `DelopayError` with code `DE_14`; a shop whose payments
14978
- * DeloPay stopped is refused with `DE_22`.
15029
+ * DeloPay stopped is refused with `DE_22`, and a shop whose payments the
15030
+ * merchant switched off with `DE_21`.
14979
15031
  *
14980
15032
  * `POST /payment-link/{merchantId}/{paymentId}/browser-card-claim`
14981
15033
  */
@@ -15001,8 +15053,11 @@ var CheckoutSession = class {
15001
15053
  * against the shop's sell-to restrictions before Stripe authorises, and a
15002
15054
  * refusal throws a `DelopayError` with code `DE_10`. A buyer on the
15003
15055
  * merchant's buyer blocklist is refused before any Stripe call with code
15004
- * `DE_14` (`buyer_blocked`, 422), which names no entry, and a shop whose
15005
- * payments DeloPay stopped with `DE_22`. When the answer's
15056
+ * `DE_14` (`buyer_blocked`, 422), which names no entry, a shop whose
15057
+ * payments DeloPay stopped with `DE_22`, and a shop whose payments the
15058
+ * merchant switched off with `DE_21`. A buyer the merchant's buyer risk
15059
+ * model refuses fails with `DE_23` (`buyer_risk_refused`, 422), which says
15060
+ * nothing about the signals. When the answer's
15006
15061
  * `status` is `requires_action`, run `stripe.handleNextAction` with its
15007
15062
  * `client_secret` — safe, because the intent is `confirmation_method=manual`
15008
15063
  * and that secret confirms nothing without the secret key — then call this
@@ -16149,4 +16204,4 @@ export {
16149
16204
  decodeNativePanes,
16150
16205
  encodeNativePanes
16151
16206
  };
16152
- //# sourceMappingURL=chunk-EPN4ZOGA.js.map
16207
+ //# sourceMappingURL=chunk-SL2XR4QR.js.map