@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.
- package/dist/{chunk-R4MDAZWF.js → chunk-GGXTGWV5.js} +100 -2
- package/dist/chunk-GGXTGWV5.js.map +1 -0
- package/dist/index.cjs +99 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +306 -10
- package/dist/index.d.ts +306 -10
- package/dist/index.js +1 -1
- package/dist/internal.cjs +99 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-R4MDAZWF.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1045,10 +1045,68 @@ var Customers = class {
|
|
|
1045
1045
|
query: toQuery(params)
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Retrieve one customer, scoped to the authenticated dashboard user's shop
|
|
1050
|
+
* (business profile). The shop-scoped counterpart of {@link retrieve}, and
|
|
1051
|
+
* what makes a shop's own customer list clickable: the list is
|
|
1052
|
+
* `ProfileCustomerRead` while {@link retrieve} is merchant-level, so a shop
|
|
1053
|
+
* member could see a customer they could not open.
|
|
1054
|
+
*
|
|
1055
|
+
* A customer belonging to a sibling shop answers `CustomerNotFound` — the
|
|
1056
|
+
* same answer as a customer that does not exist, deliberately, so one shop
|
|
1057
|
+
* cannot enumerate another's customer ids.
|
|
1058
|
+
*
|
|
1059
|
+
* `GET /customers/profile/{customerId}`
|
|
1060
|
+
*
|
|
1061
|
+
* @param customerId - The unique customer ID.
|
|
1062
|
+
* @returns The customer, with `profile_ids` narrowed to the caller's own shop.
|
|
1063
|
+
*/
|
|
1064
|
+
async retrieveByProfile(customerId) {
|
|
1065
|
+
return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}`);
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Create a customer from a shop, recording that it belongs to that shop so
|
|
1069
|
+
* the shop can see the customer it just created. The shop is taken from the
|
|
1070
|
+
* credential; a caller-chosen `customer_id` is rejected.
|
|
1071
|
+
*
|
|
1072
|
+
* `POST /customers/profile`
|
|
1073
|
+
*
|
|
1074
|
+
* @param params - The customer to create.
|
|
1075
|
+
* @returns The created customer.
|
|
1076
|
+
*/
|
|
1077
|
+
async createByProfile(params) {
|
|
1078
|
+
return this.request("POST", "/customers/profile", { body: params });
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Update a customer from a shop, if the customer belongs to that shop.
|
|
1082
|
+
* A sibling shop's customer answers `CustomerNotFound`, as with
|
|
1083
|
+
* {@link retrieveByProfile}.
|
|
1084
|
+
*
|
|
1085
|
+
* `POST /customers/profile/{customerId}`
|
|
1086
|
+
*
|
|
1087
|
+
* @param customerId - The customer ID to update.
|
|
1088
|
+
* @param params - Fields to update.
|
|
1089
|
+
* @returns The updated customer.
|
|
1090
|
+
*/
|
|
1091
|
+
async updateByProfile(customerId, params) {
|
|
1092
|
+
return this.request("POST", `/customers/profile/${encodeURIComponent(customerId)}`, {
|
|
1093
|
+
body: params
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1048
1096
|
/** List mandates for a customer. `GET /customers/{customerId}/mandates` */
|
|
1049
1097
|
async listMandates(customerId) {
|
|
1050
1098
|
return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
|
|
1051
1099
|
}
|
|
1100
|
+
/**
|
|
1101
|
+
* List one customer's mandates, scoped to the caller's shop. Same membership
|
|
1102
|
+
* rule as {@link retrieveByProfile}: a sibling shop's customer answers
|
|
1103
|
+
* `CustomerNotFound` before any mandate is read.
|
|
1104
|
+
*
|
|
1105
|
+
* `GET /customers/profile/{customerId}/mandates`
|
|
1106
|
+
*/
|
|
1107
|
+
async listMandatesByProfile(customerId) {
|
|
1108
|
+
return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}/mandates`);
|
|
1109
|
+
}
|
|
1052
1110
|
};
|
|
1053
1111
|
|
|
1054
1112
|
// src/resources/disputes.ts
|
|
@@ -1780,6 +1838,43 @@ var Payments = class {
|
|
|
1780
1838
|
options
|
|
1781
1839
|
);
|
|
1782
1840
|
}
|
|
1841
|
+
/**
|
|
1842
|
+
* What the payment's rail says about settling each attempt: whether the
|
|
1843
|
+
* money is still `pending` in the rail's hands, `available` in its balance
|
|
1844
|
+
* (**not** paid out), `paid_out` to a bank — with the payout's date and
|
|
1845
|
+
* reference — or came back as `payout_failed`; and, for the rest, which
|
|
1846
|
+
* kind of not-knowing applies (`unavailable`, `unknown`, `not_recorded`).
|
|
1847
|
+
* See {@link ConnectorSettlementStatus} for the seven values. The same
|
|
1848
|
+
* status for the active attempt rides on every list row and retrieve as
|
|
1849
|
+
* `connector_settlement_status`, and the list filters on it.
|
|
1850
|
+
*
|
|
1851
|
+
* Not the hosted-shop settlement API under `settlement.*`, which is host →
|
|
1852
|
+
* shop owner and manual; this is acquirer → merchant bank, per payment.
|
|
1853
|
+
*
|
|
1854
|
+
* `GET /payments/{paymentId}/settlement`
|
|
1855
|
+
*
|
|
1856
|
+
* @param paymentId - The payment intent ID.
|
|
1857
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
1858
|
+
* override, and an `AbortSignal`.
|
|
1859
|
+
* @returns The attempts this caller may see, oldest first, each with its
|
|
1860
|
+
* settlement status.
|
|
1861
|
+
* @throws If the payment does not exist (404), or the caller is a
|
|
1862
|
+
* profile-scoped (shop) role, who is refused rather than shown a redacted
|
|
1863
|
+
* body (403).
|
|
1864
|
+
*
|
|
1865
|
+
* @example
|
|
1866
|
+
* ```typescript
|
|
1867
|
+
* const { attempts } = await delopay.payments.settlement('pay_abc123');
|
|
1868
|
+
* for (const attempt of attempts) {
|
|
1869
|
+
* if (attempt.status === 'paid_out') {
|
|
1870
|
+
* console.log(attempt.paid_out_at, attempt.payout_reference);
|
|
1871
|
+
* }
|
|
1872
|
+
* }
|
|
1873
|
+
* ```
|
|
1874
|
+
*/
|
|
1875
|
+
async settlement(paymentId, options) {
|
|
1876
|
+
return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/settlement`, options);
|
|
1877
|
+
}
|
|
1783
1878
|
/**
|
|
1784
1879
|
* Update an existing payment intent before it is confirmed.
|
|
1785
1880
|
*
|
|
@@ -1951,7 +2046,10 @@ var Payments = class {
|
|
|
1951
2046
|
/**
|
|
1952
2047
|
* List payments by filter, scoped to the caller's profile (the shop-user
|
|
1953
2048
|
* twin of `listByFilter`). The backend narrows to the profile from the
|
|
1954
|
-
* auth context, so `profile_id` / `project_id` must not be sent
|
|
2049
|
+
* auth context, so `profile_id` / `project_id` must not be sent — and
|
|
2050
|
+
* neither may `connector_settlement_status`, which this route refuses
|
|
2051
|
+
* (403): a shop-scoped viewer is not shown the settlement state, and the
|
|
2052
|
+
* type leaves the key out so it cannot be probed through `total_count`.
|
|
1955
2053
|
*
|
|
1956
2054
|
* Not to be confused with {@link Payments.listByProfile}, which is the GET
|
|
1957
2055
|
* cursor variant and rejects this body.
|