@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/internal.cjs
CHANGED
|
@@ -132,7 +132,9 @@ __export(internal_exports, {
|
|
|
132
132
|
PlatformSettings: () => PlatformSettings,
|
|
133
133
|
PresentationCache: () => PresentationCache,
|
|
134
134
|
ProcessorCosts: () => ProcessorCosts,
|
|
135
|
+
ProcessorImports: () => ProcessorImports,
|
|
135
136
|
Products: () => Products,
|
|
137
|
+
PspImportEventStream: () => PspImportEventStream,
|
|
136
138
|
RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
|
|
137
139
|
Regions: () => Regions,
|
|
138
140
|
Risk: () => Risk,
|
|
@@ -2020,6 +2022,44 @@ var Disputes = class {
|
|
|
2020
2022
|
options
|
|
2021
2023
|
);
|
|
2022
2024
|
}
|
|
2025
|
+
/**
|
|
2026
|
+
* What a bulk action would do to the selected cases, changing nothing:
|
|
2027
|
+
* each case as eligible or skipped with a reason, and what the eligible ones
|
|
2028
|
+
* add up to per currency. Name the cases by `ids` or by the list's
|
|
2029
|
+
* `filters`, exactly one of the two; at most `max_cases` are read.
|
|
2030
|
+
*
|
|
2031
|
+
* `POST /disputes/workspace/bulk/preview`. Needs a dashboard JWT.
|
|
2032
|
+
*/
|
|
2033
|
+
async bulkPreview(request) {
|
|
2034
|
+
const { filters, ...rest } = request;
|
|
2035
|
+
return this.request("POST", "/disputes/workspace/bulk/preview", {
|
|
2036
|
+
body: filters ? { ...rest, filters: workspaceQuery(filters) } : rest
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Accept the listed cases at their processors, at most the preview's
|
|
2041
|
+
* `max_run_cases` per call; send a larger set in parts under one
|
|
2042
|
+
* `request_id`. Eligibility is decided again at run time, and every case
|
|
2043
|
+
* gets its own result. An `unknown` result means the processor may have
|
|
2044
|
+
* acted: read the case before acting on it again.
|
|
2045
|
+
*
|
|
2046
|
+
* `POST /disputes/workspace/bulk/accept`. Needs a dashboard JWT.
|
|
2047
|
+
*/
|
|
2048
|
+
async bulkAccept(request) {
|
|
2049
|
+
return this.request("POST", "/disputes/workspace/bulk/accept", { body: request });
|
|
2050
|
+
}
|
|
2051
|
+
/**
|
|
2052
|
+
* Add the buyer of each listed case's payment to the buyer blocklist: the
|
|
2053
|
+
* payment's email and customer id, and the device ids and IP address of the
|
|
2054
|
+
* browser that paid, when DeloPay can tie them to it. Identifiers already
|
|
2055
|
+
* blocked are not added again, and `unattributed` names those it could not
|
|
2056
|
+
* tie to the buyer.
|
|
2057
|
+
*
|
|
2058
|
+
* `POST /disputes/workspace/bulk/block-buyer`. Needs a dashboard JWT.
|
|
2059
|
+
*/
|
|
2060
|
+
async bulkBlockBuyer(request) {
|
|
2061
|
+
return this.request("POST", "/disputes/workspace/bulk/block-buyer", { body: request });
|
|
2062
|
+
}
|
|
2023
2063
|
/**
|
|
2024
2064
|
* Retrieve a dispute by its ID.
|
|
2025
2065
|
*
|
|
@@ -3619,15 +3659,21 @@ var Projects = class {
|
|
|
3619
3659
|
this.request = request;
|
|
3620
3660
|
}
|
|
3621
3661
|
/**
|
|
3622
|
-
* Create a new project under a merchant account.
|
|
3662
|
+
* Create a new project under a merchant account. Pass `parent_id` to create
|
|
3663
|
+
* it as a sub-project; past the merchant's maximum depth it is refused with
|
|
3664
|
+
* `400` and code `PR_01` (`project_depth_exceeded`).
|
|
3623
3665
|
*
|
|
3624
|
-
* @param params - Project creation parameters (name, description,
|
|
3666
|
+
* @param params - Project creation parameters (name, description, parent).
|
|
3625
3667
|
* @param merchantId - The merchant account ID that owns this project.
|
|
3626
3668
|
* @returns The created project.
|
|
3627
3669
|
*
|
|
3628
3670
|
* @example
|
|
3629
3671
|
* ```typescript
|
|
3630
|
-
* const
|
|
3672
|
+
* const eu = await delopay.projects.create({ project_name: 'EU Stores' }, 'merch_123');
|
|
3673
|
+
* const de = await delopay.projects.create(
|
|
3674
|
+
* { project_name: 'Germany', parent_id: eu.id },
|
|
3675
|
+
* 'merch_123',
|
|
3676
|
+
* );
|
|
3631
3677
|
* ```
|
|
3632
3678
|
*/
|
|
3633
3679
|
async create(params, merchantId) {
|
|
@@ -3652,7 +3698,14 @@ var Projects = class {
|
|
|
3652
3698
|
return this.request("GET", path, { query: { merchant_id: merchantId } });
|
|
3653
3699
|
}
|
|
3654
3700
|
/**
|
|
3655
|
-
* Update a project's details
|
|
3701
|
+
* Update a project's details, or move it with `parent_id` (omitted keeps the
|
|
3702
|
+
* parent, `null` makes it a top-level project, an id moves it under that
|
|
3703
|
+
* project). A move is refused with `PR_01` when the moved subtree would
|
|
3704
|
+
* exceed the maximum depth and with `PR_02` (`project_cycle`) when the target
|
|
3705
|
+
* is the project itself or one of its sub-projects. When the merchant's
|
|
3706
|
+
* project tree changed while the move was being checked, it is refused with
|
|
3707
|
+
* `409` and code `PR_05` (`project_tree_changed`): read the tree again and
|
|
3708
|
+
* retry.
|
|
3656
3709
|
*
|
|
3657
3710
|
* @param projectId - The project ID to update.
|
|
3658
3711
|
* @param params - Fields to update.
|
|
@@ -3668,6 +3721,9 @@ var Projects = class {
|
|
|
3668
3721
|
* Delete a project.
|
|
3669
3722
|
*
|
|
3670
3723
|
* @param projectId - The project ID to delete.
|
|
3724
|
+
* Refused with `409` and code `PR_03` (`project_not_empty`) while the
|
|
3725
|
+
* project still has sub-projects or shops; move or delete those first.
|
|
3726
|
+
*
|
|
3671
3727
|
* @param merchantId - Optional merchant scope. See {@link Projects.retrieve}.
|
|
3672
3728
|
* @returns The deleted project object.
|
|
3673
3729
|
*/
|
|
@@ -3677,7 +3733,9 @@ var Projects = class {
|
|
|
3677
3733
|
return this.request("DELETE", path, { query: { merchant_id: merchantId } });
|
|
3678
3734
|
}
|
|
3679
3735
|
/**
|
|
3680
|
-
* List all projects for a merchant.
|
|
3736
|
+
* List all projects for a merchant, at every level, as a flat array. Rebuild
|
|
3737
|
+
* the tree from each project's `parent_id`; `level`, `path`,
|
|
3738
|
+
* `child_project_count` and `direct_shop_count` are filled in for each one.
|
|
3681
3739
|
*
|
|
3682
3740
|
* @param merchantId - The merchant account ID.
|
|
3683
3741
|
* @returns Array of projects.
|
|
@@ -3690,6 +3748,11 @@ var Projects = class {
|
|
|
3690
3748
|
/**
|
|
3691
3749
|
* Get aggregate payment statistics across all projects for a merchant.
|
|
3692
3750
|
*
|
|
3751
|
+
* Each project's figures cover its whole subtree (its own shops and the
|
|
3752
|
+
* shops of its sub-projects); `projects[].direct` holds the figures for the
|
|
3753
|
+
* project's own shops only, and `projects[].shops[]` lists only those. The
|
|
3754
|
+
* merchant totals count each shop once.
|
|
3755
|
+
*
|
|
3693
3756
|
* The response's flat `shops[]` array holds every shop, including shops that
|
|
3694
3757
|
* belong to no project — those are absent from `projects[].shops[]`, so look
|
|
3695
3758
|
* a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
|
|
@@ -3711,6 +3774,26 @@ var Projects = class {
|
|
|
3711
3774
|
if (period !== void 0) query["period"] = String(period);
|
|
3712
3775
|
return this.request("GET", "/projects/stats", { query });
|
|
3713
3776
|
}
|
|
3777
|
+
/**
|
|
3778
|
+
* Get the project-depth limit that applies to a merchant: the maximum number
|
|
3779
|
+
* of project levels, where that limit comes from, and how deep the
|
|
3780
|
+
* merchant's tree currently is. Use it to tell whether a project can take a
|
|
3781
|
+
* sub-project (`project.level < max_depth`) before offering the action.
|
|
3782
|
+
*
|
|
3783
|
+
* @param merchantId - The merchant account ID.
|
|
3784
|
+
* @returns The merchant's project limits.
|
|
3785
|
+
*
|
|
3786
|
+
* @example
|
|
3787
|
+
* ```typescript
|
|
3788
|
+
* const { max_depth } = await delopay.projects.limits('merch_123');
|
|
3789
|
+
* const canNest = project.level < max_depth;
|
|
3790
|
+
* ```
|
|
3791
|
+
*/
|
|
3792
|
+
async limits(merchantId) {
|
|
3793
|
+
return this.request("GET", "/projects/limits", {
|
|
3794
|
+
query: { merchant_id: merchantId }
|
|
3795
|
+
});
|
|
3796
|
+
}
|
|
3714
3797
|
/**
|
|
3715
3798
|
* Get a high-level overview (volume, counts, top connectors) for a merchant.
|
|
3716
3799
|
*
|
|
@@ -9744,6 +9827,132 @@ var Live = class {
|
|
|
9744
9827
|
}
|
|
9745
9828
|
};
|
|
9746
9829
|
|
|
9830
|
+
// src/resources/processorImports.ts
|
|
9831
|
+
function toPspImportStreamEvent(event) {
|
|
9832
|
+
switch (event.type) {
|
|
9833
|
+
case "progress": {
|
|
9834
|
+
let run;
|
|
9835
|
+
try {
|
|
9836
|
+
run = JSON.parse(event.data);
|
|
9837
|
+
} catch {
|
|
9838
|
+
return null;
|
|
9839
|
+
}
|
|
9840
|
+
if (run === null || typeof run !== "object" || Array.isArray(run)) return null;
|
|
9841
|
+
return { type: "progress", run };
|
|
9842
|
+
}
|
|
9843
|
+
case "done":
|
|
9844
|
+
return { type: "done" };
|
|
9845
|
+
default:
|
|
9846
|
+
return null;
|
|
9847
|
+
}
|
|
9848
|
+
}
|
|
9849
|
+
var PspImportEventStream = class {
|
|
9850
|
+
constructor(connection) {
|
|
9851
|
+
this.connection = connection;
|
|
9852
|
+
}
|
|
9853
|
+
/** Close the stream; the iteration ends without an error. */
|
|
9854
|
+
close() {
|
|
9855
|
+
this.connection.close();
|
|
9856
|
+
}
|
|
9857
|
+
[Symbol.asyncIterator]() {
|
|
9858
|
+
this.iterator ?? (this.iterator = this.events());
|
|
9859
|
+
return this.iterator;
|
|
9860
|
+
}
|
|
9861
|
+
async *events() {
|
|
9862
|
+
for await (const dispatch of this.connection.dispatches) {
|
|
9863
|
+
if (!dispatch.event) continue;
|
|
9864
|
+
const event = toPspImportStreamEvent(dispatch.event);
|
|
9865
|
+
if (event) yield event;
|
|
9866
|
+
}
|
|
9867
|
+
}
|
|
9868
|
+
};
|
|
9869
|
+
var ProcessorImports = class {
|
|
9870
|
+
constructor(request, openStream) {
|
|
9871
|
+
this.request = request;
|
|
9872
|
+
this.openStream = openStream;
|
|
9873
|
+
}
|
|
9874
|
+
/**
|
|
9875
|
+
* Every connected processor account the caller may see, with what each can
|
|
9876
|
+
* provide in the environment: listed, read payment by payment, or
|
|
9877
|
+
* unavailable with a reason.
|
|
9878
|
+
*
|
|
9879
|
+
* `GET /refunds-disputes/imports/sources`
|
|
9880
|
+
*/
|
|
9881
|
+
async sources(params) {
|
|
9882
|
+
return this.request("GET", "/refunds-disputes/imports/sources", {
|
|
9883
|
+
query: { test_mode: params.test_mode }
|
|
9884
|
+
});
|
|
9885
|
+
}
|
|
9886
|
+
/**
|
|
9887
|
+
* Start an import. A source a processor cannot provide is stored as
|
|
9888
|
+
* `unavailable` with its reason. Refused while another import of the
|
|
9889
|
+
* merchant runs in the same environment.
|
|
9890
|
+
*
|
|
9891
|
+
* `POST /refunds-disputes/imports`
|
|
9892
|
+
*/
|
|
9893
|
+
async create(request) {
|
|
9894
|
+
return this.request("POST", "/refunds-disputes/imports", { body: request });
|
|
9895
|
+
}
|
|
9896
|
+
/**
|
|
9897
|
+
* The newest import in the environment, running or finished.
|
|
9898
|
+
*
|
|
9899
|
+
* `GET /refunds-disputes/imports/latest`
|
|
9900
|
+
*/
|
|
9901
|
+
async latest(params) {
|
|
9902
|
+
return this.request("GET", "/refunds-disputes/imports/latest", {
|
|
9903
|
+
query: { test_mode: params.test_mode }
|
|
9904
|
+
});
|
|
9905
|
+
}
|
|
9906
|
+
/** `GET /refunds-disputes/imports/{id}` */
|
|
9907
|
+
async retrieve(id) {
|
|
9908
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}`);
|
|
9909
|
+
}
|
|
9910
|
+
/**
|
|
9911
|
+
* The records an import left out or could not record, each with its reason.
|
|
9912
|
+
*
|
|
9913
|
+
* `GET /refunds-disputes/imports/{id}/issues`
|
|
9914
|
+
*/
|
|
9915
|
+
async issues(id, params) {
|
|
9916
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}/issues`, {
|
|
9917
|
+
query: { limit: params?.limit, offset: params?.offset }
|
|
9918
|
+
});
|
|
9919
|
+
}
|
|
9920
|
+
/**
|
|
9921
|
+
* Ask a running import to stop. It stops after the page it is reading;
|
|
9922
|
+
* what it recorded stays recorded.
|
|
9923
|
+
*
|
|
9924
|
+
* `POST /refunds-disputes/imports/{id}/cancel`
|
|
9925
|
+
*/
|
|
9926
|
+
async cancel(id) {
|
|
9927
|
+
return this.request("POST", `/refunds-disputes/imports/${encodeURIComponent(id)}/cancel`);
|
|
9928
|
+
}
|
|
9929
|
+
/**
|
|
9930
|
+
* Open the progress stream of an import. Resolves once the server answered;
|
|
9931
|
+
* a `401` rejects with `DelopayAuthenticationError`.
|
|
9932
|
+
*
|
|
9933
|
+
* `GET /refunds-disputes/imports/{id}/stream`
|
|
9934
|
+
*
|
|
9935
|
+
* @example
|
|
9936
|
+
* ```typescript
|
|
9937
|
+
* const stream = await delopay.processorImports.stream(run.id, { signal });
|
|
9938
|
+
* for await (const event of stream) {
|
|
9939
|
+
* if (event.type === 'progress') render(event.run);
|
|
9940
|
+
* }
|
|
9941
|
+
* ```
|
|
9942
|
+
*/
|
|
9943
|
+
async stream(id, options = {}) {
|
|
9944
|
+
const connection = await this.openStream(
|
|
9945
|
+
`/refunds-disputes/imports/${encodeURIComponent(id)}/stream`,
|
|
9946
|
+
{
|
|
9947
|
+
...options.signal ? { signal: options.signal } : {},
|
|
9948
|
+
...options.idleTimeoutMs !== void 0 ? { idleTimeoutMs: options.idleTimeoutMs } : {},
|
|
9949
|
+
...options.headers ? { headers: options.headers } : {}
|
|
9950
|
+
}
|
|
9951
|
+
);
|
|
9952
|
+
return new PspImportEventStream(connection);
|
|
9953
|
+
}
|
|
9954
|
+
};
|
|
9955
|
+
|
|
9747
9956
|
// src/resources/deploymentBranding.ts
|
|
9748
9957
|
function brandingAssetPath(asset, version) {
|
|
9749
9958
|
const path = `/branding/assets/${encodeURIComponent(asset)}`;
|
|
@@ -10058,6 +10267,7 @@ var Delopay = class {
|
|
|
10058
10267
|
this.messageTemplates = new MessageTemplates(request);
|
|
10059
10268
|
this.risk = new Risk(request);
|
|
10060
10269
|
this.live = new Live(request, openStream);
|
|
10270
|
+
this.processorImports = new ProcessorImports(request, openStream);
|
|
10061
10271
|
this.branding = new Branding(request, this.baseUrl);
|
|
10062
10272
|
this.subscriptions = new Subscriptions(request);
|
|
10063
10273
|
this.buyerPortal = new BuyerPortal(request);
|
|
@@ -17189,7 +17399,9 @@ var DelopayInternal = class extends Delopay {
|
|
|
17189
17399
|
PlatformSettings,
|
|
17190
17400
|
PresentationCache,
|
|
17191
17401
|
ProcessorCosts,
|
|
17402
|
+
ProcessorImports,
|
|
17192
17403
|
Products,
|
|
17404
|
+
PspImportEventStream,
|
|
17193
17405
|
RTL_CHECKOUT_LOCALES,
|
|
17194
17406
|
Regions,
|
|
17195
17407
|
Risk,
|