@esolve/ng-esolve-connect 0.7.5 → 0.10.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/esm2020/lib/account/esolve-account.service.mjs +160 -36
- package/esm2020/lib/account/esolve-change-password-result.mjs +8 -0
- package/esm2020/lib/account/esolve-forgot-password-response.mjs +2 -0
- package/esm2020/lib/account/esolve-reset-password-result.mjs +11 -0
- package/esm2020/lib/account/esolve-transaction-list.mjs +4 -0
- package/esm2020/lib/account/esolve-transaction-options.mjs +2 -0
- package/esm2020/lib/account/esolve-transaction-record.mjs +2 -0
- package/esm2020/lib/account/esolve-transaction.mjs +145 -0
- package/esm2020/lib/auth/esolve-auth-interceptor.service.mjs +1 -1
- package/esm2020/lib/auth/esolve-auth.service.mjs +25 -25
- package/esm2020/lib/banners/esolve-banner.service.mjs +26 -26
- package/esm2020/lib/cart/esolve-cart.service.mjs +25 -25
- package/esm2020/lib/category-tree/esolve-category-tree-item-options.mjs +2 -0
- package/esm2020/lib/category-tree/esolve-category-tree.service.mjs +45 -45
- package/esm2020/lib/locations/esolve-locations.service.mjs +15 -15
- package/esm2020/lib/locations/esolve-stock-location-record.mjs +1 -1
- package/esm2020/lib/locations/esolve-stock-location.mjs +16 -16
- package/esm2020/lib/media/esolve-media.service.mjs +25 -25
- package/esm2020/lib/menu/esolve-menu.service.mjs +1 -1
- package/esm2020/lib/news/esolve-news-article-options.mjs +2 -0
- package/esm2020/lib/news/esolve-news.service.mjs +1 -1
- package/esm2020/lib/payment/esolve-payment-method-record.mjs +1 -1
- package/esm2020/lib/payment/esolve-payment-method.mjs +1 -5
- package/esm2020/lib/payment/esolve-payment.service.mjs +21 -1
- package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +57 -24
- package/esm2020/lib/shared/esolve-list.mjs +9 -0
- package/esm2020/lib/shared/esolve-response.mjs +1 -1
- package/esm2020/lib/shared/esolve-result.mjs +8 -0
- package/esm2020/lib/stock/esolve-stock-item-options.mjs +1 -1
- package/esm2020/lib/stock/esolve-stock.service.mjs +4 -1
- package/esm2020/lib/topics/esolve-topic.service.mjs +11 -11
- package/esm2020/public-api.mjs +16 -3
- package/fesm2015/esolve-ng-esolve-connect.mjs +670 -322
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +672 -321
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/account/esolve-account.service.d.ts +18 -6
- package/lib/account/esolve-change-password-result.d.ts +6 -0
- package/lib/account/esolve-forgot-password-response.d.ts +7 -0
- package/lib/account/esolve-reset-password-result.d.ts +9 -0
- package/lib/account/esolve-transaction-list.d.ts +4 -0
- package/lib/account/esolve-transaction-options.d.ts +8 -0
- package/lib/account/esolve-transaction-record.d.ts +98 -0
- package/lib/account/esolve-transaction.d.ts +132 -0
- package/lib/auth/esolve-auth.service.d.ts +1 -1
- package/lib/banners/esolve-banner.service.d.ts +6 -6
- package/lib/cart/esolve-cart.service.d.ts +12 -12
- package/lib/category-tree/esolve-category-tree-item-options.d.ts +18 -0
- package/lib/category-tree/esolve-category-tree.service.d.ts +8 -26
- package/lib/locations/esolve-locations.service.d.ts +5 -5
- package/lib/locations/esolve-stock-location-record.d.ts +1 -1
- package/lib/locations/esolve-stock-location.d.ts +7 -8
- package/lib/media/esolve-media.service.d.ts +7 -7
- package/lib/news/esolve-news-article-options.d.ts +11 -0
- package/lib/news/esolve-news.service.d.ts +1 -12
- package/lib/payment/esolve-payment-method-record.d.ts +0 -4
- package/lib/payment/esolve-payment-method.d.ts +0 -4
- package/lib/payment/esolve-payment.service.d.ts +2 -0
- package/lib/shared/error-handler/esolve-error-handler.service.d.ts +8 -2
- package/lib/shared/esolve-list.d.ts +7 -0
- package/lib/shared/esolve-response.d.ts +15 -9
- package/lib/shared/esolve-result.d.ts +6 -0
- package/lib/stock/esolve-stock-item-options.d.ts +1 -0
- package/lib/topics/esolve-topic.service.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +15 -2
|
@@ -7,7 +7,7 @@ import * as i4 from 'ngx-cookie-service';
|
|
|
7
7
|
import { CookieService } from 'ngx-cookie-service';
|
|
8
8
|
import { BehaviorSubject, throwError, iif, of } from 'rxjs';
|
|
9
9
|
import * as i1 from '@angular/platform-browser';
|
|
10
|
-
import {
|
|
10
|
+
import { tap, catchError, map, switchMap } from 'rxjs/operators';
|
|
11
11
|
|
|
12
12
|
const ESOLVE_CONNECT_CONFIG = new InjectionToken('esolve.connect.config');
|
|
13
13
|
// For future development
|
|
@@ -195,6 +195,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
195
195
|
}]
|
|
196
196
|
}] });
|
|
197
197
|
|
|
198
|
+
class EsolveList {
|
|
199
|
+
constructor(items = [], page = 0, rows = 0, total = 0) {
|
|
200
|
+
this.items = items;
|
|
201
|
+
this.page = page;
|
|
202
|
+
this.rows = rows;
|
|
203
|
+
this.total = total;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
class EsolveResult {
|
|
208
|
+
constructor(status, code, message) {
|
|
209
|
+
this.status = status;
|
|
210
|
+
this.code = code;
|
|
211
|
+
this.message = message;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
198
215
|
class EsolveHttpError {
|
|
199
216
|
constructor(type, message, error_code) {
|
|
200
217
|
this.type = type;
|
|
@@ -205,11 +222,65 @@ class EsolveHttpError {
|
|
|
205
222
|
|
|
206
223
|
class EsolveErrorHandlerService {
|
|
207
224
|
constructor() { }
|
|
225
|
+
emitError(code, message) {
|
|
226
|
+
throw new EsolveHttpError('error', message, code);
|
|
227
|
+
}
|
|
228
|
+
handleHttpPostError(service_type, errorRes) {
|
|
229
|
+
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
230
|
+
!('service_type' in errorRes) &&
|
|
231
|
+
(('id' in errorRes) &&
|
|
232
|
+
('esolve_id' in errorRes) &&
|
|
233
|
+
('transaction_type' in errorRes) &&
|
|
234
|
+
('status' in errorRes) &&
|
|
235
|
+
('log' in errorRes))) {
|
|
236
|
+
return throwError(this.parsePostErrors(errorRes));
|
|
237
|
+
}
|
|
238
|
+
return this.handleHttpError(service_type, errorRes);
|
|
239
|
+
}
|
|
240
|
+
handleHttpDeleteError(service_type, errorRes) {
|
|
241
|
+
const is_not_base = (!(errorRes instanceof HttpErrorResponse) &&
|
|
242
|
+
!('service_type' in errorRes) &&
|
|
243
|
+
(('id' in errorRes) &&
|
|
244
|
+
('status' in errorRes) &&
|
|
245
|
+
('message' in errorRes) &&
|
|
246
|
+
('code' in errorRes)));
|
|
247
|
+
if (is_not_base) {
|
|
248
|
+
return throwError(this.parseDeleteError(errorRes));
|
|
249
|
+
}
|
|
250
|
+
return this.handleHttpError(service_type, errorRes);
|
|
251
|
+
}
|
|
252
|
+
handleHttpError(service_type, errorRes) {
|
|
253
|
+
if (errorRes instanceof HttpErrorResponse) {
|
|
254
|
+
if (errorRes.status === 500) {
|
|
255
|
+
const server_error = errorRes.error;
|
|
256
|
+
if (('service_type' in server_error) &&
|
|
257
|
+
(server_error.service_type === service_type)) {
|
|
258
|
+
return throwError(this.parseException(server_error));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
if (('service_type' in errorRes) &&
|
|
264
|
+
(errorRes.service_type === service_type)) {
|
|
265
|
+
if (errorRes.type === 'exception') {
|
|
266
|
+
return throwError(this.parseException(errorRes));
|
|
267
|
+
}
|
|
268
|
+
else if (errorRes.type === 'error') {
|
|
269
|
+
return throwError(this.parseResponseError(errorRes));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return throwError(errorRes);
|
|
274
|
+
}
|
|
208
275
|
parseException(exception) {
|
|
209
276
|
const error = new EsolveHttpError('exception', exception.message || 'Unknown exception has occurred', exception.additional_data.exception_type || 'unknown');
|
|
210
277
|
return error;
|
|
211
278
|
}
|
|
212
|
-
|
|
279
|
+
parseResponseError(exception) {
|
|
280
|
+
const error = new EsolveHttpError('error', exception.message || 'Unknown error has occurred', exception.code || 'unknown');
|
|
281
|
+
return error;
|
|
282
|
+
}
|
|
283
|
+
parsePostErrors(response) {
|
|
213
284
|
const error = new EsolveHttpError('error', 'Unknown error has occurred', 'unknown');
|
|
214
285
|
if ((response.status.state === 'none') && (response.log.length > 0)) {
|
|
215
286
|
error.error_code = 'no_response';
|
|
@@ -222,29 +293,8 @@ class EsolveErrorHandlerService {
|
|
|
222
293
|
}
|
|
223
294
|
return error;
|
|
224
295
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (errorRes.status === 500) {
|
|
228
|
-
const server_error = errorRes.error;
|
|
229
|
-
if ((server_error.service_type === service_type) ||
|
|
230
|
-
(server_error.type !== undefined) ||
|
|
231
|
-
(server_error.message !== undefined) ||
|
|
232
|
-
(server_error.additional_data !== undefined)) {
|
|
233
|
-
return throwError(this.parseException(server_error));
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
if (errorRes.type !== undefined) {
|
|
239
|
-
if ((errorRes.type === 'exception') || (errorRes.type === 'error')) {
|
|
240
|
-
return throwError(this.parseException(errorRes));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
else if (errorRes.transaction_type !== undefined) {
|
|
244
|
-
return throwError(this.parseErrors(errorRes));
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return throwError(errorRes);
|
|
296
|
+
parseDeleteError(result) {
|
|
297
|
+
return new EsolveHttpError('error', result.message, result.code);
|
|
248
298
|
}
|
|
249
299
|
}
|
|
250
300
|
EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -423,30 +473,6 @@ class EsolveAuthService {
|
|
|
423
473
|
this.errorHandler = errorHandler;
|
|
424
474
|
this.cookieService = cookieService;
|
|
425
475
|
}
|
|
426
|
-
checkAccessToken(session) {
|
|
427
|
-
session = session || this.session.currentSession;
|
|
428
|
-
const token = session?.key ?? '';
|
|
429
|
-
const params = new HttpParams({
|
|
430
|
-
fromObject: {
|
|
431
|
-
key: token,
|
|
432
|
-
ws_id: this.config.wsid
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
436
|
-
params,
|
|
437
|
-
headers: new HttpHeaders({
|
|
438
|
-
'Accept-Language': '*'
|
|
439
|
-
})
|
|
440
|
-
}).pipe(map(responseData => {
|
|
441
|
-
if ((responseData.type === 'error') ||
|
|
442
|
-
(responseData.type === 'exception') ||
|
|
443
|
-
(!responseData.additional_data.key_okay)) {
|
|
444
|
-
throw responseData;
|
|
445
|
-
}
|
|
446
|
-
responseData.additional_data.key = token;
|
|
447
|
-
return responseData;
|
|
448
|
-
})).toPromise();
|
|
449
|
-
}
|
|
450
476
|
getAccessToken(email, password, anonymous = false) {
|
|
451
477
|
let params = new HttpParams();
|
|
452
478
|
if (anonymous) {
|
|
@@ -522,6 +548,30 @@ class EsolveAuthService {
|
|
|
522
548
|
this.cookieService.delete('_ws_id');
|
|
523
549
|
return this.getAccessToken('', '', true).toPromise();
|
|
524
550
|
}
|
|
551
|
+
checkAccessToken(session) {
|
|
552
|
+
session = session || this.session.currentSession;
|
|
553
|
+
const token = session?.key ?? '';
|
|
554
|
+
const params = new HttpParams({
|
|
555
|
+
fromObject: {
|
|
556
|
+
key: token,
|
|
557
|
+
ws_id: this.config.wsid
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
561
|
+
params,
|
|
562
|
+
headers: new HttpHeaders({
|
|
563
|
+
'Accept-Language': '*'
|
|
564
|
+
})
|
|
565
|
+
}).pipe(map(responseData => {
|
|
566
|
+
if ((responseData.type === 'error') ||
|
|
567
|
+
(responseData.type === 'exception') ||
|
|
568
|
+
(!responseData.additional_data.key_okay)) {
|
|
569
|
+
throw responseData;
|
|
570
|
+
}
|
|
571
|
+
responseData.additional_data.key = token;
|
|
572
|
+
return responseData;
|
|
573
|
+
})).toPromise();
|
|
574
|
+
}
|
|
525
575
|
// Handlers
|
|
526
576
|
handleExpiration() {
|
|
527
577
|
return (session) => {
|
|
@@ -634,6 +684,229 @@ class EsolveUserAccountResult extends EsolveResponseResult {
|
|
|
634
684
|
}
|
|
635
685
|
}
|
|
636
686
|
|
|
687
|
+
class EsolveStockLocation {
|
|
688
|
+
constructor(record) {
|
|
689
|
+
this.id = +record.id;
|
|
690
|
+
this.identifier = record.identifier;
|
|
691
|
+
this.description = record.description;
|
|
692
|
+
this.head_office = record.head_office;
|
|
693
|
+
this.erp_identifier = record.erp_identifier;
|
|
694
|
+
this.external_system_code = record.external_system_code;
|
|
695
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
696
|
+
this.userid = +record.userid;
|
|
697
|
+
this.importance = +record.importance;
|
|
698
|
+
this.active = record.is_active;
|
|
699
|
+
this.website_url = record.website_url;
|
|
700
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
701
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
702
|
+
const telnumbers = [];
|
|
703
|
+
if (record.branch_telnumber.length > 0) {
|
|
704
|
+
telnumbers.push(record.branch_telnumber);
|
|
705
|
+
}
|
|
706
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
707
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
708
|
+
}
|
|
709
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
710
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
711
|
+
}
|
|
712
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
713
|
+
this.trading_times = new EsolveStockLocationTradingTimes(new EsolveStockLocationTradingTimesDay(record.monday_open_time, record.monday_close_time), new EsolveStockLocationTradingTimesDay(record.tuesday_open_time, record.tuesday_close_time), new EsolveStockLocationTradingTimesDay(record.wednesday_open_time, record.wednesday_close_time), new EsolveStockLocationTradingTimesDay(record.thursday_open_time, record.thursday_close_time), new EsolveStockLocationTradingTimesDay(record.friday_open_time, record.friday_close_time), new EsolveStockLocationTradingTimesDay(record.saturday_open_time, record.saturday_close_time), new EsolveStockLocationTradingTimesDay(record.sunday_open_time, record.sunday_close_time), new EsolveStockLocationTradingTimesDay(record.public_holiday_open_time, record.public_holiday_close_time), record.trading_hours_additional_info);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
class EsolveStockLocationAddress {
|
|
717
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
718
|
+
this.street = street;
|
|
719
|
+
this.suburb = suburb;
|
|
720
|
+
this.city = city;
|
|
721
|
+
this.province = province;
|
|
722
|
+
this.country = country;
|
|
723
|
+
this.postal_code = postal_code;
|
|
724
|
+
this.latitude = latitude;
|
|
725
|
+
this.longitude = longitude;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
class EsolveStockLocationPOBoxAddress {
|
|
729
|
+
constructor(pobox, city, postal_code) {
|
|
730
|
+
this.pobox = pobox;
|
|
731
|
+
this.city = city;
|
|
732
|
+
this.postal_code = postal_code;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
class EsolveStockLocationContactInfo {
|
|
736
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
737
|
+
this.telnumber = telnumber;
|
|
738
|
+
this.cellnumber = cellnumber;
|
|
739
|
+
this.email = email;
|
|
740
|
+
this.fax = fax;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
class EsolveStockLocationTradingTimes {
|
|
744
|
+
constructor(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, trading_hours_additional_info = '') {
|
|
745
|
+
this.monday = monday;
|
|
746
|
+
this.tuesday = tuesday;
|
|
747
|
+
this.wednesday = wednesday;
|
|
748
|
+
this.thursday = thursday;
|
|
749
|
+
this.friday = friday;
|
|
750
|
+
this.saturday = saturday;
|
|
751
|
+
this.sunday = sunday;
|
|
752
|
+
this.public_holiday = public_holiday;
|
|
753
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
class EsolveStockLocationTradingTimesDay {
|
|
757
|
+
constructor(open, close) {
|
|
758
|
+
this.open = open;
|
|
759
|
+
this.close = close;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
class EsolveTransaction {
|
|
764
|
+
constructor(record) {
|
|
765
|
+
// Transaction Items
|
|
766
|
+
this.items = [];
|
|
767
|
+
this.id = +record.id;
|
|
768
|
+
this.type = record.transaction_type;
|
|
769
|
+
this.status = record.status;
|
|
770
|
+
this.loyalty_number = record.loyaltynumber;
|
|
771
|
+
this.external_order_number = record.external_order_number;
|
|
772
|
+
this.external_invoice_number = record.external_invoice_number;
|
|
773
|
+
this.date = new Date(+record.txdate_timestamp * 1000);
|
|
774
|
+
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
775
|
+
this.invoice_amount = +record.invoice_amount;
|
|
776
|
+
this.vat = +record.vat;
|
|
777
|
+
this.discount = +record.discount;
|
|
778
|
+
this.total = +record.total;
|
|
779
|
+
this.shipping_total = +record.shipping_total;
|
|
780
|
+
this.insurance_total = +record.insurance_total;
|
|
781
|
+
this.payment = +record.payment;
|
|
782
|
+
this.payment_reference = record.payment_reference;
|
|
783
|
+
this.payment_description = record.payment_description;
|
|
784
|
+
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
785
|
+
this.address = new EsolveTransactionAddress(record.recipient, record.address_type, record.address_description, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, record.pobox);
|
|
786
|
+
if (record.user) {
|
|
787
|
+
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
788
|
+
}
|
|
789
|
+
if (record.client) {
|
|
790
|
+
this.client = new EsolveTransactionClient(+record.client.id, record.client.account, record.client.company_name, record.client.branch_code, record.client.email, record.client.firstname, record.client.surname, record.client.contact_number);
|
|
791
|
+
}
|
|
792
|
+
if (record.location_details) {
|
|
793
|
+
this.location = new EsolveTransactionLocation(record.location_details);
|
|
794
|
+
}
|
|
795
|
+
if (record.payment_method_details) {
|
|
796
|
+
this.payment_method = new EsolveTransactionPaymentMethod(record.payment_method_details.id, record.payment_method_details.paymethod_name, record.payment_method_details.description, record.payment_method_details.integration_type, record.payment_method_details.service_provider);
|
|
797
|
+
}
|
|
798
|
+
if (record.shipping_method_details) {
|
|
799
|
+
this.shipping_method = new EsolveTransactionShippingMethod(+record.shipping_method_details.id, record.shipping_method_details.carrier_name, record.shipping_method_details.delivery_category, record.shipping_method_details.location, record.shipping_method_details.description, record.shipping_method_details.pricing, !!record.shipping_method_details.client_to_collect);
|
|
800
|
+
}
|
|
801
|
+
this.parseTransactionItems(record.transaction_items);
|
|
802
|
+
}
|
|
803
|
+
parseTransactionItems(record_items) {
|
|
804
|
+
for (const record_item of record_items) {
|
|
805
|
+
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
806
|
+
const line_total = new EsolveTransactionItemPrice(+record_item.line_total_exclusive, +record_item.line_total_inclusive, +record_item.line_total_exclusive_after_discount, +record_item.line_total_inclusive_after_discount);
|
|
807
|
+
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
808
|
+
this.items.push(item);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
class EsolveTransactionClient {
|
|
813
|
+
constructor(id, account, company_name, branch_code, email, first_name, last_name, contact_number) {
|
|
814
|
+
this.id = id;
|
|
815
|
+
this.account = account;
|
|
816
|
+
this.company_name = company_name;
|
|
817
|
+
this.branch_code = branch_code;
|
|
818
|
+
this.email = email;
|
|
819
|
+
this.first_name = first_name;
|
|
820
|
+
this.last_name = last_name;
|
|
821
|
+
this.contact_number = contact_number;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
class EsolveTransactionUser {
|
|
825
|
+
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
826
|
+
this.id = id;
|
|
827
|
+
this.email = email;
|
|
828
|
+
this.first_name = first_name;
|
|
829
|
+
this.last_name = last_name;
|
|
830
|
+
this.tel_number = tel_number;
|
|
831
|
+
this.cell_number = cell_number;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
class EsolveTransactionLocation extends EsolveStockLocation {
|
|
835
|
+
}
|
|
836
|
+
class EsolveTransactionPaymentMethod {
|
|
837
|
+
constructor(id, name, description, integration_type, service_provider) {
|
|
838
|
+
this.id = id;
|
|
839
|
+
this.name = name;
|
|
840
|
+
this.description = description;
|
|
841
|
+
this.integration_type = integration_type;
|
|
842
|
+
this.service_provider = service_provider;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
class EsolveTransactionShippingMethod {
|
|
846
|
+
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
847
|
+
this.id = id;
|
|
848
|
+
this.name = name;
|
|
849
|
+
this.delivery_category = delivery_category;
|
|
850
|
+
this.location = location;
|
|
851
|
+
this.description = description;
|
|
852
|
+
this.pricing = pricing;
|
|
853
|
+
this.client_to_collect = client_to_collect;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
class EsolveTransactionAddress {
|
|
857
|
+
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
858
|
+
this.recipient = recipient;
|
|
859
|
+
this.address_type = address_type;
|
|
860
|
+
this.address_description = address_description;
|
|
861
|
+
this.street_number = street_number;
|
|
862
|
+
this.street = street;
|
|
863
|
+
this.suburb = suburb;
|
|
864
|
+
this.city = city;
|
|
865
|
+
this.province = province;
|
|
866
|
+
this.country = country;
|
|
867
|
+
this.postal_code = postal_code;
|
|
868
|
+
this.pobox = pobox;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
class EsolveTransactionItem {
|
|
872
|
+
constructor(code, name, qty, discount, vat_rate, price, line_total) {
|
|
873
|
+
this.code = code;
|
|
874
|
+
this.name = name;
|
|
875
|
+
this.qty = qty;
|
|
876
|
+
this.discount = discount;
|
|
877
|
+
this.vat_rate = vat_rate;
|
|
878
|
+
this.price = price;
|
|
879
|
+
this.line_total = line_total;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
class EsolveTransactionItemPrice {
|
|
883
|
+
constructor(
|
|
884
|
+
/**
|
|
885
|
+
* Price without tax
|
|
886
|
+
*/
|
|
887
|
+
price,
|
|
888
|
+
/**
|
|
889
|
+
* Price with tax
|
|
890
|
+
*/
|
|
891
|
+
price_with_tax,
|
|
892
|
+
/**
|
|
893
|
+
* Price without tax and with discounts applied if appilcable
|
|
894
|
+
*/
|
|
895
|
+
price_discounted,
|
|
896
|
+
/**
|
|
897
|
+
* Price with tax and with discounts applied if appilcable
|
|
898
|
+
*/
|
|
899
|
+
price_with_tax_discounted) {
|
|
900
|
+
this.price = price;
|
|
901
|
+
this.price_with_tax = price_with_tax;
|
|
902
|
+
this.price_discounted = price_discounted;
|
|
903
|
+
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
class EsolveTransactionList extends EsolveList {
|
|
908
|
+
}
|
|
909
|
+
|
|
637
910
|
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
638
911
|
constructor(response) {
|
|
639
912
|
super(response);
|
|
@@ -644,6 +917,23 @@ class EsolveRegistrationResult extends EsolveResponseResult {
|
|
|
644
917
|
}
|
|
645
918
|
}
|
|
646
919
|
|
|
920
|
+
class EsolveChangePasswordResult extends EsolveResponseResult {
|
|
921
|
+
constructor(response) {
|
|
922
|
+
super(response);
|
|
923
|
+
this.password_updated = (response.status.state === 'success');
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
class EsolveResetPasswordResult extends EsolveResponseResult {
|
|
928
|
+
constructor(response) {
|
|
929
|
+
super(response);
|
|
930
|
+
this.id = response.esolve_id;
|
|
931
|
+
this.reset_success = response.reset_success;
|
|
932
|
+
this.password_matches_old = response.password_matches_old;
|
|
933
|
+
this.login_required = response.login_required;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
647
937
|
class EsolveAccountService {
|
|
648
938
|
constructor(config, http, sessionService, errorHandler, responseHandler) {
|
|
649
939
|
this.config = config;
|
|
@@ -667,31 +957,6 @@ class EsolveAccountService {
|
|
|
667
957
|
this._user_id = value;
|
|
668
958
|
}
|
|
669
959
|
}
|
|
670
|
-
processUserAccount(record) {
|
|
671
|
-
if (!record) {
|
|
672
|
-
throw new Error('Invalid record');
|
|
673
|
-
}
|
|
674
|
-
if (+record.userid !== this._user_id) {
|
|
675
|
-
throw new Error('Invalid user account retrieved');
|
|
676
|
-
}
|
|
677
|
-
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
678
|
-
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
679
|
-
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
680
|
-
return user_account;
|
|
681
|
-
}
|
|
682
|
-
processUserAddress(records) {
|
|
683
|
-
const user_addresses = [];
|
|
684
|
-
if (!records || (this._user_id === 0)) {
|
|
685
|
-
return user_addresses;
|
|
686
|
-
}
|
|
687
|
-
for (const record of records) {
|
|
688
|
-
if (+record.userid !== this._user_id) {
|
|
689
|
-
continue;
|
|
690
|
-
}
|
|
691
|
-
user_addresses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
692
|
-
}
|
|
693
|
-
return user_addresses;
|
|
694
|
-
}
|
|
695
960
|
updateUserAccount(user_account_data) {
|
|
696
961
|
const body = {
|
|
697
962
|
account: user_account_data
|
|
@@ -741,19 +1006,41 @@ class EsolveAccountService {
|
|
|
741
1006
|
}));
|
|
742
1007
|
}
|
|
743
1008
|
getAddresses() {
|
|
744
|
-
|
|
745
|
-
|
|
1009
|
+
try {
|
|
1010
|
+
this.loginGuard();
|
|
1011
|
+
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
1012
|
+
params: {
|
|
1013
|
+
ws_id: this.config.wsid,
|
|
1014
|
+
user_id: this.user_id
|
|
1015
|
+
}
|
|
1016
|
+
}).pipe(map(response => {
|
|
1017
|
+
if (response.records === undefined) {
|
|
1018
|
+
throw response;
|
|
1019
|
+
}
|
|
1020
|
+
return this.processUserAddress(response.records);
|
|
1021
|
+
}));
|
|
1022
|
+
}
|
|
1023
|
+
catch (error) {
|
|
1024
|
+
return throwError(error);
|
|
746
1025
|
}
|
|
747
|
-
|
|
1026
|
+
}
|
|
1027
|
+
deleteAddress(id) {
|
|
1028
|
+
return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
|
|
748
1029
|
params: {
|
|
749
1030
|
ws_id: this.config.wsid,
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
1031
|
+
id: id
|
|
1032
|
+
},
|
|
1033
|
+
responseType: 'json',
|
|
1034
|
+
observe: 'body'
|
|
1035
|
+
}).pipe(map(http_response => {
|
|
1036
|
+
if ((http_response.result === undefined) ||
|
|
1037
|
+
(http_response.result === null) ||
|
|
1038
|
+
(http_response.result.status !== 'success')) {
|
|
1039
|
+
throw http_response;
|
|
755
1040
|
}
|
|
756
|
-
return
|
|
1041
|
+
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
1042
|
+
}), catchError((errorRes) => {
|
|
1043
|
+
return this.errorHandler.handleHttpDeleteError('delete-address', errorRes);
|
|
757
1044
|
}));
|
|
758
1045
|
}
|
|
759
1046
|
register(user_registration) {
|
|
@@ -778,6 +1065,128 @@ class EsolveAccountService {
|
|
|
778
1065
|
return this.errorHandler.handleHttpPostError('set-registration', errorRes);
|
|
779
1066
|
}));
|
|
780
1067
|
}
|
|
1068
|
+
changePassword(password, confirm_password) {
|
|
1069
|
+
const body = {
|
|
1070
|
+
password,
|
|
1071
|
+
confirm_password
|
|
1072
|
+
};
|
|
1073
|
+
return this.http.post(`${this.config.api_url}/service/set-change-password.php`, body, {
|
|
1074
|
+
headers: {
|
|
1075
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1076
|
+
},
|
|
1077
|
+
params: {
|
|
1078
|
+
ws_id: this.config.wsid
|
|
1079
|
+
},
|
|
1080
|
+
responseType: 'json',
|
|
1081
|
+
observe: 'body'
|
|
1082
|
+
}).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
1083
|
+
return new EsolveChangePasswordResult(response);
|
|
1084
|
+
})), catchError((errorRes) => {
|
|
1085
|
+
return this.errorHandler.handleHttpPostError('set-change-password', errorRes);
|
|
1086
|
+
}));
|
|
1087
|
+
}
|
|
1088
|
+
sendForgotPasswordRequest(email) {
|
|
1089
|
+
return this.http.get(`${this.config.api_url}/service/get-forgot-password.php`, {
|
|
1090
|
+
params: {
|
|
1091
|
+
ws_id: this.config.wsid,
|
|
1092
|
+
email: email
|
|
1093
|
+
}
|
|
1094
|
+
}).pipe(map(response => {
|
|
1095
|
+
if ((response.records === undefined) ||
|
|
1096
|
+
!('reset_link_sent' in response.records)) {
|
|
1097
|
+
throw response;
|
|
1098
|
+
}
|
|
1099
|
+
return response.records.reset_link_sent;
|
|
1100
|
+
}));
|
|
1101
|
+
}
|
|
1102
|
+
resetPassword(reset_key, password, confirm_password, auto_login = true) {
|
|
1103
|
+
return this.http.post(`${this.config.api_url}/service/set-forgot-password.php`, {
|
|
1104
|
+
reset_key,
|
|
1105
|
+
password,
|
|
1106
|
+
confirm_password,
|
|
1107
|
+
auto_login
|
|
1108
|
+
}, {
|
|
1109
|
+
headers: {
|
|
1110
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
|
|
1111
|
+
},
|
|
1112
|
+
params: {
|
|
1113
|
+
ws_id: this.config.wsid
|
|
1114
|
+
},
|
|
1115
|
+
responseType: 'json',
|
|
1116
|
+
observe: 'body'
|
|
1117
|
+
}).pipe(map(http_response => this.responseHandler.validateSingleHttpResponse(http_response, (response) => {
|
|
1118
|
+
if (!response.login_required) {
|
|
1119
|
+
this.sessionService.handleUpdateSession(response.esolve_id);
|
|
1120
|
+
}
|
|
1121
|
+
return new EsolveResetPasswordResult(response);
|
|
1122
|
+
})), catchError((errorRes) => {
|
|
1123
|
+
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
1124
|
+
}));
|
|
1125
|
+
}
|
|
1126
|
+
getTranscations(options = {}) {
|
|
1127
|
+
try {
|
|
1128
|
+
this.loginGuard();
|
|
1129
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1130
|
+
params: {
|
|
1131
|
+
ws_id: this.config.wsid,
|
|
1132
|
+
user_id: this.user_id,
|
|
1133
|
+
...options,
|
|
1134
|
+
}
|
|
1135
|
+
}).pipe(map(response => {
|
|
1136
|
+
if (response.records === undefined) {
|
|
1137
|
+
throw response;
|
|
1138
|
+
}
|
|
1139
|
+
const items = this.processTransactions(response.records);
|
|
1140
|
+
const total = +response.additional_data.total_records ?? 0;
|
|
1141
|
+
const rows = options.rows ?? total;
|
|
1142
|
+
const page = options.page || 1;
|
|
1143
|
+
return new EsolveTransactionList(items, page, rows, total);
|
|
1144
|
+
}));
|
|
1145
|
+
}
|
|
1146
|
+
catch (error) {
|
|
1147
|
+
return throwError(error);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
processUserAccount(record) {
|
|
1151
|
+
if (!record) {
|
|
1152
|
+
throw new Error('Invalid record');
|
|
1153
|
+
}
|
|
1154
|
+
if (+record.userid !== this._user_id) {
|
|
1155
|
+
throw new Error('Invalid user account retrieved');
|
|
1156
|
+
}
|
|
1157
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
1158
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
1159
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
1160
|
+
return user_account;
|
|
1161
|
+
}
|
|
1162
|
+
processUserAddress(records) {
|
|
1163
|
+
const user_addresses = [];
|
|
1164
|
+
if (!records || (this._user_id === 0)) {
|
|
1165
|
+
return user_addresses;
|
|
1166
|
+
}
|
|
1167
|
+
for (const record of records) {
|
|
1168
|
+
if (+record.userid !== this._user_id) {
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
user_addresses.push(new EsolveAddress(+record.id, record.recipient, record.address_type, record.pobox, record.place_name, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude));
|
|
1172
|
+
}
|
|
1173
|
+
return user_addresses;
|
|
1174
|
+
}
|
|
1175
|
+
processTransactions(records) {
|
|
1176
|
+
const transactions = [];
|
|
1177
|
+
if (records) {
|
|
1178
|
+
for (const record of records) {
|
|
1179
|
+
const transaction = new EsolveTransaction(record);
|
|
1180
|
+
transactions.push(transaction);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
return transactions;
|
|
1184
|
+
}
|
|
1185
|
+
loginGuard() {
|
|
1186
|
+
if (this.user_id <= 0) {
|
|
1187
|
+
this.errorHandler.emitError('login_required', 'Login is required');
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
781
1190
|
}
|
|
782
1191
|
EsolveAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveSessionService }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
783
1192
|
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
@@ -829,29 +1238,6 @@ class EsolveMediaService {
|
|
|
829
1238
|
this.config = config;
|
|
830
1239
|
this.http = http;
|
|
831
1240
|
}
|
|
832
|
-
processMediaRecord(record) {
|
|
833
|
-
const tags = [];
|
|
834
|
-
const topics = [];
|
|
835
|
-
if ((record.tags) && (record.tags.length > 0)) {
|
|
836
|
-
for (const tag of record.tags) {
|
|
837
|
-
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
if ((record.topics) && (record.topics.length > 0)) {
|
|
841
|
-
for (const topic of record.topics) {
|
|
842
|
-
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Retrieves media records from eSolve instance.
|
|
849
|
-
* @param params Header params
|
|
850
|
-
*/
|
|
851
|
-
getMediaRecords(params) {
|
|
852
|
-
params = params.set('ws_id', this.config.wsid);
|
|
853
|
-
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
854
|
-
}
|
|
855
1241
|
/**
|
|
856
1242
|
* Retrieves the media record from the eSolve instance using the identifier.
|
|
857
1243
|
* @param identifier String representing the eSolve media indentifier
|
|
@@ -896,6 +1282,29 @@ class EsolveMediaService {
|
|
|
896
1282
|
return mediaArticles;
|
|
897
1283
|
}));
|
|
898
1284
|
}
|
|
1285
|
+
processMediaRecord(record) {
|
|
1286
|
+
const tags = [];
|
|
1287
|
+
const topics = [];
|
|
1288
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1289
|
+
for (const tag of record.tags) {
|
|
1290
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1294
|
+
for (const topic of record.topics) {
|
|
1295
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Retrieves media records from eSolve instance.
|
|
1302
|
+
* @param params Header params
|
|
1303
|
+
*/
|
|
1304
|
+
getMediaRecords(params) {
|
|
1305
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1306
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
1307
|
+
}
|
|
899
1308
|
}
|
|
900
1309
|
EsolveMediaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
901
1310
|
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
@@ -909,6 +1318,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
909
1318
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
910
1319
|
}] }, { type: i1$1.HttpClient }]; } });
|
|
911
1320
|
|
|
1321
|
+
class EsolveNewsGroup {
|
|
1322
|
+
constructor(id, name, description, sef_name) {
|
|
1323
|
+
this.id = id;
|
|
1324
|
+
this.name = name;
|
|
1325
|
+
this.description = description;
|
|
1326
|
+
this.sef_name = sef_name;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
|
|
912
1330
|
class EsolveNewsArticle {
|
|
913
1331
|
constructor(id, title, sef_title, article, short_description, txdate, active, image, featured, author, seo_title = '', seo_keywords = '') {
|
|
914
1332
|
this.id = id;
|
|
@@ -928,15 +1346,6 @@ class EsolveNewsArticle {
|
|
|
928
1346
|
}
|
|
929
1347
|
}
|
|
930
1348
|
|
|
931
|
-
class EsolveNewsGroup {
|
|
932
|
-
constructor(id, name, description, sef_name) {
|
|
933
|
-
this.id = id;
|
|
934
|
-
this.name = name;
|
|
935
|
-
this.description = description;
|
|
936
|
-
this.sef_name = sef_name;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
|
|
940
1349
|
class EsolveNewsArticleList {
|
|
941
1350
|
constructor(newsArticles, total, page) {
|
|
942
1351
|
this.newsArticles = newsArticles;
|
|
@@ -1104,6 +1513,31 @@ class EsolveBannerService {
|
|
|
1104
1513
|
this.config = config;
|
|
1105
1514
|
this.http = http;
|
|
1106
1515
|
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Retrieves banners records from eSolve instance
|
|
1518
|
+
*
|
|
1519
|
+
* @returns An observable of eSolve banners.
|
|
1520
|
+
*/
|
|
1521
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1522
|
+
let params = new HttpParams({
|
|
1523
|
+
fromObject: {
|
|
1524
|
+
ws_id: this.config.wsid,
|
|
1525
|
+
enable_date_filter
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
if (identifier) {
|
|
1529
|
+
params = params.set('identifier', identifier);
|
|
1530
|
+
}
|
|
1531
|
+
if (banner_display_container) {
|
|
1532
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1533
|
+
}
|
|
1534
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1535
|
+
if (response.records === undefined) {
|
|
1536
|
+
throw response;
|
|
1537
|
+
}
|
|
1538
|
+
return this.processBanners(response.records);
|
|
1539
|
+
}));
|
|
1540
|
+
}
|
|
1107
1541
|
processBannerImageHotspots(hotspot_records) {
|
|
1108
1542
|
const hotspots = [];
|
|
1109
1543
|
if (hotspot_records.length > 0) {
|
|
@@ -1156,31 +1590,6 @@ class EsolveBannerService {
|
|
|
1156
1590
|
}
|
|
1157
1591
|
return banners;
|
|
1158
1592
|
}
|
|
1159
|
-
/**
|
|
1160
|
-
* Retrieves banners records from eSolve instance
|
|
1161
|
-
*
|
|
1162
|
-
* @returns An observable of eSolve banners.
|
|
1163
|
-
*/
|
|
1164
|
-
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1165
|
-
let params = new HttpParams({
|
|
1166
|
-
fromObject: {
|
|
1167
|
-
ws_id: this.config.wsid,
|
|
1168
|
-
enable_date_filter
|
|
1169
|
-
}
|
|
1170
|
-
});
|
|
1171
|
-
if (identifier) {
|
|
1172
|
-
params = params.set('identifier', identifier);
|
|
1173
|
-
}
|
|
1174
|
-
if (banner_display_container) {
|
|
1175
|
-
params = params.set('banner_display_container', banner_display_container);
|
|
1176
|
-
}
|
|
1177
|
-
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1178
|
-
if (response.records === undefined) {
|
|
1179
|
-
throw response;
|
|
1180
|
-
}
|
|
1181
|
-
return this.processBanners(response.records);
|
|
1182
|
-
}));
|
|
1183
|
-
}
|
|
1184
1593
|
}
|
|
1185
1594
|
EsolveBannerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1186
1595
|
EsolveBannerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveBannerService, providedIn: 'root' });
|
|
@@ -1249,16 +1658,6 @@ class EsolveTopicService {
|
|
|
1249
1658
|
this.config = config;
|
|
1250
1659
|
this.http = http;
|
|
1251
1660
|
}
|
|
1252
|
-
processTopics(records) {
|
|
1253
|
-
const topics = [];
|
|
1254
|
-
if (records) {
|
|
1255
|
-
for (const record of records) {
|
|
1256
|
-
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1257
|
-
topics.push(topic);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
return topics;
|
|
1261
|
-
}
|
|
1262
1661
|
/**
|
|
1263
1662
|
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1264
1663
|
* topics will not be retrieved.
|
|
@@ -1281,6 +1680,16 @@ class EsolveTopicService {
|
|
|
1281
1680
|
return this.processTopics(response.records);
|
|
1282
1681
|
}));
|
|
1283
1682
|
}
|
|
1683
|
+
processTopics(records) {
|
|
1684
|
+
const topics = [];
|
|
1685
|
+
if (records) {
|
|
1686
|
+
for (const record of records) {
|
|
1687
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1688
|
+
topics.push(topic);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
return topics;
|
|
1692
|
+
}
|
|
1284
1693
|
}
|
|
1285
1694
|
EsolveTopicService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1286
1695
|
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
@@ -1575,6 +1984,9 @@ class EsolveStockService {
|
|
|
1575
1984
|
if (options.rows) {
|
|
1576
1985
|
params = params.set('rows', options.rows);
|
|
1577
1986
|
}
|
|
1987
|
+
if (options.search_phrase) {
|
|
1988
|
+
params = params.set('search_phrase', options.search_phrase);
|
|
1989
|
+
}
|
|
1578
1990
|
if (options.display_only) {
|
|
1579
1991
|
params = params.set('display_only', options.display_only);
|
|
1580
1992
|
}
|
|
@@ -1673,50 +2085,6 @@ class EsolveCategoryTreeService {
|
|
|
1673
2085
|
this.config = config;
|
|
1674
2086
|
this.http = http;
|
|
1675
2087
|
}
|
|
1676
|
-
/**
|
|
1677
|
-
* Processes the eSolve tree records and converts them into the correct format.
|
|
1678
|
-
* @param tree_records Records to process
|
|
1679
|
-
*/
|
|
1680
|
-
processTree(tree_records) {
|
|
1681
|
-
const tree_items = [];
|
|
1682
|
-
if (tree_records) {
|
|
1683
|
-
for (const tree_record of tree_records) {
|
|
1684
|
-
let esolve_id = '';
|
|
1685
|
-
let parent_id = '';
|
|
1686
|
-
let children = [];
|
|
1687
|
-
if (tree_record.type === 'category') {
|
|
1688
|
-
children = this.processTree(tree_record.children);
|
|
1689
|
-
esolve_id = tree_record.menu_id;
|
|
1690
|
-
parent_id = tree_record.owner_menu_id;
|
|
1691
|
-
}
|
|
1692
|
-
else {
|
|
1693
|
-
esolve_id = tree_record.id;
|
|
1694
|
-
parent_id = tree_record.menu_id;
|
|
1695
|
-
}
|
|
1696
|
-
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
return tree_items;
|
|
1700
|
-
}
|
|
1701
|
-
processTreeItem(record) {
|
|
1702
|
-
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1703
|
-
}
|
|
1704
|
-
processID(id) {
|
|
1705
|
-
let type;
|
|
1706
|
-
let esolve_id;
|
|
1707
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
1708
|
-
const match_results = id.match(type_code_regex);
|
|
1709
|
-
if (match_results) {
|
|
1710
|
-
const type_code = match_results[0];
|
|
1711
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
1712
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
1713
|
-
return {
|
|
1714
|
-
type,
|
|
1715
|
-
esolve_id
|
|
1716
|
-
};
|
|
1717
|
-
}
|
|
1718
|
-
return null;
|
|
1719
|
-
}
|
|
1720
2088
|
/**
|
|
1721
2089
|
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1722
2090
|
*/
|
|
@@ -1773,6 +2141,50 @@ class EsolveCategoryTreeService {
|
|
|
1773
2141
|
}
|
|
1774
2142
|
return throwError('Invalid options');
|
|
1775
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2146
|
+
* @param tree_records Records to process
|
|
2147
|
+
*/
|
|
2148
|
+
processTree(tree_records) {
|
|
2149
|
+
const tree_items = [];
|
|
2150
|
+
if (tree_records) {
|
|
2151
|
+
for (const tree_record of tree_records) {
|
|
2152
|
+
let esolve_id = '';
|
|
2153
|
+
let parent_id = '';
|
|
2154
|
+
let children = [];
|
|
2155
|
+
if (tree_record.type === 'category') {
|
|
2156
|
+
children = this.processTree(tree_record.children);
|
|
2157
|
+
esolve_id = tree_record.menu_id;
|
|
2158
|
+
parent_id = tree_record.owner_menu_id;
|
|
2159
|
+
}
|
|
2160
|
+
else {
|
|
2161
|
+
esolve_id = tree_record.id;
|
|
2162
|
+
parent_id = tree_record.menu_id;
|
|
2163
|
+
}
|
|
2164
|
+
tree_items.push(new EsolveCategoryTreeItem(tree_record.type, esolve_id, parent_id, tree_record.description, tree_record.sef_description, tree_record.seo_description, tree_record.sort_priority, tree_record.active, tree_record.display_only, tree_record.image, tree_record.seo_page_title, tree_record.seo_keywords, tree_record.short_description, children));
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
return tree_items;
|
|
2168
|
+
}
|
|
2169
|
+
processTreeItem(record) {
|
|
2170
|
+
return new EsolveCategoryTreeItem(record.type, record.id, record.parent_id, record.description, record.sef_description, record.short_description, record.sort_priority, record.active, record.display_only, '', record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
2171
|
+
}
|
|
2172
|
+
processID(id) {
|
|
2173
|
+
let type;
|
|
2174
|
+
let esolve_id;
|
|
2175
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2176
|
+
const match_results = id.match(type_code_regex);
|
|
2177
|
+
if (match_results) {
|
|
2178
|
+
const type_code = match_results[0];
|
|
2179
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2180
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2181
|
+
return {
|
|
2182
|
+
type,
|
|
2183
|
+
esolve_id
|
|
2184
|
+
};
|
|
2185
|
+
}
|
|
2186
|
+
return null;
|
|
2187
|
+
}
|
|
1776
2188
|
}
|
|
1777
2189
|
EsolveCategoryTreeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1778
2190
|
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
@@ -1786,6 +2198,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
1786
2198
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
1787
2199
|
}] }, { type: i1$1.HttpClient }]; } });
|
|
1788
2200
|
|
|
2201
|
+
class EsolveCheckoutResult extends EsolveResponseResult {
|
|
2202
|
+
constructor(response) {
|
|
2203
|
+
super(response);
|
|
2204
|
+
this.id = 0;
|
|
2205
|
+
this.id = +response.esolve_id;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
1789
2209
|
class EsolveCartItem {
|
|
1790
2210
|
constructor(id, stock_item, qty, type, price, discount, discount_interval, vat_rate, allow_quotes, allow_orders, must_collect, requested_assembly, price_incl, discount_price, discount_price_incl, discount_total, vat_total, total, total_incl) {
|
|
1791
2211
|
this.id = id;
|
|
@@ -1849,14 +2269,6 @@ class EsolveCartTotals {
|
|
|
1849
2269
|
}
|
|
1850
2270
|
}
|
|
1851
2271
|
|
|
1852
|
-
class EsolveCheckoutResult extends EsolveResponseResult {
|
|
1853
|
-
constructor(response) {
|
|
1854
|
-
super(response);
|
|
1855
|
-
this.id = 0;
|
|
1856
|
-
this.id = +response.esolve_id;
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
2272
|
class EsolveCartStockItem {
|
|
1861
2273
|
constructor(code, name, sef_name, description, active, items_in_pack, delivery_category, image_name) {
|
|
1862
2274
|
this.code = code;
|
|
@@ -1908,30 +2320,6 @@ class EsolveCartService {
|
|
|
1908
2320
|
this.responseHandler = responseHandler;
|
|
1909
2321
|
this._cached_tracking = 0;
|
|
1910
2322
|
}
|
|
1911
|
-
/**
|
|
1912
|
-
* Processes the eSolve tree records.
|
|
1913
|
-
* @param cart_item_records Records to process
|
|
1914
|
-
* @returns An array of processed cart items
|
|
1915
|
-
*/
|
|
1916
|
-
processCart(cart_item_records) {
|
|
1917
|
-
const cart_items = [];
|
|
1918
|
-
if (cart_item_records) {
|
|
1919
|
-
for (const cart_item_record of cart_item_records) {
|
|
1920
|
-
const cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, cart_item_record.image_name);
|
|
1921
|
-
cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
return cart_items;
|
|
1925
|
-
}
|
|
1926
|
-
/**
|
|
1927
|
-
* Processes the eSolve cart totals
|
|
1928
|
-
* @param record Data to process
|
|
1929
|
-
* @returns Processed cart totals
|
|
1930
|
-
*/
|
|
1931
|
-
processCartTotals(record) {
|
|
1932
|
-
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
1933
|
-
return cart_totals;
|
|
1934
|
-
}
|
|
1935
2323
|
/**
|
|
1936
2324
|
* Retrieves the current cart
|
|
1937
2325
|
* @returns An `Observable` with an array of cart items
|
|
@@ -2050,6 +2438,30 @@ class EsolveCartService {
|
|
|
2050
2438
|
}));
|
|
2051
2439
|
}));
|
|
2052
2440
|
}
|
|
2441
|
+
/**
|
|
2442
|
+
* Processes the eSolve tree records.
|
|
2443
|
+
* @param cart_item_records Records to process
|
|
2444
|
+
* @returns An array of processed cart items
|
|
2445
|
+
*/
|
|
2446
|
+
processCart(cart_item_records) {
|
|
2447
|
+
const cart_items = [];
|
|
2448
|
+
if (cart_item_records) {
|
|
2449
|
+
for (const cart_item_record of cart_item_records) {
|
|
2450
|
+
const cart_stock_item = new EsolveCartStockItem(cart_item_record.code, cart_item_record.name, cart_item_record.sef_name, cart_item_record.description, cart_item_record.is_active, +cart_item_record.items_in_pack, cart_item_record.delivery_category, cart_item_record.image_name);
|
|
2451
|
+
cart_items.push(new EsolveCartItem(+cart_item_record.id, cart_stock_item, +cart_item_record.qty, cart_item_record.type, +cart_item_record.price, +cart_item_record.discount, +cart_item_record.discount_interval, cart_item_record.vat_rate, cart_item_record.allow_quotes, cart_item_record.allow_orders, cart_item_record.must_collect, cart_item_record.requested_assembly, +cart_item_record.price_incl, +cart_item_record.discount_price, +cart_item_record.discount_price_incl, +cart_item_record.discount_total, +cart_item_record.vat_total, +cart_item_record.line_total, +cart_item_record.line_total_incl));
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
return cart_items;
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Processes the eSolve cart totals
|
|
2458
|
+
* @param record Data to process
|
|
2459
|
+
* @returns Processed cart totals
|
|
2460
|
+
*/
|
|
2461
|
+
processCartTotals(record) {
|
|
2462
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2463
|
+
return cart_totals;
|
|
2464
|
+
}
|
|
2053
2465
|
}
|
|
2054
2466
|
EsolveCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }, { token: EsolveErrorHandlerService }, { token: EsolveResponseHandlerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2055
2467
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
@@ -2131,12 +2543,8 @@ class EsolvePaymentMethod {
|
|
|
2131
2543
|
this.description = record.description;
|
|
2132
2544
|
this.display_banking_details = record.display_banking_details;
|
|
2133
2545
|
this.currency_code = record.currency_code;
|
|
2134
|
-
this.terminal_id = record.terminal_id;
|
|
2135
|
-
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2136
2546
|
this.merchant_id = record.merchant_id;
|
|
2137
2547
|
this.application_id = record.application_id;
|
|
2138
|
-
this.api_username = record.api_username;
|
|
2139
|
-
this.api_password = record.api_password;
|
|
2140
2548
|
this.api_signature = record.api_signature;
|
|
2141
2549
|
this.is_gateway = record.is_gateway;
|
|
2142
2550
|
this.must_store_card_details = record.must_store_card_details;
|
|
@@ -2287,6 +2695,25 @@ class EsolvePaymentService {
|
|
|
2287
2695
|
return this.errorHandler.handleHttpPostError('set-vault', errorRes);
|
|
2288
2696
|
}));
|
|
2289
2697
|
}
|
|
2698
|
+
deleteVaultItem(id) {
|
|
2699
|
+
return this.http.delete(`${this.config.api_url}/service/delete-vault.php`, {
|
|
2700
|
+
params: {
|
|
2701
|
+
ws_id: this.config.wsid,
|
|
2702
|
+
id: id
|
|
2703
|
+
},
|
|
2704
|
+
responseType: 'json',
|
|
2705
|
+
observe: 'body'
|
|
2706
|
+
}).pipe(map(http_response => {
|
|
2707
|
+
if ((http_response.result === undefined) ||
|
|
2708
|
+
(http_response.result === null) ||
|
|
2709
|
+
(http_response.result.status !== 'success')) {
|
|
2710
|
+
throw http_response;
|
|
2711
|
+
}
|
|
2712
|
+
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
2713
|
+
}), catchError((errorRes) => {
|
|
2714
|
+
return this.errorHandler.handleHttpDeleteError('delete-vault', errorRes);
|
|
2715
|
+
}));
|
|
2716
|
+
}
|
|
2290
2717
|
/**
|
|
2291
2718
|
* Sets the payment for the specified transaction using selected payment method.
|
|
2292
2719
|
* @param transaction_id eSolve ID to the transaction
|
|
@@ -2488,101 +2915,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2488
2915
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2489
2916
|
}] }, { type: i1$1.HttpClient }]; } });
|
|
2490
2917
|
|
|
2491
|
-
class EsolveStockLocation {
|
|
2492
|
-
constructor(record) {
|
|
2493
|
-
this.id = +record.id;
|
|
2494
|
-
this.identifier = record.identifier;
|
|
2495
|
-
this.description = record.description;
|
|
2496
|
-
this.head_office = record.head_office;
|
|
2497
|
-
this.erp_identifier = record.erp_identifier;
|
|
2498
|
-
this.external_system_code = record.external_system_code;
|
|
2499
|
-
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2500
|
-
this.userid = +record.userid;
|
|
2501
|
-
this.importance = +record.importance;
|
|
2502
|
-
this.active = record.is_active;
|
|
2503
|
-
this.website_url = record.website_url;
|
|
2504
|
-
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2505
|
-
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2506
|
-
const telnumbers = [];
|
|
2507
|
-
if (record.branch_telnumber.length > 0) {
|
|
2508
|
-
telnumbers.push(record.branch_telnumber);
|
|
2509
|
-
}
|
|
2510
|
-
if (record.branch_telnumber_2.length > 0) {
|
|
2511
|
-
telnumbers.push(record.branch_telnumber_2);
|
|
2512
|
-
}
|
|
2513
|
-
if (record.branch_telnumber_3.length > 0) {
|
|
2514
|
-
telnumbers.push(record.branch_telnumber_3);
|
|
2515
|
-
}
|
|
2516
|
-
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2517
|
-
this.trading_times = new EsolveStockLocationTradingTimes(record.monday_open_time, record.monday_close_time, record.tuesday_open_time, record.tuesday_close_time, record.wednesday_open_time, record.wednesday_close_time, record.thursday_open_time, record.thursday_close_time, record.friday_open_time, record.friday_close_time, record.saturday_open_time, record.saturday_close_time, record.sunday_open_time, record.sunday_close_time, record.public_holiday_open_time, record.public_holiday_close_time, record.trading_hours_additional_in);
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
class EsolveStockLocationAddress {
|
|
2521
|
-
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2522
|
-
this.street = street;
|
|
2523
|
-
this.suburb = suburb;
|
|
2524
|
-
this.city = city;
|
|
2525
|
-
this.province = province;
|
|
2526
|
-
this.country = country;
|
|
2527
|
-
this.postal_code = postal_code;
|
|
2528
|
-
this.latitude = latitude;
|
|
2529
|
-
this.longitude = longitude;
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
class EsolveStockLocationPOBoxAddress {
|
|
2533
|
-
constructor(pobox, city, postal_code) {
|
|
2534
|
-
this.pobox = pobox;
|
|
2535
|
-
this.city = city;
|
|
2536
|
-
this.postal_code = postal_code;
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
class EsolveStockLocationContactInfo {
|
|
2540
|
-
constructor(telnumber, cellnumber, email, fax) {
|
|
2541
|
-
this.telnumber = telnumber;
|
|
2542
|
-
this.cellnumber = cellnumber;
|
|
2543
|
-
this.email = email;
|
|
2544
|
-
this.fax = fax;
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
class EsolveStockLocationTradingTimes {
|
|
2548
|
-
constructor(monday_open_time, monday_close_time, tuesday_open_time, tuesday_close_time, wednesday_open_time, wednesday_close_time, thursday_open_time, thursday_close_time, friday_open_time, friday_close_time, saturday_open_time, saturday_close_time, sunday_open_time, sunday_close_time, public_holiday_open_time, public_holiday_close_time, trading_hours_additional_info = '') {
|
|
2549
|
-
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2550
|
-
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2551
|
-
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2552
|
-
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2553
|
-
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2554
|
-
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2555
|
-
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2556
|
-
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2557
|
-
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
class EsolveStockLocationTradingTimesDay {
|
|
2561
|
-
constructor(open, close) {
|
|
2562
|
-
this.open = open;
|
|
2563
|
-
this.close = close;
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
2918
|
class EsolveLocationsService {
|
|
2568
2919
|
constructor(config, http) {
|
|
2569
2920
|
this.config = config;
|
|
2570
2921
|
this.http = http;
|
|
2571
2922
|
}
|
|
2572
|
-
/**
|
|
2573
|
-
* Processes the eSolve stock location records.
|
|
2574
|
-
* @param records Records to process
|
|
2575
|
-
* @returns An array of processed stock location records
|
|
2576
|
-
*/
|
|
2577
|
-
processStockLocations(records) {
|
|
2578
|
-
const stock_locations = [];
|
|
2579
|
-
if (records) {
|
|
2580
|
-
for (const record of records) {
|
|
2581
|
-
stock_locations.push(new EsolveStockLocation(record));
|
|
2582
|
-
}
|
|
2583
|
-
}
|
|
2584
|
-
return stock_locations;
|
|
2585
|
-
}
|
|
2586
2923
|
/**
|
|
2587
2924
|
* Retrieves a list of stock locations
|
|
2588
2925
|
* @returns An `Observable` with an array of stock locations
|
|
@@ -2597,6 +2934,20 @@ class EsolveLocationsService {
|
|
|
2597
2934
|
return this.processStockLocations(response.records);
|
|
2598
2935
|
}));
|
|
2599
2936
|
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Processes the eSolve stock location records.
|
|
2939
|
+
* @param records Records to process
|
|
2940
|
+
* @returns An array of processed stock location records
|
|
2941
|
+
*/
|
|
2942
|
+
processStockLocations(records) {
|
|
2943
|
+
const stock_locations = [];
|
|
2944
|
+
if (records) {
|
|
2945
|
+
for (const record of records) {
|
|
2946
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
return stock_locations;
|
|
2950
|
+
}
|
|
2600
2951
|
}
|
|
2601
2952
|
EsolveLocationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, deps: [{ token: ESOLVE_CONNECT_CONFIG }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2602
2953
|
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
@@ -2618,5 +2969,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2618
2969
|
* Generated bundle index. Do not edit.
|
|
2619
2970
|
*/
|
|
2620
2971
|
|
|
2621
|
-
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
2972
|
+
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, EsolveList, EsolveLocationsService, EsolveMediaArticle, EsolveMediaService, EsolveMenuItem, EsolveMenuService, EsolveNewsArticle, EsolveNewsArticleAuthor, EsolveNewsArticleList, EsolveNewsGroup, EsolveNewsService, EsolvePaymentMethod, EsolvePaymentResult, EsolvePaymentService, EsolveRegistrationResult, EsolveResetPasswordResult, EsolveResponseHandlerService, EsolveResponseResult, EsolveResult, EsolveSEOInfo, EsolveSeoService, EsolveSession, EsolveSessionService, EsolveShippingCost, EsolveShippingMethod, EsolveShippingService, EsolveStockBadge, EsolveStockItem, EsolveStockItemList, EsolveStockLocation, EsolveStockLocationAddress, EsolveStockLocationContactInfo, EsolveStockLocationPOBoxAddress, EsolveStockLocationTradingTimes, EsolveStockLocationTradingTimesDay, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveTransaction, EsolveTransactionAddress, EsolveTransactionClient, EsolveTransactionItem, EsolveTransactionItemPrice, EsolveTransactionList, EsolveTransactionLocation, EsolveTransactionPaymentMethod, EsolveTransactionShippingMethod, EsolveTransactionUser, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
2622
2973
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|