@delopay/sdk 0.140.0 → 0.142.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/README.md CHANGED
@@ -211,9 +211,14 @@ const opts = { headers: { 'X-Profile-Id': profileId } };
211
211
  **Browse plans and estimate cost** before creating anything:
212
212
 
213
213
  ```typescript
214
- // List purchasable plans (or addons) with their prices
214
+ // List plans (or addons) with their prices. An item the processor lists but
215
+ // cannot sell right now comes back with `available: false` and no prices;
216
+ // skip it rather than offering it.
215
217
  const plans = await delopay.subscriptions.getItems({ item_type: 'plan' }, opts);
216
- const priceId = plans[0]?.price_id[0]?.price_id;
218
+ const priceId = plans.find((item) => item.available)?.price_id[0]?.price_id;
219
+ if (!priceId) {
220
+ throw new Error('No purchasable plan on this shop');
221
+ }
217
222
 
218
223
  // Preview what the customer will be charged
219
224
  const estimate = await delopay.subscriptions.getEstimate({ item_price_id: priceId }, opts);
@@ -640,7 +640,10 @@ var Connectors = class {
640
640
  * revoke an account's ability to take payments while the credentials stay
641
641
  * perfectly valid, and then a credential check reports healthy while every
642
642
  * checkout silently stalls. This asks the account's own status instead, and
643
- * is a plain read — it costs the merchant nothing and is safe to call twice.
643
+ * does not create a payment. By default it reads a scheduler snapshot;
644
+ * `refresh: true` asks for a new probe and `stale` identifies an overdue result.
645
+ * `test_mode` selects the requested environment; `credential_source` identifies
646
+ * a sandbox, live or shared credential set. Not every provider reports chargeability.
644
647
  *
645
648
  * Connectors with no probe answer `state: 'unknown'` with
646
649
  * `unknown_reason: 'connector_not_supported'`, rather than an error — every
@@ -650,10 +653,11 @@ var Connectors = class {
650
653
  *
651
654
  * `GET /account/{accountId}/connectors/{connectorId}/health`
652
655
  */
653
- async health(accountId, connectorId) {
656
+ async health(accountId, connectorId, options) {
654
657
  return this.request(
655
658
  "GET",
656
- `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/health`
659
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/health`,
660
+ { query: options }
657
661
  );
658
662
  }
659
663
  /** Verify connector credentials. `POST /account/connectors/verify` */
@@ -3664,6 +3668,9 @@ var Verification = class {
3664
3668
  };
3665
3669
 
3666
3670
  // src/resources/webhooks.ts
3671
+ function isSubscriptionLifecycleWebhook(object) {
3672
+ return typeof object.transition_id === "string";
3673
+ }
3667
3674
  function hexToBytes(hex) {
3668
3675
  if (hex.length === 0 || hex.length % 2 !== 0) return null;
3669
3676
  const bytes = new Uint8Array(hex.length / 2);
@@ -7949,6 +7956,7 @@ export {
7949
7956
  DelopayError,
7950
7957
  DelopayAuthenticationError,
7951
7958
  Search,
7959
+ isSubscriptionLifecycleWebhook,
7952
7960
  Webhooks,
7953
7961
  Analytics,
7954
7962
  AnalyticsDashboard,
@@ -8115,4 +8123,4 @@ export {
8115
8123
  decodeNativePanes,
8116
8124
  encodeNativePanes
8117
8125
  };
8118
- //# sourceMappingURL=chunk-WW33CCSB.js.map
8126
+ //# sourceMappingURL=chunk-SV2BCXV6.js.map