@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
|
@@ -1716,6 +1716,44 @@ var Disputes = class {
|
|
|
1716
1716
|
options
|
|
1717
1717
|
);
|
|
1718
1718
|
}
|
|
1719
|
+
/**
|
|
1720
|
+
* What a bulk action would do to the selected cases, changing nothing:
|
|
1721
|
+
* each case as eligible or skipped with a reason, and what the eligible ones
|
|
1722
|
+
* add up to per currency. Name the cases by `ids` or by the list's
|
|
1723
|
+
* `filters`, exactly one of the two; at most `max_cases` are read.
|
|
1724
|
+
*
|
|
1725
|
+
* `POST /disputes/workspace/bulk/preview`. Needs a dashboard JWT.
|
|
1726
|
+
*/
|
|
1727
|
+
async bulkPreview(request) {
|
|
1728
|
+
const { filters, ...rest } = request;
|
|
1729
|
+
return this.request("POST", "/disputes/workspace/bulk/preview", {
|
|
1730
|
+
body: filters ? { ...rest, filters: workspaceQuery(filters) } : rest
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Accept the listed cases at their processors, at most the preview's
|
|
1735
|
+
* `max_run_cases` per call; send a larger set in parts under one
|
|
1736
|
+
* `request_id`. Eligibility is decided again at run time, and every case
|
|
1737
|
+
* gets its own result. An `unknown` result means the processor may have
|
|
1738
|
+
* acted: read the case before acting on it again.
|
|
1739
|
+
*
|
|
1740
|
+
* `POST /disputes/workspace/bulk/accept`. Needs a dashboard JWT.
|
|
1741
|
+
*/
|
|
1742
|
+
async bulkAccept(request) {
|
|
1743
|
+
return this.request("POST", "/disputes/workspace/bulk/accept", { body: request });
|
|
1744
|
+
}
|
|
1745
|
+
/**
|
|
1746
|
+
* Add the buyer of each listed case's payment to the buyer blocklist: the
|
|
1747
|
+
* payment's email and customer id, and the device ids and IP address of the
|
|
1748
|
+
* browser that paid, when DeloPay can tie them to it. Identifiers already
|
|
1749
|
+
* blocked are not added again, and `unattributed` names those it could not
|
|
1750
|
+
* tie to the buyer.
|
|
1751
|
+
*
|
|
1752
|
+
* `POST /disputes/workspace/bulk/block-buyer`. Needs a dashboard JWT.
|
|
1753
|
+
*/
|
|
1754
|
+
async bulkBlockBuyer(request) {
|
|
1755
|
+
return this.request("POST", "/disputes/workspace/bulk/block-buyer", { body: request });
|
|
1756
|
+
}
|
|
1719
1757
|
/**
|
|
1720
1758
|
* Retrieve a dispute by its ID.
|
|
1721
1759
|
*
|
|
@@ -3315,15 +3353,21 @@ var Projects = class {
|
|
|
3315
3353
|
this.request = request;
|
|
3316
3354
|
}
|
|
3317
3355
|
/**
|
|
3318
|
-
* Create a new project under a merchant account.
|
|
3356
|
+
* Create a new project under a merchant account. Pass `parent_id` to create
|
|
3357
|
+
* it as a sub-project; past the merchant's maximum depth it is refused with
|
|
3358
|
+
* `400` and code `PR_01` (`project_depth_exceeded`).
|
|
3319
3359
|
*
|
|
3320
|
-
* @param params - Project creation parameters (name, description,
|
|
3360
|
+
* @param params - Project creation parameters (name, description, parent).
|
|
3321
3361
|
* @param merchantId - The merchant account ID that owns this project.
|
|
3322
3362
|
* @returns The created project.
|
|
3323
3363
|
*
|
|
3324
3364
|
* @example
|
|
3325
3365
|
* ```typescript
|
|
3326
|
-
* const
|
|
3366
|
+
* const eu = await delopay.projects.create({ project_name: 'EU Stores' }, 'merch_123');
|
|
3367
|
+
* const de = await delopay.projects.create(
|
|
3368
|
+
* { project_name: 'Germany', parent_id: eu.id },
|
|
3369
|
+
* 'merch_123',
|
|
3370
|
+
* );
|
|
3327
3371
|
* ```
|
|
3328
3372
|
*/
|
|
3329
3373
|
async create(params, merchantId) {
|
|
@@ -3348,7 +3392,14 @@ var Projects = class {
|
|
|
3348
3392
|
return this.request("GET", path, { query: { merchant_id: merchantId } });
|
|
3349
3393
|
}
|
|
3350
3394
|
/**
|
|
3351
|
-
* Update a project's details
|
|
3395
|
+
* Update a project's details, or move it with `parent_id` (omitted keeps the
|
|
3396
|
+
* parent, `null` makes it a top-level project, an id moves it under that
|
|
3397
|
+
* project). A move is refused with `PR_01` when the moved subtree would
|
|
3398
|
+
* exceed the maximum depth and with `PR_02` (`project_cycle`) when the target
|
|
3399
|
+
* is the project itself or one of its sub-projects. When the merchant's
|
|
3400
|
+
* project tree changed while the move was being checked, it is refused with
|
|
3401
|
+
* `409` and code `PR_05` (`project_tree_changed`): read the tree again and
|
|
3402
|
+
* retry.
|
|
3352
3403
|
*
|
|
3353
3404
|
* @param projectId - The project ID to update.
|
|
3354
3405
|
* @param params - Fields to update.
|
|
@@ -3364,6 +3415,9 @@ var Projects = class {
|
|
|
3364
3415
|
* Delete a project.
|
|
3365
3416
|
*
|
|
3366
3417
|
* @param projectId - The project ID to delete.
|
|
3418
|
+
* Refused with `409` and code `PR_03` (`project_not_empty`) while the
|
|
3419
|
+
* project still has sub-projects or shops; move or delete those first.
|
|
3420
|
+
*
|
|
3367
3421
|
* @param merchantId - Optional merchant scope. See {@link Projects.retrieve}.
|
|
3368
3422
|
* @returns The deleted project object.
|
|
3369
3423
|
*/
|
|
@@ -3373,7 +3427,9 @@ var Projects = class {
|
|
|
3373
3427
|
return this.request("DELETE", path, { query: { merchant_id: merchantId } });
|
|
3374
3428
|
}
|
|
3375
3429
|
/**
|
|
3376
|
-
* List all projects for a merchant.
|
|
3430
|
+
* List all projects for a merchant, at every level, as a flat array. Rebuild
|
|
3431
|
+
* the tree from each project's `parent_id`; `level`, `path`,
|
|
3432
|
+
* `child_project_count` and `direct_shop_count` are filled in for each one.
|
|
3377
3433
|
*
|
|
3378
3434
|
* @param merchantId - The merchant account ID.
|
|
3379
3435
|
* @returns Array of projects.
|
|
@@ -3386,6 +3442,11 @@ var Projects = class {
|
|
|
3386
3442
|
/**
|
|
3387
3443
|
* Get aggregate payment statistics across all projects for a merchant.
|
|
3388
3444
|
*
|
|
3445
|
+
* Each project's figures cover its whole subtree (its own shops and the
|
|
3446
|
+
* shops of its sub-projects); `projects[].direct` holds the figures for the
|
|
3447
|
+
* project's own shops only, and `projects[].shops[]` lists only those. The
|
|
3448
|
+
* merchant totals count each shop once.
|
|
3449
|
+
*
|
|
3389
3450
|
* The response's flat `shops[]` array holds every shop, including shops that
|
|
3390
3451
|
* belong to no project — those are absent from `projects[].shops[]`, so look
|
|
3391
3452
|
* a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
|
|
@@ -3407,6 +3468,26 @@ var Projects = class {
|
|
|
3407
3468
|
if (period !== void 0) query["period"] = String(period);
|
|
3408
3469
|
return this.request("GET", "/projects/stats", { query });
|
|
3409
3470
|
}
|
|
3471
|
+
/**
|
|
3472
|
+
* Get the project-depth limit that applies to a merchant: the maximum number
|
|
3473
|
+
* of project levels, where that limit comes from, and how deep the
|
|
3474
|
+
* merchant's tree currently is. Use it to tell whether a project can take a
|
|
3475
|
+
* sub-project (`project.level < max_depth`) before offering the action.
|
|
3476
|
+
*
|
|
3477
|
+
* @param merchantId - The merchant account ID.
|
|
3478
|
+
* @returns The merchant's project limits.
|
|
3479
|
+
*
|
|
3480
|
+
* @example
|
|
3481
|
+
* ```typescript
|
|
3482
|
+
* const { max_depth } = await delopay.projects.limits('merch_123');
|
|
3483
|
+
* const canNest = project.level < max_depth;
|
|
3484
|
+
* ```
|
|
3485
|
+
*/
|
|
3486
|
+
async limits(merchantId) {
|
|
3487
|
+
return this.request("GET", "/projects/limits", {
|
|
3488
|
+
query: { merchant_id: merchantId }
|
|
3489
|
+
});
|
|
3490
|
+
}
|
|
3410
3491
|
/**
|
|
3411
3492
|
* Get a high-level overview (volume, counts, top connectors) for a merchant.
|
|
3412
3493
|
*
|
|
@@ -9440,6 +9521,132 @@ var Live = class {
|
|
|
9440
9521
|
}
|
|
9441
9522
|
};
|
|
9442
9523
|
|
|
9524
|
+
// src/resources/processorImports.ts
|
|
9525
|
+
function toPspImportStreamEvent(event) {
|
|
9526
|
+
switch (event.type) {
|
|
9527
|
+
case "progress": {
|
|
9528
|
+
let run;
|
|
9529
|
+
try {
|
|
9530
|
+
run = JSON.parse(event.data);
|
|
9531
|
+
} catch {
|
|
9532
|
+
return null;
|
|
9533
|
+
}
|
|
9534
|
+
if (run === null || typeof run !== "object" || Array.isArray(run)) return null;
|
|
9535
|
+
return { type: "progress", run };
|
|
9536
|
+
}
|
|
9537
|
+
case "done":
|
|
9538
|
+
return { type: "done" };
|
|
9539
|
+
default:
|
|
9540
|
+
return null;
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9543
|
+
var PspImportEventStream = class {
|
|
9544
|
+
constructor(connection) {
|
|
9545
|
+
this.connection = connection;
|
|
9546
|
+
}
|
|
9547
|
+
/** Close the stream; the iteration ends without an error. */
|
|
9548
|
+
close() {
|
|
9549
|
+
this.connection.close();
|
|
9550
|
+
}
|
|
9551
|
+
[Symbol.asyncIterator]() {
|
|
9552
|
+
this.iterator ?? (this.iterator = this.events());
|
|
9553
|
+
return this.iterator;
|
|
9554
|
+
}
|
|
9555
|
+
async *events() {
|
|
9556
|
+
for await (const dispatch of this.connection.dispatches) {
|
|
9557
|
+
if (!dispatch.event) continue;
|
|
9558
|
+
const event = toPspImportStreamEvent(dispatch.event);
|
|
9559
|
+
if (event) yield event;
|
|
9560
|
+
}
|
|
9561
|
+
}
|
|
9562
|
+
};
|
|
9563
|
+
var ProcessorImports = class {
|
|
9564
|
+
constructor(request, openStream) {
|
|
9565
|
+
this.request = request;
|
|
9566
|
+
this.openStream = openStream;
|
|
9567
|
+
}
|
|
9568
|
+
/**
|
|
9569
|
+
* Every connected processor account the caller may see, with what each can
|
|
9570
|
+
* provide in the environment: listed, read payment by payment, or
|
|
9571
|
+
* unavailable with a reason.
|
|
9572
|
+
*
|
|
9573
|
+
* `GET /refunds-disputes/imports/sources`
|
|
9574
|
+
*/
|
|
9575
|
+
async sources(params) {
|
|
9576
|
+
return this.request("GET", "/refunds-disputes/imports/sources", {
|
|
9577
|
+
query: { test_mode: params.test_mode }
|
|
9578
|
+
});
|
|
9579
|
+
}
|
|
9580
|
+
/**
|
|
9581
|
+
* Start an import. A source a processor cannot provide is stored as
|
|
9582
|
+
* `unavailable` with its reason. Refused while another import of the
|
|
9583
|
+
* merchant runs in the same environment.
|
|
9584
|
+
*
|
|
9585
|
+
* `POST /refunds-disputes/imports`
|
|
9586
|
+
*/
|
|
9587
|
+
async create(request) {
|
|
9588
|
+
return this.request("POST", "/refunds-disputes/imports", { body: request });
|
|
9589
|
+
}
|
|
9590
|
+
/**
|
|
9591
|
+
* The newest import in the environment, running or finished.
|
|
9592
|
+
*
|
|
9593
|
+
* `GET /refunds-disputes/imports/latest`
|
|
9594
|
+
*/
|
|
9595
|
+
async latest(params) {
|
|
9596
|
+
return this.request("GET", "/refunds-disputes/imports/latest", {
|
|
9597
|
+
query: { test_mode: params.test_mode }
|
|
9598
|
+
});
|
|
9599
|
+
}
|
|
9600
|
+
/** `GET /refunds-disputes/imports/{id}` */
|
|
9601
|
+
async retrieve(id) {
|
|
9602
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}`);
|
|
9603
|
+
}
|
|
9604
|
+
/**
|
|
9605
|
+
* The records an import left out or could not record, each with its reason.
|
|
9606
|
+
*
|
|
9607
|
+
* `GET /refunds-disputes/imports/{id}/issues`
|
|
9608
|
+
*/
|
|
9609
|
+
async issues(id, params) {
|
|
9610
|
+
return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}/issues`, {
|
|
9611
|
+
query: { limit: params?.limit, offset: params?.offset }
|
|
9612
|
+
});
|
|
9613
|
+
}
|
|
9614
|
+
/**
|
|
9615
|
+
* Ask a running import to stop. It stops after the page it is reading;
|
|
9616
|
+
* what it recorded stays recorded.
|
|
9617
|
+
*
|
|
9618
|
+
* `POST /refunds-disputes/imports/{id}/cancel`
|
|
9619
|
+
*/
|
|
9620
|
+
async cancel(id) {
|
|
9621
|
+
return this.request("POST", `/refunds-disputes/imports/${encodeURIComponent(id)}/cancel`);
|
|
9622
|
+
}
|
|
9623
|
+
/**
|
|
9624
|
+
* Open the progress stream of an import. Resolves once the server answered;
|
|
9625
|
+
* a `401` rejects with `DelopayAuthenticationError`.
|
|
9626
|
+
*
|
|
9627
|
+
* `GET /refunds-disputes/imports/{id}/stream`
|
|
9628
|
+
*
|
|
9629
|
+
* @example
|
|
9630
|
+
* ```typescript
|
|
9631
|
+
* const stream = await delopay.processorImports.stream(run.id, { signal });
|
|
9632
|
+
* for await (const event of stream) {
|
|
9633
|
+
* if (event.type === 'progress') render(event.run);
|
|
9634
|
+
* }
|
|
9635
|
+
* ```
|
|
9636
|
+
*/
|
|
9637
|
+
async stream(id, options = {}) {
|
|
9638
|
+
const connection = await this.openStream(
|
|
9639
|
+
`/refunds-disputes/imports/${encodeURIComponent(id)}/stream`,
|
|
9640
|
+
{
|
|
9641
|
+
...options.signal ? { signal: options.signal } : {},
|
|
9642
|
+
...options.idleTimeoutMs !== void 0 ? { idleTimeoutMs: options.idleTimeoutMs } : {},
|
|
9643
|
+
...options.headers ? { headers: options.headers } : {}
|
|
9644
|
+
}
|
|
9645
|
+
);
|
|
9646
|
+
return new PspImportEventStream(connection);
|
|
9647
|
+
}
|
|
9648
|
+
};
|
|
9649
|
+
|
|
9443
9650
|
// src/resources/deploymentBranding.ts
|
|
9444
9651
|
function brandingAssetPath(asset, version) {
|
|
9445
9652
|
const path = `/branding/assets/${encodeURIComponent(asset)}`;
|
|
@@ -9754,6 +9961,7 @@ var Delopay = class {
|
|
|
9754
9961
|
this.messageTemplates = new MessageTemplates(request);
|
|
9755
9962
|
this.risk = new Risk(request);
|
|
9756
9963
|
this.live = new Live(request, openStream);
|
|
9964
|
+
this.processorImports = new ProcessorImports(request, openStream);
|
|
9757
9965
|
this.branding = new Branding(request, this.baseUrl);
|
|
9758
9966
|
this.subscriptions = new Subscriptions(request);
|
|
9759
9967
|
this.buyerPortal = new BuyerPortal(request);
|
|
@@ -14966,6 +15174,8 @@ export {
|
|
|
14966
15174
|
LiveEventStream,
|
|
14967
15175
|
openLiveStream,
|
|
14968
15176
|
Live,
|
|
15177
|
+
PspImportEventStream,
|
|
15178
|
+
ProcessorImports,
|
|
14969
15179
|
brandingAssetPath,
|
|
14970
15180
|
Branding,
|
|
14971
15181
|
Delopay,
|
|
@@ -15187,4 +15397,4 @@ export {
|
|
|
15187
15397
|
decodeNativePanes,
|
|
15188
15398
|
encodeNativePanes
|
|
15189
15399
|
};
|
|
15190
|
-
//# sourceMappingURL=chunk-
|
|
15400
|
+
//# sourceMappingURL=chunk-JHQBYOCA.js.map
|