@delopay/sdk 0.289.0 → 0.291.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-JHQBYOCA.js} +216 -6
- package/dist/chunk-JHQBYOCA.js.map +1 -0
- package/dist/{index-DIzFgkFA.d.cts → index-DOzQ6GL9.d.cts} +655 -14
- package/dist/{index-DIzFgkFA.d.ts → index-DOzQ6GL9.d.ts} +655 -14
- package/dist/index.cjs +217 -5
- 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 +217 -5
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -3
- package/dist/internal.d.ts +6 -3
- 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
|
*
|
|
@@ -3601,15 +3641,21 @@ var Projects = class {
|
|
|
3601
3641
|
this.request = request;
|
|
3602
3642
|
}
|
|
3603
3643
|
/**
|
|
3604
|
-
* Create a new project under a merchant account.
|
|
3644
|
+
* Create a new project under a merchant account. Pass `parent_id` to create
|
|
3645
|
+
* it as a sub-project; past the merchant's maximum depth it is refused with
|
|
3646
|
+
* `400` and code `PR_01` (`project_depth_exceeded`).
|
|
3605
3647
|
*
|
|
3606
|
-
* @param params - Project creation parameters (name, description,
|
|
3648
|
+
* @param params - Project creation parameters (name, description, parent).
|
|
3607
3649
|
* @param merchantId - The merchant account ID that owns this project.
|
|
3608
3650
|
* @returns The created project.
|
|
3609
3651
|
*
|
|
3610
3652
|
* @example
|
|
3611
3653
|
* ```typescript
|
|
3612
|
-
* const
|
|
3654
|
+
* const eu = await delopay.projects.create({ project_name: 'EU Stores' }, 'merch_123');
|
|
3655
|
+
* const de = await delopay.projects.create(
|
|
3656
|
+
* { project_name: 'Germany', parent_id: eu.id },
|
|
3657
|
+
* 'merch_123',
|
|
3658
|
+
* );
|
|
3613
3659
|
* ```
|
|
3614
3660
|
*/
|
|
3615
3661
|
async create(params, merchantId) {
|
|
@@ -3634,7 +3680,14 @@ var Projects = class {
|
|
|
3634
3680
|
return this.request("GET", path, { query: { merchant_id: merchantId } });
|
|
3635
3681
|
}
|
|
3636
3682
|
/**
|
|
3637
|
-
* Update a project's details
|
|
3683
|
+
* Update a project's details, or move it with `parent_id` (omitted keeps the
|
|
3684
|
+
* parent, `null` makes it a top-level project, an id moves it under that
|
|
3685
|
+
* project). A move is refused with `PR_01` when the moved subtree would
|
|
3686
|
+
* exceed the maximum depth and with `PR_02` (`project_cycle`) when the target
|
|
3687
|
+
* is the project itself or one of its sub-projects. When the merchant's
|
|
3688
|
+
* project tree changed while the move was being checked, it is refused with
|
|
3689
|
+
* `409` and code `PR_05` (`project_tree_changed`): read the tree again and
|
|
3690
|
+
* retry.
|
|
3638
3691
|
*
|
|
3639
3692
|
* @param projectId - The project ID to update.
|
|
3640
3693
|
* @param params - Fields to update.
|
|
@@ -3650,6 +3703,9 @@ var Projects = class {
|
|
|
3650
3703
|
* Delete a project.
|
|
3651
3704
|
*
|
|
3652
3705
|
* @param projectId - The project ID to delete.
|
|
3706
|
+
* Refused with `409` and code `PR_03` (`project_not_empty`) while the
|
|
3707
|
+
* project still has sub-projects or shops; move or delete those first.
|
|
3708
|
+
*
|
|
3653
3709
|
* @param merchantId - Optional merchant scope. See {@link Projects.retrieve}.
|
|
3654
3710
|
* @returns The deleted project object.
|
|
3655
3711
|
*/
|
|
@@ -3659,7 +3715,9 @@ var Projects = class {
|
|
|
3659
3715
|
return this.request("DELETE", path, { query: { merchant_id: merchantId } });
|
|
3660
3716
|
}
|
|
3661
3717
|
/**
|
|
3662
|
-
* List all projects for a merchant.
|
|
3718
|
+
* List all projects for a merchant, at every level, as a flat array. Rebuild
|
|
3719
|
+
* the tree from each project's `parent_id`; `level`, `path`,
|
|
3720
|
+
* `child_project_count` and `direct_shop_count` are filled in for each one.
|
|
3663
3721
|
*
|
|
3664
3722
|
* @param merchantId - The merchant account ID.
|
|
3665
3723
|
* @returns Array of projects.
|
|
@@ -3672,6 +3730,11 @@ var Projects = class {
|
|
|
3672
3730
|
/**
|
|
3673
3731
|
* Get aggregate payment statistics across all projects for a merchant.
|
|
3674
3732
|
*
|
|
3733
|
+
* Each project's figures cover its whole subtree (its own shops and the
|
|
3734
|
+
* shops of its sub-projects); `projects[].direct` holds the figures for the
|
|
3735
|
+
* project's own shops only, and `projects[].shops[]` lists only those. The
|
|
3736
|
+
* merchant totals count each shop once.
|
|
3737
|
+
*
|
|
3675
3738
|
* The response's flat `shops[]` array holds every shop, including shops that
|
|
3676
3739
|
* belong to no project — those are absent from `projects[].shops[]`, so look
|
|
3677
3740
|
* a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
|
|
@@ -3693,6 +3756,26 @@ var Projects = class {
|
|
|
3693
3756
|
if (period !== void 0) query["period"] = String(period);
|
|
3694
3757
|
return this.request("GET", "/projects/stats", { query });
|
|
3695
3758
|
}
|
|
3759
|
+
/**
|
|
3760
|
+
* Get the project-depth limit that applies to a merchant: the maximum number
|
|
3761
|
+
* of project levels, where that limit comes from, and how deep the
|
|
3762
|
+
* merchant's tree currently is. Use it to tell whether a project can take a
|
|
3763
|
+
* sub-project (`project.level < max_depth`) before offering the action.
|
|
3764
|
+
*
|
|
3765
|
+
* @param merchantId - The merchant account ID.
|
|
3766
|
+
* @returns The merchant's project limits.
|
|
3767
|
+
*
|
|
3768
|
+
* @example
|
|
3769
|
+
* ```typescript
|
|
3770
|
+
* const { max_depth } = await delopay.projects.limits('merch_123');
|
|
3771
|
+
* const canNest = project.level < max_depth;
|
|
3772
|
+
* ```
|
|
3773
|
+
*/
|
|
3774
|
+
async limits(merchantId) {
|
|
3775
|
+
return this.request("GET", "/projects/limits", {
|
|
3776
|
+
query: { merchant_id: merchantId }
|
|
3777
|
+
});
|
|
3778
|
+
}
|
|
3696
3779
|
/**
|
|
3697
3780
|
* Get a high-level overview (volume, counts, top connectors) for a merchant.
|
|
3698
3781
|
*
|
|
@@ -9726,6 +9809,132 @@ var Live = class {
|
|
|
9726
9809
|
}
|
|
9727
9810
|
};
|
|
9728
9811
|
|
|
9812
|
+
// src/resources/processorImports.ts
|
|
9813
|
+
function toPspImportStreamEvent(event) {
|
|
9814
|
+
switch (event.type) {
|
|
9815
|
+
case "progress": {
|
|
9816
|
+
let run;
|
|
9817
|
+
try {
|
|
9818
|
+
run = JSON.parse(event.data);
|
|
9819
|
+
} catch {
|
|
9820
|
+
return null;
|
|
9821
|
+
}
|
|
9822
|
+
if (run === null || typeof run !== "object" || Array.isArray(run)) return null;
|
|
9823
|
+
return { type: "progress", run };
|
|
9824
|
+
}
|
|
9825
|
+
case "done":
|
|
9826
|
+
return { type: "done" };
|
|
9827
|
+
default:
|
|
9828
|
+
return null;
|
|
9829
|
+
}
|
|
9830
|
+
}
|
|
9831
|
+
var PspImportEventStream = class {
|
|
9832
|
+
constructor(connection) {
|
|
9833
|
+
this.connection = connection;
|
|
9834
|
+
}
|
|
9835
|
+
/** Close the stream; the iteration ends without an error. */
|
|
9836
|
+
close() {
|
|
9837
|
+
this.connection.close();
|
|
9838
|
+
}
|
|
9839
|
+
[Symbol.asyncIterator]() {
|
|
9840
|
+
this.iterator ?? (this.iterator = this.events());
|
|
9841
|
+
return this.iterator;
|
|
9842
|
+
}
|
|
9843
|
+
async *events() {
|
|
9844
|
+
for await (const dispatch of this.connection.dispatches) {
|
|
9845
|
+
if (!dispatch.event) continue;
|
|
9846
|
+
const event = toPspImportStreamEvent(dispatch.event);
|
|
9847
|
+
if (event) yield event;
|
|
9848
|
+
}
|
|
9849
|
+
}
|
|
9850
|
+
};
|
|
9851
|
+
var ProcessorImports = class {
|
|
9852
|
+
constructor(request, openStream) {
|
|
9853
|
+
this.request = request;
|
|
9854
|
+
this.openStream = openStream;
|
|
9855
|
+
}
|
|
9856
|
+
/**
|
|
9857
|
+
* Every connected processor account the caller may see, with what each can
|
|
9858
|
+
* provide in the environment: listed, read payment by payment, or
|
|
9859
|
+
* unavailable with a reason.
|
|
9860
|
+
*
|
|
9861
|
+
* `GET /refunds-disputes/imports/sources`
|
|
9862
|
+
*/
|
|
9863
|
+
async sources(params) {
|
|
9864
|
+
return this.request("GET", "/refunds-disputes/imports/sources", {
|
|
9865
|
+
query: { test_mode: params.test_mode }
|
|
9866
|
+
});
|
|
9867
|
+
}
|
|
9868
|
+
/**
|
|
9869
|
+
* Start an import. A source a processor cannot provide is stored as
|
|
9870
|
+
* `unavailable` with its reason. Refused while another import of the
|
|
9871
|
+
* merchant runs in the same environment.
|
|
9872
|
+
*
|
|
9873
|
+
* `POST /refunds-disputes/imports`
|
|
9874
|
+
*/
|
|
9875
|
+
async create(request) {
|
|
9876
|
+
return this.request("POST", "/refunds-disputes/imports", { body: request });
|
|
9877
|
+
}
|
|
9878
|
+
/**
|
|
9879
|
+
* The newest import in the environment, running or finished.
|
|
9880
|
+
*
|
|
9881
|
+
* `GET /refunds-disputes/imports/latest`
|
|
9882
|
+
*/
|
|
9883
|
+
async latest(params) {
|
|
9884
|
+
return this.request("GET", "/refunds-disputes/imports/latest", {
|
|
9885
|
+
query: { test_mode: params.test_mode }
|
|
9886
|
+
});
|
|
9887
|
+
}
|
|
9888
|
+
/** `GET /refunds-disputes/imports/{id}` */
|
|
9889
|
+
async retrieve(id) {
|
|
9890
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}`);
|
|
9891
|
+
}
|
|
9892
|
+
/**
|
|
9893
|
+
* The records an import left out or could not record, each with its reason.
|
|
9894
|
+
*
|
|
9895
|
+
* `GET /refunds-disputes/imports/{id}/issues`
|
|
9896
|
+
*/
|
|
9897
|
+
async issues(id, params) {
|
|
9898
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}/issues`, {
|
|
9899
|
+
query: { limit: params?.limit, offset: params?.offset }
|
|
9900
|
+
});
|
|
9901
|
+
}
|
|
9902
|
+
/**
|
|
9903
|
+
* Ask a running import to stop. It stops after the page it is reading;
|
|
9904
|
+
* what it recorded stays recorded.
|
|
9905
|
+
*
|
|
9906
|
+
* `POST /refunds-disputes/imports/{id}/cancel`
|
|
9907
|
+
*/
|
|
9908
|
+
async cancel(id) {
|
|
9909
|
+
return this.request("POST", `/refunds-disputes/imports/${encodeURIComponent(id)}/cancel`);
|
|
9910
|
+
}
|
|
9911
|
+
/**
|
|
9912
|
+
* Open the progress stream of an import. Resolves once the server answered;
|
|
9913
|
+
* a `401` rejects with `DelopayAuthenticationError`.
|
|
9914
|
+
*
|
|
9915
|
+
* `GET /refunds-disputes/imports/{id}/stream`
|
|
9916
|
+
*
|
|
9917
|
+
* @example
|
|
9918
|
+
* ```typescript
|
|
9919
|
+
* const stream = await delopay.processorImports.stream(run.id, { signal });
|
|
9920
|
+
* for await (const event of stream) {
|
|
9921
|
+
* if (event.type === 'progress') render(event.run);
|
|
9922
|
+
* }
|
|
9923
|
+
* ```
|
|
9924
|
+
*/
|
|
9925
|
+
async stream(id, options = {}) {
|
|
9926
|
+
const connection = await this.openStream(
|
|
9927
|
+
`/refunds-disputes/imports/${encodeURIComponent(id)}/stream`,
|
|
9928
|
+
{
|
|
9929
|
+
...options.signal ? { signal: options.signal } : {},
|
|
9930
|
+
...options.idleTimeoutMs !== void 0 ? { idleTimeoutMs: options.idleTimeoutMs } : {},
|
|
9931
|
+
...options.headers ? { headers: options.headers } : {}
|
|
9932
|
+
}
|
|
9933
|
+
);
|
|
9934
|
+
return new PspImportEventStream(connection);
|
|
9935
|
+
}
|
|
9936
|
+
};
|
|
9937
|
+
|
|
9729
9938
|
// src/resources/deploymentBranding.ts
|
|
9730
9939
|
function brandingAssetPath(asset, version) {
|
|
9731
9940
|
const path = `/branding/assets/${encodeURIComponent(asset)}`;
|
|
@@ -10040,6 +10249,7 @@ var Delopay = class {
|
|
|
10040
10249
|
this.messageTemplates = new MessageTemplates(request);
|
|
10041
10250
|
this.risk = new Risk(request);
|
|
10042
10251
|
this.live = new Live(request, openStream);
|
|
10252
|
+
this.processorImports = new ProcessorImports(request, openStream);
|
|
10043
10253
|
this.branding = new Branding(request, this.baseUrl);
|
|
10044
10254
|
this.subscriptions = new Subscriptions(request);
|
|
10045
10255
|
this.buyerPortal = new BuyerPortal(request);
|
|
@@ -15303,7 +15513,9 @@ var encodeNativePanes = encodePanes;
|
|
|
15303
15513
|
PaypalDisputes,
|
|
15304
15514
|
PresentationCache,
|
|
15305
15515
|
ProcessorCosts,
|
|
15516
|
+
ProcessorImports,
|
|
15306
15517
|
Products,
|
|
15518
|
+
PspImportEventStream,
|
|
15307
15519
|
RTL_CHECKOUT_LOCALES,
|
|
15308
15520
|
Regions,
|
|
15309
15521
|
Risk,
|