@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.
@@ -424,12 +424,37 @@ var Connectors = class {
424
424
  body: params
425
425
  });
426
426
  }
427
+ /**
428
+ * One connector account.
429
+ *
430
+ * The credential-bearing fields come back `null` here, whatever is stored:
431
+ * `connector_webhook_details`, `connector_wallets_details`,
432
+ * `pm_auth_config` and `additional_merchant_data`. They are dropped rather
433
+ * than masked, because an editor that prefills from this response and
434
+ * PATCHes the field back would otherwise save a mask over a live signing
435
+ * secret. Send those fields only when the operator has typed a new value,
436
+ * and omit them entirely otherwise — an omitted field leaves the stored one
437
+ * alone.
438
+ *
439
+ * This is the retrieve path alone. `create` and `update` echo back what the
440
+ * caller sent, and `clone` returns the *copied* secrets — see that method.
441
+ *
442
+ * `GET /account/{accountId}/connectors/{connectorId}`
443
+ */
427
444
  async retrieve(accountId, connectorId) {
428
445
  return this.request(
429
446
  "GET",
430
447
  `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}`
431
448
  );
432
449
  }
450
+ /**
451
+ * The merchant's connector accounts.
452
+ *
453
+ * Never wider than the caller: an API key pinned to one shop lists that
454
+ * shop's connectors only, not every sibling shop's.
455
+ *
456
+ * `GET /account/{accountId}/connectors`
457
+ */
433
458
  async list(accountId) {
434
459
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/connectors`);
435
460
  }
@@ -475,6 +500,15 @@ var Connectors = class {
475
500
  }
476
501
  );
477
502
  }
503
+ /**
504
+ * Remove a connector account.
505
+ *
506
+ * A shop-scoped role may remove a connector of its own shop — the shop is
507
+ * re-checked server-side — so creating processors and removing them are the
508
+ * same rung of access rather than two.
509
+ *
510
+ * `DELETE /account/{accountId}/connectors/{connectorId}`
511
+ */
478
512
  async delete(accountId, connectorId) {
479
513
  return this.request(
480
514
  "DELETE",
@@ -486,9 +520,15 @@ var Connectors = class {
486
520
  * merchant. `POST /account/{accountId}/connectors/{connectorId}/clone`
487
521
  *
488
522
  * Credentials are copied server-side, re-encrypted under the same merchant
489
- * key the caller never handles them (list/retrieve mask credentials, so a
490
- * client-side copy is impossible). Returns the newly created connector in
491
- * the target shop.
523
+ * key, so the caller never has to *supply* them — `retrieve` returns `null`
524
+ * for the credential fields, which is what makes a client-side copy
525
+ * impossible in the first place.
526
+ *
527
+ * The response, however, is the unredacted connector: `connector_account_details`
528
+ * is masked, but `connector_webhook_details`, `connector_wallets_details`,
529
+ * `pm_auth_config` and `additional_merchant_data` come back with the copied
530
+ * secrets in them — values this caller never sent. Do not log or echo the
531
+ * response; read `merchant_connector_id` and discard the rest.
492
532
  */
493
533
  async clone(accountId, connectorId, params) {
494
534
  return this.request(
@@ -1357,6 +1397,13 @@ var Payments = class {
1357
1397
  * test_mode: process.env.NODE_ENV !== 'production',
1358
1398
  * });
1359
1399
  * ```
1400
+ *
1401
+ * A payment that pins one connector through `routing` (the `single` form)
1402
+ * is now checked against `test_mode` here rather than at confirm: if that
1403
+ * connector has no credentials for the environment asked for, create fails
1404
+ * instead of handing back a payment whose checkout the buyer cannot
1405
+ * complete. `priority` and `volume_split` name several accounts and are
1406
+ * still resolved at confirm.
1360
1407
  */
1361
1408
  async create(params, options) {
1362
1409
  return this.request("POST", "/payments", { body: params, ...options });
@@ -1997,6 +2044,14 @@ var Refunds = class {
1997
2044
  /**
1998
2045
  * Create a refund for a payment.
1999
2046
  *
2047
+ * Dashboard-initiated refunds are subject to the caller's operation-limit
2048
+ * rule, resolved against the role the request authenticated with. An
2049
+ * over-limit refund either fails with `DE_01` (the rule blocks) or with
2050
+ * HTTP 409 `DE_06` — the rule requires approval, and `DelopayError.data`
2051
+ * carries `PendingApprovalErrorDetails`. No refund exists in either case;
2052
+ * `DE_06` names one that a second approver can still let through, via
2053
+ * `operationLimits.approve()`.
2054
+ *
2000
2055
  * @param params - Refund parameters, including the required `payment_id` and optional amount.
2001
2056
  * @returns The created refund.
2002
2057
  *
@@ -2201,6 +2256,55 @@ var Routing = class {
2201
2256
  async update(algorithmId, params) {
2202
2257
  return this.request("PUT", `/routing/${encodeURIComponent(algorithmId)}`, { body: params });
2203
2258
  }
2259
+ /**
2260
+ * Every content window a routing configuration has had, oldest first.
2261
+ *
2262
+ * A configuration's rule can be edited in place, so this is what makes "which
2263
+ * rule decided this payment" answerable after the fact. Each entry is the rule
2264
+ * as it stood between `valid_from` and `valid_until`; the windows of one
2265
+ * config abut exactly, with no gap.
2266
+ *
2267
+ * Paging covers the whole timeline including the live window, so a page never
2268
+ * holds more than `limit` entries and the live one — the only entry without a
2269
+ * `valid_until` — comes back on exactly one page. Advance `offset` by `limit`;
2270
+ * a page past the end is empty, and `total_count` says where that end is
2271
+ * without probing for it.
2272
+ *
2273
+ * `GET /routing/{algorithmId}/history`
2274
+ *
2275
+ * @param algorithmId - The routing algorithm to read the history of.
2276
+ * @param params - Optional paging.
2277
+ */
2278
+ async history(algorithmId, params = {}) {
2279
+ return this.request("GET", `/routing/${encodeURIComponent(algorithmId)}/history`, {
2280
+ query: params
2281
+ });
2282
+ }
2283
+ /**
2284
+ * A shop's lifetime per-connector payment caps, each with how much of it is
2285
+ * already spent.
2286
+ *
2287
+ * `GET /routing/connector-caps/{profileId}`
2288
+ */
2289
+ async connectorCaps(profileId) {
2290
+ return this.request("GET", `/routing/connector-caps/${encodeURIComponent(profileId)}`);
2291
+ }
2292
+ /**
2293
+ * Replace a shop's per-connector payment caps.
2294
+ *
2295
+ * Whole-set replacement, not a patch: the list sent becomes the complete set
2296
+ * of capped connectors, and an empty list clears them all — which is how
2297
+ * acquirer onboarding finishes, the new account ceasing to be a special case.
2298
+ *
2299
+ * Every account named must belong to this shop; one that does not is refused.
2300
+ *
2301
+ * `PUT /routing/connector-caps/{profileId}`
2302
+ */
2303
+ async setConnectorCaps(profileId, params) {
2304
+ return this.request("PUT", `/routing/connector-caps/${encodeURIComponent(profileId)}`, {
2305
+ body: params
2306
+ });
2307
+ }
2204
2308
  /**
2205
2309
  * List all routing algorithms for the current merchant.
2206
2310
  *
@@ -3087,7 +3191,15 @@ var Users = class {
3087
3191
  async selectAuth(params) {
3088
3192
  return this.request("POST", "/user/auth/select", { body: params });
3089
3193
  }
3090
- /** List users in lineage. `GET /user/employees/list` */
3194
+ /**
3195
+ * List users in lineage.
3196
+ *
3197
+ * Needs the Users *view* grant now — the response carries colleagues' email
3198
+ * addresses, so a role without it is refused rather than handed a roster.
3199
+ * A shop-scoped role keeps reading its own shop's members.
3200
+ *
3201
+ * `GET /user/employees/list`
3202
+ */
3091
3203
  async listUsersInLineage(params) {
3092
3204
  return this.request("GET", "/user/employees/list", {
3093
3205
  query: params
@@ -3367,6 +3479,44 @@ var Analytics = class {
3367
3479
  query: params
3368
3480
  });
3369
3481
  }
3482
+ /**
3483
+ * Subscription analytics over `subscription` and `invoice`: estimated
3484
+ * recurring volume, the invoice funnel, movement (new / expansion /
3485
+ * contraction / churn), both processor axes, plan mix and the breakdown one
3486
+ * level below the scope. Pinned server-side to your own merchant and
3487
+ * drillable via `project_id` / `shop_id` exactly like `scope`.
3488
+ *
3489
+ * Half the figures are **stocks** — a snapshot at the window's end rather
3490
+ * than a sum over it — so `est_monthly_volume_usd` and `active` can match
3491
+ * across a 7-day and a 30-day window while `billed_volume_usd` does not.
3492
+ * Day granularity only. `GET /analytics/subscriptions`
3493
+ */
3494
+ async subscriptions(params) {
3495
+ return this.request("GET", "/analytics/subscriptions", {
3496
+ query: params
3497
+ });
3498
+ }
3499
+ /**
3500
+ * The billing cycles behind one clicked element of the subscription
3501
+ * dashboard: an invoice outcome, a processor slice on either axis, a plan
3502
+ * row, a subscription status, a movement component, a series bucket or a
3503
+ * breakdown row. Same window/scope/filter contract as `subscriptions`; 50
3504
+ * rows per page (`offset` for the next), newest first, with the full match
3505
+ * count alongside.
3506
+ *
3507
+ * A cycle that never reached a payment is listed too — that is what "still
3508
+ * unpaid" means — and carries its invoice id as `payment_id` with
3509
+ * `invoice_id` set to the same value, so you can always tell which you got.
3510
+ * `GET /analytics/subscriptions/list`
3511
+ */
3512
+ async subscriptionsList(params) {
3513
+ return this.request("GET", "/analytics/subscriptions/list", {
3514
+ // A discriminated union carries no index signature, so the widening
3515
+ // goes via `unknown` — the union is the point, and the query builder
3516
+ // only ever reads own enumerable keys.
3517
+ query: params
3518
+ });
3519
+ }
3370
3520
  /** Global search. `POST /analytics/search` */
3371
3521
  async search(params) {
3372
3522
  return this.request("POST", "/analytics/search", { body: params });
@@ -3878,6 +4028,12 @@ var Settlement = class {
3878
4028
  /**
3879
4029
  * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
3880
4030
  *
4031
+ * Subject to the caller's `settlement_payout` operation limit, which can
4032
+ * only be a per-operation ceiling: an over-limit call fails with `DE_01`
4033
+ * and nothing is recorded. There is no approval route out of it — four-eyes
4034
+ * needs an executor that can run the operation once somebody says yes, and
4035
+ * only refunds have one, so a settlement rule can only block.
4036
+ *
3881
4037
  * `POST /settlement/statements/{statementId}/payout`
3882
4038
  */
3883
4039
  async updateStatementPayout(statementId, params, options) {
@@ -3978,6 +4134,11 @@ var Settlement = class {
3978
4134
  * Add a manual adjustment to a statement. Positive `amount_usd` charges
3979
4135
  * the shop (reducing their payout); negative credits them.
3980
4136
  *
4137
+ * Subject to the caller's `settlement_adjustment` operation limit (amount
4138
+ * dimensions only): an over-limit call fails with `DE_01` and no adjustment
4139
+ * is added. A settlement rule can only block — approval is refund-only, for
4140
+ * the reason given on `updateStatementPayout()`.
4141
+ *
3981
4142
  * `POST /settlement/statements/{statementId}/adjustments`
3982
4143
  */
3983
4144
  async createStatementAdjustment(statementId, params, options) {
@@ -4051,6 +4212,84 @@ var OperationLimits = class {
4051
4212
  async updateSettings(params, options) {
4052
4213
  return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
4053
4214
  }
4215
+ /**
4216
+ * The approvals inbox: over-limit operations waiting on a second person.
4217
+ *
4218
+ * Both filters default rather than widen. With no `status` the list holds
4219
+ * **pending requests only** — approved, rejected and expired ones are
4220
+ * reachable only by asking for that status, so a history view must pass one
4221
+ * per status. With no `operation` it lists **refunds only**; the list is one
4222
+ * operation at a time. `limit` defaults to 100 and is clamped to 1–500.
4223
+ *
4224
+ * Requests past their `expires_at` are expired before the list is read, so
4225
+ * nothing here is shown as actionable when it is not.
4226
+ *
4227
+ * `GET /operation-limits/approvals`
4228
+ */
4229
+ async listApprovals(params, options) {
4230
+ return this.request("GET", "/operation-limits/approvals", {
4231
+ query: {
4232
+ operation: params?.operation,
4233
+ status: params?.status,
4234
+ limit: params?.limit
4235
+ },
4236
+ ...options
4237
+ });
4238
+ }
4239
+ /**
4240
+ * Approve a parked operation and execute it.
4241
+ *
4242
+ * Refused for the user who requested it, and for an approver whose own
4243
+ * limit would not have covered the operation — the permission is necessary
4244
+ * and not sufficient.
4245
+ *
4246
+ * Approval and execution are two facts. A request that was approved but
4247
+ * whose operation then failed comes back `approved` with `execution_error`
4248
+ * set and no `result_entity_id`; that is a real outcome, not a partial read.
4249
+ *
4250
+ * `POST /operation-limits/approvals/{id}/approve`
4251
+ */
4252
+ async approve(id, params = {}, options) {
4253
+ return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/approve`, {
4254
+ body: params,
4255
+ ...options
4256
+ });
4257
+ }
4258
+ /**
4259
+ * Reject a parked operation. Nothing is executed and the request is closed.
4260
+ *
4261
+ * `POST /operation-limits/approvals/{id}/reject`
4262
+ */
4263
+ async reject(id, params = {}, options) {
4264
+ return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/reject`, {
4265
+ body: params,
4266
+ ...options
4267
+ });
4268
+ }
4269
+ };
4270
+
4271
+ // src/resources/risk.ts
4272
+ var Risk = class {
4273
+ constructor(request) {
4274
+ this.request = request;
4275
+ }
4276
+ /**
4277
+ * Every shop's stored risk for the caller's merchant, with the worst band
4278
+ * across them.
4279
+ *
4280
+ * `GET /risk`
4281
+ */
4282
+ async retrieve(options) {
4283
+ return this.request("GET", "/risk", options);
4284
+ }
4285
+ /**
4286
+ * One shop's stored risk index per connector.
4287
+ *
4288
+ * `GET /risk/shops/{profileId}`
4289
+ */
4290
+ async retrieveShop(profileId, options) {
4291
+ return this.request("GET", `/risk/shops/${encodeURIComponent(profileId)}`, options);
4292
+ }
4054
4293
  };
4055
4294
 
4056
4295
  // src/client.ts
@@ -4182,6 +4421,7 @@ var Delopay = class {
4182
4421
  this.threeDsRules = new ThreeDsRules(request);
4183
4422
  this.settlement = new Settlement(request);
4184
4423
  this.operationLimits = new OperationLimits(request);
4424
+ this.risk = new Risk(request);
4185
4425
  this.subscriptions = new Subscriptions(request);
4186
4426
  this.files = new Files(request);
4187
4427
  this.export = new Export(request);
@@ -6203,6 +6443,7 @@ export {
6203
6443
  Subscriptions,
6204
6444
  Settlement,
6205
6445
  OperationLimits,
6446
+ Risk,
6206
6447
  Delopay,
6207
6448
  leaf,
6208
6449
  allOf,
@@ -6277,4 +6518,4 @@ export {
6277
6518
  focusedCheckoutUrl,
6278
6519
  CHECKOUT_EVENT_KINDS
6279
6520
  };
6280
- //# sourceMappingURL=chunk-Q2PPDRUI.js.map
6521
+ //# sourceMappingURL=chunk-IAZ4NPT2.js.map