@delopay/sdk 0.133.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
@@ -1043,11 +1101,39 @@ var Events = class {
1043
1101
  `/events/${encodeURIComponent(merchantId)}/${encodeURIComponent(eventId)}/retry`
1044
1102
  );
1045
1103
  }
1104
+ /**
1105
+ * Fire an outgoing webhook event by hand for one object.
1106
+ * `POST /events/{merchant_id}/trigger` (be#318)
1107
+ *
1108
+ * Not a replay — see {@link EventManualTriggerRequest}. Needs the
1109
+ * `WebhookEventTrigger` permission, which is separate from the one that
1110
+ * authorizes {@link retryDelivery}, and is JWT-only: a forged payload must
1111
+ * be attributable to a person.
1112
+ */
1113
+ async trigger(merchantId, body) {
1114
+ return this.request("POST", `/events/${encodeURIComponent(merchantId)}/trigger`, { body });
1115
+ }
1046
1116
  // --- Profile-scoped listing (Task 4.12) ---
1047
- /** List events (profile-scoped). `POST /events/profile/list` */
1117
+ /**
1118
+ * List events (profile-scoped). `POST /events/profile/list`
1119
+ *
1120
+ * Takes the same constraints as {@link list} — it is the same endpoint
1121
+ * narrowed to the caller's own shop, so `profile_id` is redundant and
1122
+ * ignored there.
1123
+ */
1048
1124
  async listByProfile(params) {
1049
1125
  return this.request("POST", "/events/profile/list", { body: params });
1050
1126
  }
1127
+ /**
1128
+ * Fire an outgoing webhook event by hand (profile-scoped).
1129
+ * `POST /events/profile/trigger` (be#318)
1130
+ *
1131
+ * The shop-user twin of {@link trigger}; the shop is taken from the auth
1132
+ * context, so `profile_id` on the body is ignored.
1133
+ */
1134
+ async triggerByProfile(body) {
1135
+ return this.request("POST", "/events/profile/trigger", { body });
1136
+ }
1051
1137
  };
1052
1138
 
1053
1139
  // src/resources/fees.ts
@@ -1577,6 +1663,43 @@ var Payments = class {
1577
1663
  options
1578
1664
  );
1579
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
+ }
1580
1703
  /**
1581
1704
  * Update an existing payment intent before it is confirmed.
1582
1705
  *
@@ -1748,7 +1871,10 @@ var Payments = class {
1748
1871
  /**
1749
1872
  * List payments by filter, scoped to the caller's profile (the shop-user
1750
1873
  * twin of `listByFilter`). The backend narrows to the profile from the
1751
- * 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`.
1752
1878
  *
1753
1879
  * Not to be confused with {@link Payments.listByProfile}, which is the GET
1754
1880
  * cursor variant and rejects this body.
@@ -7671,4 +7797,4 @@ export {
7671
7797
  decodeNativePanes,
7672
7798
  encodeNativePanes
7673
7799
  };
7674
- //# sourceMappingURL=chunk-GK3QZSRX.js.map
7800
+ //# sourceMappingURL=chunk-GGXTGWV5.js.map