@delopay/sdk 0.102.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/{chunk-43FRIBNT.js → chunk-S22IPUCK.js} +248 -5
- package/dist/chunk-S22IPUCK.js.map +1 -0
- package/dist/index.cjs +248 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +899 -27
- package/dist/index.d.ts +899 -27
- package/dist/index.js +3 -1
- package/dist/internal.cjs +248 -4
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +23 -2
- package/dist/internal.d.ts +23 -2
- package/dist/internal.js +3 -1
- package/dist/internal.js.map +1 -1
- package/package.json +17 -18
- package/dist/chunk-43FRIBNT.js.map +0 -1
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
|
|
604
|
-
*
|
|
605
|
-
* the
|
|
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
|
-
/**
|
|
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
|
|
@@ -3910,6 +4023,46 @@ var Settlement = class {
|
|
|
3910
4023
|
...options
|
|
3911
4024
|
});
|
|
3912
4025
|
}
|
|
4026
|
+
/**
|
|
4027
|
+
* What a period's payments cost, and what was left over: gross, the
|
|
4028
|
+
* platform fee, hosting fees, what the rails took, and the margin, with a
|
|
4029
|
+
* per-connector breakdown.
|
|
4030
|
+
*
|
|
4031
|
+
* Send `year` and `month` together to report one UTC calendar month, or
|
|
4032
|
+
* neither for the running month so far.
|
|
4033
|
+
*
|
|
4034
|
+
* **Host-only.** The response is the host's cost base, which a shop owner
|
|
4035
|
+
* must never see, so a profile-scoped caller is refused with a 403 rather
|
|
4036
|
+
* than given a redacted shell. Gate the surface on the caller's scope
|
|
4037
|
+
* instead of calling it and handling the failure.
|
|
4038
|
+
*
|
|
4039
|
+
* Two things not to flatten when rendering the result:
|
|
4040
|
+
* `margin_usd` is absent — not zero — whenever `margin_quality` is
|
|
4041
|
+
* `'unknown'`, and `unlined_captured_attempt_count` (cost definitely
|
|
4042
|
+
* missing) means something different from `unlined_unresolved_attempt_count`
|
|
4043
|
+
* (mostly ordinary abandonment).
|
|
4044
|
+
*
|
|
4045
|
+
* `GET /settlement/cost`
|
|
4046
|
+
*
|
|
4047
|
+
* @example
|
|
4048
|
+
* ```typescript
|
|
4049
|
+
* const cost = await delopay.settlement.cost({ test_mode: false, year: 2026, month: 7 });
|
|
4050
|
+
* if (cost.margin_quality === 'unknown') {
|
|
4051
|
+
* // cost.margin_usd is absent — say so, do not render 0.00
|
|
4052
|
+
* }
|
|
4053
|
+
* ```
|
|
4054
|
+
*/
|
|
4055
|
+
async cost(params, options) {
|
|
4056
|
+
return this.request("GET", "/settlement/cost", {
|
|
4057
|
+
query: {
|
|
4058
|
+
profile_id: params?.profile_id,
|
|
4059
|
+
test_mode: params?.test_mode,
|
|
4060
|
+
year: params?.year,
|
|
4061
|
+
month: params?.month
|
|
4062
|
+
},
|
|
4063
|
+
...options
|
|
4064
|
+
});
|
|
4065
|
+
}
|
|
3913
4066
|
/**
|
|
3914
4067
|
* List generated settlement statements, newest first.
|
|
3915
4068
|
*
|
|
@@ -3952,6 +4105,12 @@ var Settlement = class {
|
|
|
3952
4105
|
/**
|
|
3953
4106
|
* Record payout progress on a statement (`unpaid` / `partial` / `paid`).
|
|
3954
4107
|
*
|
|
4108
|
+
* Subject to the caller's `settlement_payout` operation limit, which can
|
|
4109
|
+
* only be a per-operation ceiling: an over-limit call fails with `DE_01`
|
|
4110
|
+
* and nothing is recorded. There is no approval route out of it — four-eyes
|
|
4111
|
+
* needs an executor that can run the operation once somebody says yes, and
|
|
4112
|
+
* only refunds have one, so a settlement rule can only block.
|
|
4113
|
+
*
|
|
3955
4114
|
* `POST /settlement/statements/{statementId}/payout`
|
|
3956
4115
|
*/
|
|
3957
4116
|
async updateStatementPayout(statementId, params, options) {
|
|
@@ -4052,6 +4211,11 @@ var Settlement = class {
|
|
|
4052
4211
|
* Add a manual adjustment to a statement. Positive `amount_usd` charges
|
|
4053
4212
|
* the shop (reducing their payout); negative credits them.
|
|
4054
4213
|
*
|
|
4214
|
+
* Subject to the caller's `settlement_adjustment` operation limit (amount
|
|
4215
|
+
* dimensions only): an over-limit call fails with `DE_01` and no adjustment
|
|
4216
|
+
* is added. A settlement rule can only block — approval is refund-only, for
|
|
4217
|
+
* the reason given on `updateStatementPayout()`.
|
|
4218
|
+
*
|
|
4055
4219
|
* `POST /settlement/statements/{statementId}/adjustments`
|
|
4056
4220
|
*/
|
|
4057
4221
|
async createStatementAdjustment(statementId, params, options) {
|
|
@@ -4125,6 +4289,84 @@ var OperationLimits = class {
|
|
|
4125
4289
|
async updateSettings(params, options) {
|
|
4126
4290
|
return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
|
|
4127
4291
|
}
|
|
4292
|
+
/**
|
|
4293
|
+
* The approvals inbox: over-limit operations waiting on a second person.
|
|
4294
|
+
*
|
|
4295
|
+
* Both filters default rather than widen. With no `status` the list holds
|
|
4296
|
+
* **pending requests only** — approved, rejected and expired ones are
|
|
4297
|
+
* reachable only by asking for that status, so a history view must pass one
|
|
4298
|
+
* per status. With no `operation` it lists **refunds only**; the list is one
|
|
4299
|
+
* operation at a time. `limit` defaults to 100 and is clamped to 1–500.
|
|
4300
|
+
*
|
|
4301
|
+
* Requests past their `expires_at` are expired before the list is read, so
|
|
4302
|
+
* nothing here is shown as actionable when it is not.
|
|
4303
|
+
*
|
|
4304
|
+
* `GET /operation-limits/approvals`
|
|
4305
|
+
*/
|
|
4306
|
+
async listApprovals(params, options) {
|
|
4307
|
+
return this.request("GET", "/operation-limits/approvals", {
|
|
4308
|
+
query: {
|
|
4309
|
+
operation: params?.operation,
|
|
4310
|
+
status: params?.status,
|
|
4311
|
+
limit: params?.limit
|
|
4312
|
+
},
|
|
4313
|
+
...options
|
|
4314
|
+
});
|
|
4315
|
+
}
|
|
4316
|
+
/**
|
|
4317
|
+
* Approve a parked operation and execute it.
|
|
4318
|
+
*
|
|
4319
|
+
* Refused for the user who requested it, and for an approver whose own
|
|
4320
|
+
* limit would not have covered the operation — the permission is necessary
|
|
4321
|
+
* and not sufficient.
|
|
4322
|
+
*
|
|
4323
|
+
* Approval and execution are two facts. A request that was approved but
|
|
4324
|
+
* whose operation then failed comes back `approved` with `execution_error`
|
|
4325
|
+
* set and no `result_entity_id`; that is a real outcome, not a partial read.
|
|
4326
|
+
*
|
|
4327
|
+
* `POST /operation-limits/approvals/{id}/approve`
|
|
4328
|
+
*/
|
|
4329
|
+
async approve(id, params = {}, options) {
|
|
4330
|
+
return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/approve`, {
|
|
4331
|
+
body: params,
|
|
4332
|
+
...options
|
|
4333
|
+
});
|
|
4334
|
+
}
|
|
4335
|
+
/**
|
|
4336
|
+
* Reject a parked operation. Nothing is executed and the request is closed.
|
|
4337
|
+
*
|
|
4338
|
+
* `POST /operation-limits/approvals/{id}/reject`
|
|
4339
|
+
*/
|
|
4340
|
+
async reject(id, params = {}, options) {
|
|
4341
|
+
return this.request("POST", `/operation-limits/approvals/${encodeURIComponent(id)}/reject`, {
|
|
4342
|
+
body: params,
|
|
4343
|
+
...options
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
4346
|
+
};
|
|
4347
|
+
|
|
4348
|
+
// src/resources/risk.ts
|
|
4349
|
+
var Risk = class {
|
|
4350
|
+
constructor(request) {
|
|
4351
|
+
this.request = request;
|
|
4352
|
+
}
|
|
4353
|
+
/**
|
|
4354
|
+
* Every shop's stored risk for the caller's merchant, with the worst band
|
|
4355
|
+
* across them.
|
|
4356
|
+
*
|
|
4357
|
+
* `GET /risk`
|
|
4358
|
+
*/
|
|
4359
|
+
async retrieve(options) {
|
|
4360
|
+
return this.request("GET", "/risk", options);
|
|
4361
|
+
}
|
|
4362
|
+
/**
|
|
4363
|
+
* One shop's stored risk index per connector.
|
|
4364
|
+
*
|
|
4365
|
+
* `GET /risk/shops/{profileId}`
|
|
4366
|
+
*/
|
|
4367
|
+
async retrieveShop(profileId, options) {
|
|
4368
|
+
return this.request("GET", `/risk/shops/${encodeURIComponent(profileId)}`, options);
|
|
4369
|
+
}
|
|
4128
4370
|
};
|
|
4129
4371
|
|
|
4130
4372
|
// src/client.ts
|
|
@@ -4256,6 +4498,7 @@ var Delopay = class {
|
|
|
4256
4498
|
this.threeDsRules = new ThreeDsRules(request);
|
|
4257
4499
|
this.settlement = new Settlement(request);
|
|
4258
4500
|
this.operationLimits = new OperationLimits(request);
|
|
4501
|
+
this.risk = new Risk(request);
|
|
4259
4502
|
this.subscriptions = new Subscriptions(request);
|
|
4260
4503
|
this.files = new Files(request);
|
|
4261
4504
|
this.export = new Export(request);
|
|
@@ -6297,6 +6540,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6297
6540
|
NATIVE_PANE_ICON_KEYS,
|
|
6298
6541
|
OperationLimits,
|
|
6299
6542
|
Regions,
|
|
6543
|
+
Risk,
|
|
6300
6544
|
STRIPE_NATIVE_PANE_METHODS,
|
|
6301
6545
|
Search,
|
|
6302
6546
|
Settlement,
|