@delopay/sdk 0.134.0 → 0.136.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.
@@ -870,10 +870,68 @@ var Customers = class {
870
870
  query: toQuery(params)
871
871
  });
872
872
  }
873
+ /**
874
+ * Retrieve one customer, scoped to the authenticated dashboard user's shop
875
+ * (business profile). The shop-scoped counterpart of {@link retrieve}, and
876
+ * what makes a shop's own customer list clickable: the list is
877
+ * `ProfileCustomerRead` while {@link retrieve} is merchant-level, so a shop
878
+ * member could see a customer they could not open.
879
+ *
880
+ * A customer belonging to a sibling shop answers `CustomerNotFound` — the
881
+ * same answer as a customer that does not exist, deliberately, so one shop
882
+ * cannot enumerate another's customer ids.
883
+ *
884
+ * `GET /customers/profile/{customerId}`
885
+ *
886
+ * @param customerId - The unique customer ID.
887
+ * @returns The customer, with `profile_ids` narrowed to the caller's own shop.
888
+ */
889
+ async retrieveByProfile(customerId) {
890
+ return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}`);
891
+ }
892
+ /**
893
+ * Create a customer from a shop, recording that it belongs to that shop so
894
+ * the shop can see the customer it just created. The shop is taken from the
895
+ * credential; a caller-chosen `customer_id` is rejected.
896
+ *
897
+ * `POST /customers/profile`
898
+ *
899
+ * @param params - The customer to create.
900
+ * @returns The created customer.
901
+ */
902
+ async createByProfile(params) {
903
+ return this.request("POST", "/customers/profile", { body: params });
904
+ }
905
+ /**
906
+ * Update a customer from a shop, if the customer belongs to that shop.
907
+ * A sibling shop's customer answers `CustomerNotFound`, as with
908
+ * {@link retrieveByProfile}.
909
+ *
910
+ * `POST /customers/profile/{customerId}`
911
+ *
912
+ * @param customerId - The customer ID to update.
913
+ * @param params - Fields to update.
914
+ * @returns The updated customer.
915
+ */
916
+ async updateByProfile(customerId, params) {
917
+ return this.request("POST", `/customers/profile/${encodeURIComponent(customerId)}`, {
918
+ body: params
919
+ });
920
+ }
873
921
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
874
922
  async listMandates(customerId) {
875
923
  return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
876
924
  }
925
+ /**
926
+ * List one customer's mandates, scoped to the caller's shop. Same membership
927
+ * rule as {@link retrieveByProfile}: a sibling shop's customer answers
928
+ * `CustomerNotFound` before any mandate is read.
929
+ *
930
+ * `GET /customers/profile/{customerId}/mandates`
931
+ */
932
+ async listMandatesByProfile(customerId) {
933
+ return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}/mandates`);
934
+ }
877
935
  };
878
936
 
879
937
  // src/resources/disputes.ts
@@ -1605,6 +1663,43 @@ var Payments = class {
1605
1663
  options
1606
1664
  );
1607
1665
  }
1666
+ /**
1667
+ * What the payment's rail says about settling each attempt: whether the
1668
+ * money is still `pending` in the rail's hands, `available` in its balance
1669
+ * (**not** paid out), `paid_out` to a bank — with the payout's date and
1670
+ * reference — or came back as `payout_failed`; and, for the rest, which
1671
+ * kind of not-knowing applies (`unavailable`, `unknown`, `not_recorded`).
1672
+ * See {@link ConnectorSettlementStatus} for the seven values. The same
1673
+ * status for the active attempt rides on every list row and retrieve as
1674
+ * `connector_settlement_status`, and the list filters on it.
1675
+ *
1676
+ * Not the hosted-shop settlement API under `settlement.*`, which is host →
1677
+ * shop owner and manual; this is acquirer → merchant bank, per payment.
1678
+ *
1679
+ * `GET /payments/{paymentId}/settlement`
1680
+ *
1681
+ * @param paymentId - The payment intent ID.
1682
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
1683
+ * override, and an `AbortSignal`.
1684
+ * @returns The attempts this caller may see, oldest first, each with its
1685
+ * settlement status.
1686
+ * @throws If the payment does not exist (404), or the caller is a
1687
+ * profile-scoped (shop) role, who is refused rather than shown a redacted
1688
+ * body (403).
1689
+ *
1690
+ * @example
1691
+ * ```typescript
1692
+ * const { attempts } = await delopay.payments.settlement('pay_abc123');
1693
+ * for (const attempt of attempts) {
1694
+ * if (attempt.status === 'paid_out') {
1695
+ * console.log(attempt.paid_out_at, attempt.payout_reference);
1696
+ * }
1697
+ * }
1698
+ * ```
1699
+ */
1700
+ async settlement(paymentId, options) {
1701
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/settlement`, options);
1702
+ }
1608
1703
  /**
1609
1704
  * Update an existing payment intent before it is confirmed.
1610
1705
  *
@@ -1776,7 +1871,10 @@ var Payments = class {
1776
1871
  /**
1777
1872
  * List payments by filter, scoped to the caller's profile (the shop-user
1778
1873
  * twin of `listByFilter`). The backend narrows to the profile from the
1779
- * auth context, so `profile_id` / `project_id` must not be sent.
1874
+ * auth context, so `profile_id` / `project_id` must not be sent — and
1875
+ * neither may `connector_settlement_status`, which this route refuses
1876
+ * (403): a shop-scoped viewer is not shown the settlement state, and the
1877
+ * type leaves the key out so it cannot be probed through `total_count`.
1780
1878
  *
1781
1879
  * Not to be confused with {@link Payments.listByProfile}, which is the GET
1782
1880
  * cursor variant and rejects this body.
@@ -7699,4 +7797,4 @@ export {
7699
7797
  decodeNativePanes,
7700
7798
  encodeNativePanes
7701
7799
  };
7702
- //# sourceMappingURL=chunk-R4MDAZWF.js.map
7800
+ //# sourceMappingURL=chunk-GGXTGWV5.js.map