@delopay/sdk 0.393.0 → 0.398.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/internal.cjs CHANGED
@@ -1461,6 +1461,64 @@ var Connectors = class {
1461
1461
  { body: params }
1462
1462
  );
1463
1463
  }
1464
+ /**
1465
+ * Read how the return addresses of a connector's payment provider name the
1466
+ * merchant, per environment.
1467
+ * `GET /account/{merchantId}/connectors/{connectorId}/return-address`
1468
+ *
1469
+ * A return address is where the provider sends the buyer back after a step
1470
+ * it hosts. It belongs to the merchant, the provider and the environment,
1471
+ * so every connector account of that provider follows it.
1472
+ */
1473
+ async getReturnAddress(merchantId, connectorId) {
1474
+ return this.request(
1475
+ "GET",
1476
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address`
1477
+ );
1478
+ }
1479
+ /**
1480
+ * Validate a proposed return address without saving it.
1481
+ * `POST /account/{merchantId}/connectors/{connectorId}/return-address/preview`
1482
+ *
1483
+ * Nothing is reserved: a generated identifier in the answer is an example.
1484
+ * Needs the same permission as saving.
1485
+ *
1486
+ * @example
1487
+ * ```typescript
1488
+ * const preview = await delopay.connectors.previewReturnAddress('mer_abc', 'mca_xyz', {
1489
+ * environment: 'live',
1490
+ * mode: 'anonymous',
1491
+ * share_webhook_identifier: true,
1492
+ * });
1493
+ * if (!preview.valid) console.warn(preview.errors);
1494
+ * ```
1495
+ */
1496
+ async previewReturnAddress(merchantId, connectorId, params) {
1497
+ return this.request(
1498
+ "POST",
1499
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address/preview`,
1500
+ { body: params }
1501
+ );
1502
+ }
1503
+ /**
1504
+ * Save the return address of a connector's payment provider for one
1505
+ * environment.
1506
+ * `PUT /account/{merchantId}/connectors/{connectorId}/return-address`
1507
+ *
1508
+ * Payments started afterwards get return addresses of the new form; every
1509
+ * address already handed to the provider keeps working. A refused proposal
1510
+ * answers 422 with error code `IR_06` and the message
1511
+ * `Return address refused: field:code,…`. A caller who may not edit every
1512
+ * connector account of the provider answers 403. Address changes are
1513
+ * limited per provider and environment (`rate_limit`).
1514
+ */
1515
+ async updateReturnAddress(merchantId, connectorId, params) {
1516
+ return this.request(
1517
+ "PUT",
1518
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address`,
1519
+ { body: params }
1520
+ );
1521
+ }
1464
1522
  /**
1465
1523
  * Every webhook the connector's payment provider lists for its credentials
1466
1524
  * in one environment: Delopay's own, other connector accounts', former
@@ -3152,6 +3210,23 @@ var Payments = class {
3152
3210
  async buyerRisk(paymentId, options) {
3153
3211
  return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);
3154
3212
  }
3213
+ /**
3214
+ * Lift the holds put on an authorized payment when a chargeback prevention
3215
+ * alert or an AML hit on the same buyer arrived after it was scored and the
3216
+ * shop's `buyer_risk_source_changes` setting asked to hold it. Until then a
3217
+ * capture is refused with `IR_16`; after the release the payment can be
3218
+ * captured or cancelled as usual. A payment with no hold answers an empty
3219
+ * list. A caller scoped to one shop releases only that shop's payments.
3220
+ *
3221
+ * `POST /payments/{paymentId}/buyer-risk/release`
3222
+ */
3223
+ async releaseBuyerRiskHold(paymentId, options) {
3224
+ return this.request(
3225
+ "POST",
3226
+ `/payments/${encodeURIComponent(paymentId)}/buyer-risk/release`,
3227
+ options
3228
+ );
3229
+ }
3155
3230
  /**
3156
3231
  * What the payment's checkout client was, for AI shopping agents: a
3157
3232
  * verified agent (with its operator, protocol and key), an agent signature
@@ -5915,6 +5990,56 @@ var Users = class {
5915
5990
  body: params
5916
5991
  });
5917
5992
  }
5993
+ /**
5994
+ * One team member's sign-in history: successes and failures with method,
5995
+ * address, location and device, filtered, sorted and paged as
5996
+ * `listLoginActivity` is. `GET /user/employees/{user_id}/login-activity`
5997
+ *
5998
+ * Needs the *Users* write permission. Answers only for a member
5999
+ * `listUsersInLineage` shows you; any other id is a 404 `UR_68` with
6000
+ * `data.reason: 'member_not_found'`. Sign-ins belong to the account, so
6001
+ * they are shown only for an account wholly in this merchant: refused with
6002
+ * a 400 `UR_68` `member_has_access_elsewhere` for an account that also
6003
+ * holds a role elsewhere, and `member_not_activated` for one that is only
6004
+ * invited. `TeamMemberDetails.can_view_sign_ins` answers the same rule.
6005
+ */
6006
+ async listTeamMemberLoginActivity(userId, params) {
6007
+ const path4 = `/user/employees/${encodeURIComponent(userId)}/login-activity`;
6008
+ if (params === void 0) {
6009
+ return this.request("GET", path4);
6010
+ }
6011
+ return this.request("GET", path4, {
6012
+ query: csvQuery(params, ["event_type", "auth_method"])
6013
+ });
6014
+ }
6015
+ /**
6016
+ * One team member's live sessions: neither signed out nor expired.
6017
+ * `is_current` marks the caller's own session only.
6018
+ * `GET /user/employees/{user_id}/sessions`
6019
+ *
6020
+ * Same permission and refusals as `listTeamMemberLoginActivity`.
6021
+ */
6022
+ async listTeamMemberSessions(userId) {
6023
+ return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/sessions`);
6024
+ }
6025
+ /**
6026
+ * Sign a team member out everywhere: ends every session and token of the
6027
+ * member, at this merchant and at every other merchant the account belongs
6028
+ * to. `POST /user/employees/{user_id}/sessions/revoke-all`
6029
+ *
6030
+ * The account stays active and its password unchanged, so the member can
6031
+ * sign in again at once. Allowed on exactly the members whose password you
6032
+ * may reset with `resetTeamMemberPassword`, and refused with the same
6033
+ * `UR_68` reasons ({@link TeamMemberRefusal}).
6034
+ * `TeamMemberDetails.can_sign_out` answers the same rule. Recorded in the
6035
+ * audit log.
6036
+ */
6037
+ async revokeTeamMemberSessions(userId) {
6038
+ return this.request(
6039
+ "POST",
6040
+ `/user/employees/${encodeURIComponent(userId)}/sessions/revoke-all`
6041
+ );
6042
+ }
5918
6043
  /**
5919
6044
  * Which checkout payment methods a member may change in your merchant.
5920
6045
  * `GET /user/employees/{user_id}/method-access`
@@ -18065,10 +18190,29 @@ var AdminPortal = class {
18065
18190
  query
18066
18191
  });
18067
18192
  }
18193
+ /**
18194
+ * Persons of every merchant account, connected accounts included, or of the
18195
+ * one merchant named in `merchant_id`. Each row is one merchant's person
18196
+ * and names that merchant; persons of two merchants are never merged,
18197
+ * whatever they share. `search` is matched at every merchant listed.
18198
+ *
18199
+ * A `limit` outside 1 to 100, a `search` longer than 320 characters, or
18200
+ * `sort_by: 'captured'` without a three-letter `captured_currency` is a
18201
+ * `400`.
18202
+ *
18203
+ * `GET /admin-portal/persons`
18204
+ */
18205
+ async listPersonsAcrossMerchants(params) {
18206
+ if (params === void 0) {
18207
+ return this.request("GET", "/admin-portal/persons");
18208
+ }
18209
+ return this.request("GET", "/admin-portal/persons", { query: params });
18210
+ }
18068
18211
  /**
18069
18212
  * One page of ONE merchant's persons: the same query and response as the
18070
- * merchant-facing `persons.list`, admin-authenticated. Persons are never
18071
- * read across merchants.
18213
+ * merchant-facing `persons.list`, admin-authenticated. A person stays one
18214
+ * merchant's; `listPersonsAcrossMerchants` lists several merchants' side by
18215
+ * side.
18072
18216
  *
18073
18217
  * `GET /admin-portal/persons/{merchantId}`
18074
18218
  */
@@ -18608,6 +18752,31 @@ var AdminPortal = class {
18608
18752
  query: params
18609
18753
  });
18610
18754
  }
18755
+ /**
18756
+ * How accurate buyer risk scores were in a period, against what later
18757
+ * happened to the payments: fraud, clean, pending and never charged, how
18758
+ * well the flagged bands caught the fraud, each band and signal, and the
18759
+ * buyers the score stopped who later paid with no fraud. Stores nothing.
18760
+ * `GET /admin-portal/buyer-risk/accuracy`
18761
+ */
18762
+ async buyerRiskAccuracy(params = {}) {
18763
+ return this.request("GET", "/admin-portal/buyer-risk/accuracy", {
18764
+ query: params
18765
+ });
18766
+ }
18767
+ /**
18768
+ * The payments behind one number of {@link AdminPortal.buyerRiskAccuracy}:
18769
+ * the payments a signal fired on, those in a band, a flagged × outcome cell,
18770
+ * the interventions or the false declines. Paged, sorted and searchable
18771
+ * like the analytics drills, and answered in the same shape, with each
18772
+ * row's band, score, outcome and applied action.
18773
+ * `GET /admin-portal/buyer-risk/accuracy/payments`
18774
+ */
18775
+ async buyerRiskAccuracyPayments(params = {}) {
18776
+ return this.request("GET", "/admin-portal/buyer-risk/accuracy/payments", {
18777
+ query: params
18778
+ });
18779
+ }
18611
18780
  /**
18612
18781
  * Platform billing dashboard: total balance across all ledger accounts (+
18613
18782
  * the net change), top-ups, fees collected, and the day-by-day ledger flow.
@@ -18689,6 +18858,70 @@ var AdminPortal = class {
18689
18858
  async updateUser(userId, body) {
18690
18859
  return this.request("PATCH", `/admin-portal/users/${encodeURIComponent(userId)}`, { body });
18691
18860
  }
18861
+ /**
18862
+ * One user's account and its health: whether it is active and verified,
18863
+ * whether two-factor authentication is set up, when the password last
18864
+ * changed, the linked single sign-on providers, the newest successful and
18865
+ * failed sign-in, when the user was last seen and how many sessions are
18866
+ * live. Lists every membership the user holds in this tenant, invitations
18867
+ * and expired ones included, with its role and status. Never returns a
18868
+ * credential. `GET /admin-portal/users/{user_id}`
18869
+ *
18870
+ * Needs an internal role holding `ProfileUserRead`, or the admin API key.
18871
+ * A user with no membership in this tenant is a `404`.
18872
+ */
18873
+ async getUser(userId) {
18874
+ return this.request("GET", `/admin-portal/users/${encodeURIComponent(userId)}`);
18875
+ }
18876
+ /**
18877
+ * One user's sign-in history (successes and failures, method, address,
18878
+ * location and device), filtered, sorted and paged as
18879
+ * `users.listLoginActivity` is. Same access and `404` rule as `getUser`.
18880
+ * `GET /admin-portal/users/{user_id}/login-activity`
18881
+ */
18882
+ async listUserLoginActivity(userId, params) {
18883
+ const path4 = `/admin-portal/users/${encodeURIComponent(userId)}/login-activity`;
18884
+ if (params === void 0) {
18885
+ return this.request("GET", path4);
18886
+ }
18887
+ return this.request("GET", path4, {
18888
+ query: csvQuery(params, ["event_type", "auth_method"])
18889
+ });
18890
+ }
18891
+ /**
18892
+ * One user's live sessions: neither signed out nor expired. `is_current`
18893
+ * marks the caller's own session only, when the caller looks at themselves.
18894
+ * Same access and `404` rule as `getUser`.
18895
+ * `GET /admin-portal/users/{user_id}/sessions`
18896
+ */
18897
+ async listUserSessions(userId) {
18898
+ return this.request("GET", `/admin-portal/users/${encodeURIComponent(userId)}/sessions`);
18899
+ }
18900
+ /**
18901
+ * End one session of the user: its token is refused on its next request.
18902
+ * Needs `UsersManage`. Recorded in the audit log. A session that has
18903
+ * already ended answers `revoked: false` and records nothing. A session of
18904
+ * another user is a `404`, as an unknown id is.
18905
+ * `POST /admin-portal/users/{user_id}/sessions/{session_id}/revoke`
18906
+ */
18907
+ async revokeUserSession(userId, sessionId) {
18908
+ return this.request(
18909
+ "POST",
18910
+ `/admin-portal/users/${encodeURIComponent(userId)}/sessions/${encodeURIComponent(sessionId)}/revoke`
18911
+ );
18912
+ }
18913
+ /**
18914
+ * Sign the user out of every session and token, wherever they signed in.
18915
+ * Needs `UsersManage`. The account stays active and the user can sign in
18916
+ * again at once. Answers how many live sessions were ended. Recorded in the
18917
+ * audit log. `POST /admin-portal/users/{user_id}/sessions/revoke-all`
18918
+ */
18919
+ async revokeAllUserSessions(userId) {
18920
+ return this.request(
18921
+ "POST",
18922
+ `/admin-portal/users/${encodeURIComponent(userId)}/sessions/revoke-all`
18923
+ );
18924
+ }
18692
18925
  /**
18693
18926
  * Which checkout payment methods a member of `merchantId` may change.
18694
18927
  * `GET /admin-portal/accounts/{merchant_id}/members/{user_id}/method-access`