@delopay/sdk 0.147.0 → 0.150.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-CK3APM5M.js → chunk-NM2EROEY.js} +188 -27
- package/dist/chunk-NM2EROEY.js.map +1 -0
- package/dist/index.cjs +187 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +440 -77
- package/dist/index.d.ts +440 -77
- package/dist/index.js +1 -1
- package/dist/internal.cjs +188 -27
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +4 -4
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +2 -2
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CK3APM5M.js.map +0 -1
|
@@ -1153,7 +1153,7 @@ var Events = class {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
/**
|
|
1155
1155
|
* Fire an outgoing webhook event by hand for one object.
|
|
1156
|
-
* `POST /events/{merchant_id}/trigger`
|
|
1156
|
+
* `POST /events/{merchant_id}/trigger`
|
|
1157
1157
|
*
|
|
1158
1158
|
* Not a replay — see {@link EventManualTriggerRequest}. Needs the
|
|
1159
1159
|
* `WebhookEventTrigger` permission, which is separate from the one that
|
|
@@ -1176,7 +1176,7 @@ var Events = class {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
/**
|
|
1178
1178
|
* Fire an outgoing webhook event by hand (profile-scoped).
|
|
1179
|
-
* `POST /events/profile/trigger`
|
|
1179
|
+
* `POST /events/profile/trigger`
|
|
1180
1180
|
*
|
|
1181
1181
|
* The shop-user twin of {@link trigger}; the shop is taken from the auth
|
|
1182
1182
|
* context, so `profile_id` on the body is ignored.
|
|
@@ -1869,9 +1869,8 @@ var Payments = class {
|
|
|
1869
1869
|
);
|
|
1870
1870
|
}
|
|
1871
1871
|
/**
|
|
1872
|
-
* Open a playback of the payment's stored checkout recording
|
|
1873
|
-
*
|
|
1874
|
-
* watching. Answers the manifest — which slices exist, how long the
|
|
1872
|
+
* Open a playback of the payment's stored checkout recording: the audited
|
|
1873
|
+
* act of watching. Answers the manifest — which slices exist, how long the
|
|
1875
1874
|
* recording runs, whether a pause in it is expected — and the
|
|
1876
1875
|
* `playback_id` every {@link Payments.replaySlice} call carries.
|
|
1877
1876
|
*
|
|
@@ -4481,6 +4480,15 @@ var Audit = class {
|
|
|
4481
4480
|
};
|
|
4482
4481
|
|
|
4483
4482
|
// src/resources/settlement.ts
|
|
4483
|
+
function exportHeaders(options, accept) {
|
|
4484
|
+
const headers = new Headers(options?.headers);
|
|
4485
|
+
headers.set("Accept", accept);
|
|
4486
|
+
const output = {};
|
|
4487
|
+
headers.forEach((value, key) => {
|
|
4488
|
+
output[key] = value;
|
|
4489
|
+
});
|
|
4490
|
+
return output;
|
|
4491
|
+
}
|
|
4484
4492
|
var Settlement = class {
|
|
4485
4493
|
constructor(request) {
|
|
4486
4494
|
this.request = request;
|
|
@@ -4633,6 +4641,45 @@ var Settlement = class {
|
|
|
4633
4641
|
{ body: params, ...options }
|
|
4634
4642
|
);
|
|
4635
4643
|
}
|
|
4644
|
+
/** Append one external transfer record. Send a stable idempotency_key for safe retries. */
|
|
4645
|
+
async recordStatementPayout(statementId, params, options) {
|
|
4646
|
+
return this.request(
|
|
4647
|
+
"POST",
|
|
4648
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/payout`,
|
|
4649
|
+
{
|
|
4650
|
+
body: params,
|
|
4651
|
+
...options,
|
|
4652
|
+
bodyIdempotencyKey: params.idempotency_key ?? null
|
|
4653
|
+
}
|
|
4654
|
+
);
|
|
4655
|
+
}
|
|
4656
|
+
/** Read individual transfer records, their signed total, and any overpayment. */
|
|
4657
|
+
async listStatementPayouts(statementId, options) {
|
|
4658
|
+
return this.request(
|
|
4659
|
+
"GET",
|
|
4660
|
+
`/settlement/statements/${encodeURIComponent(statementId)}/payouts`,
|
|
4661
|
+
options
|
|
4662
|
+
);
|
|
4663
|
+
}
|
|
4664
|
+
/** Record a transfer against a shop's month before its statement exists. */
|
|
4665
|
+
async recordAdvance(params, options) {
|
|
4666
|
+
return this.request("POST", "/settlement/advances", {
|
|
4667
|
+
body: params,
|
|
4668
|
+
...options,
|
|
4669
|
+
bodyIdempotencyKey: params.idempotency_key ?? null
|
|
4670
|
+
});
|
|
4671
|
+
}
|
|
4672
|
+
async listAdvances(params, options) {
|
|
4673
|
+
return this.request("GET", "/settlement/advances", {
|
|
4674
|
+
query: {
|
|
4675
|
+
profile_id: params.profile_id,
|
|
4676
|
+
year: params.year,
|
|
4677
|
+
month: params.month,
|
|
4678
|
+
test_mode: params.test_mode
|
|
4679
|
+
},
|
|
4680
|
+
...options
|
|
4681
|
+
});
|
|
4682
|
+
}
|
|
4636
4683
|
/**
|
|
4637
4684
|
* Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
|
|
4638
4685
|
* the same auth, retries and error handling as every other call — persist
|
|
@@ -4750,6 +4797,109 @@ var Settlement = class {
|
|
|
4750
4797
|
options
|
|
4751
4798
|
);
|
|
4752
4799
|
}
|
|
4800
|
+
/**
|
|
4801
|
+
* Calculate a period in its transaction currency. Requires a host-level
|
|
4802
|
+
* dashboard JWT and settlement read permission. Profile users and roles
|
|
4803
|
+
* restricted to selected connector accounts cannot read this aggregate.
|
|
4804
|
+
* Rates apply once to the period total. Unknown or estimated fees keep
|
|
4805
|
+
* dependent amounts provisional. Native money values remain integer strings.
|
|
4806
|
+
*/
|
|
4807
|
+
async previewNative(params, options) {
|
|
4808
|
+
return this.request("POST", "/settlement/native/preview", { body: params, ...options });
|
|
4809
|
+
}
|
|
4810
|
+
/**
|
|
4811
|
+
* Recalculate and freeze an immutable report version. Requires settlement
|
|
4812
|
+
* edit permission. Explicitly allow provisional figures when source fees
|
|
4813
|
+
* are incomplete. A report records a calculation and sends no money.
|
|
4814
|
+
* Reuse the same idempotency key when retrying the same request.
|
|
4815
|
+
*/
|
|
4816
|
+
async createNativeReport(params, options) {
|
|
4817
|
+
return this.request("POST", "/settlement/native/reports", {
|
|
4818
|
+
body: params,
|
|
4819
|
+
...options,
|
|
4820
|
+
bodyIdempotencyKey: params.idempotency_key
|
|
4821
|
+
});
|
|
4822
|
+
}
|
|
4823
|
+
async retrieveNativeReport(reportId, options) {
|
|
4824
|
+
return this.request(
|
|
4825
|
+
"GET",
|
|
4826
|
+
`/settlement/native/reports/${encodeURIComponent(reportId)}`,
|
|
4827
|
+
options
|
|
4828
|
+
);
|
|
4829
|
+
}
|
|
4830
|
+
/** List report summaries without fetching every source row in each saved snapshot. */
|
|
4831
|
+
async listNativeReports(params, options) {
|
|
4832
|
+
return this.request("GET", "/settlement/native/reports", {
|
|
4833
|
+
query: {
|
|
4834
|
+
profile_id: params.profile_id,
|
|
4835
|
+
currency: params.currency,
|
|
4836
|
+
test_mode: params.test_mode,
|
|
4837
|
+
limit: params.limit,
|
|
4838
|
+
offset: params.offset
|
|
4839
|
+
},
|
|
4840
|
+
...options
|
|
4841
|
+
});
|
|
4842
|
+
}
|
|
4843
|
+
/**
|
|
4844
|
+
* Record a transfer already made, under settlement write permission and
|
|
4845
|
+
* the caller's payout limits. This method never sends money. Native minor
|
|
4846
|
+
* units remain strings; negative records must name a same-scope reversal.
|
|
4847
|
+
* These records belong to the native ledger, separate from monthly USD
|
|
4848
|
+
* statement payouts and advances.
|
|
4849
|
+
*/
|
|
4850
|
+
async recordNativePayout(params, options) {
|
|
4851
|
+
return this.request("POST", "/settlement/native/payouts", {
|
|
4852
|
+
body: params,
|
|
4853
|
+
...options,
|
|
4854
|
+
bodyIdempotencyKey: params.idempotency_key
|
|
4855
|
+
});
|
|
4856
|
+
}
|
|
4857
|
+
async listNativePayouts(params, options) {
|
|
4858
|
+
return this.request("GET", "/settlement/native/payouts", {
|
|
4859
|
+
query: {
|
|
4860
|
+
profile_id: params.profile_id,
|
|
4861
|
+
currency: params.currency,
|
|
4862
|
+
test_mode: params.test_mode,
|
|
4863
|
+
limit: params.limit,
|
|
4864
|
+
offset: params.offset
|
|
4865
|
+
},
|
|
4866
|
+
...options
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
/** Refresh a bounded page of provider fee evidence. Follow next_offset while has_more is true. */
|
|
4870
|
+
async refreshNativeFees(params, options) {
|
|
4871
|
+
return this.request("POST", "/settlement/native/fees/refresh", { body: params, ...options });
|
|
4872
|
+
}
|
|
4873
|
+
async downloadNativeReportPdf(reportId, params, options) {
|
|
4874
|
+
return this.request("GET", `/settlement/native/reports/${encodeURIComponent(reportId)}/pdf`, {
|
|
4875
|
+
query: { include_transactions: params?.include_transactions },
|
|
4876
|
+
responseType: "blob",
|
|
4877
|
+
...options
|
|
4878
|
+
});
|
|
4879
|
+
}
|
|
4880
|
+
/** Download the frozen source rows and calculation as CSV. */
|
|
4881
|
+
async downloadNativeReportCsv(reportId, options) {
|
|
4882
|
+
return this.request(
|
|
4883
|
+
"GET",
|
|
4884
|
+
`/settlement/native/reports/${encodeURIComponent(reportId)}/export`,
|
|
4885
|
+
{
|
|
4886
|
+
...options,
|
|
4887
|
+
headers: exportHeaders(options, "text/csv"),
|
|
4888
|
+
responseType: "blob"
|
|
4889
|
+
}
|
|
4890
|
+
);
|
|
4891
|
+
}
|
|
4892
|
+
/** Export the frozen report as JSON, excluding host account-level costs. */
|
|
4893
|
+
async exportNativeReportJson(reportId, options) {
|
|
4894
|
+
return this.request(
|
|
4895
|
+
"GET",
|
|
4896
|
+
`/settlement/native/reports/${encodeURIComponent(reportId)}/export`,
|
|
4897
|
+
{
|
|
4898
|
+
...options,
|
|
4899
|
+
headers: exportHeaders(options, "application/json")
|
|
4900
|
+
}
|
|
4901
|
+
);
|
|
4902
|
+
}
|
|
4753
4903
|
};
|
|
4754
4904
|
|
|
4755
4905
|
// src/resources/operationLimits.ts
|
|
@@ -5107,7 +5257,7 @@ var Delopay = class {
|
|
|
5107
5257
|
url += `?${qs}`;
|
|
5108
5258
|
}
|
|
5109
5259
|
}
|
|
5110
|
-
|
|
5260
|
+
let headers = {
|
|
5111
5261
|
...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : this.apiKey ? { "api-key": this.apiKey } : {},
|
|
5112
5262
|
...options?.headers
|
|
5113
5263
|
};
|
|
@@ -5115,14 +5265,40 @@ var Delopay = class {
|
|
|
5115
5265
|
if (options?.body && !isRawBody) {
|
|
5116
5266
|
headers["Content-Type"] = "application/json";
|
|
5117
5267
|
}
|
|
5118
|
-
const idempotencyKey = findIdempotencyKey(headers)?.trim();
|
|
5119
|
-
const isRetryable = method === "GET" || method === "DELETE" || idempotencyKey !== void 0 && idempotencyKey !== "";
|
|
5120
5268
|
let serializedBody;
|
|
5121
5269
|
if (isRawBody) {
|
|
5122
5270
|
serializedBody = options?.body;
|
|
5123
5271
|
} else if (options?.body) {
|
|
5124
5272
|
serializedBody = JSON.stringify(options.body);
|
|
5125
5273
|
}
|
|
5274
|
+
let idempotencyKey = findIdempotencyKey(headers)?.trim();
|
|
5275
|
+
if (options && Object.prototype.hasOwnProperty.call(options, "bodyIdempotencyKey")) {
|
|
5276
|
+
const bodyKey = options?.bodyIdempotencyKey;
|
|
5277
|
+
const serialized = !isRawBody && typeof serializedBody === "string" ? JSON.parse(serializedBody) : null;
|
|
5278
|
+
const actualKey = serialized && typeof serialized === "object" && !Array.isArray(serialized) ? serialized.idempotency_key ?? null : null;
|
|
5279
|
+
const suppliedHeaders = Object.keys(headers).filter(
|
|
5280
|
+
(name) => name.toLowerCase() === "idempotency-key"
|
|
5281
|
+
);
|
|
5282
|
+
if (bodyKey !== null && typeof bodyKey !== "string" || actualKey !== bodyKey || suppliedHeaders.some(
|
|
5283
|
+
(name) => headers[name] !== bodyKey || headers[name]?.trim() !== headers[name]
|
|
5284
|
+
)) {
|
|
5285
|
+
throw new DelopayError("Request retry keys must match the JSON body key", {
|
|
5286
|
+
status: 0,
|
|
5287
|
+
code: "IDEMPOTENCY_KEY_MISMATCH",
|
|
5288
|
+
type: "invalid_request"
|
|
5289
|
+
});
|
|
5290
|
+
}
|
|
5291
|
+
idempotencyKey = bodyKey?.trim();
|
|
5292
|
+
if (suppliedHeaders.length > 0) {
|
|
5293
|
+
headers = {
|
|
5294
|
+
...Object.fromEntries(
|
|
5295
|
+
Object.entries(headers).filter(([name]) => name.toLowerCase() !== "idempotency-key")
|
|
5296
|
+
),
|
|
5297
|
+
"Idempotency-Key": idempotencyKey ?? ""
|
|
5298
|
+
};
|
|
5299
|
+
}
|
|
5300
|
+
}
|
|
5301
|
+
const isRetryable = method === "GET" || method === "DELETE" || idempotencyKey !== void 0 && idempotencyKey !== "";
|
|
5126
5302
|
const callerSignal = options?.signal;
|
|
5127
5303
|
if (callerSignal?.aborted) {
|
|
5128
5304
|
throw new DelopayError("Request aborted", {
|
|
@@ -7463,10 +7639,9 @@ var CheckoutSession = class {
|
|
|
7463
7639
|
}
|
|
7464
7640
|
}
|
|
7465
7641
|
/**
|
|
7466
|
-
* Store one slice of the buyer's checkout recording on our own side
|
|
7467
|
-
*
|
|
7468
|
-
*
|
|
7469
|
-
* attached automatically.
|
|
7642
|
+
* Store one slice of the buyer's checkout recording on our own side.
|
|
7643
|
+
* Called by the hosted checkout as the buyer works through the page; the
|
|
7644
|
+
* client secret is attached automatically.
|
|
7470
7645
|
*
|
|
7471
7646
|
* **Not telemetry semantics, on purpose.** Unlike
|
|
7472
7647
|
* {@link CheckoutSession.recordEvent}, this rejects with a `DelopayError`
|
|
@@ -7522,20 +7697,6 @@ var CheckoutSession = class {
|
|
|
7522
7697
|
}
|
|
7523
7698
|
);
|
|
7524
7699
|
}
|
|
7525
|
-
/**
|
|
7526
|
-
* The Paysepro rail catalog for the buyer's country.
|
|
7527
|
-
*
|
|
7528
|
-
* `GET /payment-link/{merchantId}/{paymentId}/paysepro/methods`
|
|
7529
|
-
*
|
|
7530
|
-
* @param country - Lowercase ISO 3166-1 alpha-2 country code.
|
|
7531
|
-
*/
|
|
7532
|
-
async payseproMethods(country, options) {
|
|
7533
|
-
return this.client.request("GET", `${this.linkBase}/paysepro/methods`, {
|
|
7534
|
-
query: { cc: country },
|
|
7535
|
-
...options,
|
|
7536
|
-
headers: this.bearerHeaders(options?.headers)
|
|
7537
|
-
});
|
|
7538
|
-
}
|
|
7539
7700
|
/**
|
|
7540
7701
|
* The e-Payouts rail catalog for the buyer's country, plus the set of
|
|
7541
7702
|
* countries that have at least one vendor.
|
|
@@ -8296,4 +8457,4 @@ export {
|
|
|
8296
8457
|
decodeNativePanes,
|
|
8297
8458
|
encodeNativePanes
|
|
8298
8459
|
};
|
|
8299
|
-
//# sourceMappingURL=chunk-
|
|
8460
|
+
//# sourceMappingURL=chunk-NM2EROEY.js.map
|