@delopay/sdk 0.290.0 → 0.292.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-7QXWTMSG.js → chunk-JHQBYOCA.js} +49 -6
- package/dist/chunk-JHQBYOCA.js.map +1 -0
- package/dist/{index-CCxMFvNk.d.cts → index-DNWBhj2U.d.cts} +181 -14
- package/dist/{index-CCxMFvNk.d.ts → index-DNWBhj2U.d.ts} +181 -14
- package/dist/index.cjs +48 -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 +1 -1
- package/dist/internal.cjs +48 -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 +1 -1
- package/package.json +1 -1
- package/dist/chunk-7QXWTMSG.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3641,15 +3641,21 @@ var Projects = class {
|
|
|
3641
3641
|
this.request = request;
|
|
3642
3642
|
}
|
|
3643
3643
|
/**
|
|
3644
|
-
* 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`).
|
|
3645
3647
|
*
|
|
3646
|
-
* @param params - Project creation parameters (name, description,
|
|
3648
|
+
* @param params - Project creation parameters (name, description, parent).
|
|
3647
3649
|
* @param merchantId - The merchant account ID that owns this project.
|
|
3648
3650
|
* @returns The created project.
|
|
3649
3651
|
*
|
|
3650
3652
|
* @example
|
|
3651
3653
|
* ```typescript
|
|
3652
|
-
* 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
|
+
* );
|
|
3653
3659
|
* ```
|
|
3654
3660
|
*/
|
|
3655
3661
|
async create(params, merchantId) {
|
|
@@ -3674,7 +3680,14 @@ var Projects = class {
|
|
|
3674
3680
|
return this.request("GET", path, { query: { merchant_id: merchantId } });
|
|
3675
3681
|
}
|
|
3676
3682
|
/**
|
|
3677
|
-
* 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.
|
|
3678
3691
|
*
|
|
3679
3692
|
* @param projectId - The project ID to update.
|
|
3680
3693
|
* @param params - Fields to update.
|
|
@@ -3690,6 +3703,9 @@ var Projects = class {
|
|
|
3690
3703
|
* Delete a project.
|
|
3691
3704
|
*
|
|
3692
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
|
+
*
|
|
3693
3709
|
* @param merchantId - Optional merchant scope. See {@link Projects.retrieve}.
|
|
3694
3710
|
* @returns The deleted project object.
|
|
3695
3711
|
*/
|
|
@@ -3699,7 +3715,9 @@ var Projects = class {
|
|
|
3699
3715
|
return this.request("DELETE", path, { query: { merchant_id: merchantId } });
|
|
3700
3716
|
}
|
|
3701
3717
|
/**
|
|
3702
|
-
* 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.
|
|
3703
3721
|
*
|
|
3704
3722
|
* @param merchantId - The merchant account ID.
|
|
3705
3723
|
* @returns Array of projects.
|
|
@@ -3712,6 +3730,11 @@ var Projects = class {
|
|
|
3712
3730
|
/**
|
|
3713
3731
|
* Get aggregate payment statistics across all projects for a merchant.
|
|
3714
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
|
+
*
|
|
3715
3738
|
* The response's flat `shops[]` array holds every shop, including shops that
|
|
3716
3739
|
* belong to no project — those are absent from `projects[].shops[]`, so look
|
|
3717
3740
|
* a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
|
|
@@ -3733,6 +3756,26 @@ var Projects = class {
|
|
|
3733
3756
|
if (period !== void 0) query["period"] = String(period);
|
|
3734
3757
|
return this.request("GET", "/projects/stats", { query });
|
|
3735
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
|
+
}
|
|
3736
3779
|
/**
|
|
3737
3780
|
* Get a high-level overview (volume, counts, top connectors) for a merchant.
|
|
3738
3781
|
*
|