@hapl/api-queries 0.1.124 → 0.1.125--canary.56.5e78c49.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/CHANGELOG.md CHANGED
@@ -1,15 +1,3 @@
1
- # v0.1.124 (Tue Feb 08 2022)
2
-
3
- #### ⚠️ Pushed to `main`
4
-
5
- - список баеров ([@yeshkarluk](https://github.com/yeshkarluk))
6
-
7
- #### Authors: 1
8
-
9
- - Ivan Ignatev ([@yeshkarluk](https://github.com/yeshkarluk))
10
-
11
- ---
12
-
13
1
  # v0.1.123 (Mon Feb 07 2022)
14
2
 
15
3
  #### ⚠️ Pushed to `main`
@@ -6,6 +6,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var axios = _interopDefault(require('axios'));
8
8
  var qs = _interopDefault(require('qs'));
9
+ var nanoid = require('nanoid');
9
10
  var nonSecure = require('nanoid/non-secure');
10
11
  var chunk = _interopDefault(require('lodash/chunk'));
11
12
 
@@ -194,12 +195,33 @@ function deleteAvailableFundsRequest(_ref) {
194
195
  });
195
196
  }
196
197
 
197
- function countBuyersRequest(_ref) {
198
+ function createBillRequest(_ref) {
199
+ var _ref$baseURL = _ref.baseURL,
200
+ baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
201
+ body = _ref.body,
202
+ headers = _ref.headers;
203
+ return axios.post('/api/bill', body, {
204
+ baseURL: baseURL,
205
+ headers: _extends({
206
+ Accept: 'application/json',
207
+ 'Content-Type': 'application/json'
208
+ }, headers),
209
+ transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
210
+ return data.success ? data.data : data.data.error;
211
+ }])
212
+ }).then(function (res) {
213
+ return res;
214
+ })["catch"](function (err) {
215
+ throw err;
216
+ });
217
+ }
218
+
219
+ function findBillsRequest(_ref) {
198
220
  var _ref$baseURL = _ref.baseURL,
199
221
  baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
200
222
  headers = _ref.headers,
201
223
  params = _ref.params;
202
- return axios.get('/api/buyer/count', {
224
+ return axios.get('/api/bill/list', {
203
225
  baseURL: baseURL,
204
226
  params: params,
205
227
  paramsSerializer: function paramsSerializer(params) {
@@ -211,11 +233,24 @@ function countBuyersRequest(_ref) {
211
233
  Accept: 'application/json'
212
234
  }, headers),
213
235
  transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
214
- if (data.success) {
215
- return data.data;
216
- }
236
+ if (!data.success) return data.data.error || data.data.message;
237
+ var ids = [];
238
+ var byId = {};
239
+ data.data.forEach(function (entity) {
240
+ var _id = nanoid.nanoid();
217
241
 
218
- return data.data.error;
242
+ byId[_id] = _extends({}, entity, {
243
+ _id: _id
244
+ });
245
+ ids.push(_id);
246
+ });
247
+ return {
248
+ ids: ids,
249
+ byId: byId,
250
+ meta: {
251
+ total: data.pageParams.length
252
+ }
253
+ };
219
254
  }])
220
255
  }).then(function (res) {
221
256
  return res;
@@ -224,12 +259,12 @@ function countBuyersRequest(_ref) {
224
259
  });
225
260
  }
226
261
 
227
- function findBuyersRequest(_ref) {
262
+ function countBuyersRequest(_ref) {
228
263
  var _ref$baseURL = _ref.baseURL,
229
264
  baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
230
265
  headers = _ref.headers,
231
266
  params = _ref.params;
232
- return axios.get('/api/buyer', {
267
+ return axios.get('/api/buyer/count', {
233
268
  baseURL: baseURL,
234
269
  params: params,
235
270
  paramsSerializer: function paramsSerializer(params) {
@@ -242,19 +277,7 @@ function findBuyersRequest(_ref) {
242
277
  }, headers),
243
278
  transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
244
279
  if (data.success) {
245
- var ids = [];
246
- var byId = {};
247
- data.data.forEach(function (entity) {
248
- byId[entity.id] = entity;
249
- ids.push(entity.id);
250
- });
251
- return {
252
- ids: ids,
253
- byId: byId,
254
- meta: {
255
- total: data.pageParams.length
256
- }
257
- };
280
+ return data.data;
258
281
  }
259
282
 
260
283
  return data.data.error;
@@ -486,6 +509,45 @@ function declineContractRequest(_ref) {
486
509
  });
487
510
  }
488
511
 
512
+ function findContractsRequest(_ref) {
513
+ var _ref$baseURL = _ref.baseURL,
514
+ baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
515
+ headers = _ref.headers,
516
+ params = _ref.params;
517
+ return axios.get('/api/contract', {
518
+ baseURL: baseURL,
519
+ params: params,
520
+ paramsSerializer: function paramsSerializer(params) {
521
+ return qs.stringify(params, {
522
+ arrayFormat: 'brackets'
523
+ });
524
+ },
525
+ headers: _extends({
526
+ Accept: 'application/json'
527
+ }, headers),
528
+ transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
529
+ if (!data.success) return data.data.error || data.data.message;
530
+ var ids = [];
531
+ var byId = {};
532
+ data.data.forEach(function (entity) {
533
+ byId[entity.id] = entity;
534
+ ids.push(entity.id);
535
+ });
536
+ return {
537
+ ids: ids,
538
+ byId: byId,
539
+ meta: {
540
+ total: data.pageParams.length
541
+ }
542
+ };
543
+ }])
544
+ }).then(function (res) {
545
+ return res;
546
+ })["catch"](function (err) {
547
+ throw err;
548
+ });
549
+ }
550
+
489
551
  function terminateContractRequest(_ref) {
490
552
  var _ref$baseURL = _ref.baseURL,
491
553
  baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
@@ -1848,6 +1910,20 @@ var AvailableFundsPayerType;
1848
1910
  AvailableFundsPayerType["Expert"] = "expert";
1849
1911
  })(AvailableFundsPayerType || (AvailableFundsPayerType = {}));
1850
1912
 
1913
+ var BillServiceType;
1914
+
1915
+ (function (BillServiceType) {
1916
+ BillServiceType["PartPayment"] = "part_payment";
1917
+ BillServiceType["FullPayment"] = "full_payment";
1918
+ BillServiceType["BuyServicePayment"] = "buy_service_payment";
1919
+ })(BillServiceType || (BillServiceType = {}));
1920
+
1921
+ var BillServiceUnit;
1922
+
1923
+ (function (BillServiceUnit) {
1924
+ BillServiceUnit["Piece"] = "piece";
1925
+ })(BillServiceUnit || (BillServiceUnit = {}));
1926
+
1851
1927
  var BuyerStatus;
1852
1928
 
1853
1929
  (function (BuyerStatus) {
@@ -2536,6 +2612,11 @@ var AvailableFundsDictionary = {
2536
2612
  PayerType: (_PayerType = {}, _PayerType[AvailableFundsPayerType.Common] = 'Общий', _PayerType[AvailableFundsPayerType.Homeapp] = 'Homeapp', _PayerType[AvailableFundsPayerType.SalesHead] = 'РОП', _PayerType[AvailableFundsPayerType.Expert] = 'Эксперт', _PayerType)
2537
2613
  };
2538
2614
 
2615
+ var _ServiceType;
2616
+ var BillDictionary = {
2617
+ ServiceType: (_ServiceType = {}, _ServiceType[BillServiceType.PartPayment] = 'Частичная оплата обеспечительного платежа по договору', _ServiceType[BillServiceType.FullPayment] = 'Окончательный расчет по договору', _ServiceType[BillServiceType.BuyServicePayment] = 'Оплата по договору оказания услуг', _ServiceType)
2618
+ };
2619
+
2539
2620
  var _BuyerStatus;
2540
2621
  var BuyerDictionary = {
2541
2622
  BuyerStatus: (_BuyerStatus = {}, _BuyerStatus[BuyerStatus.Incoming] = 'Входящее обращение', _BuyerStatus[BuyerStatus.ShowCoordination] = 'Согласование даты показа', _BuyerStatus[BuyerStatus.ShowScheduled] = 'Показ назначен', _BuyerStatus[BuyerStatus.ShowComplete] = 'Показ проведен (ожидание оффера)', _BuyerStatus[BuyerStatus.GotOffer] = 'Оффер получен (согласование)', _BuyerStatus[BuyerStatus.Advance] = 'Аванс', _BuyerStatus[BuyerStatus.Closed] = 'Завершение работы', _BuyerStatus)
@@ -2715,19 +2796,28 @@ var Api = function Api(baseURL) {
2715
2796
  headers: headers,
2716
2797
  baseURL: _this.baseURL
2717
2798
  });
2718
- }; // buyer
2799
+ }; // bill
2719
2800
 
2720
2801
 
2721
- this.countBuyers = function (params, headers) {
2722
- return countBuyersRequest({
2723
- params: params,
2802
+ this.createBill = function (body, headers) {
2803
+ return createBillRequest({
2804
+ body: body,
2724
2805
  headers: headers,
2725
2806
  baseURL: _this.baseURL
2726
2807
  });
2727
2808
  };
2728
2809
 
2729
- this.findBuyers = function (params, headers) {
2730
- return findBuyersRequest({
2810
+ this.findBills = function (params, headers) {
2811
+ return findBillsRequest({
2812
+ params: params,
2813
+ headers: headers,
2814
+ baseURL: _this.baseURL
2815
+ });
2816
+ }; // buyer
2817
+
2818
+
2819
+ this.countBuyers = function (params, headers) {
2820
+ return countBuyersRequest({
2731
2821
  params: params,
2732
2822
  headers: headers,
2733
2823
  baseURL: _this.baseURL
@@ -2809,6 +2899,14 @@ var Api = function Api(baseURL) {
2809
2899
  });
2810
2900
  };
2811
2901
 
2902
+ this.findContracts = function (params, headers) {
2903
+ return findContractsRequest({
2904
+ params: params,
2905
+ headers: headers,
2906
+ baseURL: _this.baseURL
2907
+ });
2908
+ };
2909
+
2812
2910
  this.terminateContract = function (urlParams, body, headers) {
2813
2911
  return terminateContractRequest({
2814
2912
  urlParams: urlParams,
@@ -3223,8 +3321,9 @@ var index = {
3223
3321
  findAvailableFundsRequest: findAvailableFundsRequest,
3224
3322
  updateAvailableFundsRequest: updateAvailableFundsRequest,
3225
3323
  deleteAvailableFundsRequest: deleteAvailableFundsRequest,
3324
+ createBillRequest: createBillRequest,
3325
+ findBillsRequest: findBillsRequest,
3226
3326
  countBuyersRequest: countBuyersRequest,
3227
- findBuyersRequest: findBuyersRequest,
3228
3327
  findCallsRequest: findCallsRequest,
3229
3328
  findFirstSuccessOutgoingCallsRequest: findFirstSuccessOutgoingCallsRequest,
3230
3329
  markupCallRequest: markupCallRequest,
@@ -3234,6 +3333,7 @@ var index = {
3234
3333
  createCallTaskRequest: createCallTaskRequest,
3235
3334
  approveContractRequest: approveContractRequest,
3236
3335
  declineContractRequest: declineContractRequest,
3336
+ findContractsRequest: findContractsRequest,
3237
3337
  terminateContractRequest: terminateContractRequest,
3238
3338
  createDealCategorizedFileRequest: createDealCategorizedFileRequest,
3239
3339
  createDealInvestPrepaymentRequest: createDealInvestPrepaymentRequest,
@@ -3284,6 +3384,7 @@ var index = {
3284
3384
  findValuationByServiceRequestIdRequest: findValuationByServiceRequestIdRequest,
3285
3385
  AddressBTIParamsDictionary: AddressBTIParamsDictionary,
3286
3386
  AvailableFundsDictionary: AvailableFundsDictionary,
3387
+ BillDictionary: BillDictionary,
3287
3388
  BuyerDictionary: BuyerDictionary,
3288
3389
  CallDictionary: CallDictionary,
3289
3390
  CallTaskDictionary: CallTaskDictionary,
@@ -3309,6 +3410,8 @@ var index = {
3309
3410
  get AvailableFundsPaymentType () { return AvailableFundsPaymentType; },
3310
3411
  get AvailableFundsRealtyType () { return AvailableFundsRealtyType; },
3311
3412
  get AvailableFundsPayerType () { return AvailableFundsPayerType; },
3413
+ get BillServiceType () { return BillServiceType; },
3414
+ get BillServiceUnit () { return BillServiceUnit; },
3312
3415
  get BuyerStatus () { return BuyerStatus; },
3313
3416
  get BuyerRealtyShowStatus () { return BuyerRealtyShowStatus; },
3314
3417
  get CallType () { return CallType; },