btrz-api-client 8.71.1 → 8.73.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.
@@ -43,6 +43,33 @@ function agenciesFactory(_ref) {
43
43
  });
44
44
  }
45
45
 
46
+ /**
47
+ * PUT /agencies/:agencyId - update an agency.
48
+ * @param {Object} opts
49
+ * @param {string} opts.token - API key
50
+ * @param {string} opts.jwtToken - JWT
51
+ * @param {string} opts.agencyId - Agency (seller) ID, 24-char hex ObjectId. Must not be the provider's own accountId.
52
+ * @param {Object} opts.agency - Agency payload
53
+ * @param {Object} [opts.headers] - Optional headers
54
+ * @returns {Promise<import("axios").AxiosResponse>}
55
+ */
56
+ function update(_ref3) {
57
+ var token = _ref3.token,
58
+ jwtToken = _ref3.jwtToken,
59
+ agencyId = _ref3.agencyId,
60
+ agency = _ref3.agency,
61
+ headers = _ref3.headers;
62
+
63
+ return client({
64
+ url: "/agencies/" + agencyId,
65
+ method: "put",
66
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
67
+ data: {
68
+ agency: agency
69
+ }
70
+ });
71
+ }
72
+
46
73
  /**
47
74
  * PUT /agencies/:agencyId/credit-limit - update credit limit for an agency (seller) in the provider's network.
48
75
  * Requires BETTEREZ_APP audience. Request body can be { limitAmount, unlimited } or { creditLimit: { limitAmount, unlimited } }.
@@ -55,12 +82,12 @@ function agenciesFactory(_ref) {
55
82
  * @param {Object} [opts.headers] - Optional headers
56
83
  * @returns {Promise<import("axios").AxiosResponse<{ creditLimit: { _id: string, sellerId: string, providerId: string, unlimited: boolean, overrideLimit: number, currentLimit: number } }>>}
57
84
  */
58
- function putCreditLimit(_ref3) {
59
- var token = _ref3.token,
60
- jwtToken = _ref3.jwtToken,
61
- agencyId = _ref3.agencyId,
62
- data = _ref3.data,
63
- headers = _ref3.headers;
85
+ function putCreditLimit(_ref4) {
86
+ var token = _ref4.token,
87
+ jwtToken = _ref4.jwtToken,
88
+ agencyId = _ref4.agencyId,
89
+ data = _ref4.data,
90
+ headers = _ref4.headers;
64
91
 
65
92
  return client({
66
93
  url: "/agencies/" + agencyId + "/credit-limit",
@@ -72,6 +99,7 @@ function agenciesFactory(_ref) {
72
99
 
73
100
  return {
74
101
  create: create,
102
+ update: update,
75
103
  putCreditLimit: putCreditLimit
76
104
  };
77
105
  }
@@ -66,6 +66,30 @@ function externalCustomersFactory(_ref) {
66
66
  });
67
67
  }
68
68
 
69
+ /**
70
+ * POST /external-customers/ado/confirmation/resend – Resend a Saldo Max Profile V2 quick registration OTP.
71
+ * Requires BETTEREZ_APP JWT.
72
+ * @param {Object} opts
73
+ * @param {string} [opts.token] - API key
74
+ * @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
75
+ * @param {{confirmationToken: string}} opts.data - Confirmation token returned by quick registration
76
+ * @param {Object} [opts.headers] - Optional headers
77
+ * @returns {Promise<import("axios").AxiosResponse<{ code: string, message?: string }>>}
78
+ */
79
+ function resendSaldoMaxRegistrationConfirmation(_ref4) {
80
+ var data = _ref4.data,
81
+ token = _ref4.token,
82
+ jwtToken = _ref4.jwtToken,
83
+ headers = _ref4.headers;
84
+
85
+ return client({
86
+ url: "/external-customers/ado/confirmation/resend",
87
+ method: "post",
88
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
89
+ data: data
90
+ });
91
+ }
92
+
69
93
  var saldoMax = {
70
94
  /**
71
95
  * GET /external-customers/ado - get SaldoMax user by email, phone or walletId.
@@ -84,11 +108,11 @@ function externalCustomersFactory(_ref) {
84
108
  * @returns {Promise<import("axios").AxiosResponse<{ adoUsers: Array<Object> }>>}
85
109
  * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
86
110
  */
87
- get: function get(_ref4) {
88
- var token = _ref4.token,
89
- jwtToken = _ref4.jwtToken,
90
- query = _ref4.query,
91
- headers = _ref4.headers;
111
+ get: function get(_ref5) {
112
+ var token = _ref5.token,
113
+ jwtToken = _ref5.jwtToken,
114
+ query = _ref5.query,
115
+ headers = _ref5.headers;
92
116
 
93
117
  return client.get("/external-customers/ado", {
94
118
  params: query,
@@ -97,7 +121,10 @@ function externalCustomersFactory(_ref) {
97
121
  },
98
122
  create: registerSaldoMax,
99
123
  confirmation: {
100
- create: confirmSaldoMaxRegistration
124
+ create: confirmSaldoMaxRegistration,
125
+ resend: {
126
+ create: resendSaldoMaxRegistrationConfirmation
127
+ }
101
128
  }
102
129
  };
103
130
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.71.1",
3
+ "version": "8.73.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,6 +32,27 @@ function agenciesFactory({client, internalAuthTokenProvider}) {
32
32
  });
33
33
  }
34
34
 
35
+ /**
36
+ * PUT /agencies/:agencyId - update an agency.
37
+ * @param {Object} opts
38
+ * @param {string} opts.token - API key
39
+ * @param {string} opts.jwtToken - JWT
40
+ * @param {string} opts.agencyId - Agency (seller) ID, 24-char hex ObjectId. Must not be the provider's own accountId.
41
+ * @param {Object} opts.agency - Agency payload
42
+ * @param {Object} [opts.headers] - Optional headers
43
+ * @returns {Promise<import("axios").AxiosResponse>}
44
+ */
45
+ function update({token, jwtToken, agencyId, agency, headers}) {
46
+ return client({
47
+ url: `/agencies/${agencyId}`,
48
+ method: "put",
49
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
50
+ data: {
51
+ agency
52
+ }
53
+ });
54
+ }
55
+
35
56
  /**
36
57
  * PUT /agencies/:agencyId/credit-limit - update credit limit for an agency (seller) in the provider's network.
37
58
  * Requires BETTEREZ_APP audience. Request body can be { limitAmount, unlimited } or { creditLimit: { limitAmount, unlimited } }.
@@ -55,6 +76,7 @@ function agenciesFactory({client, internalAuthTokenProvider}) {
55
76
 
56
77
  return {
57
78
  create,
79
+ update,
58
80
  putCreditLimit
59
81
  };
60
82
  }
@@ -48,6 +48,25 @@ function externalCustomersFactory({client, internalAuthTokenProvider}) {
48
48
  });
49
49
  }
50
50
 
51
+ /**
52
+ * POST /external-customers/ado/confirmation/resend – Resend a Saldo Max Profile V2 quick registration OTP.
53
+ * Requires BETTEREZ_APP JWT.
54
+ * @param {Object} opts
55
+ * @param {string} [opts.token] - API key
56
+ * @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
57
+ * @param {{confirmationToken: string}} opts.data - Confirmation token returned by quick registration
58
+ * @param {Object} [opts.headers] - Optional headers
59
+ * @returns {Promise<import("axios").AxiosResponse<{ code: string, message?: string }>>}
60
+ */
61
+ function resendSaldoMaxRegistrationConfirmation({data, token, jwtToken, headers}) {
62
+ return client({
63
+ url: "/external-customers/ado/confirmation/resend",
64
+ method: "post",
65
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
66
+ data
67
+ });
68
+ }
69
+
51
70
  const saldoMax = {
52
71
  /**
53
72
  * GET /external-customers/ado - get SaldoMax user by email, phone or walletId.
@@ -74,7 +93,10 @@ function externalCustomersFactory({client, internalAuthTokenProvider}) {
74
93
  },
75
94
  create: registerSaldoMax,
76
95
  confirmation: {
77
- create: confirmSaldoMaxRegistration
96
+ create: confirmSaldoMaxRegistration,
97
+ resend: {
98
+ create: resendSaldoMaxRegistrationConfirmation
99
+ }
78
100
  }
79
101
  };
80
102
 
@@ -42,6 +42,41 @@ describe("accounts/agencies", () => {
42
42
  });
43
43
  });
44
44
 
45
+ it("should PUT an agency", () => {
46
+ const agencyId = "507f1f77bcf86cd799439011";
47
+ const agency = {
48
+ seller: {
49
+ preferences: {
50
+ sales: {
51
+ creditLimit: {
52
+ limitAmount: 1000,
53
+ unlimited: false
54
+ }
55
+ }
56
+ }
57
+ },
58
+ network: {
59
+ productIds: ["productId"],
60
+ globalSearch: false,
61
+ active: true
62
+ }
63
+ };
64
+
65
+ axiosMock.onPut(`/agencies/${agencyId}`).reply(expectRequest({
66
+ statusCode: 200,
67
+ token,
68
+ jwtToken,
69
+ body: {agency}
70
+ }));
71
+
72
+ return api.accounts.agencies.update({
73
+ token,
74
+ jwtToken,
75
+ agencyId,
76
+ agency
77
+ });
78
+ });
79
+
45
80
  it("should PUT credit limit for an agency", () => {
46
81
  const agencyId = "507f1f77bcf86cd799439011";
47
82
  const data = {
@@ -77,4 +77,21 @@ describe("accounts/external-customers", () => {
77
77
  data
78
78
  });
79
79
  });
80
+
81
+ it("should POST Saldo Max Profile V2 registration confirmation resend", () => {
82
+ const data = {
83
+ confirmationToken: "confirmation-token"
84
+ };
85
+ axiosMock.onPost("/external-customers/ado/confirmation/resend").reply(expectRequest({
86
+ statusCode: 200,
87
+ token,
88
+ jwtToken,
89
+ body: data
90
+ }));
91
+ return api.accounts.externalCustomers.saldoMax.confirmation.resend.create({
92
+ token,
93
+ jwtToken,
94
+ data
95
+ });
96
+ });
80
97
  });