@delopay/sdk 0.103.0 → 0.105.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/index.cjs CHANGED
@@ -56,6 +56,7 @@ __export(index_exports, {
56
56
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
57
57
  OperationLimits: () => OperationLimits,
58
58
  Regions: () => Regions,
59
+ Risk: () => Risk,
59
60
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
60
61
  Search: () => Search,
61
62
  Settlement: () => Settlement,
@@ -538,12 +539,37 @@ var Connectors = class {
538
539
  body: params
539
540
  });
540
541
  }
542
+ /**
543
+ * One connector account.
544
+ *
545
+ * The credential-bearing fields come back `null` here, whatever is stored:
546
+ * `connector_webhook_details`, `connector_wallets_details`,
547
+ * `pm_auth_config` and `additional_merchant_data`. They are dropped rather
548
+ * than masked, because an editor that prefills from this response and
549
+ * PATCHes the field back would otherwise save a mask over a live signing
550
+ * secret. Send those fields only when the operator has typed a new value,
551
+ * and omit them entirely otherwise — an omitted field leaves the stored one
552
+ * alone.
553
+ *
554
+ * This is the retrieve path alone. `create` and `update` echo back what the
555
+ * caller sent, and `clone` returns the *copied* secrets — see that method.
556
+ *
557
+ * `GET /account/{accountId}/connectors/{connectorId}`
558
+ */
541
559
  async retrieve(accountId, connectorId) {
542
560
  return this.request(
543
561
  "GET",
544
562
  `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}`
545
563
  );
546
564
  }
565
+ /**
566
+ * The merchant's connector accounts.
567
+ *
568
+ * Never wider than the caller: an API key pinned to one shop lists that
569
+ * shop's connectors only, not every sibling shop's.
570
+ *
571
+ * `GET /account/{accountId}/connectors`
572
+ */
547
573
  async list(accountId) {
548
574
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/connectors`);
549
575
  }
@@ -589,6 +615,15 @@ var Connectors = class {
589
615
  }
590
616
  );
591
617
  }
618
+ /**
619
+ * Remove a connector account.
620
+ *
621
+ * A shop-scoped role may remove a connector of its own shop — the shop is
622
+ * re-checked server-side — so creating processors and removing them are the
623
+ * same rung of access rather than two.
624
+ *
625
+ * `DELETE /account/{accountId}/connectors/{connectorId}`
626
+ */
592
627
  async delete(accountId, connectorId) {
593
628
  return this.request(
594
629
  "DELETE",
@@ -600,9 +635,15 @@ var Connectors = class {
600
635
  * merchant. `POST /account/{accountId}/connectors/{connectorId}/clone`
601
636
  *
602
637
  * Credentials are copied server-side, re-encrypted under the same merchant
603
- * key the caller never handles them (list/retrieve mask credentials, so a
604
- * client-side copy is impossible). Returns the newly created connector in
605
- * the target shop.
638
+ * key, so the caller never has to *supply* them — `retrieve` returns `null`
639
+ * for the credential fields, which is what makes a client-side copy
640
+ * impossible in the first place.
641
+ *
642
+ * The response, however, is the unredacted connector: `connector_account_details`
643
+ * is masked, but `connector_webhook_details`, `connector_wallets_details`,
644
+ * `pm_auth_config` and `additional_merchant_data` come back with the copied
645
+ * secrets in them — values this caller never sent. Do not log or echo the
646
+ * response; read `merchant_connector_id` and discard the rest.
606
647
  */
607
648
  async clone(accountId, connectorId, params) {
608
649
  return this.request(
@@ -1471,6 +1512,13 @@ var Payments = class {
1471
1512
  * test_mode: process.env.NODE_ENV !== 'production',
1472
1513
  * });
1473
1514
  * ```
1515
+ *
1516
+ * A payment that pins one connector through `routing` (the `single` form)
1517
+ * is now checked against `test_mode` here rather than at confirm: if that
1518
+ * connector has no credentials for the environment asked for, create fails
1519
+ * instead of handing back a payment whose checkout the buyer cannot
1520
+ * complete. `priority` and `volume_split` name several accounts and are
1521
+ * still resolved at confirm.
1474
1522
  */
1475
1523
  async create(params, options) {
1476
1524
  return this.request("POST", "/payments", { body: params, ...options });
@@ -2111,6 +2159,14 @@ var Refunds = class {
2111
2159
  /**
2112
2160
  * Create a refund for a payment.
2113
2161
  *
2162
+ * Dashboard-initiated refunds are subject to the caller's operation-limit
2163
+ * rule, resolved against the role the request authenticated with. An
2164
+ * over-limit refund either fails with `DE_01` (the rule blocks) or with
2165
+ * HTTP 409 `DE_06` — the rule requires approval, and `DelopayError.data`
2166
+ * carries `PendingApprovalErrorDetails`. No refund exists in either case;
2167
+ * `DE_06` names one that a second approver can still let through, via
2168
+ * `operationLimits.approve()`.
2169
+ *
2114
2170
  * @param params - Refund parameters, including the required `payment_id` and optional amount.
2115
2171
  * @returns The created refund.
2116
2172
  *
@@ -2315,6 +2371,55 @@ var Routing = class {
2315
2371
  async update(algorithmId, params) {
2316
2372
  return this.request("PUT", `/routing/${encodeURIComponent(algorithmId)}`, { body: params });
2317
2373
  }
2374
+ /**
2375
+ * Every content window a routing configuration has had, oldest first.
2376
+ *
2377
+ * A configuration's rule can be edited in place, so this is what makes "which
2378
+ * rule decided this payment" answerable after the fact. Each entry is the rule
2379
+ * as it stood between `valid_from` and `valid_until`; the windows of one
2380
+ * config abut exactly, with no gap.
2381
+ *
2382
+ * Paging covers the whole timeline including the live window, so a page never
2383
+ * holds more than `limit` entries and the live one — the only entry without a
2384
+ * `valid_until` — comes back on exactly one page. Advance `offset` by `limit`;
2385
+ * a page past the end is empty, and `total_count` says where that end is
2386
+ * without probing for it.
2387
+ *
2388
+ * `GET /routing/{algorithmId}/history`
2389
+ *
2390
+ * @param algorithmId - The routing algorithm to read the history of.
2391
+ * @param params - Optional paging.
2392
+ */
2393
+ async history(algorithmId, params = {}) {
2394
+ return this.request("GET", `/routing/${encodeURIComponent(algorithmId)}/history`, {
2395
+ query: params
2396
+ });
2397
+ }
2398
+ /**
2399
+ * A shop's lifetime per-connector payment caps, each with how much of it is
2400
+ * already spent.
2401
+ *
2402
+ * `GET /routing/connector-caps/{profileId}`
2403
+ */
2404
+ async connectorCaps(profileId) {
2405
+ return this.request("GET", `/routing/connector-caps/${encodeURIComponent(profileId)}`);
2406
+ }
2407
+ /**
2408
+ * Replace a shop's per-connector payment caps.
2409
+ *
2410
+ * Whole-set replacement, not a patch: the list sent becomes the complete set
2411
+ * of capped connectors, and an empty list clears them all — which is how
2412
+ * acquirer onboarding finishes, the new account ceasing to be a special case.
2413
+ *
2414
+ * Every account named must belong to this shop; one that does not is refused.
2415
+ *
2416
+ * `PUT /routing/connector-caps/{profileId}`
2417
+ */
2418
+ async setConnectorCaps(profileId, params) {
2419
+ return this.request("PUT", `/routing/connector-caps/${encodeURIComponent(profileId)}`, {
2420
+ body: params
2421
+ });
2422
+ }
2318
2423
  /**
2319
2424
  * List all routing algorithms for the current merchant.
2320
2425
  *
@@ -3201,7 +3306,15 @@ var Users = class {
3201
3306
  async selectAuth(params) {
3202
3307
  return this.request("POST", "/user/auth/select", { body: params });
3203
3308
  }
3204
- /** List users in lineage. `GET /user/employees/list` */
3309
+ /**
3310
+ * List users in lineage.
3311
+ *
3312
+ * Needs the Users *view* grant now — the response carries colleagues' email
3313
+ * addresses, so a role without it is refused rather than handed a roster.
3314
+ * A shop-scoped role keeps reading its own shop's members.
3315
+ *
3316
+ * `GET /user/employees/list`
3317
+ */
3205
3318
  async listUsersInLineage(params) {
3206
3319
  return this.request("GET", "/user/employees/list", {
3207
3320
  query: params
@@ -3481,6 +3594,44 @@ var Analytics = class {
3481
3594
  query: params
3482
3595
  });
3483
3596
  }
3597
+ /**
3598
+ * Subscription analytics over `subscription` and `invoice`: estimated
3599
+ * recurring volume, the invoice funnel, movement (new / expansion /
3600
+ * contraction / churn), both processor axes, plan mix and the breakdown one
3601
+ * level below the scope. Pinned server-side to your own merchant and
3602
+ * drillable via `project_id` / `shop_id` exactly like `scope`.
3603
+ *
3604
+ * Half the figures are **stocks** — a snapshot at the window's end rather
3605
+ * than a sum over it — so `est_monthly_volume_usd` and `active` can match
3606
+ * across a 7-day and a 30-day window while `billed_volume_usd` does not.
3607
+ * Day granularity only. `GET /analytics/subscriptions`
3608
+ */
3609
+ async subscriptions(params) {
3610
+ return this.request("GET", "/analytics/subscriptions", {
3611
+ query: params
3612
+ });
3613
+ }
3614
+ /**
3615
+ * The billing cycles behind one clicked element of the subscription
3616
+ * dashboard: an invoice outcome, a processor slice on either axis, a plan
3617
+ * row, a subscription status, a movement component, a series bucket or a
3618
+ * breakdown row. Same window/scope/filter contract as `subscriptions`; 50
3619
+ * rows per page (`offset` for the next), newest first, with the full match
3620
+ * count alongside.
3621
+ *
3622
+ * A cycle that never reached a payment is listed too — that is what "still
3623
+ * unpaid" means — and carries its invoice id as `payment_id` with
3624
+ * `invoice_id` set to the same value, so you can always tell which you got.
3625
+ * `GET /analytics/subscriptions/list`
3626
+ */
3627
+ async subscriptionsList(params) {
3628
+ return this.request("GET", "/analytics/subscriptions/list", {
3629
+ // A discriminated union carries no index signature, so the widening
3630
+ // goes via `unknown` — the union is the point, and the query builder
3631
+ // only ever reads own enumerable keys.
3632
+ query: params
3633
+ });
3634
+ }
3484
3635
  /** Global search. `POST /analytics/search` */
3485
3636
  async search(params) {
3486
3637
  return this.request("POST", "/analytics/search", { body: params });
@@ -3992,6 +4143,12 @@ var Settlement = class {
3992
4143
  /**
3993
4144
  * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
3994
4145
  *
4146
+ * Subject to the caller's `settlement_payout` operation limit, which can
4147
+ * only be a per-operation ceiling: an over-limit call fails with `DE_01`
4148
+ * and nothing is recorded. There is no approval route out of it — four-eyes
4149
+ * needs an executor that can run the operation once somebody says yes, and
4150
+ * only refunds have one, so a settlement rule can only block.
4151
+ *
3995
4152
  * `POST /settlement/statements/{statementId}/payout`
3996
4153
  */
3997
4154
  async updateStatementPayout(statementId, params, options) {
@@ -4092,6 +4249,11 @@ var Settlement = class {
4092
4249
  * Add a manual adjustment to a statement. Positive `amount_usd` charges
4093
4250
  * the shop (reducing their payout); negative credits them.
4094
4251
  *
4252
+ * Subject to the caller's `settlement_adjustment` operation limit (amount
4253
+ * dimensions only): an over-limit call fails with `DE_01` and no adjustment
4254
+ * is added. A settlement rule can only block — approval is refund-only, for
4255
+ * the reason given on `updateStatementPayout()`.
4256
+ *
4095
4257
  * `POST /settlement/statements/{statementId}/adjustments`
4096
4258
  */
4097
4259
  async createStatementAdjustment(statementId, params, options) {
@@ -4165,6 +4327,84 @@ var OperationLimits = class {
4165
4327
  async updateSettings(params, options) {
4166
4328
  return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
4167
4329
  }
4330
+ /**
4331
+ * The approvals inbox: over-limit operations waiting on a second person.
4332
+ *
4333
+ * Both filters default rather than widen. With no `status` the list holds
4334
+ * **pending requests only** — approved, rejected and expired ones are
4335
+ * reachable only by asking for that status, so a history view must pass one
4336
+ * per status. With no `operation` it lists **refunds only**; the list is one
4337
+ * operation at a time. `limit` defaults to 100 and is clamped to 1–500.
4338
+ *
4339
+ * Requests past their `expires_at` are expired before the list is read, so
4340
+ * nothing here is shown as actionable when it is not.
4341
+ *
4342
+ * `GET /operation-limits/approvals`
4343
+ */
4344
+ async listApprovals(params, options) {
4345
+ return this.request("GET", "/operation-limits/approvals", {
4346
+ query: {
4347
+ operation: params?.operation,
4348
+ status: params?.status,
4349
+ limit: params?.limit
4350
+ },
4351
+ ...options
4352
+ });
4353
+ }
4354
+ /**
4355
+ * Approve a parked operation and execute it.
4356
+ *
4357
+ * Refused for the user who requested it, and for an approver whose own
4358
+ * limit would not have covered the operation — the permission is necessary
4359
+ * and not sufficient.
4360
+ *
4361
+ * Approval and execution are two facts. A request that was approved but
4362
+ * whose operation then failed comes back `approved` with `execution_error`
4363
+ * set and no `result_entity_id`; that is a real outcome, not a partial read.
4364
+ *
4365
+ * `POST /operation-limits/approvals/{id}/approve`
4366
+ */
4367
+ async approve(id, params = {}, options) {
4368
+ return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/approve`, {
4369
+ body: params,
4370
+ ...options
4371
+ });
4372
+ }
4373
+ /**
4374
+ * Reject a parked operation. Nothing is executed and the request is closed.
4375
+ *
4376
+ * `POST /operation-limits/approvals/{id}/reject`
4377
+ */
4378
+ async reject(id, params = {}, options) {
4379
+ return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/reject`, {
4380
+ body: params,
4381
+ ...options
4382
+ });
4383
+ }
4384
+ };
4385
+
4386
+ // src/resources/risk.ts
4387
+ var Risk = class {
4388
+ constructor(request) {
4389
+ this.request = request;
4390
+ }
4391
+ /**
4392
+ * Every shop's stored risk for the caller's merchant, with the worst band
4393
+ * across them.
4394
+ *
4395
+ * `GET /risk`
4396
+ */
4397
+ async retrieve(options) {
4398
+ return this.request("GET", "/risk", options);
4399
+ }
4400
+ /**
4401
+ * One shop's stored risk index per connector.
4402
+ *
4403
+ * `GET /risk/shops/{profileId}`
4404
+ */
4405
+ async retrieveShop(profileId, options) {
4406
+ return this.request("GET", `/risk/shops/${encodeURIComponent(profileId)}`, options);
4407
+ }
4168
4408
  };
4169
4409
 
4170
4410
  // src/client.ts
@@ -4296,6 +4536,7 @@ var Delopay = class {
4296
4536
  this.threeDsRules = new ThreeDsRules(request);
4297
4537
  this.settlement = new Settlement(request);
4298
4538
  this.operationLimits = new OperationLimits(request);
4539
+ this.risk = new Risk(request);
4299
4540
  this.subscriptions = new Subscriptions(request);
4300
4541
  this.files = new Files(request);
4301
4542
  this.export = new Export(request);
@@ -6337,6 +6578,7 @@ var CHECKOUT_EVENT_KINDS = [
6337
6578
  NATIVE_PANE_ICON_KEYS,
6338
6579
  OperationLimits,
6339
6580
  Regions,
6581
+ Risk,
6340
6582
  STRIPE_NATIVE_PANE_METHODS,
6341
6583
  Search,
6342
6584
  Settlement,