@delopay/sdk 0.393.0 → 0.400.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
@@ -137,6 +137,7 @@ __export(index_exports, {
137
137
  PAYPAL_CARD_LAYOUTS: () => PAYPAL_CARD_LAYOUTS,
138
138
  PAYPAL_LABEL_STYLES: () => PAYPAL_LABEL_STYLES,
139
139
  PRESENTATION_CONTRACT_VERSION: () => PRESENTATION_CONTRACT_VERSION,
140
+ PayoutDestinations: () => PayoutDestinations,
140
141
  PaypalDisputes: () => PaypalDisputes,
141
142
  Persons: () => Persons,
142
143
  PresentationCache: () => PresentationCache,
@@ -1440,6 +1441,64 @@ var Connectors = class {
1440
1441
  { body: params }
1441
1442
  );
1442
1443
  }
1444
+ /**
1445
+ * Read how the return addresses of a connector's payment provider name the
1446
+ * merchant, per environment.
1447
+ * `GET /account/{merchantId}/connectors/{connectorId}/return-address`
1448
+ *
1449
+ * A return address is where the provider sends the buyer back after a step
1450
+ * it hosts. It belongs to the merchant, the provider and the environment,
1451
+ * so every connector account of that provider follows it.
1452
+ */
1453
+ async getReturnAddress(merchantId, connectorId) {
1454
+ return this.request(
1455
+ "GET",
1456
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address`
1457
+ );
1458
+ }
1459
+ /**
1460
+ * Validate a proposed return address without saving it.
1461
+ * `POST /account/{merchantId}/connectors/{connectorId}/return-address/preview`
1462
+ *
1463
+ * Nothing is reserved: a generated identifier in the answer is an example.
1464
+ * Needs the same permission as saving.
1465
+ *
1466
+ * @example
1467
+ * ```typescript
1468
+ * const preview = await delopay.connectors.previewReturnAddress('mer_abc', 'mca_xyz', {
1469
+ * environment: 'live',
1470
+ * mode: 'anonymous',
1471
+ * share_webhook_identifier: true,
1472
+ * });
1473
+ * if (!preview.valid) console.warn(preview.errors);
1474
+ * ```
1475
+ */
1476
+ async previewReturnAddress(merchantId, connectorId, params) {
1477
+ return this.request(
1478
+ "POST",
1479
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address/preview`,
1480
+ { body: params }
1481
+ );
1482
+ }
1483
+ /**
1484
+ * Save the return address of a connector's payment provider for one
1485
+ * environment.
1486
+ * `PUT /account/{merchantId}/connectors/{connectorId}/return-address`
1487
+ *
1488
+ * Payments started afterwards get return addresses of the new form; every
1489
+ * address already handed to the provider keeps working. A refused proposal
1490
+ * answers 422 with error code `IR_06` and the message
1491
+ * `Return address refused: field:code,…`. A caller who may not edit every
1492
+ * connector account of the provider answers 403. Address changes are
1493
+ * limited per provider and environment (`rate_limit`).
1494
+ */
1495
+ async updateReturnAddress(merchantId, connectorId, params) {
1496
+ return this.request(
1497
+ "PUT",
1498
+ `/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/return-address`,
1499
+ { body: params }
1500
+ );
1501
+ }
1443
1502
  /**
1444
1503
  * Every webhook the connector's payment provider lists for its credentials
1445
1504
  * in one environment: Delopay's own, other connector accounts', former
@@ -3131,6 +3190,23 @@ var Payments = class {
3131
3190
  async buyerRisk(paymentId, options) {
3132
3191
  return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/buyer-risk`, options);
3133
3192
  }
3193
+ /**
3194
+ * Lift the holds put on an authorized payment when a chargeback prevention
3195
+ * alert or an AML hit on the same buyer arrived after it was scored and the
3196
+ * shop's `buyer_risk_source_changes` setting asked to hold it. Until then a
3197
+ * capture is refused with `IR_16`; after the release the payment can be
3198
+ * captured or cancelled as usual. A payment with no hold answers an empty
3199
+ * list. A caller scoped to one shop releases only that shop's payments.
3200
+ *
3201
+ * `POST /payments/{paymentId}/buyer-risk/release`
3202
+ */
3203
+ async releaseBuyerRiskHold(paymentId, options) {
3204
+ return this.request(
3205
+ "POST",
3206
+ `/payments/${encodeURIComponent(paymentId)}/buyer-risk/release`,
3207
+ options
3208
+ );
3209
+ }
3134
3210
  /**
3135
3211
  * What the payment's checkout client was, for AI shopping agents: a
3136
3212
  * verified agent (with its operator, protocol and key), an agent signature
@@ -5894,6 +5970,56 @@ var Users = class {
5894
5970
  body: params
5895
5971
  });
5896
5972
  }
5973
+ /**
5974
+ * One team member's sign-in history: successes and failures with method,
5975
+ * address, location and device, filtered, sorted and paged as
5976
+ * `listLoginActivity` is. `GET /user/employees/{user_id}/login-activity`
5977
+ *
5978
+ * Needs the *Users* write permission. Answers only for a member
5979
+ * `listUsersInLineage` shows you; any other id is a 404 `UR_68` with
5980
+ * `data.reason: 'member_not_found'`. Sign-ins belong to the account, so
5981
+ * they are shown only for an account wholly in this merchant: refused with
5982
+ * a 400 `UR_68` `member_has_access_elsewhere` for an account that also
5983
+ * holds a role elsewhere, and `member_not_activated` for one that is only
5984
+ * invited. `TeamMemberDetails.can_view_sign_ins` answers the same rule.
5985
+ */
5986
+ async listTeamMemberLoginActivity(userId, params) {
5987
+ const path2 = `/user/employees/${encodeURIComponent(userId)}/login-activity`;
5988
+ if (params === void 0) {
5989
+ return this.request("GET", path2);
5990
+ }
5991
+ return this.request("GET", path2, {
5992
+ query: csvQuery(params, ["event_type", "auth_method"])
5993
+ });
5994
+ }
5995
+ /**
5996
+ * One team member's live sessions: neither signed out nor expired.
5997
+ * `is_current` marks the caller's own session only.
5998
+ * `GET /user/employees/{user_id}/sessions`
5999
+ *
6000
+ * Same permission and refusals as `listTeamMemberLoginActivity`.
6001
+ */
6002
+ async listTeamMemberSessions(userId) {
6003
+ return this.request("GET", `/user/employees/${encodeURIComponent(userId)}/sessions`);
6004
+ }
6005
+ /**
6006
+ * Sign a team member out everywhere: ends every session and token of the
6007
+ * member, at this merchant and at every other merchant the account belongs
6008
+ * to. `POST /user/employees/{user_id}/sessions/revoke-all`
6009
+ *
6010
+ * The account stays active and its password unchanged, so the member can
6011
+ * sign in again at once. Allowed on exactly the members whose password you
6012
+ * may reset with `resetTeamMemberPassword`, and refused with the same
6013
+ * `UR_68` reasons ({@link TeamMemberRefusal}).
6014
+ * `TeamMemberDetails.can_sign_out` answers the same rule. Recorded in the
6015
+ * audit log.
6016
+ */
6017
+ async revokeTeamMemberSessions(userId) {
6018
+ return this.request(
6019
+ "POST",
6020
+ `/user/employees/${encodeURIComponent(userId)}/sessions/revoke-all`
6021
+ );
6022
+ }
5897
6023
  /**
5898
6024
  * Which checkout payment methods a member may change in your merchant.
5899
6025
  * `GET /user/employees/{user_id}/method-access`
@@ -7620,6 +7746,150 @@ function shopPath(profileId) {
7620
7746
  return `/industries/shops/${encodeURIComponent(profileId)}`;
7621
7747
  }
7622
7748
 
7749
+ // src/resources/payoutDestinations.ts
7750
+ var PayoutDestinations = class {
7751
+ constructor(request) {
7752
+ this.request = request;
7753
+ }
7754
+ /**
7755
+ * The caller's own destinations, masked, and the methods offered to them.
7756
+ *
7757
+ * `GET /payout-destinations/me`
7758
+ */
7759
+ async listMine() {
7760
+ return this.request("GET", "/payout-destinations/me");
7761
+ }
7762
+ /**
7763
+ * Save a destination. The method must be offered; at most 20 per member.
7764
+ *
7765
+ * `POST /payout-destinations/me`
7766
+ */
7767
+ async createMine(params) {
7768
+ return this.request("POST", "/payout-destinations/me", { body: params });
7769
+ }
7770
+ /**
7771
+ * Replace a destination's details at the version read.
7772
+ *
7773
+ * `PUT /payout-destinations/me/{destinationId}`
7774
+ */
7775
+ async updateMine(destinationId, params) {
7776
+ return this.request("PUT", `/payout-destinations/me/${encodeURIComponent(destinationId)}`, {
7777
+ body: params
7778
+ });
7779
+ }
7780
+ /**
7781
+ * Make a destination the preferred one; the others lose it.
7782
+ *
7783
+ * `POST /payout-destinations/me/{destinationId}/preferred`
7784
+ */
7785
+ async preferMine(destinationId, version) {
7786
+ return this.request(
7787
+ "POST",
7788
+ `/payout-destinations/me/${encodeURIComponent(destinationId)}/preferred`,
7789
+ { body: { version } }
7790
+ );
7791
+ }
7792
+ /**
7793
+ * Delete a destination. Final: the history keeps who, when and which
7794
+ * fields, never a value.
7795
+ *
7796
+ * `DELETE /payout-destinations/me/{destinationId}?version=`
7797
+ */
7798
+ async deleteMine(destinationId, version) {
7799
+ await this.request("DELETE", `/payout-destinations/me/${encodeURIComponent(destinationId)}`, {
7800
+ query: { version }
7801
+ });
7802
+ }
7803
+ /**
7804
+ * One's own destination in plain text. Recorded in the history first.
7805
+ *
7806
+ * `POST /payout-destinations/me/{destinationId}/reveal`
7807
+ */
7808
+ async revealMine(destinationId) {
7809
+ return this.request(
7810
+ "POST",
7811
+ `/payout-destinations/me/${encodeURIComponent(destinationId)}/reveal`
7812
+ );
7813
+ }
7814
+ /**
7815
+ * The methods offered to the caller.
7816
+ *
7817
+ * `GET /payout-destinations/methods`
7818
+ */
7819
+ async offeredMethods() {
7820
+ return this.request("GET", "/payout-destinations/methods");
7821
+ }
7822
+ /**
7823
+ * The merchant's list and, with `shop_id`, one shop's. A shop role reads
7824
+ * its own shop only.
7825
+ *
7826
+ * `GET /payout-destinations/methods/settings`
7827
+ */
7828
+ async retrieveMethodsSettings(params) {
7829
+ return this.request("GET", "/payout-destinations/methods/settings", {
7830
+ query: params
7831
+ });
7832
+ }
7833
+ /**
7834
+ * Set the methods offered at the merchant or at one shop.
7835
+ *
7836
+ * `PUT /payout-destinations/methods/settings`
7837
+ */
7838
+ async updateMethodsSettings(params) {
7839
+ return this.request("PUT", "/payout-destinations/methods/settings", { body: params });
7840
+ }
7841
+ /**
7842
+ * The team's destinations the caller manages, masked: every member for a
7843
+ * merchant-level role, the members reaching the caller's shop for a shop
7844
+ * role.
7845
+ *
7846
+ * `GET /payout-destinations`
7847
+ */
7848
+ async listTeam(params) {
7849
+ return this.request("GET", "/payout-destinations", { query: params });
7850
+ }
7851
+ /**
7852
+ * A managed member's destination in plain text. Recorded in the history
7853
+ * first.
7854
+ *
7855
+ * `POST /payout-destinations/{destinationId}/reveal`
7856
+ */
7857
+ async revealTeam(destinationId) {
7858
+ return this.request("POST", `/payout-destinations/${encodeURIComponent(destinationId)}/reveal`);
7859
+ }
7860
+ /**
7861
+ * Confirm a changed destination was seen, at the version read.
7862
+ *
7863
+ * `POST /payout-destinations/{destinationId}/acknowledge`
7864
+ */
7865
+ async acknowledgeTeam(destinationId, version) {
7866
+ return this.request(
7867
+ "POST",
7868
+ `/payout-destinations/${encodeURIComponent(destinationId)}/acknowledge`,
7869
+ { body: { version } }
7870
+ );
7871
+ }
7872
+ /**
7873
+ * Link a revenue-share holder to a team member, or unlink it (`null`). The
7874
+ * member must be an active member of the merchant whose role reads Payouts.
7875
+ *
7876
+ * `PUT /revenue-shares/holders/{holderId}/member`
7877
+ */
7878
+ async linkRevenueShareHolder(holderId, userId) {
7879
+ return this.request("PUT", `/revenue-shares/holders/${encodeURIComponent(holderId)}/member`, {
7880
+ body: { user_id: userId }
7881
+ });
7882
+ }
7883
+ /**
7884
+ * The share terms of the holders linked to the caller. Read-only.
7885
+ *
7886
+ * `GET /revenue-shares/mine`
7887
+ */
7888
+ async listMyRevenueShares() {
7889
+ return this.request("GET", "/revenue-shares/mine");
7890
+ }
7891
+ };
7892
+
7623
7893
  // src/resources/checkoutTemplates.ts
7624
7894
  var CheckoutTemplates = class {
7625
7895
  constructor(request) {
@@ -11717,6 +11987,7 @@ var Delopay = class {
11717
11987
  this.persons = new Persons(request);
11718
11988
  this.shopLabels = new ShopLabels(request);
11719
11989
  this.industries = new Industries(request);
11990
+ this.payoutDestinations = new PayoutDestinations(request);
11720
11991
  this.checkoutTemplates = new CheckoutTemplates(request);
11721
11992
  this.buyerConversations = new BuyerConversations(request);
11722
11993
  this.buyerEvidence = new BuyerEvidenceReviews(request);
@@ -17820,6 +18091,7 @@ var encodeNativePanes = encodePanes;
17820
18091
  PAYPAL_CARD_LAYOUTS,
17821
18092
  PAYPAL_LABEL_STYLES,
17822
18093
  PRESENTATION_CONTRACT_VERSION,
18094
+ PayoutDestinations,
17823
18095
  PaypalDisputes,
17824
18096
  Persons,
17825
18097
  PresentationCache,