@delopay/sdk 0.234.0 → 0.238.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-3NOAX6WN.js → chunk-H7EC7OQF.js} +112 -17
- package/dist/chunk-H7EC7OQF.js.map +1 -0
- package/dist/index.cjs +111 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +237 -5
- package/dist/index.d.ts +237 -5
- package/dist/index.js +1 -1
- package/dist/internal.cjs +111 -16
- 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-3NOAX6WN.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3227,6 +3227,44 @@ var Refunds = class {
|
|
|
3227
3227
|
return this.request("POST", "/refunds/list", { body: params });
|
|
3228
3228
|
}
|
|
3229
3229
|
// --- OLAP extensions (Task 4.3) ---
|
|
3230
|
+
/**
|
|
3231
|
+
* Refund requests buyers raised from the customer portal, newest first.
|
|
3232
|
+
* Limited to the caller's shop when the caller is scoped to one.
|
|
3233
|
+
* `GET /refund-requests`
|
|
3234
|
+
*/
|
|
3235
|
+
async listRequests(params) {
|
|
3236
|
+
return this.request("GET", "/refund-requests", {
|
|
3237
|
+
query: params
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
/**
|
|
3241
|
+
* Approve a buyer's refund request with a refund of its payment that has
|
|
3242
|
+
* succeeded, made with `create()` after the buyer asked. Approving records
|
|
3243
|
+
* the decision and moves no money. A refund that is still `pending` or in
|
|
3244
|
+
* `review` is refused: check it again later with `retrieve()` under the same
|
|
3245
|
+
* refund ID and approve once it has succeeded, rather than creating another
|
|
3246
|
+
* refund. `POST /refund-requests/{id}/approve`
|
|
3247
|
+
*
|
|
3248
|
+
* @example
|
|
3249
|
+
* ```typescript
|
|
3250
|
+
* const refund = await delopay.refunds.create({ payment_id: request.payment_id, amount: request.amount });
|
|
3251
|
+
* if (refund.status === 'succeeded') {
|
|
3252
|
+
* await delopay.refunds.approveRequest(request.id, { refund_id: refund.refund_id });
|
|
3253
|
+
* }
|
|
3254
|
+
* // Otherwise keep refund.refund_id, check it with retrieve() and approve once it has succeeded.
|
|
3255
|
+
* ```
|
|
3256
|
+
*/
|
|
3257
|
+
async approveRequest(requestId, params) {
|
|
3258
|
+
return this.request("POST", `/refund-requests/${encodeURIComponent(requestId)}/approve`, {
|
|
3259
|
+
body: params
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
/** Decline a buyer's refund request. The buyer sees the reply. `POST /refund-requests/{id}/decline` */
|
|
3263
|
+
async declineRequest(requestId, params) {
|
|
3264
|
+
return this.request("POST", `/refund-requests/${encodeURIComponent(requestId)}/decline`, {
|
|
3265
|
+
body: params
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3230
3268
|
/** List refunds (profile-scoped). `POST /refunds/profile/list` */
|
|
3231
3269
|
async listByProfile(params) {
|
|
3232
3270
|
return this.request("POST", "/refunds/profile/list", { body: params });
|
|
@@ -6991,6 +7029,29 @@ var BuyerPortal = class {
|
|
|
6991
7029
|
async getSession(options) {
|
|
6992
7030
|
return this.request("GET", "/buyer-portal/session", { ...options });
|
|
6993
7031
|
}
|
|
7032
|
+
/** The buyer's contact and billing details, and what they may change. */
|
|
7033
|
+
async getProfile(options) {
|
|
7034
|
+
return this.request("GET", "/buyer-portal/profile", { ...options });
|
|
7035
|
+
}
|
|
7036
|
+
/**
|
|
7037
|
+
* Change the buyer's contact and billing details. Fields left out stay as
|
|
7038
|
+
* they are; the merchant decides whether buyers may change them at all.
|
|
7039
|
+
*/
|
|
7040
|
+
async updateProfile(params, options) {
|
|
7041
|
+
return this.request("POST", "/buyer-portal/profile", { body: params, ...options });
|
|
7042
|
+
}
|
|
7043
|
+
/**
|
|
7044
|
+
* Ask the shop for a refund of one of the buyer's purchases, named by its
|
|
7045
|
+
* `id` from `listPurchases()`. Nothing is refunded until the shop approves
|
|
7046
|
+
* the request with a refund.
|
|
7047
|
+
*/
|
|
7048
|
+
async createRefundRequest(purchaseId, params, options) {
|
|
7049
|
+
return this.request(
|
|
7050
|
+
"POST",
|
|
7051
|
+
`/buyer-portal/purchases/${encodeURIComponent(purchaseId)}/refund-requests`,
|
|
7052
|
+
{ body: params, ...options }
|
|
7053
|
+
);
|
|
7054
|
+
}
|
|
6994
7055
|
async listInvoices(params, options) {
|
|
6995
7056
|
return this.request("GET", "/buyer-portal/invoices", {
|
|
6996
7057
|
query: params,
|
|
@@ -11569,6 +11630,21 @@ function withoutCredentialHeaders(extra) {
|
|
|
11569
11630
|
}
|
|
11570
11631
|
return out;
|
|
11571
11632
|
}
|
|
11633
|
+
function vaultFormQuery(params) {
|
|
11634
|
+
const look = params?.appearance;
|
|
11635
|
+
return {
|
|
11636
|
+
locale: params?.locale,
|
|
11637
|
+
form_surface: look?.surface,
|
|
11638
|
+
form_text: look?.text,
|
|
11639
|
+
form_border: look?.border,
|
|
11640
|
+
form_accent: look?.accent,
|
|
11641
|
+
form_danger: look?.danger,
|
|
11642
|
+
form_font: look?.font,
|
|
11643
|
+
form_radius: look?.radius,
|
|
11644
|
+
form_size: look?.size,
|
|
11645
|
+
form_labels: look?.labels
|
|
11646
|
+
};
|
|
11647
|
+
}
|
|
11572
11648
|
function withoutHeader(headers, name) {
|
|
11573
11649
|
const out = {};
|
|
11574
11650
|
for (const [key, value] of Object.entries(headers)) {
|
|
@@ -11988,21 +12064,31 @@ var CheckoutSession = class {
|
|
|
11988
12064
|
* `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
|
|
11989
12065
|
*/
|
|
11990
12066
|
async vaultCollectSession(options, params) {
|
|
11991
|
-
const look = params?.appearance;
|
|
11992
12067
|
return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
|
|
11993
12068
|
...options,
|
|
11994
|
-
query:
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12069
|
+
query: vaultFormQuery(params),
|
|
12070
|
+
headers: this.bearerHeaders(options?.headers)
|
|
12071
|
+
});
|
|
12072
|
+
}
|
|
12073
|
+
/**
|
|
12074
|
+
* The saved cards the buyer of this payment can pay with, on a shop whose
|
|
12075
|
+
* vault keeps the security code itself (Enigma Vault): the cards of the
|
|
12076
|
+
* payment's own customer that the shop's vault holds, most recently used
|
|
12077
|
+
* first. A payment without a customer answers an empty list.
|
|
12078
|
+
*
|
|
12079
|
+
* Draw saved cards from this list, not from the customer's payment-method
|
|
12080
|
+
* list: that one also carries cards the security-code form cannot open.
|
|
12081
|
+
* To pay with one, mint its form with {@link vaultSecurityCodeSession},
|
|
12082
|
+
* and confirm with its `payment_token` once the form reports the code
|
|
12083
|
+
* stored.
|
|
12084
|
+
*
|
|
12085
|
+
* A shop without a vault, and a VGS shop, answer `400`.
|
|
12086
|
+
*
|
|
12087
|
+
* `GET /payment-link/{merchantId}/{paymentId}/vault/saved-cards`
|
|
12088
|
+
*/
|
|
12089
|
+
async vaultSavedCards(options) {
|
|
12090
|
+
return this.client.request("GET", `${this.linkBase}/vault/saved-cards`, {
|
|
12091
|
+
...options,
|
|
12006
12092
|
headers: this.bearerHeaders(options?.headers)
|
|
12007
12093
|
});
|
|
12008
12094
|
}
|
|
@@ -12012,15 +12098,24 @@ var CheckoutSession = class {
|
|
|
12012
12098
|
* vault's own form, so it never reaches the checkout; confirm with the saved
|
|
12013
12099
|
* card's `payment_token` once the form reports it stored.
|
|
12014
12100
|
*
|
|
12015
|
-
* `paymentToken` is the saved card's token from
|
|
12101
|
+
* `paymentToken` is the saved card's token from {@link vaultSavedCards}. A
|
|
12016
12102
|
* VGS shop answers `400`: VGS re-collects the code with Collect.
|
|
12017
12103
|
*
|
|
12104
|
+
* `params.appearance` asks for a form styled to match the page, as on
|
|
12105
|
+
* {@link vaultCollectSession}. The styled form is the security-code field
|
|
12106
|
+
* alone, with no label: draw the label beside the frame, and size the frame
|
|
12107
|
+
* to the answer's `height`. `labels` is ignored. If the vault refuses the
|
|
12108
|
+
* styled form the answer is the plain one, without `height`.
|
|
12109
|
+
*
|
|
12110
|
+
* The form stores one code and then disables itself. After a failed
|
|
12111
|
+
* payment, mint a new form before the buyer tries again.
|
|
12112
|
+
*
|
|
12018
12113
|
* `GET /payment-link/{merchantId}/{paymentId}/vault/security-code-session`
|
|
12019
12114
|
*/
|
|
12020
|
-
async vaultSecurityCodeSession(paymentToken, options) {
|
|
12115
|
+
async vaultSecurityCodeSession(paymentToken, options, params) {
|
|
12021
12116
|
return this.client.request("GET", `${this.linkBase}/vault/security-code-session`, {
|
|
12022
12117
|
...options,
|
|
12023
|
-
query: { payment_token: paymentToken },
|
|
12118
|
+
query: { payment_token: paymentToken, ...vaultFormQuery(params) },
|
|
12024
12119
|
headers: this.bearerHeaders(options?.headers)
|
|
12025
12120
|
});
|
|
12026
12121
|
}
|