@esolve/ng-esolve-connect 0.9.0 → 0.10.2
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 +106 -41
- 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.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/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 +2 -2
- package/esm2020/lib/shared/error-handler/esolve-error-handler.service.mjs +5 -3
- package/esm2020/lib/shared/esolve-list.mjs +9 -0
- package/esm2020/lib/topics/esolve-topic.service.mjs +11 -11
- package/esm2020/public-api.mjs +6 -2
- package/fesm2015/esolve-ng-esolve-connect.mjs +507 -293
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +509 -292
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/account/esolve-account.service.d.ts +11 -4
- 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.service.d.ts +7 -7
- 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/payment/esolve-payment-method-record.d.ts +0 -4
- package/lib/payment/esolve-payment-method.d.ts +0 -4
- package/lib/shared/error-handler/esolve-error-handler.service.d.ts +1 -0
- package/lib/shared/esolve-list.d.ts +7 -0
- package/lib/topics/esolve-topic.service.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +5 -1
|
@@ -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
|
|
@@ -199,6 +199,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
199
199
|
}]
|
|
200
200
|
}] });
|
|
201
201
|
|
|
202
|
+
class EsolveList {
|
|
203
|
+
constructor(items = [], page = 0, rows = 0, total = 0) {
|
|
204
|
+
this.items = items;
|
|
205
|
+
this.page = page;
|
|
206
|
+
this.rows = rows;
|
|
207
|
+
this.total = total;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
202
211
|
class EsolveResult {
|
|
203
212
|
constructor(status, code, message) {
|
|
204
213
|
this.status = status;
|
|
@@ -217,6 +226,9 @@ class EsolveHttpError {
|
|
|
217
226
|
|
|
218
227
|
class EsolveErrorHandlerService {
|
|
219
228
|
constructor() { }
|
|
229
|
+
emitError(code, message) {
|
|
230
|
+
throw new EsolveHttpError('error', message, code);
|
|
231
|
+
}
|
|
220
232
|
handleHttpPostError(service_type, errorRes) {
|
|
221
233
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
222
234
|
!('service_type' in errorRes) &&
|
|
@@ -286,8 +298,7 @@ class EsolveErrorHandlerService {
|
|
|
286
298
|
return error;
|
|
287
299
|
}
|
|
288
300
|
parseDeleteError(result) {
|
|
289
|
-
|
|
290
|
-
return error;
|
|
301
|
+
return new EsolveHttpError('error', result.message, result.code);
|
|
291
302
|
}
|
|
292
303
|
}
|
|
293
304
|
EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -468,31 +479,6 @@ class EsolveAuthService {
|
|
|
468
479
|
this.errorHandler = errorHandler;
|
|
469
480
|
this.cookieService = cookieService;
|
|
470
481
|
}
|
|
471
|
-
checkAccessToken(session) {
|
|
472
|
-
var _a;
|
|
473
|
-
session = session || this.session.currentSession;
|
|
474
|
-
const token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
|
|
475
|
-
const params = new HttpParams({
|
|
476
|
-
fromObject: {
|
|
477
|
-
key: token,
|
|
478
|
-
ws_id: this.config.wsid
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
482
|
-
params,
|
|
483
|
-
headers: new HttpHeaders({
|
|
484
|
-
'Accept-Language': '*'
|
|
485
|
-
})
|
|
486
|
-
}).pipe(map(responseData => {
|
|
487
|
-
if ((responseData.type === 'error') ||
|
|
488
|
-
(responseData.type === 'exception') ||
|
|
489
|
-
(!responseData.additional_data.key_okay)) {
|
|
490
|
-
throw responseData;
|
|
491
|
-
}
|
|
492
|
-
responseData.additional_data.key = token;
|
|
493
|
-
return responseData;
|
|
494
|
-
})).toPromise();
|
|
495
|
-
}
|
|
496
482
|
getAccessToken(email, password, anonymous = false) {
|
|
497
483
|
let params = new HttpParams();
|
|
498
484
|
if (anonymous) {
|
|
@@ -568,6 +554,31 @@ class EsolveAuthService {
|
|
|
568
554
|
this.cookieService.delete('_ws_id');
|
|
569
555
|
return this.getAccessToken('', '', true).toPromise();
|
|
570
556
|
}
|
|
557
|
+
checkAccessToken(session) {
|
|
558
|
+
var _a;
|
|
559
|
+
session = session || this.session.currentSession;
|
|
560
|
+
const token = (_a = session === null || session === void 0 ? void 0 : session.key) !== null && _a !== void 0 ? _a : '';
|
|
561
|
+
const params = new HttpParams({
|
|
562
|
+
fromObject: {
|
|
563
|
+
key: token,
|
|
564
|
+
ws_id: this.config.wsid
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
568
|
+
params,
|
|
569
|
+
headers: new HttpHeaders({
|
|
570
|
+
'Accept-Language': '*'
|
|
571
|
+
})
|
|
572
|
+
}).pipe(map(responseData => {
|
|
573
|
+
if ((responseData.type === 'error') ||
|
|
574
|
+
(responseData.type === 'exception') ||
|
|
575
|
+
(!responseData.additional_data.key_okay)) {
|
|
576
|
+
throw responseData;
|
|
577
|
+
}
|
|
578
|
+
responseData.additional_data.key = token;
|
|
579
|
+
return responseData;
|
|
580
|
+
})).toPromise();
|
|
581
|
+
}
|
|
571
582
|
// Handlers
|
|
572
583
|
handleExpiration() {
|
|
573
584
|
return (session) => {
|
|
@@ -682,6 +693,229 @@ class EsolveUserAccountResult extends EsolveResponseResult {
|
|
|
682
693
|
}
|
|
683
694
|
}
|
|
684
695
|
|
|
696
|
+
class EsolveStockLocation {
|
|
697
|
+
constructor(record) {
|
|
698
|
+
this.id = +record.id;
|
|
699
|
+
this.identifier = record.identifier;
|
|
700
|
+
this.description = record.description;
|
|
701
|
+
this.head_office = record.head_office;
|
|
702
|
+
this.erp_identifier = record.erp_identifier;
|
|
703
|
+
this.external_system_code = record.external_system_code;
|
|
704
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
705
|
+
this.userid = +record.userid;
|
|
706
|
+
this.importance = +record.importance;
|
|
707
|
+
this.active = record.is_active;
|
|
708
|
+
this.website_url = record.website_url;
|
|
709
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
710
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
711
|
+
const telnumbers = [];
|
|
712
|
+
if (record.branch_telnumber.length > 0) {
|
|
713
|
+
telnumbers.push(record.branch_telnumber);
|
|
714
|
+
}
|
|
715
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
716
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
717
|
+
}
|
|
718
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
719
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
720
|
+
}
|
|
721
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
722
|
+
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);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
class EsolveStockLocationAddress {
|
|
726
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
727
|
+
this.street = street;
|
|
728
|
+
this.suburb = suburb;
|
|
729
|
+
this.city = city;
|
|
730
|
+
this.province = province;
|
|
731
|
+
this.country = country;
|
|
732
|
+
this.postal_code = postal_code;
|
|
733
|
+
this.latitude = latitude;
|
|
734
|
+
this.longitude = longitude;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
class EsolveStockLocationPOBoxAddress {
|
|
738
|
+
constructor(pobox, city, postal_code) {
|
|
739
|
+
this.pobox = pobox;
|
|
740
|
+
this.city = city;
|
|
741
|
+
this.postal_code = postal_code;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
class EsolveStockLocationContactInfo {
|
|
745
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
746
|
+
this.telnumber = telnumber;
|
|
747
|
+
this.cellnumber = cellnumber;
|
|
748
|
+
this.email = email;
|
|
749
|
+
this.fax = fax;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
class EsolveStockLocationTradingTimes {
|
|
753
|
+
constructor(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, trading_hours_additional_info = '') {
|
|
754
|
+
this.monday = monday;
|
|
755
|
+
this.tuesday = tuesday;
|
|
756
|
+
this.wednesday = wednesday;
|
|
757
|
+
this.thursday = thursday;
|
|
758
|
+
this.friday = friday;
|
|
759
|
+
this.saturday = saturday;
|
|
760
|
+
this.sunday = sunday;
|
|
761
|
+
this.public_holiday = public_holiday;
|
|
762
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
class EsolveStockLocationTradingTimesDay {
|
|
766
|
+
constructor(open, close) {
|
|
767
|
+
this.open = open;
|
|
768
|
+
this.close = close;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
class EsolveTransaction {
|
|
773
|
+
constructor(record) {
|
|
774
|
+
// Transaction Items
|
|
775
|
+
this.items = [];
|
|
776
|
+
this.id = +record.id;
|
|
777
|
+
this.type = record.transaction_type;
|
|
778
|
+
this.status = record.status;
|
|
779
|
+
this.loyalty_number = record.loyaltynumber;
|
|
780
|
+
this.external_order_number = record.external_order_number;
|
|
781
|
+
this.external_invoice_number = record.external_invoice_number;
|
|
782
|
+
this.date = new Date(+record.txdate_timestamp * 1000);
|
|
783
|
+
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
784
|
+
this.invoice_amount = +record.invoice_amount;
|
|
785
|
+
this.vat = +record.vat;
|
|
786
|
+
this.discount = +record.discount;
|
|
787
|
+
this.total = +record.total;
|
|
788
|
+
this.shipping_total = +record.shipping_total;
|
|
789
|
+
this.insurance_total = +record.insurance_total;
|
|
790
|
+
this.payment = +record.payment;
|
|
791
|
+
this.payment_reference = record.payment_reference;
|
|
792
|
+
this.payment_description = record.payment_description;
|
|
793
|
+
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
794
|
+
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);
|
|
795
|
+
if (record.user) {
|
|
796
|
+
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
797
|
+
}
|
|
798
|
+
if (record.client) {
|
|
799
|
+
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);
|
|
800
|
+
}
|
|
801
|
+
if (record.location_details) {
|
|
802
|
+
this.location = new EsolveTransactionLocation(record.location_details);
|
|
803
|
+
}
|
|
804
|
+
if (record.payment_method_details) {
|
|
805
|
+
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);
|
|
806
|
+
}
|
|
807
|
+
if (record.shipping_method_details) {
|
|
808
|
+
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);
|
|
809
|
+
}
|
|
810
|
+
this.parseTransactionItems(record.transaction_items);
|
|
811
|
+
}
|
|
812
|
+
parseTransactionItems(record_items) {
|
|
813
|
+
for (const record_item of record_items) {
|
|
814
|
+
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
815
|
+
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);
|
|
816
|
+
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
817
|
+
this.items.push(item);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
class EsolveTransactionClient {
|
|
822
|
+
constructor(id, account, company_name, branch_code, email, first_name, last_name, contact_number) {
|
|
823
|
+
this.id = id;
|
|
824
|
+
this.account = account;
|
|
825
|
+
this.company_name = company_name;
|
|
826
|
+
this.branch_code = branch_code;
|
|
827
|
+
this.email = email;
|
|
828
|
+
this.first_name = first_name;
|
|
829
|
+
this.last_name = last_name;
|
|
830
|
+
this.contact_number = contact_number;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
class EsolveTransactionUser {
|
|
834
|
+
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
835
|
+
this.id = id;
|
|
836
|
+
this.email = email;
|
|
837
|
+
this.first_name = first_name;
|
|
838
|
+
this.last_name = last_name;
|
|
839
|
+
this.tel_number = tel_number;
|
|
840
|
+
this.cell_number = cell_number;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
class EsolveTransactionLocation extends EsolveStockLocation {
|
|
844
|
+
}
|
|
845
|
+
class EsolveTransactionPaymentMethod {
|
|
846
|
+
constructor(id, name, description, integration_type, service_provider) {
|
|
847
|
+
this.id = id;
|
|
848
|
+
this.name = name;
|
|
849
|
+
this.description = description;
|
|
850
|
+
this.integration_type = integration_type;
|
|
851
|
+
this.service_provider = service_provider;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
class EsolveTransactionShippingMethod {
|
|
855
|
+
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
856
|
+
this.id = id;
|
|
857
|
+
this.name = name;
|
|
858
|
+
this.delivery_category = delivery_category;
|
|
859
|
+
this.location = location;
|
|
860
|
+
this.description = description;
|
|
861
|
+
this.pricing = pricing;
|
|
862
|
+
this.client_to_collect = client_to_collect;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
class EsolveTransactionAddress {
|
|
866
|
+
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
867
|
+
this.recipient = recipient;
|
|
868
|
+
this.address_type = address_type;
|
|
869
|
+
this.address_description = address_description;
|
|
870
|
+
this.street_number = street_number;
|
|
871
|
+
this.street = street;
|
|
872
|
+
this.suburb = suburb;
|
|
873
|
+
this.city = city;
|
|
874
|
+
this.province = province;
|
|
875
|
+
this.country = country;
|
|
876
|
+
this.postal_code = postal_code;
|
|
877
|
+
this.pobox = pobox;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
class EsolveTransactionItem {
|
|
881
|
+
constructor(code, name, qty, discount, vat_rate, price, line_total) {
|
|
882
|
+
this.code = code;
|
|
883
|
+
this.name = name;
|
|
884
|
+
this.qty = qty;
|
|
885
|
+
this.discount = discount;
|
|
886
|
+
this.vat_rate = vat_rate;
|
|
887
|
+
this.price = price;
|
|
888
|
+
this.line_total = line_total;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
class EsolveTransactionItemPrice {
|
|
892
|
+
constructor(
|
|
893
|
+
/**
|
|
894
|
+
* Price without tax
|
|
895
|
+
*/
|
|
896
|
+
price,
|
|
897
|
+
/**
|
|
898
|
+
* Price with tax
|
|
899
|
+
*/
|
|
900
|
+
price_with_tax,
|
|
901
|
+
/**
|
|
902
|
+
* Price without tax and with discounts applied if appilcable
|
|
903
|
+
*/
|
|
904
|
+
price_discounted,
|
|
905
|
+
/**
|
|
906
|
+
* Price with tax and with discounts applied if appilcable
|
|
907
|
+
*/
|
|
908
|
+
price_with_tax_discounted) {
|
|
909
|
+
this.price = price;
|
|
910
|
+
this.price_with_tax = price_with_tax;
|
|
911
|
+
this.price_discounted = price_discounted;
|
|
912
|
+
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
class EsolveTransactionList extends EsolveList {
|
|
917
|
+
}
|
|
918
|
+
|
|
685
919
|
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
686
920
|
constructor(response) {
|
|
687
921
|
super(response);
|
|
@@ -732,31 +966,6 @@ class EsolveAccountService {
|
|
|
732
966
|
this._user_id = value;
|
|
733
967
|
}
|
|
734
968
|
}
|
|
735
|
-
processUserAccount(record) {
|
|
736
|
-
if (!record) {
|
|
737
|
-
throw new Error('Invalid record');
|
|
738
|
-
}
|
|
739
|
-
if (+record.userid !== this._user_id) {
|
|
740
|
-
throw new Error('Invalid user account retrieved');
|
|
741
|
-
}
|
|
742
|
-
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
743
|
-
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
744
|
-
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
745
|
-
return user_account;
|
|
746
|
-
}
|
|
747
|
-
processUserAddress(records) {
|
|
748
|
-
const user_addresses = [];
|
|
749
|
-
if (!records || (this._user_id === 0)) {
|
|
750
|
-
return user_addresses;
|
|
751
|
-
}
|
|
752
|
-
for (const record of records) {
|
|
753
|
-
if (+record.userid !== this._user_id) {
|
|
754
|
-
continue;
|
|
755
|
-
}
|
|
756
|
-
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));
|
|
757
|
-
}
|
|
758
|
-
return user_addresses;
|
|
759
|
-
}
|
|
760
969
|
updateUserAccount(user_account_data) {
|
|
761
970
|
const body = {
|
|
762
971
|
account: user_account_data
|
|
@@ -806,20 +1015,23 @@ class EsolveAccountService {
|
|
|
806
1015
|
}));
|
|
807
1016
|
}
|
|
808
1017
|
getAddresses() {
|
|
809
|
-
|
|
810
|
-
|
|
1018
|
+
try {
|
|
1019
|
+
this.loginGuard();
|
|
1020
|
+
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
1021
|
+
params: {
|
|
1022
|
+
ws_id: this.config.wsid,
|
|
1023
|
+
user_id: this.user_id
|
|
1024
|
+
}
|
|
1025
|
+
}).pipe(map(response => {
|
|
1026
|
+
if (response.records === undefined) {
|
|
1027
|
+
throw response;
|
|
1028
|
+
}
|
|
1029
|
+
return this.processUserAddress(response.records);
|
|
1030
|
+
}));
|
|
1031
|
+
}
|
|
1032
|
+
catch (error) {
|
|
1033
|
+
return throwError(error);
|
|
811
1034
|
}
|
|
812
|
-
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
813
|
-
params: {
|
|
814
|
-
ws_id: this.config.wsid,
|
|
815
|
-
user_id: this.user_id
|
|
816
|
-
}
|
|
817
|
-
}).pipe(map(response => {
|
|
818
|
-
if (response.records === undefined) {
|
|
819
|
-
throw response;
|
|
820
|
-
}
|
|
821
|
-
return this.processUserAddress(response.records);
|
|
822
|
-
}));
|
|
823
1035
|
}
|
|
824
1036
|
deleteAddress(id) {
|
|
825
1037
|
return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
|
|
@@ -837,7 +1049,7 @@ class EsolveAccountService {
|
|
|
837
1049
|
}
|
|
838
1050
|
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
839
1051
|
}), catchError((errorRes) => {
|
|
840
|
-
return this.errorHandler.
|
|
1052
|
+
return this.errorHandler.handleHttpDeleteError('delete-address', errorRes);
|
|
841
1053
|
}));
|
|
842
1054
|
}
|
|
843
1055
|
register(user_registration) {
|
|
@@ -920,6 +1132,88 @@ class EsolveAccountService {
|
|
|
920
1132
|
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
921
1133
|
}));
|
|
922
1134
|
}
|
|
1135
|
+
getTransactions(options = {}) {
|
|
1136
|
+
try {
|
|
1137
|
+
this.loginGuard();
|
|
1138
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1139
|
+
params: Object.assign({ ws_id: this.config.wsid, user_id: this.user_id }, options)
|
|
1140
|
+
}).pipe(map(response => {
|
|
1141
|
+
var _a, _b;
|
|
1142
|
+
if (response.records === undefined) {
|
|
1143
|
+
throw response;
|
|
1144
|
+
}
|
|
1145
|
+
const items = this.processTransactions(response.records);
|
|
1146
|
+
const total = (_a = +response.additional_data.total_records) !== null && _a !== void 0 ? _a : 0;
|
|
1147
|
+
const rows = (_b = options.rows) !== null && _b !== void 0 ? _b : total;
|
|
1148
|
+
const page = options.page || 1;
|
|
1149
|
+
return new EsolveTransactionList(items, page, rows, total);
|
|
1150
|
+
}));
|
|
1151
|
+
}
|
|
1152
|
+
catch (error) {
|
|
1153
|
+
return throwError(error);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
getTransaction(id) {
|
|
1157
|
+
try {
|
|
1158
|
+
this.loginGuard();
|
|
1159
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1160
|
+
params: {
|
|
1161
|
+
ws_id: this.config.wsid,
|
|
1162
|
+
user_id: this.user_id,
|
|
1163
|
+
transaction_id: id,
|
|
1164
|
+
}
|
|
1165
|
+
}).pipe(map(response => {
|
|
1166
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1167
|
+
throw response;
|
|
1168
|
+
}
|
|
1169
|
+
const items = this.processTransactions(response.records);
|
|
1170
|
+
return items[0];
|
|
1171
|
+
}));
|
|
1172
|
+
}
|
|
1173
|
+
catch (error) {
|
|
1174
|
+
return throwError(error);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
processUserAccount(record) {
|
|
1178
|
+
if (!record) {
|
|
1179
|
+
throw new Error('Invalid record');
|
|
1180
|
+
}
|
|
1181
|
+
if (+record.userid !== this._user_id) {
|
|
1182
|
+
throw new Error('Invalid user account retrieved');
|
|
1183
|
+
}
|
|
1184
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
1185
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
1186
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
1187
|
+
return user_account;
|
|
1188
|
+
}
|
|
1189
|
+
processUserAddress(records) {
|
|
1190
|
+
const user_addresses = [];
|
|
1191
|
+
if (!records || (this._user_id === 0)) {
|
|
1192
|
+
return user_addresses;
|
|
1193
|
+
}
|
|
1194
|
+
for (const record of records) {
|
|
1195
|
+
if (+record.userid !== this._user_id) {
|
|
1196
|
+
continue;
|
|
1197
|
+
}
|
|
1198
|
+
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));
|
|
1199
|
+
}
|
|
1200
|
+
return user_addresses;
|
|
1201
|
+
}
|
|
1202
|
+
processTransactions(records) {
|
|
1203
|
+
const transactions = [];
|
|
1204
|
+
if (records) {
|
|
1205
|
+
for (const record of records) {
|
|
1206
|
+
const transaction = new EsolveTransaction(record);
|
|
1207
|
+
transactions.push(transaction);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return transactions;
|
|
1211
|
+
}
|
|
1212
|
+
loginGuard() {
|
|
1213
|
+
if (this.user_id <= 0) {
|
|
1214
|
+
this.errorHandler.emitError('login_required', 'Login is required');
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
923
1217
|
}
|
|
924
1218
|
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 });
|
|
925
1219
|
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
@@ -973,29 +1267,6 @@ class EsolveMediaService {
|
|
|
973
1267
|
this.config = config;
|
|
974
1268
|
this.http = http;
|
|
975
1269
|
}
|
|
976
|
-
processMediaRecord(record) {
|
|
977
|
-
const tags = [];
|
|
978
|
-
const topics = [];
|
|
979
|
-
if ((record.tags) && (record.tags.length > 0)) {
|
|
980
|
-
for (const tag of record.tags) {
|
|
981
|
-
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
if ((record.topics) && (record.topics.length > 0)) {
|
|
985
|
-
for (const topic of record.topics) {
|
|
986
|
-
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Retrieves media records from eSolve instance.
|
|
993
|
-
* @param params Header params
|
|
994
|
-
*/
|
|
995
|
-
getMediaRecords(params) {
|
|
996
|
-
params = params.set('ws_id', this.config.wsid);
|
|
997
|
-
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
998
|
-
}
|
|
999
1270
|
/**
|
|
1000
1271
|
* Retrieves the media record from the eSolve instance using the identifier.
|
|
1001
1272
|
* @param identifier String representing the eSolve media indentifier
|
|
@@ -1040,6 +1311,29 @@ class EsolveMediaService {
|
|
|
1040
1311
|
return mediaArticles;
|
|
1041
1312
|
}));
|
|
1042
1313
|
}
|
|
1314
|
+
processMediaRecord(record) {
|
|
1315
|
+
const tags = [];
|
|
1316
|
+
const topics = [];
|
|
1317
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1318
|
+
for (const tag of record.tags) {
|
|
1319
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1323
|
+
for (const topic of record.topics) {
|
|
1324
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Retrieves media records from eSolve instance.
|
|
1331
|
+
* @param params Header params
|
|
1332
|
+
*/
|
|
1333
|
+
getMediaRecords(params) {
|
|
1334
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1335
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
1336
|
+
}
|
|
1043
1337
|
}
|
|
1044
1338
|
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 });
|
|
1045
1339
|
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
@@ -1252,6 +1546,31 @@ class EsolveBannerService {
|
|
|
1252
1546
|
this.config = config;
|
|
1253
1547
|
this.http = http;
|
|
1254
1548
|
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Retrieves banners records from eSolve instance
|
|
1551
|
+
*
|
|
1552
|
+
* @returns An observable of eSolve banners.
|
|
1553
|
+
*/
|
|
1554
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1555
|
+
let params = new HttpParams({
|
|
1556
|
+
fromObject: {
|
|
1557
|
+
ws_id: this.config.wsid,
|
|
1558
|
+
enable_date_filter
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
if (identifier) {
|
|
1562
|
+
params = params.set('identifier', identifier);
|
|
1563
|
+
}
|
|
1564
|
+
if (banner_display_container) {
|
|
1565
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1566
|
+
}
|
|
1567
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1568
|
+
if (response.records === undefined) {
|
|
1569
|
+
throw response;
|
|
1570
|
+
}
|
|
1571
|
+
return this.processBanners(response.records);
|
|
1572
|
+
}));
|
|
1573
|
+
}
|
|
1255
1574
|
processBannerImageHotspots(hotspot_records) {
|
|
1256
1575
|
const hotspots = [];
|
|
1257
1576
|
if (hotspot_records.length > 0) {
|
|
@@ -1298,36 +1617,11 @@ class EsolveBannerService {
|
|
|
1298
1617
|
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1299
1618
|
url: record.link.url,
|
|
1300
1619
|
target: record.link.target
|
|
1301
|
-
}, image_sets);
|
|
1302
|
-
banners.push(banner);
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
return banners;
|
|
1306
|
-
}
|
|
1307
|
-
/**
|
|
1308
|
-
* Retrieves banners records from eSolve instance
|
|
1309
|
-
*
|
|
1310
|
-
* @returns An observable of eSolve banners.
|
|
1311
|
-
*/
|
|
1312
|
-
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1313
|
-
let params = new HttpParams({
|
|
1314
|
-
fromObject: {
|
|
1315
|
-
ws_id: this.config.wsid,
|
|
1316
|
-
enable_date_filter
|
|
1317
|
-
}
|
|
1318
|
-
});
|
|
1319
|
-
if (identifier) {
|
|
1320
|
-
params = params.set('identifier', identifier);
|
|
1321
|
-
}
|
|
1322
|
-
if (banner_display_container) {
|
|
1323
|
-
params = params.set('banner_display_container', banner_display_container);
|
|
1324
|
-
}
|
|
1325
|
-
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1326
|
-
if (response.records === undefined) {
|
|
1327
|
-
throw response;
|
|
1620
|
+
}, image_sets);
|
|
1621
|
+
banners.push(banner);
|
|
1328
1622
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1623
|
+
}
|
|
1624
|
+
return banners;
|
|
1331
1625
|
}
|
|
1332
1626
|
}
|
|
1333
1627
|
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 });
|
|
@@ -1401,16 +1695,6 @@ class EsolveTopicService {
|
|
|
1401
1695
|
this.config = config;
|
|
1402
1696
|
this.http = http;
|
|
1403
1697
|
}
|
|
1404
|
-
processTopics(records) {
|
|
1405
|
-
const topics = [];
|
|
1406
|
-
if (records) {
|
|
1407
|
-
for (const record of records) {
|
|
1408
|
-
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1409
|
-
topics.push(topic);
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
return topics;
|
|
1413
|
-
}
|
|
1414
1698
|
/**
|
|
1415
1699
|
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1416
1700
|
* topics will not be retrieved.
|
|
@@ -1433,6 +1717,16 @@ class EsolveTopicService {
|
|
|
1433
1717
|
return this.processTopics(response.records);
|
|
1434
1718
|
}));
|
|
1435
1719
|
}
|
|
1720
|
+
processTopics(records) {
|
|
1721
|
+
const topics = [];
|
|
1722
|
+
if (records) {
|
|
1723
|
+
for (const record of records) {
|
|
1724
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1725
|
+
topics.push(topic);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
return topics;
|
|
1729
|
+
}
|
|
1436
1730
|
}
|
|
1437
1731
|
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 });
|
|
1438
1732
|
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
@@ -1833,50 +2127,6 @@ class EsolveCategoryTreeService {
|
|
|
1833
2127
|
this.config = config;
|
|
1834
2128
|
this.http = http;
|
|
1835
2129
|
}
|
|
1836
|
-
/**
|
|
1837
|
-
* Processes the eSolve tree records and converts them into the correct format.
|
|
1838
|
-
* @param tree_records Records to process
|
|
1839
|
-
*/
|
|
1840
|
-
processTree(tree_records) {
|
|
1841
|
-
const tree_items = [];
|
|
1842
|
-
if (tree_records) {
|
|
1843
|
-
for (const tree_record of tree_records) {
|
|
1844
|
-
let esolve_id = '';
|
|
1845
|
-
let parent_id = '';
|
|
1846
|
-
let children = [];
|
|
1847
|
-
if (tree_record.type === 'category') {
|
|
1848
|
-
children = this.processTree(tree_record.children);
|
|
1849
|
-
esolve_id = tree_record.menu_id;
|
|
1850
|
-
parent_id = tree_record.owner_menu_id;
|
|
1851
|
-
}
|
|
1852
|
-
else {
|
|
1853
|
-
esolve_id = tree_record.id;
|
|
1854
|
-
parent_id = tree_record.menu_id;
|
|
1855
|
-
}
|
|
1856
|
-
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));
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
return tree_items;
|
|
1860
|
-
}
|
|
1861
|
-
processTreeItem(record) {
|
|
1862
|
-
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);
|
|
1863
|
-
}
|
|
1864
|
-
processID(id) {
|
|
1865
|
-
let type;
|
|
1866
|
-
let esolve_id;
|
|
1867
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
1868
|
-
const match_results = id.match(type_code_regex);
|
|
1869
|
-
if (match_results) {
|
|
1870
|
-
const type_code = match_results[0];
|
|
1871
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
1872
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
1873
|
-
return {
|
|
1874
|
-
type,
|
|
1875
|
-
esolve_id
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
return null;
|
|
1879
|
-
}
|
|
1880
2130
|
/**
|
|
1881
2131
|
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1882
2132
|
*/
|
|
@@ -1933,6 +2183,50 @@ class EsolveCategoryTreeService {
|
|
|
1933
2183
|
}
|
|
1934
2184
|
return throwError('Invalid options');
|
|
1935
2185
|
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2188
|
+
* @param tree_records Records to process
|
|
2189
|
+
*/
|
|
2190
|
+
processTree(tree_records) {
|
|
2191
|
+
const tree_items = [];
|
|
2192
|
+
if (tree_records) {
|
|
2193
|
+
for (const tree_record of tree_records) {
|
|
2194
|
+
let esolve_id = '';
|
|
2195
|
+
let parent_id = '';
|
|
2196
|
+
let children = [];
|
|
2197
|
+
if (tree_record.type === 'category') {
|
|
2198
|
+
children = this.processTree(tree_record.children);
|
|
2199
|
+
esolve_id = tree_record.menu_id;
|
|
2200
|
+
parent_id = tree_record.owner_menu_id;
|
|
2201
|
+
}
|
|
2202
|
+
else {
|
|
2203
|
+
esolve_id = tree_record.id;
|
|
2204
|
+
parent_id = tree_record.menu_id;
|
|
2205
|
+
}
|
|
2206
|
+
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));
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
return tree_items;
|
|
2210
|
+
}
|
|
2211
|
+
processTreeItem(record) {
|
|
2212
|
+
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);
|
|
2213
|
+
}
|
|
2214
|
+
processID(id) {
|
|
2215
|
+
let type;
|
|
2216
|
+
let esolve_id;
|
|
2217
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2218
|
+
const match_results = id.match(type_code_regex);
|
|
2219
|
+
if (match_results) {
|
|
2220
|
+
const type_code = match_results[0];
|
|
2221
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2222
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2223
|
+
return {
|
|
2224
|
+
type,
|
|
2225
|
+
esolve_id
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
return null;
|
|
2229
|
+
}
|
|
1936
2230
|
}
|
|
1937
2231
|
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 });
|
|
1938
2232
|
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
@@ -2070,30 +2364,6 @@ class EsolveCartService {
|
|
|
2070
2364
|
this.responseHandler = responseHandler;
|
|
2071
2365
|
this._cached_tracking = 0;
|
|
2072
2366
|
}
|
|
2073
|
-
/**
|
|
2074
|
-
* Processes the eSolve tree records.
|
|
2075
|
-
* @param cart_item_records Records to process
|
|
2076
|
-
* @returns An array of processed cart items
|
|
2077
|
-
*/
|
|
2078
|
-
processCart(cart_item_records) {
|
|
2079
|
-
const cart_items = [];
|
|
2080
|
-
if (cart_item_records) {
|
|
2081
|
-
for (const cart_item_record of cart_item_records) {
|
|
2082
|
-
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);
|
|
2083
|
-
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));
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
return cart_items;
|
|
2087
|
-
}
|
|
2088
|
-
/**
|
|
2089
|
-
* Processes the eSolve cart totals
|
|
2090
|
-
* @param record Data to process
|
|
2091
|
-
* @returns Processed cart totals
|
|
2092
|
-
*/
|
|
2093
|
-
processCartTotals(record) {
|
|
2094
|
-
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2095
|
-
return cart_totals;
|
|
2096
|
-
}
|
|
2097
2367
|
/**
|
|
2098
2368
|
* Retrieves the current cart
|
|
2099
2369
|
* @returns An `Observable` with an array of cart items
|
|
@@ -2212,6 +2482,30 @@ class EsolveCartService {
|
|
|
2212
2482
|
}));
|
|
2213
2483
|
}));
|
|
2214
2484
|
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Processes the eSolve tree records.
|
|
2487
|
+
* @param cart_item_records Records to process
|
|
2488
|
+
* @returns An array of processed cart items
|
|
2489
|
+
*/
|
|
2490
|
+
processCart(cart_item_records) {
|
|
2491
|
+
const cart_items = [];
|
|
2492
|
+
if (cart_item_records) {
|
|
2493
|
+
for (const cart_item_record of cart_item_records) {
|
|
2494
|
+
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);
|
|
2495
|
+
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));
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
return cart_items;
|
|
2499
|
+
}
|
|
2500
|
+
/**
|
|
2501
|
+
* Processes the eSolve cart totals
|
|
2502
|
+
* @param record Data to process
|
|
2503
|
+
* @returns Processed cart totals
|
|
2504
|
+
*/
|
|
2505
|
+
processCartTotals(record) {
|
|
2506
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2507
|
+
return cart_totals;
|
|
2508
|
+
}
|
|
2215
2509
|
}
|
|
2216
2510
|
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 });
|
|
2217
2511
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
@@ -2295,12 +2589,8 @@ class EsolvePaymentMethod {
|
|
|
2295
2589
|
this.description = record.description;
|
|
2296
2590
|
this.display_banking_details = record.display_banking_details;
|
|
2297
2591
|
this.currency_code = record.currency_code;
|
|
2298
|
-
this.terminal_id = record.terminal_id;
|
|
2299
|
-
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2300
2592
|
this.merchant_id = record.merchant_id;
|
|
2301
2593
|
this.application_id = record.application_id;
|
|
2302
|
-
this.api_username = record.api_username;
|
|
2303
|
-
this.api_password = record.api_password;
|
|
2304
2594
|
this.api_signature = record.api_signature;
|
|
2305
2595
|
this.is_gateway = record.is_gateway;
|
|
2306
2596
|
this.must_store_card_details = record.must_store_card_details;
|
|
@@ -2467,7 +2757,7 @@ class EsolvePaymentService {
|
|
|
2467
2757
|
}
|
|
2468
2758
|
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
2469
2759
|
}), catchError((errorRes) => {
|
|
2470
|
-
return this.errorHandler.
|
|
2760
|
+
return this.errorHandler.handleHttpDeleteError('delete-vault', errorRes);
|
|
2471
2761
|
}));
|
|
2472
2762
|
}
|
|
2473
2763
|
/**
|
|
@@ -2675,101 +2965,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2675
2965
|
}] }, { type: i1$1.HttpClient }];
|
|
2676
2966
|
} });
|
|
2677
2967
|
|
|
2678
|
-
class EsolveStockLocation {
|
|
2679
|
-
constructor(record) {
|
|
2680
|
-
this.id = +record.id;
|
|
2681
|
-
this.identifier = record.identifier;
|
|
2682
|
-
this.description = record.description;
|
|
2683
|
-
this.head_office = record.head_office;
|
|
2684
|
-
this.erp_identifier = record.erp_identifier;
|
|
2685
|
-
this.external_system_code = record.external_system_code;
|
|
2686
|
-
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2687
|
-
this.userid = +record.userid;
|
|
2688
|
-
this.importance = +record.importance;
|
|
2689
|
-
this.active = record.is_active;
|
|
2690
|
-
this.website_url = record.website_url;
|
|
2691
|
-
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2692
|
-
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2693
|
-
const telnumbers = [];
|
|
2694
|
-
if (record.branch_telnumber.length > 0) {
|
|
2695
|
-
telnumbers.push(record.branch_telnumber);
|
|
2696
|
-
}
|
|
2697
|
-
if (record.branch_telnumber_2.length > 0) {
|
|
2698
|
-
telnumbers.push(record.branch_telnumber_2);
|
|
2699
|
-
}
|
|
2700
|
-
if (record.branch_telnumber_3.length > 0) {
|
|
2701
|
-
telnumbers.push(record.branch_telnumber_3);
|
|
2702
|
-
}
|
|
2703
|
-
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2704
|
-
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);
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
class EsolveStockLocationAddress {
|
|
2708
|
-
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2709
|
-
this.street = street;
|
|
2710
|
-
this.suburb = suburb;
|
|
2711
|
-
this.city = city;
|
|
2712
|
-
this.province = province;
|
|
2713
|
-
this.country = country;
|
|
2714
|
-
this.postal_code = postal_code;
|
|
2715
|
-
this.latitude = latitude;
|
|
2716
|
-
this.longitude = longitude;
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
class EsolveStockLocationPOBoxAddress {
|
|
2720
|
-
constructor(pobox, city, postal_code) {
|
|
2721
|
-
this.pobox = pobox;
|
|
2722
|
-
this.city = city;
|
|
2723
|
-
this.postal_code = postal_code;
|
|
2724
|
-
}
|
|
2725
|
-
}
|
|
2726
|
-
class EsolveStockLocationContactInfo {
|
|
2727
|
-
constructor(telnumber, cellnumber, email, fax) {
|
|
2728
|
-
this.telnumber = telnumber;
|
|
2729
|
-
this.cellnumber = cellnumber;
|
|
2730
|
-
this.email = email;
|
|
2731
|
-
this.fax = fax;
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
class EsolveStockLocationTradingTimes {
|
|
2735
|
-
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 = '') {
|
|
2736
|
-
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2737
|
-
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2738
|
-
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2739
|
-
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2740
|
-
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2741
|
-
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2742
|
-
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2743
|
-
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2744
|
-
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
class EsolveStockLocationTradingTimesDay {
|
|
2748
|
-
constructor(open, close) {
|
|
2749
|
-
this.open = open;
|
|
2750
|
-
this.close = close;
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
2968
|
class EsolveLocationsService {
|
|
2755
2969
|
constructor(config, http) {
|
|
2756
2970
|
this.config = config;
|
|
2757
2971
|
this.http = http;
|
|
2758
2972
|
}
|
|
2759
|
-
/**
|
|
2760
|
-
* Processes the eSolve stock location records.
|
|
2761
|
-
* @param records Records to process
|
|
2762
|
-
* @returns An array of processed stock location records
|
|
2763
|
-
*/
|
|
2764
|
-
processStockLocations(records) {
|
|
2765
|
-
const stock_locations = [];
|
|
2766
|
-
if (records) {
|
|
2767
|
-
for (const record of records) {
|
|
2768
|
-
stock_locations.push(new EsolveStockLocation(record));
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
return stock_locations;
|
|
2772
|
-
}
|
|
2773
2973
|
/**
|
|
2774
2974
|
* Retrieves a list of stock locations
|
|
2775
2975
|
* @returns An `Observable` with an array of stock locations
|
|
@@ -2784,6 +2984,20 @@ class EsolveLocationsService {
|
|
|
2784
2984
|
return this.processStockLocations(response.records);
|
|
2785
2985
|
}));
|
|
2786
2986
|
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Processes the eSolve stock location records.
|
|
2989
|
+
* @param records Records to process
|
|
2990
|
+
* @returns An array of processed stock location records
|
|
2991
|
+
*/
|
|
2992
|
+
processStockLocations(records) {
|
|
2993
|
+
const stock_locations = [];
|
|
2994
|
+
if (records) {
|
|
2995
|
+
for (const record of records) {
|
|
2996
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
return stock_locations;
|
|
3000
|
+
}
|
|
2787
3001
|
}
|
|
2788
3002
|
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 });
|
|
2789
3003
|
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
@@ -2807,5 +3021,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2807
3021
|
* Generated bundle index. Do not edit.
|
|
2808
3022
|
*/
|
|
2809
3023
|
|
|
2810
|
-
export { EsolveAccountService, EsolveAddress, EsolveAddressResult, EsolveAuthService, EsolveBankingDetails, EsolveBanner, EsolveBannerImage, EsolveBannerImageHotspot, EsolveBannerService, EsolveCartItem, EsolveCartService, EsolveCartTotals, EsolveCategoryTreeItem, EsolveCategoryTreeService, EsolveChangePasswordResult, EsolveCheckoutResult, EsolveErrorHandlerService, EsolveHttpError, 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, EsolveStockPrice, EsolveStockService, EsolveTag, EsolveTopic, EsolveTopicService, EsolveUserAccount, EsolveUserAccountBusiness, EsolveUserAccountContact, EsolveUserAccountResult, EsolveVaultItem, EsolveVaultItemResult, NgEsolveConnectModule };
|
|
3024
|
+
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 };
|
|
2811
3025
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|