@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.
- package/dist/{chunk-GK3QZSRX.js → chunk-GGXTGWV5.js} +129 -3
- package/dist/chunk-GGXTGWV5.js.map +1 -0
- package/dist/index.cjs +128 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +406 -15
- package/dist/index.d.ts +406 -15
- package/dist/index.js +1 -1
- package/dist/internal.cjs +128 -2
- 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-GK3QZSRX.js.map +0 -1
package/dist/internal.cjs
CHANGED
|
@@ -1057,10 +1057,68 @@ var Customers = class {
|
|
|
1057
1057
|
query: toQuery(params)
|
|
1058
1058
|
});
|
|
1059
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Retrieve one customer, scoped to the authenticated dashboard user's shop
|
|
1062
|
+
* (business profile). The shop-scoped counterpart of {@link retrieve}, and
|
|
1063
|
+
* what makes a shop's own customer list clickable: the list is
|
|
1064
|
+
* `ProfileCustomerRead` while {@link retrieve} is merchant-level, so a shop
|
|
1065
|
+
* member could see a customer they could not open.
|
|
1066
|
+
*
|
|
1067
|
+
* A customer belonging to a sibling shop answers `CustomerNotFound` — the
|
|
1068
|
+
* same answer as a customer that does not exist, deliberately, so one shop
|
|
1069
|
+
* cannot enumerate another's customer ids.
|
|
1070
|
+
*
|
|
1071
|
+
* `GET /customers/profile/{customerId}`
|
|
1072
|
+
*
|
|
1073
|
+
* @param customerId - The unique customer ID.
|
|
1074
|
+
* @returns The customer, with `profile_ids` narrowed to the caller's own shop.
|
|
1075
|
+
*/
|
|
1076
|
+
async retrieveByProfile(customerId) {
|
|
1077
|
+
return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}`);
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Create a customer from a shop, recording that it belongs to that shop so
|
|
1081
|
+
* the shop can see the customer it just created. The shop is taken from the
|
|
1082
|
+
* credential; a caller-chosen `customer_id` is rejected.
|
|
1083
|
+
*
|
|
1084
|
+
* `POST /customers/profile`
|
|
1085
|
+
*
|
|
1086
|
+
* @param params - The customer to create.
|
|
1087
|
+
* @returns The created customer.
|
|
1088
|
+
*/
|
|
1089
|
+
async createByProfile(params) {
|
|
1090
|
+
return this.request("POST", "/customers/profile", { body: params });
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Update a customer from a shop, if the customer belongs to that shop.
|
|
1094
|
+
* A sibling shop's customer answers `CustomerNotFound`, as with
|
|
1095
|
+
* {@link retrieveByProfile}.
|
|
1096
|
+
*
|
|
1097
|
+
* `POST /customers/profile/{customerId}`
|
|
1098
|
+
*
|
|
1099
|
+
* @param customerId - The customer ID to update.
|
|
1100
|
+
* @param params - Fields to update.
|
|
1101
|
+
* @returns The updated customer.
|
|
1102
|
+
*/
|
|
1103
|
+
async updateByProfile(customerId, params) {
|
|
1104
|
+
return this.request("POST", `/customers/profile/${encodeURIComponent(customerId)}`, {
|
|
1105
|
+
body: params
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1060
1108
|
/** List mandates for a customer. `GET /customers/{customerId}/mandates` */
|
|
1061
1109
|
async listMandates(customerId) {
|
|
1062
1110
|
return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
|
|
1063
1111
|
}
|
|
1112
|
+
/**
|
|
1113
|
+
* List one customer's mandates, scoped to the caller's shop. Same membership
|
|
1114
|
+
* rule as {@link retrieveByProfile}: a sibling shop's customer answers
|
|
1115
|
+
* `CustomerNotFound` before any mandate is read.
|
|
1116
|
+
*
|
|
1117
|
+
* `GET /customers/profile/{customerId}/mandates`
|
|
1118
|
+
*/
|
|
1119
|
+
async listMandatesByProfile(customerId) {
|
|
1120
|
+
return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}/mandates`);
|
|
1121
|
+
}
|
|
1064
1122
|
};
|
|
1065
1123
|
|
|
1066
1124
|
// src/resources/disputes.ts
|
|
@@ -1230,11 +1288,39 @@ var Events = class {
|
|
|
1230
1288
|
`/events/${encodeURIComponent(merchantId)}/${encodeURIComponent(eventId)}/retry`
|
|
1231
1289
|
);
|
|
1232
1290
|
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Fire an outgoing webhook event by hand for one object.
|
|
1293
|
+
* `POST /events/{merchant_id}/trigger` (be#318)
|
|
1294
|
+
*
|
|
1295
|
+
* Not a replay — see {@link EventManualTriggerRequest}. Needs the
|
|
1296
|
+
* `WebhookEventTrigger` permission, which is separate from the one that
|
|
1297
|
+
* authorizes {@link retryDelivery}, and is JWT-only: a forged payload must
|
|
1298
|
+
* be attributable to a person.
|
|
1299
|
+
*/
|
|
1300
|
+
async trigger(merchantId, body) {
|
|
1301
|
+
return this.request("POST", `/events/${encodeURIComponent(merchantId)}/trigger`, { body });
|
|
1302
|
+
}
|
|
1233
1303
|
// --- Profile-scoped listing (Task 4.12) ---
|
|
1234
|
-
/**
|
|
1304
|
+
/**
|
|
1305
|
+
* List events (profile-scoped). `POST /events/profile/list`
|
|
1306
|
+
*
|
|
1307
|
+
* Takes the same constraints as {@link list} — it is the same endpoint
|
|
1308
|
+
* narrowed to the caller's own shop, so `profile_id` is redundant and
|
|
1309
|
+
* ignored there.
|
|
1310
|
+
*/
|
|
1235
1311
|
async listByProfile(params) {
|
|
1236
1312
|
return this.request("POST", "/events/profile/list", { body: params });
|
|
1237
1313
|
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Fire an outgoing webhook event by hand (profile-scoped).
|
|
1316
|
+
* `POST /events/profile/trigger` (be#318)
|
|
1317
|
+
*
|
|
1318
|
+
* The shop-user twin of {@link trigger}; the shop is taken from the auth
|
|
1319
|
+
* context, so `profile_id` on the body is ignored.
|
|
1320
|
+
*/
|
|
1321
|
+
async triggerByProfile(body) {
|
|
1322
|
+
return this.request("POST", "/events/profile/trigger", { body });
|
|
1323
|
+
}
|
|
1238
1324
|
};
|
|
1239
1325
|
|
|
1240
1326
|
// src/resources/fees.ts
|
|
@@ -1764,6 +1850,43 @@ var Payments = class {
|
|
|
1764
1850
|
options
|
|
1765
1851
|
);
|
|
1766
1852
|
}
|
|
1853
|
+
/**
|
|
1854
|
+
* What the payment's rail says about settling each attempt: whether the
|
|
1855
|
+
* money is still `pending` in the rail's hands, `available` in its balance
|
|
1856
|
+
* (**not** paid out), `paid_out` to a bank — with the payout's date and
|
|
1857
|
+
* reference — or came back as `payout_failed`; and, for the rest, which
|
|
1858
|
+
* kind of not-knowing applies (`unavailable`, `unknown`, `not_recorded`).
|
|
1859
|
+
* See {@link ConnectorSettlementStatus} for the seven values. The same
|
|
1860
|
+
* status for the active attempt rides on every list row and retrieve as
|
|
1861
|
+
* `connector_settlement_status`, and the list filters on it.
|
|
1862
|
+
*
|
|
1863
|
+
* Not the hosted-shop settlement API under `settlement.*`, which is host →
|
|
1864
|
+
* shop owner and manual; this is acquirer → merchant bank, per payment.
|
|
1865
|
+
*
|
|
1866
|
+
* `GET /payments/{paymentId}/settlement`
|
|
1867
|
+
*
|
|
1868
|
+
* @param paymentId - The payment intent ID.
|
|
1869
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
1870
|
+
* override, and an `AbortSignal`.
|
|
1871
|
+
* @returns The attempts this caller may see, oldest first, each with its
|
|
1872
|
+
* settlement status.
|
|
1873
|
+
* @throws If the payment does not exist (404), or the caller is a
|
|
1874
|
+
* profile-scoped (shop) role, who is refused rather than shown a redacted
|
|
1875
|
+
* body (403).
|
|
1876
|
+
*
|
|
1877
|
+
* @example
|
|
1878
|
+
* ```typescript
|
|
1879
|
+
* const { attempts } = await delopay.payments.settlement('pay_abc123');
|
|
1880
|
+
* for (const attempt of attempts) {
|
|
1881
|
+
* if (attempt.status === 'paid_out') {
|
|
1882
|
+
* console.log(attempt.paid_out_at, attempt.payout_reference);
|
|
1883
|
+
* }
|
|
1884
|
+
* }
|
|
1885
|
+
* ```
|
|
1886
|
+
*/
|
|
1887
|
+
async settlement(paymentId, options) {
|
|
1888
|
+
return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/settlement`, options);
|
|
1889
|
+
}
|
|
1767
1890
|
/**
|
|
1768
1891
|
* Update an existing payment intent before it is confirmed.
|
|
1769
1892
|
*
|
|
@@ -1935,7 +2058,10 @@ var Payments = class {
|
|
|
1935
2058
|
/**
|
|
1936
2059
|
* List payments by filter, scoped to the caller's profile (the shop-user
|
|
1937
2060
|
* twin of `listByFilter`). The backend narrows to the profile from the
|
|
1938
|
-
* auth context, so `profile_id` / `project_id` must not be sent
|
|
2061
|
+
* auth context, so `profile_id` / `project_id` must not be sent — and
|
|
2062
|
+
* neither may `connector_settlement_status`, which this route refuses
|
|
2063
|
+
* (403): a shop-scoped viewer is not shown the settlement state, and the
|
|
2064
|
+
* type leaves the key out so it cannot be probed through `total_count`.
|
|
1939
2065
|
*
|
|
1940
2066
|
* Not to be confused with {@link Payments.listByProfile}, which is the GET
|
|
1941
2067
|
* cursor variant and rejects this body.
|