@delopay/sdk 0.103.0 → 0.104.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.js CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  NATIVE_PANE_ICON_KEYS,
36
36
  OperationLimits,
37
37
  Regions,
38
+ Risk,
38
39
  STRIPE_NATIVE_PANE_METHODS,
39
40
  Search,
40
41
  Settlement,
@@ -88,7 +89,7 @@ import {
88
89
  surfacePadValue,
89
90
  verticalGapValue,
90
91
  visibleCustomFields
91
- } from "./chunk-Q2PPDRUI.js";
92
+ } from "./chunk-S22IPUCK.js";
92
93
  export {
93
94
  ALL_CUSTOM_FIELD_CONDITION_SOURCES,
94
95
  ALL_CUSTOM_FIELD_OPERATORS,
@@ -126,6 +127,7 @@ export {
126
127
  NATIVE_PANE_ICON_KEYS,
127
128
  OperationLimits,
128
129
  Regions,
130
+ Risk,
129
131
  STRIPE_NATIVE_PANE_METHODS,
130
132
  Search,
131
133
  Settlement,
package/dist/internal.cjs CHANGED
@@ -68,6 +68,7 @@ __export(internal_exports, {
68
68
  PlatformBilling: () => PlatformBilling,
69
69
  PlatformFees: () => PlatformFees,
70
70
  Regions: () => Regions,
71
+ Risk: () => Risk,
71
72
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
72
73
  Search: () => Search,
73
74
  Settlement: () => Settlement,
@@ -550,12 +551,37 @@ var Connectors = class {
550
551
  body: params
551
552
  });
552
553
  }
554
+ /**
555
+ * One connector account.
556
+ *
557
+ * The credential-bearing fields come back `null` here, whatever is stored:
558
+ * `connector_webhook_details`, `connector_wallets_details`,
559
+ * `pm_auth_config` and `additional_merchant_data`. They are dropped rather
560
+ * than masked, because an editor that prefills from this response and
561
+ * PATCHes the field back would otherwise save a mask over a live signing
562
+ * secret. Send those fields only when the operator has typed a new value,
563
+ * and omit them entirely otherwise — an omitted field leaves the stored one
564
+ * alone.
565
+ *
566
+ * This is the retrieve path alone. `create` and `update` echo back what the
567
+ * caller sent, and `clone` returns the *copied* secrets — see that method.
568
+ *
569
+ * `GET /account/{accountId}/connectors/{connectorId}`
570
+ */
553
571
  async retrieve(accountId, connectorId) {
554
572
  return this.request(
555
573
  "GET",
556
574
  `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}`
557
575
  );
558
576
  }
577
+ /**
578
+ * The merchant's connector accounts.
579
+ *
580
+ * Never wider than the caller: an API key pinned to one shop lists that
581
+ * shop's connectors only, not every sibling shop's.
582
+ *
583
+ * `GET /account/{accountId}/connectors`
584
+ */
559
585
  async list(accountId) {
560
586
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/connectors`);
561
587
  }
@@ -601,6 +627,15 @@ var Connectors = class {
601
627
  }
602
628
  );
603
629
  }
630
+ /**
631
+ * Remove a connector account.
632
+ *
633
+ * A shop-scoped role may remove a connector of its own shop — the shop is
634
+ * re-checked server-side — so creating processors and removing them are the
635
+ * same rung of access rather than two.
636
+ *
637
+ * `DELETE /account/{accountId}/connectors/{connectorId}`
638
+ */
604
639
  async delete(accountId, connectorId) {
605
640
  return this.request(
606
641
  "DELETE",
@@ -612,9 +647,15 @@ var Connectors = class {
612
647
  * merchant. `POST /account/{accountId}/connectors/{connectorId}/clone`
613
648
  *
614
649
  * Credentials are copied server-side, re-encrypted under the same merchant
615
- * key the caller never handles them (list/retrieve mask credentials, so a
616
- * client-side copy is impossible). Returns the newly created connector in
617
- * the target shop.
650
+ * key, so the caller never has to *supply* them — `retrieve` returns `null`
651
+ * for the credential fields, which is what makes a client-side copy
652
+ * impossible in the first place.
653
+ *
654
+ * The response, however, is the unredacted connector: `connector_account_details`
655
+ * is masked, but `connector_webhook_details`, `connector_wallets_details`,
656
+ * `pm_auth_config` and `additional_merchant_data` come back with the copied
657
+ * secrets in them — values this caller never sent. Do not log or echo the
658
+ * response; read `merchant_connector_id` and discard the rest.
618
659
  */
619
660
  async clone(accountId, connectorId, params) {
620
661
  return this.request(
@@ -1483,6 +1524,13 @@ var Payments = class {
1483
1524
  * test_mode: process.env.NODE_ENV !== 'production',
1484
1525
  * });
1485
1526
  * ```
1527
+ *
1528
+ * A payment that pins one connector through `routing` (the `single` form)
1529
+ * is now checked against `test_mode` here rather than at confirm: if that
1530
+ * connector has no credentials for the environment asked for, create fails
1531
+ * instead of handing back a payment whose checkout the buyer cannot
1532
+ * complete. `priority` and `volume_split` name several accounts and are
1533
+ * still resolved at confirm.
1486
1534
  */
1487
1535
  async create(params, options) {
1488
1536
  return this.request("POST", "/payments", { body: params, ...options });
@@ -2123,6 +2171,14 @@ var Refunds = class {
2123
2171
  /**
2124
2172
  * Create a refund for a payment.
2125
2173
  *
2174
+ * Dashboard-initiated refunds are subject to the caller's operation-limit
2175
+ * rule, resolved against the role the request authenticated with. An
2176
+ * over-limit refund either fails with `DE_01` (the rule blocks) or with
2177
+ * HTTP 409 `DE_06` — the rule requires approval, and `DelopayError.data`
2178
+ * carries `PendingApprovalErrorDetails`. No refund exists in either case;
2179
+ * `DE_06` names one that a second approver can still let through, via
2180
+ * `operationLimits.approve()`.
2181
+ *
2126
2182
  * @param params - Refund parameters, including the required `payment_id` and optional amount.
2127
2183
  * @returns The created refund.
2128
2184
  *
@@ -2327,6 +2383,55 @@ var Routing = class {
2327
2383
  async update(algorithmId, params) {
2328
2384
  return this.request("PUT", `/routing/${encodeURIComponent(algorithmId)}`, { body: params });
2329
2385
  }
2386
+ /**
2387
+ * Every content window a routing configuration has had, oldest first.
2388
+ *
2389
+ * A configuration's rule can be edited in place, so this is what makes "which
2390
+ * rule decided this payment" answerable after the fact. Each entry is the rule
2391
+ * as it stood between `valid_from` and `valid_until`; the windows of one
2392
+ * config abut exactly, with no gap.
2393
+ *
2394
+ * Paging covers the whole timeline including the live window, so a page never
2395
+ * holds more than `limit` entries and the live one — the only entry without a
2396
+ * `valid_until` — comes back on exactly one page. Advance `offset` by `limit`;
2397
+ * a page past the end is empty, and `total_count` says where that end is
2398
+ * without probing for it.
2399
+ *
2400
+ * `GET /routing/{algorithmId}/history`
2401
+ *
2402
+ * @param algorithmId - The routing algorithm to read the history of.
2403
+ * @param params - Optional paging.
2404
+ */
2405
+ async history(algorithmId, params = {}) {
2406
+ return this.request("GET", `/routing/${encodeURIComponent(algorithmId)}/history`, {
2407
+ query: params
2408
+ });
2409
+ }
2410
+ /**
2411
+ * A shop's lifetime per-connector payment caps, each with how much of it is
2412
+ * already spent.
2413
+ *
2414
+ * `GET /routing/connector-caps/{profileId}`
2415
+ */
2416
+ async connectorCaps(profileId) {
2417
+ return this.request("GET", `/routing/connector-caps/${encodeURIComponent(profileId)}`);
2418
+ }
2419
+ /**
2420
+ * Replace a shop's per-connector payment caps.
2421
+ *
2422
+ * Whole-set replacement, not a patch: the list sent becomes the complete set
2423
+ * of capped connectors, and an empty list clears them all — which is how
2424
+ * acquirer onboarding finishes, the new account ceasing to be a special case.
2425
+ *
2426
+ * Every account named must belong to this shop; one that does not is refused.
2427
+ *
2428
+ * `PUT /routing/connector-caps/{profileId}`
2429
+ */
2430
+ async setConnectorCaps(profileId, params) {
2431
+ return this.request("PUT", `/routing/connector-caps/${encodeURIComponent(profileId)}`, {
2432
+ body: params
2433
+ });
2434
+ }
2330
2435
  /**
2331
2436
  * List all routing algorithms for the current merchant.
2332
2437
  *
@@ -3213,7 +3318,15 @@ var Users = class {
3213
3318
  async selectAuth(params) {
3214
3319
  return this.request("POST", "/user/auth/select", { body: params });
3215
3320
  }
3216
- /** List users in lineage. `GET /user/employees/list` */
3321
+ /**
3322
+ * List users in lineage.
3323
+ *
3324
+ * Needs the Users *view* grant now — the response carries colleagues' email
3325
+ * addresses, so a role without it is refused rather than handed a roster.
3326
+ * A shop-scoped role keeps reading its own shop's members.
3327
+ *
3328
+ * `GET /user/employees/list`
3329
+ */
3217
3330
  async listUsersInLineage(params) {
3218
3331
  return this.request("GET", "/user/employees/list", {
3219
3332
  query: params
@@ -4004,6 +4117,12 @@ var Settlement = class {
4004
4117
  /**
4005
4118
  * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
4006
4119
  *
4120
+ * Subject to the caller's `settlement_payout` operation limit, which can
4121
+ * only be a per-operation ceiling: an over-limit call fails with `DE_01`
4122
+ * and nothing is recorded. There is no approval route out of it — four-eyes
4123
+ * needs an executor that can run the operation once somebody says yes, and
4124
+ * only refunds have one, so a settlement rule can only block.
4125
+ *
4007
4126
  * `POST /settlement/statements/{statementId}/payout`
4008
4127
  */
4009
4128
  async updateStatementPayout(statementId, params, options) {
@@ -4104,6 +4223,11 @@ var Settlement = class {
4104
4223
  * Add a manual adjustment to a statement. Positive `amount_usd` charges
4105
4224
  * the shop (reducing their payout); negative credits them.
4106
4225
  *
4226
+ * Subject to the caller's `settlement_adjustment` operation limit (amount
4227
+ * dimensions only): an over-limit call fails with `DE_01` and no adjustment
4228
+ * is added. A settlement rule can only block — approval is refund-only, for
4229
+ * the reason given on `updateStatementPayout()`.
4230
+ *
4107
4231
  * `POST /settlement/statements/{statementId}/adjustments`
4108
4232
  */
4109
4233
  async createStatementAdjustment(statementId, params, options) {
@@ -4177,6 +4301,84 @@ var OperationLimits = class {
4177
4301
  async updateSettings(params, options) {
4178
4302
  return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
4179
4303
  }
4304
+ /**
4305
+ * The approvals inbox: over-limit operations waiting on a second person.
4306
+ *
4307
+ * Both filters default rather than widen. With no `status` the list holds
4308
+ * **pending requests only** — approved, rejected and expired ones are
4309
+ * reachable only by asking for that status, so a history view must pass one
4310
+ * per status. With no `operation` it lists **refunds only**; the list is one
4311
+ * operation at a time. `limit` defaults to 100 and is clamped to 1–500.
4312
+ *
4313
+ * Requests past their `expires_at` are expired before the list is read, so
4314
+ * nothing here is shown as actionable when it is not.
4315
+ *
4316
+ * `GET /operation-limits/approvals`
4317
+ */
4318
+ async listApprovals(params, options) {
4319
+ return this.request("GET", "/operation-limits/approvals", {
4320
+ query: {
4321
+ operation: params?.operation,
4322
+ status: params?.status,
4323
+ limit: params?.limit
4324
+ },
4325
+ ...options
4326
+ });
4327
+ }
4328
+ /**
4329
+ * Approve a parked operation and execute it.
4330
+ *
4331
+ * Refused for the user who requested it, and for an approver whose own
4332
+ * limit would not have covered the operation — the permission is necessary
4333
+ * and not sufficient.
4334
+ *
4335
+ * Approval and execution are two facts. A request that was approved but
4336
+ * whose operation then failed comes back `approved` with `execution_error`
4337
+ * set and no `result_entity_id`; that is a real outcome, not a partial read.
4338
+ *
4339
+ * `POST /operation-limits/approvals/{id}/approve`
4340
+ */
4341
+ async approve(id, params = {}, options) {
4342
+ return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/approve`, {
4343
+ body: params,
4344
+ ...options
4345
+ });
4346
+ }
4347
+ /**
4348
+ * Reject a parked operation. Nothing is executed and the request is closed.
4349
+ *
4350
+ * `POST /operation-limits/approvals/{id}/reject`
4351
+ */
4352
+ async reject(id, params = {}, options) {
4353
+ return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/reject`, {
4354
+ body: params,
4355
+ ...options
4356
+ });
4357
+ }
4358
+ };
4359
+
4360
+ // src/resources/risk.ts
4361
+ var Risk = class {
4362
+ constructor(request) {
4363
+ this.request = request;
4364
+ }
4365
+ /**
4366
+ * Every shop's stored risk for the caller's merchant, with the worst band
4367
+ * across them.
4368
+ *
4369
+ * `GET /risk`
4370
+ */
4371
+ async retrieve(options) {
4372
+ return this.request("GET", "/risk", options);
4373
+ }
4374
+ /**
4375
+ * One shop's stored risk index per connector.
4376
+ *
4377
+ * `GET /risk/shops/{profileId}`
4378
+ */
4379
+ async retrieveShop(profileId, options) {
4380
+ return this.request("GET", `/risk/shops/${encodeURIComponent(profileId)}`, options);
4381
+ }
4180
4382
  };
4181
4383
 
4182
4384
  // src/client.ts
@@ -4308,6 +4510,7 @@ var Delopay = class {
4308
4510
  this.threeDsRules = new ThreeDsRules(request);
4309
4511
  this.settlement = new Settlement(request);
4310
4512
  this.operationLimits = new OperationLimits(request);
4513
+ this.risk = new Risk(request);
4311
4514
  this.subscriptions = new Subscriptions(request);
4312
4515
  this.files = new Files(request);
4313
4516
  this.export = new Export(request);
@@ -7185,6 +7388,7 @@ var DelopayInternal = class extends Delopay {
7185
7388
  PlatformBilling,
7186
7389
  PlatformFees,
7187
7390
  Regions,
7391
+ Risk,
7188
7392
  STRIPE_NATIVE_PANE_METHODS,
7189
7393
  Search,
7190
7394
  Settlement,