@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
|
|
@@ -195,6 +195,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
195
195
|
}]
|
|
196
196
|
}] });
|
|
197
197
|
|
|
198
|
+
class EsolveList {
|
|
199
|
+
constructor(items = [], page = 0, rows = 0, total = 0) {
|
|
200
|
+
this.items = items;
|
|
201
|
+
this.page = page;
|
|
202
|
+
this.rows = rows;
|
|
203
|
+
this.total = total;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
198
207
|
class EsolveResult {
|
|
199
208
|
constructor(status, code, message) {
|
|
200
209
|
this.status = status;
|
|
@@ -213,6 +222,9 @@ class EsolveHttpError {
|
|
|
213
222
|
|
|
214
223
|
class EsolveErrorHandlerService {
|
|
215
224
|
constructor() { }
|
|
225
|
+
emitError(code, message) {
|
|
226
|
+
throw new EsolveHttpError('error', message, code);
|
|
227
|
+
}
|
|
216
228
|
handleHttpPostError(service_type, errorRes) {
|
|
217
229
|
if (!(errorRes instanceof HttpErrorResponse) &&
|
|
218
230
|
!('service_type' in errorRes) &&
|
|
@@ -282,8 +294,7 @@ class EsolveErrorHandlerService {
|
|
|
282
294
|
return error;
|
|
283
295
|
}
|
|
284
296
|
parseDeleteError(result) {
|
|
285
|
-
|
|
286
|
-
return error;
|
|
297
|
+
return new EsolveHttpError('error', result.message, result.code);
|
|
287
298
|
}
|
|
288
299
|
}
|
|
289
300
|
EsolveErrorHandlerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveErrorHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -462,30 +473,6 @@ class EsolveAuthService {
|
|
|
462
473
|
this.errorHandler = errorHandler;
|
|
463
474
|
this.cookieService = cookieService;
|
|
464
475
|
}
|
|
465
|
-
checkAccessToken(session) {
|
|
466
|
-
session = session || this.session.currentSession;
|
|
467
|
-
const token = session?.key ?? '';
|
|
468
|
-
const params = new HttpParams({
|
|
469
|
-
fromObject: {
|
|
470
|
-
key: token,
|
|
471
|
-
ws_id: this.config.wsid
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
475
|
-
params,
|
|
476
|
-
headers: new HttpHeaders({
|
|
477
|
-
'Accept-Language': '*'
|
|
478
|
-
})
|
|
479
|
-
}).pipe(map(responseData => {
|
|
480
|
-
if ((responseData.type === 'error') ||
|
|
481
|
-
(responseData.type === 'exception') ||
|
|
482
|
-
(!responseData.additional_data.key_okay)) {
|
|
483
|
-
throw responseData;
|
|
484
|
-
}
|
|
485
|
-
responseData.additional_data.key = token;
|
|
486
|
-
return responseData;
|
|
487
|
-
})).toPromise();
|
|
488
|
-
}
|
|
489
476
|
getAccessToken(email, password, anonymous = false) {
|
|
490
477
|
let params = new HttpParams();
|
|
491
478
|
if (anonymous) {
|
|
@@ -561,6 +548,30 @@ class EsolveAuthService {
|
|
|
561
548
|
this.cookieService.delete('_ws_id');
|
|
562
549
|
return this.getAccessToken('', '', true).toPromise();
|
|
563
550
|
}
|
|
551
|
+
checkAccessToken(session) {
|
|
552
|
+
session = session || this.session.currentSession;
|
|
553
|
+
const token = session?.key ?? '';
|
|
554
|
+
const params = new HttpParams({
|
|
555
|
+
fromObject: {
|
|
556
|
+
key: token,
|
|
557
|
+
ws_id: this.config.wsid
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
return this.http.get(`${this.config.api_url}/service/get-access-token.php`, {
|
|
561
|
+
params,
|
|
562
|
+
headers: new HttpHeaders({
|
|
563
|
+
'Accept-Language': '*'
|
|
564
|
+
})
|
|
565
|
+
}).pipe(map(responseData => {
|
|
566
|
+
if ((responseData.type === 'error') ||
|
|
567
|
+
(responseData.type === 'exception') ||
|
|
568
|
+
(!responseData.additional_data.key_okay)) {
|
|
569
|
+
throw responseData;
|
|
570
|
+
}
|
|
571
|
+
responseData.additional_data.key = token;
|
|
572
|
+
return responseData;
|
|
573
|
+
})).toPromise();
|
|
574
|
+
}
|
|
564
575
|
// Handlers
|
|
565
576
|
handleExpiration() {
|
|
566
577
|
return (session) => {
|
|
@@ -673,6 +684,229 @@ class EsolveUserAccountResult extends EsolveResponseResult {
|
|
|
673
684
|
}
|
|
674
685
|
}
|
|
675
686
|
|
|
687
|
+
class EsolveStockLocation {
|
|
688
|
+
constructor(record) {
|
|
689
|
+
this.id = +record.id;
|
|
690
|
+
this.identifier = record.identifier;
|
|
691
|
+
this.description = record.description;
|
|
692
|
+
this.head_office = record.head_office;
|
|
693
|
+
this.erp_identifier = record.erp_identifier;
|
|
694
|
+
this.external_system_code = record.external_system_code;
|
|
695
|
+
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
696
|
+
this.userid = +record.userid;
|
|
697
|
+
this.importance = +record.importance;
|
|
698
|
+
this.active = record.is_active;
|
|
699
|
+
this.website_url = record.website_url;
|
|
700
|
+
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
701
|
+
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
702
|
+
const telnumbers = [];
|
|
703
|
+
if (record.branch_telnumber.length > 0) {
|
|
704
|
+
telnumbers.push(record.branch_telnumber);
|
|
705
|
+
}
|
|
706
|
+
if (record.branch_telnumber_2.length > 0) {
|
|
707
|
+
telnumbers.push(record.branch_telnumber_2);
|
|
708
|
+
}
|
|
709
|
+
if (record.branch_telnumber_3.length > 0) {
|
|
710
|
+
telnumbers.push(record.branch_telnumber_3);
|
|
711
|
+
}
|
|
712
|
+
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
713
|
+
this.trading_times = new EsolveStockLocationTradingTimes(new EsolveStockLocationTradingTimesDay(record.monday_open_time, record.monday_close_time), new EsolveStockLocationTradingTimesDay(record.tuesday_open_time, record.tuesday_close_time), new EsolveStockLocationTradingTimesDay(record.wednesday_open_time, record.wednesday_close_time), new EsolveStockLocationTradingTimesDay(record.thursday_open_time, record.thursday_close_time), new EsolveStockLocationTradingTimesDay(record.friday_open_time, record.friday_close_time), new EsolveStockLocationTradingTimesDay(record.saturday_open_time, record.saturday_close_time), new EsolveStockLocationTradingTimesDay(record.sunday_open_time, record.sunday_close_time), new EsolveStockLocationTradingTimesDay(record.public_holiday_open_time, record.public_holiday_close_time), record.trading_hours_additional_info);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
class EsolveStockLocationAddress {
|
|
717
|
+
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
718
|
+
this.street = street;
|
|
719
|
+
this.suburb = suburb;
|
|
720
|
+
this.city = city;
|
|
721
|
+
this.province = province;
|
|
722
|
+
this.country = country;
|
|
723
|
+
this.postal_code = postal_code;
|
|
724
|
+
this.latitude = latitude;
|
|
725
|
+
this.longitude = longitude;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
class EsolveStockLocationPOBoxAddress {
|
|
729
|
+
constructor(pobox, city, postal_code) {
|
|
730
|
+
this.pobox = pobox;
|
|
731
|
+
this.city = city;
|
|
732
|
+
this.postal_code = postal_code;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
class EsolveStockLocationContactInfo {
|
|
736
|
+
constructor(telnumber, cellnumber, email, fax) {
|
|
737
|
+
this.telnumber = telnumber;
|
|
738
|
+
this.cellnumber = cellnumber;
|
|
739
|
+
this.email = email;
|
|
740
|
+
this.fax = fax;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
class EsolveStockLocationTradingTimes {
|
|
744
|
+
constructor(monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_holiday, trading_hours_additional_info = '') {
|
|
745
|
+
this.monday = monday;
|
|
746
|
+
this.tuesday = tuesday;
|
|
747
|
+
this.wednesday = wednesday;
|
|
748
|
+
this.thursday = thursday;
|
|
749
|
+
this.friday = friday;
|
|
750
|
+
this.saturday = saturday;
|
|
751
|
+
this.sunday = sunday;
|
|
752
|
+
this.public_holiday = public_holiday;
|
|
753
|
+
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
class EsolveStockLocationTradingTimesDay {
|
|
757
|
+
constructor(open, close) {
|
|
758
|
+
this.open = open;
|
|
759
|
+
this.close = close;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
class EsolveTransaction {
|
|
764
|
+
constructor(record) {
|
|
765
|
+
// Transaction Items
|
|
766
|
+
this.items = [];
|
|
767
|
+
this.id = +record.id;
|
|
768
|
+
this.type = record.transaction_type;
|
|
769
|
+
this.status = record.status;
|
|
770
|
+
this.loyalty_number = record.loyaltynumber;
|
|
771
|
+
this.external_order_number = record.external_order_number;
|
|
772
|
+
this.external_invoice_number = record.external_invoice_number;
|
|
773
|
+
this.date = new Date(+record.txdate_timestamp * 1000);
|
|
774
|
+
this.expected_date = new Date(+record.expected_date_timestamp * 1000);
|
|
775
|
+
this.invoice_amount = +record.invoice_amount;
|
|
776
|
+
this.vat = +record.vat;
|
|
777
|
+
this.discount = +record.discount;
|
|
778
|
+
this.total = +record.total;
|
|
779
|
+
this.shipping_total = +record.shipping_total;
|
|
780
|
+
this.insurance_total = +record.insurance_total;
|
|
781
|
+
this.payment = +record.payment;
|
|
782
|
+
this.payment_reference = record.payment_reference;
|
|
783
|
+
this.payment_description = record.payment_description;
|
|
784
|
+
this.gateway_transaction_id = record.gateway_transaction_id;
|
|
785
|
+
this.address = new EsolveTransactionAddress(record.recipient, record.address_type, record.address_description, record.street_number, record.street, record.suburb, record.city, record.province, record.country, record.postal_code, record.pobox);
|
|
786
|
+
if (record.user) {
|
|
787
|
+
this.user = new EsolveTransactionUser(+record.user.id, record.user.email, record.user.firstname, record.user.surname, record.user.telnumber, record.user.cellnumber);
|
|
788
|
+
}
|
|
789
|
+
if (record.client) {
|
|
790
|
+
this.client = new EsolveTransactionClient(+record.client.id, record.client.account, record.client.company_name, record.client.branch_code, record.client.email, record.client.firstname, record.client.surname, record.client.contact_number);
|
|
791
|
+
}
|
|
792
|
+
if (record.location_details) {
|
|
793
|
+
this.location = new EsolveTransactionLocation(record.location_details);
|
|
794
|
+
}
|
|
795
|
+
if (record.payment_method_details) {
|
|
796
|
+
this.payment_method = new EsolveTransactionPaymentMethod(record.payment_method_details.id, record.payment_method_details.paymethod_name, record.payment_method_details.description, record.payment_method_details.integration_type, record.payment_method_details.service_provider);
|
|
797
|
+
}
|
|
798
|
+
if (record.shipping_method_details) {
|
|
799
|
+
this.shipping_method = new EsolveTransactionShippingMethod(+record.shipping_method_details.id, record.shipping_method_details.carrier_name, record.shipping_method_details.delivery_category, record.shipping_method_details.location, record.shipping_method_details.description, record.shipping_method_details.pricing, !!record.shipping_method_details.client_to_collect);
|
|
800
|
+
}
|
|
801
|
+
this.parseTransactionItems(record.transaction_items);
|
|
802
|
+
}
|
|
803
|
+
parseTransactionItems(record_items) {
|
|
804
|
+
for (const record_item of record_items) {
|
|
805
|
+
const price = new EsolveTransactionItemPrice(+record_item.price_exclusive, +record_item.price_inclusive, +record_item.price_exclusive_after_discount, +record_item.price_inclusive_after_discount);
|
|
806
|
+
const line_total = new EsolveTransactionItemPrice(+record_item.line_total_exclusive, +record_item.line_total_inclusive, +record_item.line_total_exclusive_after_discount, +record_item.line_total_inclusive_after_discount);
|
|
807
|
+
const item = new EsolveTransactionItem(record_item.code, record_item.name, +record_item.qty, +record_item.discount, +record_item.vat_rate, price, line_total);
|
|
808
|
+
this.items.push(item);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
class EsolveTransactionClient {
|
|
813
|
+
constructor(id, account, company_name, branch_code, email, first_name, last_name, contact_number) {
|
|
814
|
+
this.id = id;
|
|
815
|
+
this.account = account;
|
|
816
|
+
this.company_name = company_name;
|
|
817
|
+
this.branch_code = branch_code;
|
|
818
|
+
this.email = email;
|
|
819
|
+
this.first_name = first_name;
|
|
820
|
+
this.last_name = last_name;
|
|
821
|
+
this.contact_number = contact_number;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
class EsolveTransactionUser {
|
|
825
|
+
constructor(id, email, first_name, last_name, tel_number, cell_number) {
|
|
826
|
+
this.id = id;
|
|
827
|
+
this.email = email;
|
|
828
|
+
this.first_name = first_name;
|
|
829
|
+
this.last_name = last_name;
|
|
830
|
+
this.tel_number = tel_number;
|
|
831
|
+
this.cell_number = cell_number;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
class EsolveTransactionLocation extends EsolveStockLocation {
|
|
835
|
+
}
|
|
836
|
+
class EsolveTransactionPaymentMethod {
|
|
837
|
+
constructor(id, name, description, integration_type, service_provider) {
|
|
838
|
+
this.id = id;
|
|
839
|
+
this.name = name;
|
|
840
|
+
this.description = description;
|
|
841
|
+
this.integration_type = integration_type;
|
|
842
|
+
this.service_provider = service_provider;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
class EsolveTransactionShippingMethod {
|
|
846
|
+
constructor(id, name, delivery_category, location, description, pricing, client_to_collect) {
|
|
847
|
+
this.id = id;
|
|
848
|
+
this.name = name;
|
|
849
|
+
this.delivery_category = delivery_category;
|
|
850
|
+
this.location = location;
|
|
851
|
+
this.description = description;
|
|
852
|
+
this.pricing = pricing;
|
|
853
|
+
this.client_to_collect = client_to_collect;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
class EsolveTransactionAddress {
|
|
857
|
+
constructor(recipient, address_type, address_description, street_number, street, suburb, city, province, country, postal_code, pobox) {
|
|
858
|
+
this.recipient = recipient;
|
|
859
|
+
this.address_type = address_type;
|
|
860
|
+
this.address_description = address_description;
|
|
861
|
+
this.street_number = street_number;
|
|
862
|
+
this.street = street;
|
|
863
|
+
this.suburb = suburb;
|
|
864
|
+
this.city = city;
|
|
865
|
+
this.province = province;
|
|
866
|
+
this.country = country;
|
|
867
|
+
this.postal_code = postal_code;
|
|
868
|
+
this.pobox = pobox;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
class EsolveTransactionItem {
|
|
872
|
+
constructor(code, name, qty, discount, vat_rate, price, line_total) {
|
|
873
|
+
this.code = code;
|
|
874
|
+
this.name = name;
|
|
875
|
+
this.qty = qty;
|
|
876
|
+
this.discount = discount;
|
|
877
|
+
this.vat_rate = vat_rate;
|
|
878
|
+
this.price = price;
|
|
879
|
+
this.line_total = line_total;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
class EsolveTransactionItemPrice {
|
|
883
|
+
constructor(
|
|
884
|
+
/**
|
|
885
|
+
* Price without tax
|
|
886
|
+
*/
|
|
887
|
+
price,
|
|
888
|
+
/**
|
|
889
|
+
* Price with tax
|
|
890
|
+
*/
|
|
891
|
+
price_with_tax,
|
|
892
|
+
/**
|
|
893
|
+
* Price without tax and with discounts applied if appilcable
|
|
894
|
+
*/
|
|
895
|
+
price_discounted,
|
|
896
|
+
/**
|
|
897
|
+
* Price with tax and with discounts applied if appilcable
|
|
898
|
+
*/
|
|
899
|
+
price_with_tax_discounted) {
|
|
900
|
+
this.price = price;
|
|
901
|
+
this.price_with_tax = price_with_tax;
|
|
902
|
+
this.price_discounted = price_discounted;
|
|
903
|
+
this.price_with_tax_discounted = price_with_tax_discounted;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
class EsolveTransactionList extends EsolveList {
|
|
908
|
+
}
|
|
909
|
+
|
|
676
910
|
class EsolveRegistrationResult extends EsolveResponseResult {
|
|
677
911
|
constructor(response) {
|
|
678
912
|
super(response);
|
|
@@ -723,31 +957,6 @@ class EsolveAccountService {
|
|
|
723
957
|
this._user_id = value;
|
|
724
958
|
}
|
|
725
959
|
}
|
|
726
|
-
processUserAccount(record) {
|
|
727
|
-
if (!record) {
|
|
728
|
-
throw new Error('Invalid record');
|
|
729
|
-
}
|
|
730
|
-
if (+record.userid !== this._user_id) {
|
|
731
|
-
throw new Error('Invalid user account retrieved');
|
|
732
|
-
}
|
|
733
|
-
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
734
|
-
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
735
|
-
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
736
|
-
return user_account;
|
|
737
|
-
}
|
|
738
|
-
processUserAddress(records) {
|
|
739
|
-
const user_addresses = [];
|
|
740
|
-
if (!records || (this._user_id === 0)) {
|
|
741
|
-
return user_addresses;
|
|
742
|
-
}
|
|
743
|
-
for (const record of records) {
|
|
744
|
-
if (+record.userid !== this._user_id) {
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
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));
|
|
748
|
-
}
|
|
749
|
-
return user_addresses;
|
|
750
|
-
}
|
|
751
960
|
updateUserAccount(user_account_data) {
|
|
752
961
|
const body = {
|
|
753
962
|
account: user_account_data
|
|
@@ -797,20 +1006,23 @@ class EsolveAccountService {
|
|
|
797
1006
|
}));
|
|
798
1007
|
}
|
|
799
1008
|
getAddresses() {
|
|
800
|
-
|
|
801
|
-
|
|
1009
|
+
try {
|
|
1010
|
+
this.loginGuard();
|
|
1011
|
+
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
1012
|
+
params: {
|
|
1013
|
+
ws_id: this.config.wsid,
|
|
1014
|
+
user_id: this.user_id
|
|
1015
|
+
}
|
|
1016
|
+
}).pipe(map(response => {
|
|
1017
|
+
if (response.records === undefined) {
|
|
1018
|
+
throw response;
|
|
1019
|
+
}
|
|
1020
|
+
return this.processUserAddress(response.records);
|
|
1021
|
+
}));
|
|
1022
|
+
}
|
|
1023
|
+
catch (error) {
|
|
1024
|
+
return throwError(error);
|
|
802
1025
|
}
|
|
803
|
-
return this.http.get(`${this.config.api_url}/service/get-addresses.php`, {
|
|
804
|
-
params: {
|
|
805
|
-
ws_id: this.config.wsid,
|
|
806
|
-
user_id: this.user_id
|
|
807
|
-
}
|
|
808
|
-
}).pipe(map(response => {
|
|
809
|
-
if (response.records === undefined) {
|
|
810
|
-
throw response;
|
|
811
|
-
}
|
|
812
|
-
return this.processUserAddress(response.records);
|
|
813
|
-
}));
|
|
814
1026
|
}
|
|
815
1027
|
deleteAddress(id) {
|
|
816
1028
|
return this.http.delete(`${this.config.api_url}/service/delete-address.php`, {
|
|
@@ -828,7 +1040,7 @@ class EsolveAccountService {
|
|
|
828
1040
|
}
|
|
829
1041
|
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
830
1042
|
}), catchError((errorRes) => {
|
|
831
|
-
return this.errorHandler.
|
|
1043
|
+
return this.errorHandler.handleHttpDeleteError('delete-address', errorRes);
|
|
832
1044
|
}));
|
|
833
1045
|
}
|
|
834
1046
|
register(user_registration) {
|
|
@@ -911,6 +1123,91 @@ class EsolveAccountService {
|
|
|
911
1123
|
return this.errorHandler.handleHttpPostError('set-forgot-password', errorRes);
|
|
912
1124
|
}));
|
|
913
1125
|
}
|
|
1126
|
+
getTransactions(options = {}) {
|
|
1127
|
+
try {
|
|
1128
|
+
this.loginGuard();
|
|
1129
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1130
|
+
params: {
|
|
1131
|
+
ws_id: this.config.wsid,
|
|
1132
|
+
user_id: this.user_id,
|
|
1133
|
+
...options,
|
|
1134
|
+
}
|
|
1135
|
+
}).pipe(map(response => {
|
|
1136
|
+
if (response.records === undefined) {
|
|
1137
|
+
throw response;
|
|
1138
|
+
}
|
|
1139
|
+
const items = this.processTransactions(response.records);
|
|
1140
|
+
const total = +response.additional_data.total_records ?? 0;
|
|
1141
|
+
const rows = options.rows ?? total;
|
|
1142
|
+
const page = options.page || 1;
|
|
1143
|
+
return new EsolveTransactionList(items, page, rows, total);
|
|
1144
|
+
}));
|
|
1145
|
+
}
|
|
1146
|
+
catch (error) {
|
|
1147
|
+
return throwError(error);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
getTransaction(id) {
|
|
1151
|
+
try {
|
|
1152
|
+
this.loginGuard();
|
|
1153
|
+
return this.http.get(`${this.config.api_url}/service/get-transactions.php`, {
|
|
1154
|
+
params: {
|
|
1155
|
+
ws_id: this.config.wsid,
|
|
1156
|
+
user_id: this.user_id,
|
|
1157
|
+
transaction_id: id,
|
|
1158
|
+
}
|
|
1159
|
+
}).pipe(map(response => {
|
|
1160
|
+
if ((response.records === undefined) || (response.records.length <= 0)) {
|
|
1161
|
+
throw response;
|
|
1162
|
+
}
|
|
1163
|
+
const items = this.processTransactions(response.records);
|
|
1164
|
+
return items[0];
|
|
1165
|
+
}));
|
|
1166
|
+
}
|
|
1167
|
+
catch (error) {
|
|
1168
|
+
return throwError(error);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
processUserAccount(record) {
|
|
1172
|
+
if (!record) {
|
|
1173
|
+
throw new Error('Invalid record');
|
|
1174
|
+
}
|
|
1175
|
+
if (+record.userid !== this._user_id) {
|
|
1176
|
+
throw new Error('Invalid user account retrieved');
|
|
1177
|
+
}
|
|
1178
|
+
const user_account = new EsolveUserAccount(+record.userid, record.email, record.registration_type, record.title, record.firstname, record.surname, record.initials, record.gender, record.idnumber);
|
|
1179
|
+
user_account.contact_details = new EsolveUserAccountContact(record.telnumber, record.cellnumber, record.fax);
|
|
1180
|
+
user_account.business_details = new EsolveUserAccountBusiness(record.busname, record.vatnum, record.busdescript, record.business_type);
|
|
1181
|
+
return user_account;
|
|
1182
|
+
}
|
|
1183
|
+
processUserAddress(records) {
|
|
1184
|
+
const user_addresses = [];
|
|
1185
|
+
if (!records || (this._user_id === 0)) {
|
|
1186
|
+
return user_addresses;
|
|
1187
|
+
}
|
|
1188
|
+
for (const record of records) {
|
|
1189
|
+
if (+record.userid !== this._user_id) {
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1192
|
+
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));
|
|
1193
|
+
}
|
|
1194
|
+
return user_addresses;
|
|
1195
|
+
}
|
|
1196
|
+
processTransactions(records) {
|
|
1197
|
+
const transactions = [];
|
|
1198
|
+
if (records) {
|
|
1199
|
+
for (const record of records) {
|
|
1200
|
+
const transaction = new EsolveTransaction(record);
|
|
1201
|
+
transactions.push(transaction);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
return transactions;
|
|
1205
|
+
}
|
|
1206
|
+
loginGuard() {
|
|
1207
|
+
if (this.user_id <= 0) {
|
|
1208
|
+
this.errorHandler.emitError('login_required', 'Login is required');
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
914
1211
|
}
|
|
915
1212
|
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 });
|
|
916
1213
|
EsolveAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveAccountService, providedIn: 'root' });
|
|
@@ -962,29 +1259,6 @@ class EsolveMediaService {
|
|
|
962
1259
|
this.config = config;
|
|
963
1260
|
this.http = http;
|
|
964
1261
|
}
|
|
965
|
-
processMediaRecord(record) {
|
|
966
|
-
const tags = [];
|
|
967
|
-
const topics = [];
|
|
968
|
-
if ((record.tags) && (record.tags.length > 0)) {
|
|
969
|
-
for (const tag of record.tags) {
|
|
970
|
-
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
if ((record.topics) && (record.topics.length > 0)) {
|
|
974
|
-
for (const topic of record.topics) {
|
|
975
|
-
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Retrieves media records from eSolve instance.
|
|
982
|
-
* @param params Header params
|
|
983
|
-
*/
|
|
984
|
-
getMediaRecords(params) {
|
|
985
|
-
params = params.set('ws_id', this.config.wsid);
|
|
986
|
-
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
987
|
-
}
|
|
988
1262
|
/**
|
|
989
1263
|
* Retrieves the media record from the eSolve instance using the identifier.
|
|
990
1264
|
* @param identifier String representing the eSolve media indentifier
|
|
@@ -1029,6 +1303,29 @@ class EsolveMediaService {
|
|
|
1029
1303
|
return mediaArticles;
|
|
1030
1304
|
}));
|
|
1031
1305
|
}
|
|
1306
|
+
processMediaRecord(record) {
|
|
1307
|
+
const tags = [];
|
|
1308
|
+
const topics = [];
|
|
1309
|
+
if ((record.tags) && (record.tags.length > 0)) {
|
|
1310
|
+
for (const tag of record.tags) {
|
|
1311
|
+
tags.push(new EsolveTag(+tag.id, tag.tag_phrase, +tag.tag_weight, tag.description));
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
if ((record.topics) && (record.topics.length > 0)) {
|
|
1315
|
+
for (const topic of record.topics) {
|
|
1316
|
+
topics.push(new EsolveTopic(+topic.id, topic.name, topic.short_description, +topic.sort_priority));
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return new EsolveMediaArticle(record.identifier, record.title, record.article, record.image_url, tags, topics, record.seo_page_title, record.seo_keywords, record.seo_description);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Retrieves media records from eSolve instance.
|
|
1323
|
+
* @param params Header params
|
|
1324
|
+
*/
|
|
1325
|
+
getMediaRecords(params) {
|
|
1326
|
+
params = params.set('ws_id', this.config.wsid);
|
|
1327
|
+
return this.http.get(`${this.config.api_url}/service/get-media.php`, { params });
|
|
1328
|
+
}
|
|
1032
1329
|
}
|
|
1033
1330
|
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 });
|
|
1034
1331
|
EsolveMediaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveMediaService, providedIn: 'root' });
|
|
@@ -1237,6 +1534,31 @@ class EsolveBannerService {
|
|
|
1237
1534
|
this.config = config;
|
|
1238
1535
|
this.http = http;
|
|
1239
1536
|
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Retrieves banners records from eSolve instance
|
|
1539
|
+
*
|
|
1540
|
+
* @returns An observable of eSolve banners.
|
|
1541
|
+
*/
|
|
1542
|
+
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1543
|
+
let params = new HttpParams({
|
|
1544
|
+
fromObject: {
|
|
1545
|
+
ws_id: this.config.wsid,
|
|
1546
|
+
enable_date_filter
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
if (identifier) {
|
|
1550
|
+
params = params.set('identifier', identifier);
|
|
1551
|
+
}
|
|
1552
|
+
if (banner_display_container) {
|
|
1553
|
+
params = params.set('banner_display_container', banner_display_container);
|
|
1554
|
+
}
|
|
1555
|
+
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1556
|
+
if (response.records === undefined) {
|
|
1557
|
+
throw response;
|
|
1558
|
+
}
|
|
1559
|
+
return this.processBanners(response.records);
|
|
1560
|
+
}));
|
|
1561
|
+
}
|
|
1240
1562
|
processBannerImageHotspots(hotspot_records) {
|
|
1241
1563
|
const hotspots = [];
|
|
1242
1564
|
if (hotspot_records.length > 0) {
|
|
@@ -1283,36 +1605,11 @@ class EsolveBannerService {
|
|
|
1283
1605
|
const banner = new EsolveBanner(+record.id, record.banner_display_container, record.identifier, record.type, record.title, record.article, +record.sort_priority, {
|
|
1284
1606
|
url: record.link.url,
|
|
1285
1607
|
target: record.link.target
|
|
1286
|
-
}, image_sets);
|
|
1287
|
-
banners.push(banner);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
return banners;
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Retrieves banners records from eSolve instance
|
|
1294
|
-
*
|
|
1295
|
-
* @returns An observable of eSolve banners.
|
|
1296
|
-
*/
|
|
1297
|
-
getBanners(identifier, banner_display_container, enable_date_filter = false) {
|
|
1298
|
-
let params = new HttpParams({
|
|
1299
|
-
fromObject: {
|
|
1300
|
-
ws_id: this.config.wsid,
|
|
1301
|
-
enable_date_filter
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
if (identifier) {
|
|
1305
|
-
params = params.set('identifier', identifier);
|
|
1306
|
-
}
|
|
1307
|
-
if (banner_display_container) {
|
|
1308
|
-
params = params.set('banner_display_container', banner_display_container);
|
|
1309
|
-
}
|
|
1310
|
-
return this.http.get(`${this.config.api_url}/service/get-banners.php`, { params }).pipe(map(response => {
|
|
1311
|
-
if (response.records === undefined) {
|
|
1312
|
-
throw response;
|
|
1608
|
+
}, image_sets);
|
|
1609
|
+
banners.push(banner);
|
|
1313
1610
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1611
|
+
}
|
|
1612
|
+
return banners;
|
|
1316
1613
|
}
|
|
1317
1614
|
}
|
|
1318
1615
|
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 });
|
|
@@ -1382,16 +1679,6 @@ class EsolveTopicService {
|
|
|
1382
1679
|
this.config = config;
|
|
1383
1680
|
this.http = http;
|
|
1384
1681
|
}
|
|
1385
|
-
processTopics(records) {
|
|
1386
|
-
const topics = [];
|
|
1387
|
-
if (records) {
|
|
1388
|
-
for (const record of records) {
|
|
1389
|
-
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1390
|
-
topics.push(topic);
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
return topics;
|
|
1394
|
-
}
|
|
1395
1682
|
/**
|
|
1396
1683
|
* Retrieves active topics from the list of topic ID's. Note that inactive or expired
|
|
1397
1684
|
* topics will not be retrieved.
|
|
@@ -1414,6 +1701,16 @@ class EsolveTopicService {
|
|
|
1414
1701
|
return this.processTopics(response.records);
|
|
1415
1702
|
}));
|
|
1416
1703
|
}
|
|
1704
|
+
processTopics(records) {
|
|
1705
|
+
const topics = [];
|
|
1706
|
+
if (records) {
|
|
1707
|
+
for (const record of records) {
|
|
1708
|
+
const topic = new EsolveTopic(+record.id, record.name, record.short_description, +record.sort_priority);
|
|
1709
|
+
topics.push(topic);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
return topics;
|
|
1713
|
+
}
|
|
1417
1714
|
}
|
|
1418
1715
|
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 });
|
|
1419
1716
|
EsolveTopicService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveTopicService, providedIn: 'root' });
|
|
@@ -1809,50 +2106,6 @@ class EsolveCategoryTreeService {
|
|
|
1809
2106
|
this.config = config;
|
|
1810
2107
|
this.http = http;
|
|
1811
2108
|
}
|
|
1812
|
-
/**
|
|
1813
|
-
* Processes the eSolve tree records and converts them into the correct format.
|
|
1814
|
-
* @param tree_records Records to process
|
|
1815
|
-
*/
|
|
1816
|
-
processTree(tree_records) {
|
|
1817
|
-
const tree_items = [];
|
|
1818
|
-
if (tree_records) {
|
|
1819
|
-
for (const tree_record of tree_records) {
|
|
1820
|
-
let esolve_id = '';
|
|
1821
|
-
let parent_id = '';
|
|
1822
|
-
let children = [];
|
|
1823
|
-
if (tree_record.type === 'category') {
|
|
1824
|
-
children = this.processTree(tree_record.children);
|
|
1825
|
-
esolve_id = tree_record.menu_id;
|
|
1826
|
-
parent_id = tree_record.owner_menu_id;
|
|
1827
|
-
}
|
|
1828
|
-
else {
|
|
1829
|
-
esolve_id = tree_record.id;
|
|
1830
|
-
parent_id = tree_record.menu_id;
|
|
1831
|
-
}
|
|
1832
|
-
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));
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
return tree_items;
|
|
1836
|
-
}
|
|
1837
|
-
processTreeItem(record) {
|
|
1838
|
-
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);
|
|
1839
|
-
}
|
|
1840
|
-
processID(id) {
|
|
1841
|
-
let type;
|
|
1842
|
-
let esolve_id;
|
|
1843
|
-
const type_code_regex = /^\<\<(CAT|SUB)\>\>/g;
|
|
1844
|
-
const match_results = id.match(type_code_regex);
|
|
1845
|
-
if (match_results) {
|
|
1846
|
-
const type_code = match_results[0];
|
|
1847
|
-
type = (type_code === '<<CAT>>' ? 'category' : 'subcategory');
|
|
1848
|
-
esolve_id = id.replace(type_code_regex, '');
|
|
1849
|
-
return {
|
|
1850
|
-
type,
|
|
1851
|
-
esolve_id
|
|
1852
|
-
};
|
|
1853
|
-
}
|
|
1854
|
-
return null;
|
|
1855
|
-
}
|
|
1856
2109
|
/**
|
|
1857
2110
|
* Retrieves the category tree from eSolve instance and coverts it to the correct format.
|
|
1858
2111
|
*/
|
|
@@ -1909,6 +2162,50 @@ class EsolveCategoryTreeService {
|
|
|
1909
2162
|
}
|
|
1910
2163
|
return throwError('Invalid options');
|
|
1911
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
|
+
}
|
|
1912
2209
|
}
|
|
1913
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 });
|
|
1914
2211
|
EsolveCategoryTreeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCategoryTreeService, providedIn: 'root' });
|
|
@@ -2044,30 +2341,6 @@ class EsolveCartService {
|
|
|
2044
2341
|
this.responseHandler = responseHandler;
|
|
2045
2342
|
this._cached_tracking = 0;
|
|
2046
2343
|
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Processes the eSolve tree records.
|
|
2049
|
-
* @param cart_item_records Records to process
|
|
2050
|
-
* @returns An array of processed cart items
|
|
2051
|
-
*/
|
|
2052
|
-
processCart(cart_item_records) {
|
|
2053
|
-
const cart_items = [];
|
|
2054
|
-
if (cart_item_records) {
|
|
2055
|
-
for (const cart_item_record of cart_item_records) {
|
|
2056
|
-
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);
|
|
2057
|
-
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));
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
return cart_items;
|
|
2061
|
-
}
|
|
2062
|
-
/**
|
|
2063
|
-
* Processes the eSolve cart totals
|
|
2064
|
-
* @param record Data to process
|
|
2065
|
-
* @returns Processed cart totals
|
|
2066
|
-
*/
|
|
2067
|
-
processCartTotals(record) {
|
|
2068
|
-
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2069
|
-
return cart_totals;
|
|
2070
|
-
}
|
|
2071
2344
|
/**
|
|
2072
2345
|
* Retrieves the current cart
|
|
2073
2346
|
* @returns An `Observable` with an array of cart items
|
|
@@ -2186,6 +2459,30 @@ class EsolveCartService {
|
|
|
2186
2459
|
}));
|
|
2187
2460
|
}));
|
|
2188
2461
|
}
|
|
2462
|
+
/**
|
|
2463
|
+
* Processes the eSolve tree records.
|
|
2464
|
+
* @param cart_item_records Records to process
|
|
2465
|
+
* @returns An array of processed cart items
|
|
2466
|
+
*/
|
|
2467
|
+
processCart(cart_item_records) {
|
|
2468
|
+
const cart_items = [];
|
|
2469
|
+
if (cart_item_records) {
|
|
2470
|
+
for (const cart_item_record of cart_item_records) {
|
|
2471
|
+
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);
|
|
2472
|
+
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));
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
return cart_items;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Processes the eSolve cart totals
|
|
2479
|
+
* @param record Data to process
|
|
2480
|
+
* @returns Processed cart totals
|
|
2481
|
+
*/
|
|
2482
|
+
processCartTotals(record) {
|
|
2483
|
+
const cart_totals = new EsolveCartTotals(+record.records, +record.items, +record.total, +record.vat, +record.discount);
|
|
2484
|
+
return cart_totals;
|
|
2485
|
+
}
|
|
2189
2486
|
}
|
|
2190
2487
|
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 });
|
|
2191
2488
|
EsolveCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveCartService, providedIn: 'root' });
|
|
@@ -2267,12 +2564,8 @@ class EsolvePaymentMethod {
|
|
|
2267
2564
|
this.description = record.description;
|
|
2268
2565
|
this.display_banking_details = record.display_banking_details;
|
|
2269
2566
|
this.currency_code = record.currency_code;
|
|
2270
|
-
this.terminal_id = record.terminal_id;
|
|
2271
|
-
this.terminal_id_secondary = record.terminal_id_secondary;
|
|
2272
2567
|
this.merchant_id = record.merchant_id;
|
|
2273
2568
|
this.application_id = record.application_id;
|
|
2274
|
-
this.api_username = record.api_username;
|
|
2275
|
-
this.api_password = record.api_password;
|
|
2276
2569
|
this.api_signature = record.api_signature;
|
|
2277
2570
|
this.is_gateway = record.is_gateway;
|
|
2278
2571
|
this.must_store_card_details = record.must_store_card_details;
|
|
@@ -2439,7 +2732,7 @@ class EsolvePaymentService {
|
|
|
2439
2732
|
}
|
|
2440
2733
|
return new EsolveResult(http_response.result.status, http_response.result.code, http_response.result.message);
|
|
2441
2734
|
}), catchError((errorRes) => {
|
|
2442
|
-
return this.errorHandler.
|
|
2735
|
+
return this.errorHandler.handleHttpDeleteError('delete-vault', errorRes);
|
|
2443
2736
|
}));
|
|
2444
2737
|
}
|
|
2445
2738
|
/**
|
|
@@ -2643,101 +2936,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2643
2936
|
args: [ESOLVE_CONNECT_CONFIG]
|
|
2644
2937
|
}] }, { type: i1$1.HttpClient }]; } });
|
|
2645
2938
|
|
|
2646
|
-
class EsolveStockLocation {
|
|
2647
|
-
constructor(record) {
|
|
2648
|
-
this.id = +record.id;
|
|
2649
|
-
this.identifier = record.identifier;
|
|
2650
|
-
this.description = record.description;
|
|
2651
|
-
this.head_office = record.head_office;
|
|
2652
|
-
this.erp_identifier = record.erp_identifier;
|
|
2653
|
-
this.external_system_code = record.external_system_code;
|
|
2654
|
-
this.default_location_for_payment_methods = record.default_location_for_payment_methods;
|
|
2655
|
-
this.userid = +record.userid;
|
|
2656
|
-
this.importance = +record.importance;
|
|
2657
|
-
this.active = record.is_active;
|
|
2658
|
-
this.website_url = record.website_url;
|
|
2659
|
-
this.address = new EsolveStockLocationAddress(record.street, record.suburb, record.city, record.province, record.country, record.postal_code, +record.latitude, +record.longitude);
|
|
2660
|
-
this.pobox_address = new EsolveStockLocationPOBoxAddress(record.pobox, record.pobox_city, record.pobox_postal_code);
|
|
2661
|
-
const telnumbers = [];
|
|
2662
|
-
if (record.branch_telnumber.length > 0) {
|
|
2663
|
-
telnumbers.push(record.branch_telnumber);
|
|
2664
|
-
}
|
|
2665
|
-
if (record.branch_telnumber_2.length > 0) {
|
|
2666
|
-
telnumbers.push(record.branch_telnumber_2);
|
|
2667
|
-
}
|
|
2668
|
-
if (record.branch_telnumber_3.length > 0) {
|
|
2669
|
-
telnumbers.push(record.branch_telnumber_3);
|
|
2670
|
-
}
|
|
2671
|
-
this.contact_info = new EsolveStockLocationContactInfo(telnumbers, record.branch_cellnumber, record.branch_email, record.branch_fax);
|
|
2672
|
-
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);
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
class EsolveStockLocationAddress {
|
|
2676
|
-
constructor(street, suburb, city, province, country, postal_code, latitude, longitude) {
|
|
2677
|
-
this.street = street;
|
|
2678
|
-
this.suburb = suburb;
|
|
2679
|
-
this.city = city;
|
|
2680
|
-
this.province = province;
|
|
2681
|
-
this.country = country;
|
|
2682
|
-
this.postal_code = postal_code;
|
|
2683
|
-
this.latitude = latitude;
|
|
2684
|
-
this.longitude = longitude;
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
class EsolveStockLocationPOBoxAddress {
|
|
2688
|
-
constructor(pobox, city, postal_code) {
|
|
2689
|
-
this.pobox = pobox;
|
|
2690
|
-
this.city = city;
|
|
2691
|
-
this.postal_code = postal_code;
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
class EsolveStockLocationContactInfo {
|
|
2695
|
-
constructor(telnumber, cellnumber, email, fax) {
|
|
2696
|
-
this.telnumber = telnumber;
|
|
2697
|
-
this.cellnumber = cellnumber;
|
|
2698
|
-
this.email = email;
|
|
2699
|
-
this.fax = fax;
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
class EsolveStockLocationTradingTimes {
|
|
2703
|
-
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 = '') {
|
|
2704
|
-
this.trading_hours_additional_info = trading_hours_additional_info;
|
|
2705
|
-
this.monday = new EsolveStockLocationTradingTimesDay(monday_open_time, monday_close_time);
|
|
2706
|
-
this.tuesday = new EsolveStockLocationTradingTimesDay(tuesday_open_time, tuesday_close_time);
|
|
2707
|
-
this.wednesday = new EsolveStockLocationTradingTimesDay(wednesday_open_time, wednesday_close_time);
|
|
2708
|
-
this.thursday = new EsolveStockLocationTradingTimesDay(thursday_open_time, thursday_close_time);
|
|
2709
|
-
this.friday = new EsolveStockLocationTradingTimesDay(friday_open_time, friday_close_time);
|
|
2710
|
-
this.saturday = new EsolveStockLocationTradingTimesDay(saturday_open_time, saturday_close_time);
|
|
2711
|
-
this.sunday = new EsolveStockLocationTradingTimesDay(sunday_open_time, sunday_close_time);
|
|
2712
|
-
this.public_holiday = new EsolveStockLocationTradingTimesDay(public_holiday_open_time, public_holiday_close_time);
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
class EsolveStockLocationTradingTimesDay {
|
|
2716
|
-
constructor(open, close) {
|
|
2717
|
-
this.open = open;
|
|
2718
|
-
this.close = close;
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
2939
|
class EsolveLocationsService {
|
|
2723
2940
|
constructor(config, http) {
|
|
2724
2941
|
this.config = config;
|
|
2725
2942
|
this.http = http;
|
|
2726
2943
|
}
|
|
2727
|
-
/**
|
|
2728
|
-
* Processes the eSolve stock location records.
|
|
2729
|
-
* @param records Records to process
|
|
2730
|
-
* @returns An array of processed stock location records
|
|
2731
|
-
*/
|
|
2732
|
-
processStockLocations(records) {
|
|
2733
|
-
const stock_locations = [];
|
|
2734
|
-
if (records) {
|
|
2735
|
-
for (const record of records) {
|
|
2736
|
-
stock_locations.push(new EsolveStockLocation(record));
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
return stock_locations;
|
|
2740
|
-
}
|
|
2741
2944
|
/**
|
|
2742
2945
|
* Retrieves a list of stock locations
|
|
2743
2946
|
* @returns An `Observable` with an array of stock locations
|
|
@@ -2752,6 +2955,20 @@ class EsolveLocationsService {
|
|
|
2752
2955
|
return this.processStockLocations(response.records);
|
|
2753
2956
|
}));
|
|
2754
2957
|
}
|
|
2958
|
+
/**
|
|
2959
|
+
* Processes the eSolve stock location records.
|
|
2960
|
+
* @param records Records to process
|
|
2961
|
+
* @returns An array of processed stock location records
|
|
2962
|
+
*/
|
|
2963
|
+
processStockLocations(records) {
|
|
2964
|
+
const stock_locations = [];
|
|
2965
|
+
if (records) {
|
|
2966
|
+
for (const record of records) {
|
|
2967
|
+
stock_locations.push(new EsolveStockLocation(record));
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
return stock_locations;
|
|
2971
|
+
}
|
|
2755
2972
|
}
|
|
2756
2973
|
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 });
|
|
2757
2974
|
EsolveLocationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: EsolveLocationsService, providedIn: 'root' });
|
|
@@ -2773,5 +2990,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
|
|
|
2773
2990
|
* Generated bundle index. Do not edit.
|
|
2774
2991
|
*/
|
|
2775
2992
|
|
|
2776
|
-
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 };
|
|
2993
|
+
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 };
|
|
2777
2994
|
//# sourceMappingURL=esolve-ng-esolve-connect.mjs.map
|