@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.
@@ -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
  *
@@ -9440,6 +9478,132 @@ var Live = class {
9440
9478
  }
9441
9479
  };
9442
9480
 
9481
+ // src/resources/processorImports.ts
9482
+ function toPspImportStreamEvent(event) {
9483
+ switch (event.type) {
9484
+ case "progress": {
9485
+ let run;
9486
+ try {
9487
+ run = JSON.parse(event.data);
9488
+ } catch {
9489
+ return null;
9490
+ }
9491
+ if (run === null || typeof run !== "object" || Array.isArray(run)) return null;
9492
+ return { type: "progress", run };
9493
+ }
9494
+ case "done":
9495
+ return { type: "done" };
9496
+ default:
9497
+ return null;
9498
+ }
9499
+ }
9500
+ var PspImportEventStream = class {
9501
+ constructor(connection) {
9502
+ this.connection = connection;
9503
+ }
9504
+ /** Close the stream; the iteration ends without an error. */
9505
+ close() {
9506
+ this.connection.close();
9507
+ }
9508
+ [Symbol.asyncIterator]() {
9509
+ this.iterator ?? (this.iterator = this.events());
9510
+ return this.iterator;
9511
+ }
9512
+ async *events() {
9513
+ for await (const dispatch of this.connection.dispatches) {
9514
+ if (!dispatch.event) continue;
9515
+ const event = toPspImportStreamEvent(dispatch.event);
9516
+ if (event) yield event;
9517
+ }
9518
+ }
9519
+ };
9520
+ var ProcessorImports = class {
9521
+ constructor(request, openStream) {
9522
+ this.request = request;
9523
+ this.openStream = openStream;
9524
+ }
9525
+ /**
9526
+ * Every connected processor account the caller may see, with what each can
9527
+ * provide in the environment: listed, read payment by payment, or
9528
+ * unavailable with a reason.
9529
+ *
9530
+ * `GET /refunds-disputes/imports/sources`
9531
+ */
9532
+ async sources(params) {
9533
+ return this.request("GET", "/refunds-disputes/imports/sources", {
9534
+ query: { test_mode: params.test_mode }
9535
+ });
9536
+ }
9537
+ /**
9538
+ * Start an import. A source a processor cannot provide is stored as
9539
+ * `unavailable` with its reason. Refused while another import of the
9540
+ * merchant runs in the same environment.
9541
+ *
9542
+ * `POST /refunds-disputes/imports`
9543
+ */
9544
+ async create(request) {
9545
+ return this.request("POST", "/refunds-disputes/imports", { body: request });
9546
+ }
9547
+ /**
9548
+ * The newest import in the environment, running or finished.
9549
+ *
9550
+ * `GET /refunds-disputes/imports/latest`
9551
+ */
9552
+ async latest(params) {
9553
+ return this.request("GET", "/refunds-disputes/imports/latest", {
9554
+ query: { test_mode: params.test_mode }
9555
+ });
9556
+ }
9557
+ /** `GET /refunds-disputes/imports/{id}` */
9558
+ async retrieve(id) {
9559
+ return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}`);
9560
+ }
9561
+ /**
9562
+ * The records an import left out or could not record, each with its reason.
9563
+ *
9564
+ * `GET /refunds-disputes/imports/{id}/issues`
9565
+ */
9566
+ async issues(id, params) {
9567
+ return this.request("GET", `/refunds-disputes/imports/${encodeURIComponent(id)}/issues`, {
9568
+ query: { limit: params?.limit, offset: params?.offset }
9569
+ });
9570
+ }
9571
+ /**
9572
+ * Ask a running import to stop. It stops after the page it is reading;
9573
+ * what it recorded stays recorded.
9574
+ *
9575
+ * `POST /refunds-disputes/imports/{id}/cancel`
9576
+ */
9577
+ async cancel(id) {
9578
+ return this.request("POST", `/refunds-disputes/imports/${encodeURIComponent(id)}/cancel`);
9579
+ }
9580
+ /**
9581
+ * Open the progress stream of an import. Resolves once the server answered;
9582
+ * a `401` rejects with `DelopayAuthenticationError`.
9583
+ *
9584
+ * `GET /refunds-disputes/imports/{id}/stream`
9585
+ *
9586
+ * @example
9587
+ * ```typescript
9588
+ * const stream = await delopay.processorImports.stream(run.id, { signal });
9589
+ * for await (const event of stream) {
9590
+ * if (event.type === 'progress') render(event.run);
9591
+ * }
9592
+ * ```
9593
+ */
9594
+ async stream(id, options = {}) {
9595
+ const connection = await this.openStream(
9596
+ `/refunds-disputes/imports/${encodeURIComponent(id)}/stream`,
9597
+ {
9598
+ ...options.signal ? { signal: options.signal } : {},
9599
+ ...options.idleTimeoutMs !== void 0 ? { idleTimeoutMs: options.idleTimeoutMs } : {},
9600
+ ...options.headers ? { headers: options.headers } : {}
9601
+ }
9602
+ );
9603
+ return new PspImportEventStream(connection);
9604
+ }
9605
+ };
9606
+
9443
9607
  // src/resources/deploymentBranding.ts
9444
9608
  function brandingAssetPath(asset, version) {
9445
9609
  const path = `/branding/assets/${encodeURIComponent(asset)}`;
@@ -9754,6 +9918,7 @@ var Delopay = class {
9754
9918
  this.messageTemplates = new MessageTemplates(request);
9755
9919
  this.risk = new Risk(request);
9756
9920
  this.live = new Live(request, openStream);
9921
+ this.processorImports = new ProcessorImports(request, openStream);
9757
9922
  this.branding = new Branding(request, this.baseUrl);
9758
9923
  this.subscriptions = new Subscriptions(request);
9759
9924
  this.buyerPortal = new BuyerPortal(request);
@@ -14966,6 +15131,8 @@ export {
14966
15131
  LiveEventStream,
14967
15132
  openLiveStream,
14968
15133
  Live,
15134
+ PspImportEventStream,
15135
+ ProcessorImports,
14969
15136
  brandingAssetPath,
14970
15137
  Branding,
14971
15138
  Delopay,
@@ -15187,4 +15354,4 @@ export {
15187
15354
  decodeNativePanes,
15188
15355
  encodeNativePanes
15189
15356
  };
15190
- //# sourceMappingURL=chunk-ZZEGL45P.js.map
15357
+ //# sourceMappingURL=chunk-7QXWTMSG.js.map