@delopay/sdk 0.289.0 → 0.290.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-ZZEGL45P.js → chunk-7QXWTMSG.js} +168 -1
- package/dist/chunk-7QXWTMSG.js.map +1 -0
- package/dist/{index-DIzFgkFA.d.cts → index-CCxMFvNk.d.cts} +476 -2
- package/dist/{index-DIzFgkFA.d.ts → index-CCxMFvNk.d.ts} +476 -2
- package/dist/index.cjs +169 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -1
- package/dist/internal.cjs +169 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +5 -1
- package/dist/internal.js.map +1 -1
- package/package.json +17 -18
- package/dist/chunk-ZZEGL45P.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -114,7 +114,9 @@ __export(index_exports, {
|
|
|
114
114
|
PaypalDisputes: () => PaypalDisputes,
|
|
115
115
|
PresentationCache: () => PresentationCache,
|
|
116
116
|
ProcessorCosts: () => ProcessorCosts,
|
|
117
|
+
ProcessorImports: () => ProcessorImports,
|
|
117
118
|
Products: () => Products,
|
|
119
|
+
PspImportEventStream: () => PspImportEventStream,
|
|
118
120
|
RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
|
|
119
121
|
Regions: () => Regions,
|
|
120
122
|
Risk: () => Risk,
|
|
@@ -2002,6 +2004,44 @@ var Disputes = class {
|
|
|
2002
2004
|
options
|
|
2003
2005
|
);
|
|
2004
2006
|
}
|
|
2007
|
+
/**
|
|
2008
|
+
* What a bulk action would do to the selected cases, changing nothing:
|
|
2009
|
+
* each case as eligible or skipped with a reason, and what the eligible ones
|
|
2010
|
+
* add up to per currency. Name the cases by `ids` or by the list's
|
|
2011
|
+
* `filters`, exactly one of the two; at most `max_cases` are read.
|
|
2012
|
+
*
|
|
2013
|
+
* `POST /disputes/workspace/bulk/preview`. Needs a dashboard JWT.
|
|
2014
|
+
*/
|
|
2015
|
+
async bulkPreview(request) {
|
|
2016
|
+
const { filters, ...rest } = request;
|
|
2017
|
+
return this.request("POST", "/disputes/workspace/bulk/preview", {
|
|
2018
|
+
body: filters ? { ...rest, filters: workspaceQuery(filters) } : rest
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
/**
|
|
2022
|
+
* Accept the listed cases at their processors, at most the preview's
|
|
2023
|
+
* `max_run_cases` per call; send a larger set in parts under one
|
|
2024
|
+
* `request_id`. Eligibility is decided again at run time, and every case
|
|
2025
|
+
* gets its own result. An `unknown` result means the processor may have
|
|
2026
|
+
* acted: read the case before acting on it again.
|
|
2027
|
+
*
|
|
2028
|
+
* `POST /disputes/workspace/bulk/accept`. Needs a dashboard JWT.
|
|
2029
|
+
*/
|
|
2030
|
+
async bulkAccept(request) {
|
|
2031
|
+
return this.request("POST", "/disputes/workspace/bulk/accept", { body: request });
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* Add the buyer of each listed case's payment to the buyer blocklist: the
|
|
2035
|
+
* payment's email and customer id, and the device ids and IP address of the
|
|
2036
|
+
* browser that paid, when DeloPay can tie them to it. Identifiers already
|
|
2037
|
+
* blocked are not added again, and `unattributed` names those it could not
|
|
2038
|
+
* tie to the buyer.
|
|
2039
|
+
*
|
|
2040
|
+
* `POST /disputes/workspace/bulk/block-buyer`. Needs a dashboard JWT.
|
|
2041
|
+
*/
|
|
2042
|
+
async bulkBlockBuyer(request) {
|
|
2043
|
+
return this.request("POST", "/disputes/workspace/bulk/block-buyer", { body: request });
|
|
2044
|
+
}
|
|
2005
2045
|
/**
|
|
2006
2046
|
* Retrieve a dispute by its ID.
|
|
2007
2047
|
*
|
|
@@ -9726,6 +9766,132 @@ var Live = class {
|
|
|
9726
9766
|
}
|
|
9727
9767
|
};
|
|
9728
9768
|
|
|
9769
|
+
// src/resources/processorImports.ts
|
|
9770
|
+
function toPspImportStreamEvent(event) {
|
|
9771
|
+
switch (event.type) {
|
|
9772
|
+
case "progress": {
|
|
9773
|
+
let run;
|
|
9774
|
+
try {
|
|
9775
|
+
run = JSON.parse(event.data);
|
|
9776
|
+
} catch {
|
|
9777
|
+
return null;
|
|
9778
|
+
}
|
|
9779
|
+
if (run === null || typeof run !== "object" || Array.isArray(run)) return null;
|
|
9780
|
+
return { type: "progress", run };
|
|
9781
|
+
}
|
|
9782
|
+
case "done":
|
|
9783
|
+
return { type: "done" };
|
|
9784
|
+
default:
|
|
9785
|
+
return null;
|
|
9786
|
+
}
|
|
9787
|
+
}
|
|
9788
|
+
var PspImportEventStream = class {
|
|
9789
|
+
constructor(connection) {
|
|
9790
|
+
this.connection = connection;
|
|
9791
|
+
}
|
|
9792
|
+
/** Close the stream; the iteration ends without an error. */
|
|
9793
|
+
close() {
|
|
9794
|
+
this.connection.close();
|
|
9795
|
+
}
|
|
9796
|
+
[Symbol.asyncIterator]() {
|
|
9797
|
+
this.iterator ?? (this.iterator = this.events());
|
|
9798
|
+
return this.iterator;
|
|
9799
|
+
}
|
|
9800
|
+
async *events() {
|
|
9801
|
+
for await (const dispatch of this.connection.dispatches) {
|
|
9802
|
+
if (!dispatch.event) continue;
|
|
9803
|
+
const event = toPspImportStreamEvent(dispatch.event);
|
|
9804
|
+
if (event) yield event;
|
|
9805
|
+
}
|
|
9806
|
+
}
|
|
9807
|
+
};
|
|
9808
|
+
var ProcessorImports = class {
|
|
9809
|
+
constructor(request, openStream) {
|
|
9810
|
+
this.request = request;
|
|
9811
|
+
this.openStream = openStream;
|
|
9812
|
+
}
|
|
9813
|
+
/**
|
|
9814
|
+
* Every connected processor account the caller may see, with what each can
|
|
9815
|
+
* provide in the environment: listed, read payment by payment, or
|
|
9816
|
+
* unavailable with a reason.
|
|
9817
|
+
*
|
|
9818
|
+
* `GET /refunds-disputes/imports/sources`
|
|
9819
|
+
*/
|
|
9820
|
+
async sources(params) {
|
|
9821
|
+
return this.request("GET", "/refunds-disputes/imports/sources", {
|
|
9822
|
+
query: { test_mode: params.test_mode }
|
|
9823
|
+
});
|
|
9824
|
+
}
|
|
9825
|
+
/**
|
|
9826
|
+
* Start an import. A source a processor cannot provide is stored as
|
|
9827
|
+
* `unavailable` with its reason. Refused while another import of the
|
|
9828
|
+
* merchant runs in the same environment.
|
|
9829
|
+
*
|
|
9830
|
+
* `POST /refunds-disputes/imports`
|
|
9831
|
+
*/
|
|
9832
|
+
async create(request) {
|
|
9833
|
+
return this.request("POST", "/refunds-disputes/imports", { body: request });
|
|
9834
|
+
}
|
|
9835
|
+
/**
|
|
9836
|
+
* The newest import in the environment, running or finished.
|
|
9837
|
+
*
|
|
9838
|
+
* `GET /refunds-disputes/imports/latest`
|
|
9839
|
+
*/
|
|
9840
|
+
async latest(params) {
|
|
9841
|
+
return this.request("GET", "/refunds-disputes/imports/latest", {
|
|
9842
|
+
query: { test_mode: params.test_mode }
|
|
9843
|
+
});
|
|
9844
|
+
}
|
|
9845
|
+
/** `GET /refunds-disputes/imports/{id}` */
|
|
9846
|
+
async retrieve(id) {
|
|
9847
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}`);
|
|
9848
|
+
}
|
|
9849
|
+
/**
|
|
9850
|
+
* The records an import left out or could not record, each with its reason.
|
|
9851
|
+
*
|
|
9852
|
+
* `GET /refunds-disputes/imports/{id}/issues`
|
|
9853
|
+
*/
|
|
9854
|
+
async issues(id, params) {
|
|
9855
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}/issues`, {
|
|
9856
|
+
query: { limit: params?.limit, offset: params?.offset }
|
|
9857
|
+
});
|
|
9858
|
+
}
|
|
9859
|
+
/**
|
|
9860
|
+
* Ask a running import to stop. It stops after the page it is reading;
|
|
9861
|
+
* what it recorded stays recorded.
|
|
9862
|
+
*
|
|
9863
|
+
* `POST /refunds-disputes/imports/{id}/cancel`
|
|
9864
|
+
*/
|
|
9865
|
+
async cancel(id) {
|
|
9866
|
+
return this.request("POST", `/refunds-disputes/imports/${encodeURIComponent(id)}/cancel`);
|
|
9867
|
+
}
|
|
9868
|
+
/**
|
|
9869
|
+
* Open the progress stream of an import. Resolves once the server answered;
|
|
9870
|
+
* a `401` rejects with `DelopayAuthenticationError`.
|
|
9871
|
+
*
|
|
9872
|
+
* `GET /refunds-disputes/imports/{id}/stream`
|
|
9873
|
+
*
|
|
9874
|
+
* @example
|
|
9875
|
+
* ```typescript
|
|
9876
|
+
* const stream = await delopay.processorImports.stream(run.id, { signal });
|
|
9877
|
+
* for await (const event of stream) {
|
|
9878
|
+
* if (event.type === 'progress') render(event.run);
|
|
9879
|
+
* }
|
|
9880
|
+
* ```
|
|
9881
|
+
*/
|
|
9882
|
+
async stream(id, options = {}) {
|
|
9883
|
+
const connection = await this.openStream(
|
|
9884
|
+
`/refunds-disputes/imports/${encodeURIComponent(id)}/stream`,
|
|
9885
|
+
{
|
|
9886
|
+
...options.signal ? { signal: options.signal } : {},
|
|
9887
|
+
...options.idleTimeoutMs !== void 0 ? { idleTimeoutMs: options.idleTimeoutMs } : {},
|
|
9888
|
+
...options.headers ? { headers: options.headers } : {}
|
|
9889
|
+
}
|
|
9890
|
+
);
|
|
9891
|
+
return new PspImportEventStream(connection);
|
|
9892
|
+
}
|
|
9893
|
+
};
|
|
9894
|
+
|
|
9729
9895
|
// src/resources/deploymentBranding.ts
|
|
9730
9896
|
function brandingAssetPath(asset, version) {
|
|
9731
9897
|
const path = `/branding/assets/${encodeURIComponent(asset)}`;
|
|
@@ -10040,6 +10206,7 @@ var Delopay = class {
|
|
|
10040
10206
|
this.messageTemplates = new MessageTemplates(request);
|
|
10041
10207
|
this.risk = new Risk(request);
|
|
10042
10208
|
this.live = new Live(request, openStream);
|
|
10209
|
+
this.processorImports = new ProcessorImports(request, openStream);
|
|
10043
10210
|
this.branding = new Branding(request, this.baseUrl);
|
|
10044
10211
|
this.subscriptions = new Subscriptions(request);
|
|
10045
10212
|
this.buyerPortal = new BuyerPortal(request);
|
|
@@ -15303,7 +15470,9 @@ var encodeNativePanes = encodePanes;
|
|
|
15303
15470
|
PaypalDisputes,
|
|
15304
15471
|
PresentationCache,
|
|
15305
15472
|
ProcessorCosts,
|
|
15473
|
+
ProcessorImports,
|
|
15306
15474
|
Products,
|
|
15475
|
+
PspImportEventStream,
|
|
15307
15476
|
RTL_CHECKOUT_LOCALES,
|
|
15308
15477
|
Regions,
|
|
15309
15478
|
Risk,
|