@delopay/sdk 0.392.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/index.cjs CHANGED
@@ -1440,6 +1440,64 @@ var Connectors = class {
1440
1440
  { body: params }
1441
1441
  );
1442
1442
  }
1443
+ /**
1444
+ * Read how the return addresses of a connector's payment provider name the
1445
+ * merchant, per environment.
1446
+ * `GET /account/{merchantId}/connectors/{connectorId}/return-address`
1447
+ *
1448
+ * A return address is where the provider sends the buyer back after a step
1449
+ * it hosts. It belongs to the merchant, the provider and the environment,
1450
+ * so every connector account of that provider follows it.
1451
+ */
1452
+ async getReturnAddress(merchantId, connectorId) {
1453
+ return this.request(
1454
+ "GET",
1455
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address`
1456
+ );
1457
+ }
1458
+ /**
1459
+ * Validate a proposed return address without saving it.
1460
+ * `POST /account/{merchantId}/connectors/{connectorId}/return-address/preview`
1461
+ *
1462
+ * Nothing is reserved: a generated identifier in the answer is an example.
1463
+ * Needs the same permission as saving.
1464
+ *
1465
+ * @example
1466
+ * ```typescript
1467
+ * const preview = await delopay.connectors.previewReturnAddress('mer_abc', 'mca_xyz', {
1468
+ * environment: 'live',
1469
+ * mode: 'anonymous',
1470
+ * share_webhook_identifier: true,
1471
+ * });
1472
+ * if (!preview.valid) console.warn(preview.errors);
1473
+ * ```
1474
+ */
1475
+ async previewReturnAddress(merchantId, connectorId, params) {
1476
+ return this.request(
1477
+ "POST",
1478
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address/preview`,
1479
+ { body: params }
1480
+ );
1481
+ }
1482
+ /**
1483
+ * Save the return address of a connector's payment provider for one
1484
+ * environment.
1485
+ * `PUT /account/{merchantId}/connectors/{connectorId}/return-address`
1486
+ *
1487
+ * Payments started afterwards get return addresses of the new form; every
1488
+ * address already handed to the provider keeps working. A refused proposal
1489
+ * answers 422 with error code `IR_06` and the message
1490
+ * `Return address refused: field:code,…`. A caller who may not edit every
1491
+ * connector account of the provider answers 403. Address changes are
1492
+ * limited per provider and environment (`rate_limit`).
1493
+ */
1494
+ async updateReturnAddress(merchantId, connectorId, params) {
1495
+ return this.request(
1496
+ "PUT",
1497
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address`,
1498
+ { body: params }
1499
+ );
1500
+ }
1443
1501
  /**
1444
1502
  * Every webhook the connector's payment provider lists for its credentials
1445
1503
  * in one environment: Delopay's own, other connector accounts', former
@@ -1642,7 +1700,8 @@ var Customers = class {
1642
1700
  * Place an existing customer in a shop of the merchant, so the shop's API keys and team members
1643
1701
  * find the customer before any payment. The customer keeps the shops they already belong to;
1644
1702
  * placing one already in the shop changes nothing (`already_in_shop`). Needs a merchant-wide key:
1645
- * a key bound to one shop is refused. `POST /customers/{customer_id}/shops`
1703
+ * a key bound to one shop is refused. An unknown customer answers `CustomerNotFound` (404).
1704
+ * `POST /customers/{customer_id}/shops`
1646
1705
  *
1647
1706
  * @param customerId - The customer to place.
1648
1707
  * @param profileId - The shop. It must belong to the merchant.
@@ -3130,6 +3189,23 @@ var Payments = class {
3130
3189
  async buyerRisk(paymentId, options) {
3131
3190
  return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);
3132
3191
  }
3192
+ /**
3193
+ * Lift the holds put on an authorized payment when a chargeback prevention
3194
+ * alert or an AML hit on the same buyer arrived after it was scored and the
3195
+ * shop's `buyer_risk_source_changes` setting asked to hold it. Until then a
3196
+ * capture is refused with `IR_16`; after the release the payment can be
3197
+ * captured or cancelled as usual. A payment with no hold answers an empty
3198
+ * list. A caller scoped to one shop releases only that shop's payments.
3199
+ *
3200
+ * `POST /payments/{paymentId}/buyer-risk/release`
3201
+ */
3202
+ async releaseBuyerRiskHold(paymentId, options) {
3203
+ return this.request(
3204
+ "POST",
3205
+ `/payments/${encodeURIComponent(paymentId)}/buyer-risk/release`,
3206
+ options
3207
+ );
3208
+ }
3133
3209
  /**
3134
3210
  * What the payment's checkout client was, for AI shopping agents: a
3135
3211
  * verified agent (with its operator, protocol and key), an agent signature
@@ -5893,6 +5969,56 @@ var Users = class {
5893
5969
  body: params
5894
5970
  });
5895
5971
  }
5972
+ /**
5973
+ * One team member's sign-in history: successes and failures with method,
5974
+ * address, location and device, filtered, sorted and paged as
5975
+ * `listLoginActivity` is. `GET /user/employees/{user_id}/login-activity`
5976
+ *
5977
+ * Needs the *Users* write permission. Answers only for a member
5978
+ * `listUsersInLineage` shows you; any other id is a 404 `UR_68` with
5979
+ * `data.reason: 'member_not_found'`. Sign-ins belong to the account, so
5980
+ * they are shown only for an account wholly in this merchant: refused with
5981
+ * a 400 `UR_68` `member_has_access_elsewhere` for an account that also
5982
+ * holds a role elsewhere, and `member_not_activated` for one that is only
5983
+ * invited. `TeamMemberDetails.can_view_sign_ins` answers the same rule.
5984
+ */
5985
+ async listTeamMemberLoginActivity(userId, params) {
5986
+ const path2 = `/user/employees/${encodeURIComponent(userId)}/login-activity`;
5987
+ if (params === void 0) {
5988
+ return this.request("GET", path2);
5989
+ }
5990
+ return this.request("GET", path2, {
5991
+ query: csvQuery(params, ["event_type", "auth_method"])
5992
+ });
5993
+ }
5994
+ /**
5995
+ * One team member's live sessions: neither signed out nor expired.
5996
+ * `is_current` marks the caller's own session only.
5997
+ * `GET /user/employees/{user_id}/sessions`
5998
+ *
5999
+ * Same permission and refusals as `listTeamMemberLoginActivity`.
6000
+ */
6001
+ async listTeamMemberSessions(userId) {
6002
+ return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/sessions`);
6003
+ }
6004
+ /**
6005
+ * Sign a team member out everywhere: ends every session and token of the
6006
+ * member, at this merchant and at every other merchant the account belongs
6007
+ * to. `POST /user/employees/{user_id}/sessions/revoke-all`
6008
+ *
6009
+ * The account stays active and its password unchanged, so the member can
6010
+ * sign in again at once. Allowed on exactly the members whose password you
6011
+ * may reset with `resetTeamMemberPassword`, and refused with the same
6012
+ * `UR_68` reasons ({@link TeamMemberRefusal}).
6013
+ * `TeamMemberDetails.can_sign_out` answers the same rule. Recorded in the
6014
+ * audit log.
6015
+ */
6016
+ async revokeTeamMemberSessions(userId) {
6017
+ return this.request(
6018
+ "POST",
6019
+ `/user/employees/${encodeURIComponent(userId)}/sessions/revoke-all`
6020
+ );
6021
+ }
5896
6022
  /**
5897
6023
  * Which checkout payment methods a member may change in your merchant.
5898
6024
  * `GET /user/employees/{user_id}/method-access`