@esolve/ng-esolve-connect 0.9.1 → 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 +84 -40
- 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/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 +484 -291
- package/fesm2015/esolve-ng-esolve-connect.mjs.map +1 -1
- package/fesm2020/esolve-ng-esolve-connect.mjs +486 -290
- package/fesm2020/esolve-ng-esolve-connect.mjs.map +1 -1
- package/lib/account/esolve-account.service.d.ts +9 -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`, {
|
|
@@ -920,6 +1132,67 @@ class EsolveAccountService {
|
|
|
920
1132
|
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
921
1133
|
}));
|
|
922
1134
|
}
|
|
1135
|
+
getTranscations(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
|
+
processUserAccount(record) {
|
|
1157
|
+
if (!record) {
|
|
1158
|
+
throw new Error('Invalid record');
|
|
1159
|
+
}
|
|
1160
|
+
if (+record.userid !== this._user_id) {
|
|
1161
|
+
throw new Error('Invalid user account retrieved');
|
|
1162
|
+
}
|
|
1163
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
1164
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
1165
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
1166
|
+
return user_account;
|
|
1167
|
+
}
|
|
1168
|
+
processUserAddress(records) {
|
|
1169
|
+
const user_addresses = [];
|
|
1170
|
+
if (!records || (this._user_id === 0)) {
|
|
1171
|
+
return user_addresses;
|
|
1172
|
+
}
|
|
1173
|
+
for (const record of records) {
|
|
1174
|
+
if (+record.userid !== this._user_id) {
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
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));
|
|
1178
|
+
}
|
|
1179
|
+
return user_addresses;
|
|
1180
|
+
}
|
|
1181
|
+
processTransactions(records) {
|
|
1182
|
+
const transactions = [];
|
|
1183
|
+
if (records) {
|
|
1184
|
+
for (const record of records) {
|
|
1185
|
+
const transaction = new EsolveTransaction(record);
|
|
1186
|
+
transactions.push(transaction);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
return transactions;
|
|
1190
|
+
}
|
|
1191
|
+
loginGuard() {
|
|
1192
|
+
if (this.user_id <= 0) {
|
|
1193
|
+
this.errorHandler.emitError('login_required', 'Login is required');
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
923
1196
|
}
|
|
924
1197
|
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
1198
|
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
@@ -973,29 +1246,6 @@ class EsolveMediaService {
|
|
|
973
1246
|
this.config = config;
|
|
974
1247
|
this.http = http;
|
|
975
1248
|
}
|
|
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
1249
|
/**
|
|
1000
1250
|
* Retrieves the media record from the eSolve instance using the identifier.
|
|
1001
1251
|
* @param identifier String representing the eSolve media indentifier
|
|
@@ -1040,6 +1290,29 @@ class EsolveMediaService {
|
|
|
1040
1290
|
return mediaArticles;
|
|
1041
1291
|
}));
|
|
1042
1292
|
}
|
|
1293
|
+
processMediaRecord(record) {
|
|
1294
|
+
const tags = [];
|
|
1295
|
+
const topics = [];
|
|
1296
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1297
|
+
for (const tag of record.tags) {
|
|
1298
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1302
|
+
for (const topic of record.topics) {
|
|
1303
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Retrieves media records from eSolve instance.
|
|
1310
|
+
* @param params Header params
|
|
1311
|
+
*/
|
|
1312
|
+
getMediaRecords(params) {
|
|
1313
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1314
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
1315
|
+
}
|
|
1043
1316
|
}
|
|
1044
1317
|
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
1318
|
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
@@ -1252,6 +1525,31 @@ class EsolveBannerService {
|
|
|
1252
1525
|
this.config = config;
|
|
1253
1526
|
this.http = http;
|
|
1254
1527
|
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Retrieves banners records from eSolve instance
|
|
1530
|
+
*
|
|
1531
|
+
* @returns An observable of eSolve banners.
|
|
1532
|
+
*/
|
|
1533
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1534
|
+
let params = new HttpParams({
|
|
1535
|
+
fromObject: {
|
|
1536
|
+
ws_id: this.config.wsid,
|
|
1537
|
+
enable_date_filter
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
if (identifier) {
|
|
1541
|
+
params = params.set('identifier', identifier);
|
|
1542
|
+
}
|
|
1543
|
+
if (banner_display_container) {
|
|
1544
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1545
|
+
}
|
|
1546
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1547
|
+
if (response.records === undefined) {
|
|
1548
|
+
throw response;
|
|
1549
|
+
}
|
|
1550
|
+
return this.processBanners(response.records);
|
|
1551
|
+
}));
|
|
1552
|
+
}
|
|
1255
1553
|
processBannerImageHotspots(hotspot_records) {
|
|
1256
1554
|
const hotspots = [];
|
|
1257
1555
|
if (hotspot_records.length > 0) {
|
|
@@ -1298,36 +1596,11 @@ class EsolveBannerService {
|
|
|
1298
1596
|
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1299
1597
|
url: record.link.url,
|
|
1300
1598
|
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;
|
|
1599
|
+
}, image_sets);
|
|
1600
|
+
banners.push(banner);
|
|
1328
1601
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1602
|
+
}
|
|
1603
|
+
return banners;
|
|
1331
1604
|
}
|
|
1332
1605
|
}
|
|
1333
1606
|
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 +1674,6 @@ class EsolveTopicService {
|
|
|
1401
1674
|
this.config = config;
|
|
1402
1675
|
this.http = http;
|
|
1403
1676
|
}
|
|
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
1677
|
/**
|
|
1415
1678
|
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1416
1679
|
* topics will not be retrieved.
|
|
@@ -1433,6 +1696,16 @@ class EsolveTopicService {
|
|
|
1433
1696
|
return this.processTopics(response.records);
|
|
1434
1697
|
}));
|
|
1435
1698
|
}
|
|
1699
|
+
processTopics(records) {
|
|
1700
|
+
const topics = [];
|
|
1701
|
+
if (records) {
|
|
1702
|
+
for (const record of records) {
|
|
1703
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1704
|
+
topics.push(topic);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
return topics;
|
|
1708
|
+
}
|
|
1436
1709
|
}
|
|
1437
1710
|
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
1711
|
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
@@ -1833,50 +2106,6 @@ class EsolveCategoryTreeService {
|
|
|
1833
2106
|
this.config = config;
|
|
1834
2107
|
this.http = http;
|
|
1835
2108
|
}
|
|
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
2109
|
/**
|
|
1881
2110
|
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1882
2111
|
*/
|
|
@@ -1933,6 +2162,50 @@ class EsolveCategoryTreeService {
|
|
|
1933
2162
|
}
|
|
1934
2163
|
return throwError('Invalid options');
|
|
1935
2164
|
}
|
|
2165
|
+
/**
|
|
2166
|
+
* Processes the eSolve tree records and converts them into the correct format.
|
|
2167
|
+
* @param tree_records Records to process
|
|
2168
|
+
*/
|
|
2169
|
+
processTree(tree_records) {
|
|
2170
|
+
const tree_items = [];
|
|
2171
|
+
if (tree_records) {
|
|
2172
|
+
for (const tree_record of tree_records) {
|
|
2173
|
+
let esolve_id = '';
|
|
2174
|
+
let parent_id = '';
|
|
2175
|
+
let children = [];
|
|
2176
|
+
if (tree_record.type === 'category') {
|
|
2177
|
+
children = this.processTree(tree_record.children);
|
|
2178
|
+
esolve_id = tree_record.menu_id;
|
|
2179
|
+
parent_id = tree_record.owner_menu_id;
|
|
2180
|
+
}
|
|
2181
|
+
else {
|
|
2182
|
+
esolve_id = tree_record.id;
|
|
2183
|
+
parent_id = tree_record.menu_id;
|
|
2184
|
+
}
|
|
2185
|
+
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));
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
return tree_items;
|
|
2189
|
+
}
|
|
2190
|
+
processTreeItem(record) {
|
|
2191
|
+
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);
|
|
2192
|
+
}
|
|
2193
|
+
processID(id) {
|
|
2194
|
+
let type;
|
|
2195
|
+
let esolve_id;
|
|
2196
|
+
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
2197
|
+
const match_results = id.match(type_code_regex);
|
|
2198
|
+
if (match_results) {
|
|
2199
|
+
const type_code = match_results[0];
|
|
2200
|
+
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
2201
|
+
esolve_id = id.replace(type_code_regex, '');
|
|
2202
|
+
return {
|
|
2203
|
+
type,
|
|
2204
|
+
esolve_id
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
return null;
|
|
2208
|
+
}
|
|
1936
2209
|
}
|
|
1937
2210
|
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
2211
|
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
@@ -2070,30 +2343,6 @@ class EsolveCartService {
|
|
|
2070
2343
|
this.responseHandler = responseHandler;
|
|
2071
2344
|
this._cached_tracking = 0;
|
|
2072
2345
|
}
|
|
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
2346
|
/**
|
|
2098
2347
|
* Retrieves the current cart
|
|
2099
2348
|
* @returns An `Observable` with an array of cart items
|
|
@@ -2212,6 +2461,30 @@ class EsolveCartService {
|
|
|
2212
2461
|
}));
|
|
2213
2462
|
}));
|
|
2214
2463
|
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Processes the eSolve tree records.
|
|
2466
|
+
* @param cart_item_records Records to process
|
|
2467
|
+
* @returns An array of processed cart items
|
|
2468
|
+
*/
|
|
2469
|
+
processCart(cart_item_records) {
|
|
2470
|
+
const cart_items = [];
|
|
2471
|
+
if (cart_item_records) {
|
|
2472
|
+
for (const cart_item_record of cart_item_records) {
|
|
2473
|
+
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);
|
|
2474
|
+
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));
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
return cart_items;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Processes the eSolve cart totals
|
|
2481
|
+
* @param record Data to process
|
|
2482
|
+
* @returns Processed cart totals
|
|
2483
|
+
*/
|
|
2484
|
+
processCartTotals(record) {
|
|
2485
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2486
|
+
return cart_totals;
|
|
2487
|
+
}
|
|
2215
2488
|
}
|
|
2216
2489
|
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
2490
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
@@ -2295,12 +2568,8 @@ class EsolvePaymentMethod {
|
|
|
2295
2568
|
this.description = record.description;
|
|
2296
2569
|
this.display_banking_details = record.display_banking_details;
|
|
2297
2570
|
this.currency_code = record.currency_code;
|
|
2298
|
-
this.terminal_id = record.terminal_id;
|
|
2299
|
-
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2300
2571
|
this.merchant_id = record.merchant_id;
|
|
2301
2572
|
this.application_id = record.application_id;
|
|
2302
|
-
this.api_username = record.api_username;
|
|
2303
|
-
this.api_password = record.api_password;
|
|
2304
2573
|
this.api_signature = record.api_signature;
|
|
2305
2574
|
this.is_gateway = record.is_gateway;
|
|
2306
2575
|
this.must_store_card_details = record.must_store_card_details;
|
|
@@ -2675,101 +2944,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2675
2944
|
}] }, { type: i1$1.HttpClient }];
|
|
2676
2945
|
} });
|
|
2677
2946
|
|
|
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
2947
|
class EsolveLocationsService {
|
|
2755
2948
|
constructor(config, http) {
|
|
2756
2949
|
this.config = config;
|
|
2757
2950
|
this.http = http;
|
|
2758
2951
|
}
|
|
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
2952
|
/**
|
|
2774
2953
|
* Retrieves a list of stock locations
|
|
2775
2954
|
* @returns An `Observable` with an array of stock locations
|
|
@@ -2784,6 +2963,20 @@ class EsolveLocationsService {
|
|
|
2784
2963
|
return this.processStockLocations(response.records);
|
|
2785
2964
|
}));
|
|
2786
2965
|
}
|
|
2966
|
+
/**
|
|
2967
|
+
* Processes the eSolve stock location records.
|
|
2968
|
+
* @param records Records to process
|
|
2969
|
+
* @returns An array of processed stock location records
|
|
2970
|
+
*/
|
|
2971
|
+
processStockLocations(records) {
|
|
2972
|
+
const stock_locations = [];
|
|
2973
|
+
if (records) {
|
|
2974
|
+
for (const record of records) {
|
|
2975
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
return stock_locations;
|
|
2979
|
+
}
|
|
2787
2980
|
}
|
|
2788
2981
|
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
2982
|
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
@@ -2807,5 +3000,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2807
3000
|
* Generated bundle index. Do not edit.
|
|
2808
3001
|
*/
|
|
2809
3002
|
|
|
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 };
|
|
3003
|
+
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
3004
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|