@hapl/api-queries 0.1.125 → 0.1.126

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.
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import qs from 'qs';
3
- import { nanoid } from 'nanoid/non-secure';
3
+ import { nanoid } from 'nanoid';
4
+ import { nanoid as nanoid$1 } from 'nanoid/non-secure';
4
5
  import chunk from 'lodash-es/chunk';
5
6
 
6
7
  function getPasswordRequest(_ref) {
@@ -188,6 +189,70 @@ function deleteAvailableFundsRequest(_ref) {
188
189
  });
189
190
  }
190
191
 
192
+ function createBillRequest(_ref) {
193
+ var _ref$baseURL = _ref.baseURL,
194
+ baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
195
+ body = _ref.body,
196
+ headers = _ref.headers;
197
+ return axios.post('/api/bill', body, {
198
+ baseURL: baseURL,
199
+ headers: _extends({
200
+ Accept: 'application/json',
201
+ 'Content-Type': 'application/json'
202
+ }, headers),
203
+ transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
204
+ return data.success ? data.data : data.data.error;
205
+ }])
206
+ }).then(function (res) {
207
+ return res;
208
+ })["catch"](function (err) {
209
+ throw err;
210
+ });
211
+ }
212
+
213
+ function findBillsRequest(_ref) {
214
+ var _ref$baseURL = _ref.baseURL,
215
+ baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
216
+ headers = _ref.headers,
217
+ params = _ref.params;
218
+ return axios.get('/api/bill/list', {
219
+ baseURL: baseURL,
220
+ params: params,
221
+ paramsSerializer: function paramsSerializer(params) {
222
+ return qs.stringify(params, {
223
+ arrayFormat: 'brackets'
224
+ });
225
+ },
226
+ headers: _extends({
227
+ Accept: 'application/json'
228
+ }, headers),
229
+ transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
230
+ if (!data.success) return data.data.error || data.data.message;
231
+ var ids = [];
232
+ var byId = {};
233
+ data.data.forEach(function (entity) {
234
+ var _id = nanoid();
235
+
236
+ byId[_id] = _extends({}, entity, {
237
+ _id: _id
238
+ });
239
+ ids.push(_id);
240
+ });
241
+ return {
242
+ ids: ids,
243
+ byId: byId,
244
+ meta: {
245
+ total: data.pageParams.length
246
+ }
247
+ };
248
+ }])
249
+ }).then(function (res) {
250
+ return res;
251
+ })["catch"](function (err) {
252
+ throw err;
253
+ });
254
+ }
255
+
191
256
  function countBuyersRequest(_ref) {
192
257
  var _ref$baseURL = _ref.baseURL,
193
258
  baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
@@ -480,6 +545,45 @@ function declineContractRequest(_ref) {
480
545
  });
481
546
  }
482
547
 
548
+ function findContractsRequest(_ref) {
549
+ var _ref$baseURL = _ref.baseURL,
550
+ baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
551
+ headers = _ref.headers,
552
+ params = _ref.params;
553
+ return axios.get('/api/contract', {
554
+ baseURL: baseURL,
555
+ params: params,
556
+ paramsSerializer: function paramsSerializer(params) {
557
+ return qs.stringify(params, {
558
+ arrayFormat: 'brackets'
559
+ });
560
+ },
561
+ headers: _extends({
562
+ Accept: 'application/json'
563
+ }, headers),
564
+ transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
565
+ if (!data.success) return data.data.error || data.data.message;
566
+ var ids = [];
567
+ var byId = {};
568
+ data.data.forEach(function (entity) {
569
+ byId[entity.id] = entity;
570
+ ids.push(entity.id);
571
+ });
572
+ return {
573
+ ids: ids,
574
+ byId: byId,
575
+ meta: {
576
+ total: data.pageParams.length
577
+ }
578
+ };
579
+ }])
580
+ }).then(function (res) {
581
+ return res;
582
+ })["catch"](function (err) {
583
+ throw err;
584
+ });
585
+ }
586
+
483
587
  function terminateContractRequest(_ref) {
484
588
  var _ref$baseURL = _ref.baseURL,
485
589
  baseURL = _ref$baseURL === void 0 ? 'https://clients.homeapp.ru' : _ref$baseURL,
@@ -1842,6 +1946,20 @@ var AvailableFundsPayerType;
1842
1946
  AvailableFundsPayerType["Expert"] = "expert";
1843
1947
  })(AvailableFundsPayerType || (AvailableFundsPayerType = {}));
1844
1948
 
1949
+ var BillServiceType;
1950
+
1951
+ (function (BillServiceType) {
1952
+ BillServiceType["PartPayment"] = "part_payment";
1953
+ BillServiceType["FullPayment"] = "full_payment";
1954
+ BillServiceType["BuyServicePayment"] = "buy_service_payment";
1955
+ })(BillServiceType || (BillServiceType = {}));
1956
+
1957
+ var BillServiceUnit;
1958
+
1959
+ (function (BillServiceUnit) {
1960
+ BillServiceUnit["Piece"] = "piece";
1961
+ })(BillServiceUnit || (BillServiceUnit = {}));
1962
+
1845
1963
  var BuyerStatus;
1846
1964
 
1847
1965
  (function (BuyerStatus) {
@@ -2529,6 +2647,12 @@ var AvailableFundsDictionary = {
2529
2647
  PayerType: (_PayerType = {}, _PayerType[AvailableFundsPayerType.Common] = 'Общий', _PayerType[AvailableFundsPayerType.Homeapp] = 'Homeapp', _PayerType[AvailableFundsPayerType.SalesHead] = 'РОП', _PayerType[AvailableFundsPayerType.Expert] = 'Эксперт', _PayerType)
2530
2648
  };
2531
2649
 
2650
+ var _ServiceType, _ServiceUnit;
2651
+ var BillDictionary = {
2652
+ ServiceType: (_ServiceType = {}, _ServiceType[BillServiceType.PartPayment] = 'Частичная оплата обеспечительного платежа', _ServiceType[BillServiceType.FullPayment] = 'Окончательный расчет', _ServiceType[BillServiceType.BuyServicePayment] = 'Оплата оказания услуг', _ServiceType),
2653
+ ServiceUnit: (_ServiceUnit = {}, _ServiceUnit[BillServiceUnit.Piece] = 'шт', _ServiceUnit)
2654
+ };
2655
+
2532
2656
  var _BuyerStatus;
2533
2657
  var BuyerDictionary = {
2534
2658
  BuyerStatus: (_BuyerStatus = {}, _BuyerStatus[BuyerStatus.Incoming] = 'Входящее обращение', _BuyerStatus[BuyerStatus.ShowCoordination] = 'Согласование даты показа', _BuyerStatus[BuyerStatus.ShowScheduled] = 'Показ назначен', _BuyerStatus[BuyerStatus.ShowComplete] = 'Показ проведен (ожидание оффера)', _BuyerStatus[BuyerStatus.GotOffer] = 'Оффер получен (согласование)', _BuyerStatus[BuyerStatus.Advance] = 'Аванс', _BuyerStatus[BuyerStatus.Closed] = 'Завершение работы', _BuyerStatus)
@@ -2710,6 +2834,23 @@ var Api = function Api(baseURL) {
2710
2834
  headers: headers,
2711
2835
  baseURL: _this.baseURL
2712
2836
  });
2837
+ }; // bill
2838
+
2839
+
2840
+ this.createBill = function (body, headers) {
2841
+ return createBillRequest({
2842
+ body: body,
2843
+ headers: headers,
2844
+ baseURL: _this.baseURL
2845
+ });
2846
+ };
2847
+
2848
+ this.findBills = function (params, headers) {
2849
+ return findBillsRequest({
2850
+ params: params,
2851
+ headers: headers,
2852
+ baseURL: _this.baseURL
2853
+ });
2713
2854
  }; // buyer
2714
2855
 
2715
2856
 
@@ -2804,6 +2945,14 @@ var Api = function Api(baseURL) {
2804
2945
  });
2805
2946
  };
2806
2947
 
2948
+ this.findContracts = function (params, headers) {
2949
+ return findContractsRequest({
2950
+ params: params,
2951
+ headers: headers,
2952
+ baseURL: _this.baseURL
2953
+ });
2954
+ };
2955
+
2807
2956
  this.terminateContract = function (urlParams, body, headers) {
2808
2957
  return terminateContractRequest({
2809
2958
  urlParams: urlParams,
@@ -3218,6 +3367,8 @@ var index = {
3218
3367
  findAvailableFundsRequest: findAvailableFundsRequest,
3219
3368
  updateAvailableFundsRequest: updateAvailableFundsRequest,
3220
3369
  deleteAvailableFundsRequest: deleteAvailableFundsRequest,
3370
+ createBillRequest: createBillRequest,
3371
+ findBillsRequest: findBillsRequest,
3221
3372
  countBuyersRequest: countBuyersRequest,
3222
3373
  findBuyersRequest: findBuyersRequest,
3223
3374
  findCallsRequest: findCallsRequest,
@@ -3229,6 +3380,7 @@ var index = {
3229
3380
  createCallTaskRequest: createCallTaskRequest,
3230
3381
  approveContractRequest: approveContractRequest,
3231
3382
  declineContractRequest: declineContractRequest,
3383
+ findContractsRequest: findContractsRequest,
3232
3384
  terminateContractRequest: terminateContractRequest,
3233
3385
  createDealCategorizedFileRequest: createDealCategorizedFileRequest,
3234
3386
  createDealInvestPrepaymentRequest: createDealInvestPrepaymentRequest,
@@ -3279,6 +3431,7 @@ var index = {
3279
3431
  findValuationByServiceRequestIdRequest: findValuationByServiceRequestIdRequest,
3280
3432
  AddressBTIParamsDictionary: AddressBTIParamsDictionary,
3281
3433
  AvailableFundsDictionary: AvailableFundsDictionary,
3434
+ BillDictionary: BillDictionary,
3282
3435
  BuyerDictionary: BuyerDictionary,
3283
3436
  CallDictionary: CallDictionary,
3284
3437
  CallTaskDictionary: CallTaskDictionary,
@@ -3304,6 +3457,8 @@ var index = {
3304
3457
  get AvailableFundsPaymentType () { return AvailableFundsPaymentType; },
3305
3458
  get AvailableFundsRealtyType () { return AvailableFundsRealtyType; },
3306
3459
  get AvailableFundsPayerType () { return AvailableFundsPayerType; },
3460
+ get BillServiceType () { return BillServiceType; },
3461
+ get BillServiceUnit () { return BillServiceUnit; },
3307
3462
  get BuyerStatus () { return BuyerStatus; },
3308
3463
  get BuyerRealtyShowStatus () { return BuyerRealtyShowStatus; },
3309
3464
  get CallType () { return CallType; },
@@ -4736,7 +4891,7 @@ function findActualEventsRowRequest(_ref) {
4736
4891
  var ids = [];
4737
4892
  var byId = {};
4738
4893
  data.data.forEach(function (entity) {
4739
- var _id = nanoid();
4894
+ var _id = nanoid$1();
4740
4895
 
4741
4896
  byId[_id] = _extends({}, entity, {
4742
4897
  _id: _id