Compare commits
No commits in common. "299cae0c801c050e4f7ef0a12bc7491270666d03" and "299ef37f69b87e43a1712a1a9aa3b49a033e54e8" have entirely different histories.
299cae0c80
...
299ef37f69
52 changed files with 12635 additions and 4673 deletions
60
CHANGELOG.md
60
CHANGELOG.md
|
@ -3,65 +3,6 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [2.3.1] - 2023-06-26
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Broken wallet link for invoices
|
|
||||||
|
|
||||||
## [2.3.0] - 2023-06-26
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- Modified order to handle new `token` field.
|
|
||||||
- Modified order service to query API using `token`.
|
|
||||||
- Modified receipt component to use the new `token`.
|
|
||||||
- Modified invoice component to use the new `token`.
|
|
||||||
- Modified payment service component to remove order-creation logic.
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Receipt prompt textarea is now read-only.
|
|
||||||
- Invoice prompt textarea is now read-only.
|
|
||||||
- Button text color is now correct for Invoice and Receipt.
|
|
||||||
|
|
||||||
## [2.2.0] - 2023-05-15
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- New API calls for requesting language data for login page
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- Owner model modified to remove unnecessary fields
|
|
||||||
- Fullnode service uses `session` for API calls.
|
|
||||||
- User service uses `session` for API calls.
|
|
||||||
- Auth-guard service uses new `checkUser` function to confirm session exists and is validated.
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Business sign-up stepper skipping is corrected
|
|
||||||
|
|
||||||
## [2.1.0] - 2023-05-02
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- New dialog to purchase sessions ahead of expiration.
|
|
||||||
|
|
||||||
## [2.0.0] - 2023-03-16
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- Added the Xero invoice number in the memo for invoice payments.
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- Various look and feel changes to support the latest version of Angular.
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Correct display of translated phrases in various components.
|
|
||||||
|
|
||||||
## [2.0.0-beta] - 2023-02-23
|
## [2.0.0-beta] - 2023-02-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -71,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Parametrization of text elements
|
- Parametrization of text elements
|
||||||
|
- Expanded Xero reference message to include ZEC amount
|
||||||
|
|
||||||
## [1.4.1] - 2023-01-09
|
## [1.4.1] - 2023-01-09
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# ZGo - The Zcash Register
|
# ZGo - The Zcash Register
|
||||||
|
|
||||||
[![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page)
|
|
||||||
|
|
||||||
A Point-of-Sale application for accepting payments in [Zcash](https://z.cash/)
|
A Point-of-Sale application for accepting payments in [Zcash](https://z.cash/)
|
||||||
|
|
||||||
Visit our [ZGo Homepage](https://zgo.cash/) for more details.
|
Visit our [ZGo Homepage](https://zgo.cash/) for more details.
|
||||||
|
|
14867
package-lock.json
generated
14867
package-lock.json
generated
File diff suppressed because it is too large
Load diff
51
package.json
51
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "zgo",
|
"name": "zgo",
|
||||||
"version": "2.3.1",
|
"version": "2.0.0-beta",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
|
@ -10,22 +10,23 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^16.0.0",
|
"@angular-material-components/datetime-picker": "^9.0.0",
|
||||||
"@angular/cdk": "^16.0.0",
|
"@angular/animations": "^15.1.2",
|
||||||
"@angular/common": "^16.0.0",
|
"@angular/cdk": "^15.1.2",
|
||||||
"@angular/compiler": "^16.0.0",
|
"@angular/common": "^15.1.2",
|
||||||
"@angular/core": "^16.0.0",
|
"@angular/compiler": "^15.1.2",
|
||||||
"@angular/forms": "^16.0.0",
|
"@angular/core": "^15.1.2",
|
||||||
"@angular/material": "^16.0.0",
|
"@angular/forms": "^15.1.2",
|
||||||
"@angular/platform-browser": "^16.0.0",
|
"@angular/material": "^15.1.2",
|
||||||
"@angular/platform-browser-dynamic": "^16.0.0",
|
"@angular/platform-browser": "^15.1.2",
|
||||||
"@angular/router": "^16.0.0",
|
"@angular/platform-browser-dynamic": "^15.1.2",
|
||||||
"@fortawesome/angular-fontawesome": "^0.13.0",
|
"@angular/router": "^15.1.2",
|
||||||
"@fortawesome/fontawesome-free": "^6.4.0",
|
"@fortawesome/angular-fontawesome": "^0.12.1",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
"@fortawesome/fontawesome-free": "^6.2.1",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.4.0",
|
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.4.0",
|
"@fortawesome/free-brands-svg-icons": "^6.2.1",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
"@fortawesome/free-regular-svg-icons": "^6.2.1",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
||||||
"@supercharge/request-ip": "^1.2.0",
|
"@supercharge/request-ip": "^1.2.0",
|
||||||
"angular-local-storage": "^0.7.1",
|
"angular-local-storage": "^0.7.1",
|
||||||
"angular-material-datepicker": "^1.0.2",
|
"angular-material-datepicker": "^1.0.2",
|
||||||
|
@ -38,23 +39,23 @@
|
||||||
"tslib": "^2.5.0",
|
"tslib": "^2.5.0",
|
||||||
"urlsafe-base64": "^1.0.0",
|
"urlsafe-base64": "^1.0.0",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"zone.js": "~0.13.0"
|
"zone.js": "~0.12.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^16.0.0",
|
"@angular-devkit/build-angular": "^15.1.3",
|
||||||
"@angular/cli": "^16.0.0",
|
"@angular/cli": "^15.1.3",
|
||||||
"@angular/compiler-cli": "^16.0.0",
|
"@angular/compiler-cli": "^15.1.2",
|
||||||
"@types/jasmine": "~4.3.1",
|
"@types/jasmine": "~4.3.1",
|
||||||
"@types/node": "^18.16.6",
|
"@types/node": "^18.11.18",
|
||||||
"@types/request": "^2.48.8",
|
"@types/request": "^2.48.8",
|
||||||
"@types/urlsafe-base64": "^1.0.28",
|
"@types/urlsafe-base64": "^1.0.28",
|
||||||
"@types/uuid": "^9.0.1",
|
"@types/uuid": "^9.0.0",
|
||||||
"jasmine-core": "~4.5.0",
|
"jasmine-core": "~4.5.0",
|
||||||
"karma": "~6.4.2",
|
"karma": "~6.4.1",
|
||||||
"karma-chrome-launcher": "~3.1.1",
|
"karma-chrome-launcher": "~3.1.1",
|
||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.2.0",
|
||||||
"karma-jasmine": "~5.1.0",
|
"karma-jasmine": "~5.1.0",
|
||||||
"karma-jasmine-html-reporter": "~2.0.0",
|
"karma-jasmine-html-reporter": "~2.0.0",
|
||||||
"typescript": "~4.9.5"
|
"typescript": "~4.9.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
style="margin-top: 10px;
|
style="margin-top: 10px;
|
||||||
margin-bottom: 20px;">
|
margin-bottom: 20px;">
|
||||||
<div >© 2023 Vergara Technologies LLC</div>
|
<div >© 2023 Vergara Technologies LLC</div>
|
||||||
<div class="tiny">Version 2.3.1</div>
|
<div class="tiny">Version 2.0.0-beta</div>
|
||||||
<div class="tiny">{{ vE.mainPriceData }}</div>
|
<div class="tiny">{{ vE.mainPriceData }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div></div>
|
<div></div>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { LanguageService } from './language.service';
|
import { LanguageService } from './language.service';
|
||||||
|
import { LanguageData } from './language.model';
|
||||||
|
|
||||||
|
//import { Post} from './posts/post.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
@ -22,21 +24,21 @@ export class AppComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
//console.log('chgUILanguage() called on ngOnInit ');
|
console.log('chgUILanguage() called on ngOnInit ');
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage() {
|
chgUILanguage() {
|
||||||
//console.log('MAIN.chgUILanguage Called ');
|
console.log('MAIN.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('main').subscribe({
|
this.languageService.getViewElements('main').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('response >> ', response );
|
console.log('response >> ', response );
|
||||||
//console.log('main_price_data -> ',response.data.main_price_data);
|
console.log('main_price_data -> ',response.data.main_price_data);
|
||||||
this.vE.mainPriceData = response.data.main_price_data;
|
this.vE.mainPriceData = response.data.main_price_data;
|
||||||
this.zgoLanguage = response.language;
|
this.zgoLanguage = response.language;
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error --> ',error); }
|
error => { console.log('Error --> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
usFlagClicked() {
|
usFlagClicked() {
|
||||||
|
|
|
@ -51,7 +51,6 @@ import { NotifierComponent } from './notifier/notifier.component';
|
||||||
import { PmtserviceComponent } from './pmtservice/pmtservice.component';
|
import { PmtserviceComponent } from './pmtservice/pmtservice.component';
|
||||||
import { XeroRegComponent } from './xeroreg/xeroreg.component';
|
import { XeroRegComponent } from './xeroreg/xeroreg.component';
|
||||||
import { DbExportComponent } from './db-export/db-export.component';
|
import { DbExportComponent } from './db-export/db-export.component';
|
||||||
import { SessionpayComponent } from './sessionpay/sessionpay.component';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -82,7 +81,6 @@ import { SessionpayComponent } from './sessionpay/sessionpay.component';
|
||||||
PmtserviceComponent,
|
PmtserviceComponent,
|
||||||
XeroRegComponent,
|
XeroRegComponent,
|
||||||
DbExportComponent,
|
DbExportComponent,
|
||||||
SessionpayComponent,
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|
|
@ -1,51 +1,57 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
|
import { CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||||
import { UserService } from './user.service';
|
import { UserService } from './user.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Subscription, Observable } from 'rxjs';
|
||||||
|
import { Owner } from './owner.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
||||||
export class AuthGuardService {
|
export class AuthGuardService implements CanActivate {
|
||||||
|
private UserSub: Subscription = new Subscription();
|
||||||
private addr = '';
|
private addr = '';
|
||||||
private paid = false;
|
private paid = false;
|
||||||
private paidUpdate: Observable<boolean>;
|
private paidUpdate: Observable<boolean>;
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
private http: HttpClient,
|
||||||
public userService: UserService
|
public userService: UserService
|
||||||
){
|
){
|
||||||
this.userService.findUser();
|
|
||||||
this.paidUpdate = this.userService.paidUpdate;
|
this.paidUpdate = this.userService.paidUpdate;
|
||||||
this.paidUpdate.subscribe((indicator) => {
|
this.paidUpdate.subscribe((indicator) => {
|
||||||
this.paid = indicator;
|
this.paid = indicator;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
const token = localStorage.getItem('s4z_token');
|
const token = localStorage.getItem('s4z_token');
|
||||||
|
|
||||||
var path = route.url[0].path;
|
var path = route.url[0].path;
|
||||||
|
|
||||||
if(token != null){
|
if(token != null){
|
||||||
|
this.userService.uZaddrUpdate.
|
||||||
|
subscribe((addr) => {
|
||||||
|
if (addr != null) {
|
||||||
|
console.log(addr);
|
||||||
|
this.addr = addr;
|
||||||
|
} else {
|
||||||
|
console.log("No record for that token");
|
||||||
|
}
|
||||||
|
});
|
||||||
if (path === 'biz') {
|
if (path === 'biz') {
|
||||||
this.userService.checkUser()?.subscribe( response => {
|
if (this.addr.length > 0) {
|
||||||
if (response.status == 200 && response.body?.validated) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.userService.checkUser()?.subscribe( response => {
|
if (this.addr != null && this.paid) {
|
||||||
if (response.status == 200 && response.body?.validated && this.paid) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Not logged in");
|
console.log("Not logged in");
|
||||||
|
|
|
@ -13,11 +13,6 @@ mat-card.centercard{
|
||||||
font-family: 'Spartan', sans-serif;
|
font-family: 'Spartan', sans-serif;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep .mat-vertical-stepper-header{
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.link{
|
a.link{
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<mat-card class="centercard">
|
<mat-card class="centercard">
|
||||||
<h3>{{ vE.businessSignupTitle }}</h3>
|
<h3>{{ vE.businessSignupTitle }}</h3>
|
||||||
<mat-vertical-stepper #stepper [linear]="true">
|
<mat-vertical-stepper #stepper linear>
|
||||||
<mat-step label="{{ vE.businessBizInfo }}" editable="false">
|
<mat-step label="{{ vE.businessBizInfo }}" editable="false">
|
||||||
<p>{{ vE.businessAddrsNobiz }}</p>
|
<p>{{ vE.businessAddrsNobiz }}</p>
|
||||||
<mat-card [formGroup]="bizForm">
|
<mat-card [formGroup]="bizForm">
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { ScanComponent } from '../scan/scan.component';
|
||||||
import { TermsComponent } from '../terms/terms.component';
|
import { TermsComponent } from '../terms/terms.component';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-business',
|
selector: 'app-business',
|
||||||
|
@ -50,19 +51,29 @@ export class BusinessComponent implements OnInit {
|
||||||
countries: Country[] = [];
|
countries: Country[] = [];
|
||||||
owner: Owner = {
|
owner: Owner = {
|
||||||
address: '',
|
address: '',
|
||||||
name: '',
|
|
||||||
currency: 'usd',
|
currency: 'usd',
|
||||||
tax: false,
|
tax: false,
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
name: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
country: '',
|
||||||
|
email: '',
|
||||||
|
website: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
}
|
}
|
||||||
public countriesUpdate: Observable<Country[]>;
|
public countriesUpdate: Observable<Country[]>;
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
|
@ -72,20 +83,6 @@ export class BusinessComponent implements OnInit {
|
||||||
sessionId = '';
|
sessionId = '';
|
||||||
ownerKnown = false;
|
ownerKnown = false;
|
||||||
termsChecked = false;
|
termsChecked = false;
|
||||||
ownerdata = {
|
|
||||||
first: '',
|
|
||||||
last: '',
|
|
||||||
phone: '',
|
|
||||||
name: '',
|
|
||||||
street: '',
|
|
||||||
city: '',
|
|
||||||
state: '',
|
|
||||||
postal: '',
|
|
||||||
country: '',
|
|
||||||
email: '',
|
|
||||||
website: '',
|
|
||||||
payconf: false
|
|
||||||
};
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
//
|
//
|
||||||
// Language Support
|
// Language Support
|
||||||
|
@ -190,7 +187,7 @@ export class BusinessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(ob: MatSlideToggleChange){
|
onChange(ob: MatSlideToggleChange){
|
||||||
//console.log(ob.checked);
|
console.log(ob.checked);
|
||||||
this.termsChecked = ob.checked;
|
this.termsChecked = ob.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,17 +196,25 @@ export class BusinessComponent implements OnInit {
|
||||||
dialogConfig.disableClose = true;
|
dialogConfig.disableClose = true;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
|
|
||||||
this.dialog.open(TermsComponent, dialogConfig);
|
const dialogRef = this.dialog.open(TermsComponent, dialogConfig);
|
||||||
//dialogRef.afterClosed().subscribe(val => {
|
dialogRef.afterClosed().subscribe(val => {
|
||||||
//console.log('Terms read');
|
console.log('Terms read');
|
||||||
//});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.ownerdata = {
|
this.owner = {
|
||||||
|
_id: '',
|
||||||
|
address: '',
|
||||||
|
currency: 'usd',
|
||||||
|
tax: false,
|
||||||
|
taxValue: 0,
|
||||||
|
vat: false,
|
||||||
|
vatValue: 0,
|
||||||
first: this.bizForm.get('first')!.value,
|
first: this.bizForm.get('first')!.value,
|
||||||
last: this.bizForm.get('last')!.value,
|
last: this.bizForm.get('last')!.value,
|
||||||
phone: '',
|
phone: '',
|
||||||
|
paid: false,
|
||||||
name: this.bizForm.get('name')!.value,
|
name: this.bizForm.get('name')!.value,
|
||||||
street: this.bizForm.get('street')!.value,
|
street: this.bizForm.get('street')!.value,
|
||||||
city: this.bizForm.get('city')!.value,
|
city: this.bizForm.get('city')!.value,
|
||||||
|
@ -218,9 +223,14 @@ export class BusinessComponent implements OnInit {
|
||||||
country: this.bizForm.get('country')!.value,
|
country: this.bizForm.get('country')!.value,
|
||||||
email: this.bizForm.get('email')!.value,
|
email: this.bizForm.get('email')!.value,
|
||||||
website: this.bizForm.get('website')!.value,
|
website: this.bizForm.get('website')!.value,
|
||||||
payconf: false
|
zats: false,
|
||||||
|
invoices: false,
|
||||||
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
|
payconf: false,
|
||||||
|
viewkey: '',
|
||||||
|
crmToken: ''
|
||||||
};
|
};
|
||||||
this.userService.addOwner(this.ownerdata);
|
this.userService.addOwner(this.owner);
|
||||||
this.stepper!.next();
|
this.stepper!.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +248,7 @@ export class BusinessComponent implements OnInit {
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(ScanComponent, dialogConfig);
|
const dialogRef = this.dialog.open(ScanComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe(val => {
|
dialogRef.afterClosed().subscribe(val => {
|
||||||
//console.log('Awaiting payment');
|
console.log('Awaiting payment');
|
||||||
if(val){
|
if(val){
|
||||||
this.stepper!.next();
|
this.stepper!.next();
|
||||||
}
|
}
|
||||||
|
@ -256,13 +266,13 @@ export class BusinessComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('BUSINESS.chgUILanguage Called ');
|
console.log('BUSINESS.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('business').subscribe(
|
this.languageService.getViewElements('business').subscribe(
|
||||||
response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.businessSignupTitle = response.data.business_signup_title;
|
this.vE.businessSignupTitle = response.data.business_signup_title;
|
||||||
this.vE.businessBizInfo = response.data.business_biz_info;
|
this.vE.businessBizInfo = response.data.business_biz_info;
|
||||||
|
|
|
@ -33,13 +33,23 @@ export class DbExportComponent implements OnInit {
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
_ordersOk = false;
|
_ordersOk = false;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {BehaviorSubject, Observable} from 'rxjs';
|
import {Subject, Subscription, BehaviorSubject, Observable} from 'rxjs';
|
||||||
import {HttpClient, HttpParams, HttpHeaders} from '@angular/common/http';
|
import {HttpClient, HttpParams, HttpHeaders} from '@angular/common/http';
|
||||||
import {UserService} from './user.service';
|
import {UserService} from './user.service';
|
||||||
import { Owner } from './owner.model';
|
import { Owner } from './owner.model';
|
||||||
|
@ -12,7 +12,6 @@ var Buffer = require('buffer/').Buffer;
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({providedIn: 'root'})
|
||||||
export class FullnodeService{
|
export class FullnodeService{
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private session: null|string = '';
|
|
||||||
private dataStore: { height: number, memoList: string[], addr: string, price: number } = { height: 0, memoList: [], addr: '', price:0 };
|
private dataStore: { height: number, memoList: string[], addr: string, price: number } = { height: 0, memoList: [], addr: '', price:0 };
|
||||||
private _heightUpdated: BehaviorSubject<number> = new BehaviorSubject(this.dataStore.height);
|
private _heightUpdated: BehaviorSubject<number> = new BehaviorSubject(this.dataStore.height);
|
||||||
private _memoUpdated: BehaviorSubject<string[]> = new BehaviorSubject(this.dataStore.memoList);
|
private _memoUpdated: BehaviorSubject<string[]> = new BehaviorSubject(this.dataStore.memoList);
|
||||||
|
@ -23,8 +22,8 @@ export class FullnodeService{
|
||||||
public readonly memoUpdate: Observable<string[]> = this._memoUpdated.asObservable();
|
public readonly memoUpdate: Observable<string[]> = this._memoUpdated.asObservable();
|
||||||
public readonly priceUpdate: Observable<number> = this._priceUpdated.asObservable();
|
public readonly priceUpdate: Observable<number> = this._priceUpdated.asObservable();
|
||||||
public readonly ownerUpdate: Observable<Owner>;
|
public readonly ownerUpdate: Observable<Owner>;
|
||||||
|
private UserSub: Subscription = new Subscription();
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private params : HttpParams;
|
|
||||||
private owner: Owner = {
|
private owner: Owner = {
|
||||||
_id: '',
|
_id: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -34,18 +33,26 @@ export class FullnodeService{
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(private http: HttpClient, public userService: UserService){
|
constructor(private http: HttpClient, public userService: UserService){
|
||||||
this.session = localStorage.getItem('s4z_token');
|
|
||||||
this.params = new HttpParams().append('session', this.session!);
|
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.ownerUpdate = userService.ownerUpdate;
|
this.ownerUpdate = userService.ownerUpdate;
|
||||||
|
@ -58,7 +65,7 @@ export class FullnodeService{
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeight(){
|
getHeight(){
|
||||||
let obs = this.http.get<{message: string, height: number}>(this.beUrl+'blockheight', { headers: this.reqHeaders, params: this.params });
|
let obs = this.http.get<{message: string, height: number}>(this.beUrl+'api/blockheight', { headers: this.reqHeaders });
|
||||||
obs.subscribe((BlockData) => {
|
obs.subscribe((BlockData) => {
|
||||||
this.dataStore.height = BlockData.height;
|
this.dataStore.height = BlockData.height;
|
||||||
this._heightUpdated.next(Object.assign({}, this.dataStore).height);
|
this._heightUpdated.next(Object.assign({}, this.dataStore).height);
|
||||||
|
@ -69,8 +76,8 @@ export class FullnodeService{
|
||||||
|
|
||||||
getPrice(currency: string){
|
getPrice(currency: string){
|
||||||
//var currency = 'usd';
|
//var currency = 'usd';
|
||||||
const params = this.params.append('currency', currency);
|
const params = new HttpParams().append('currency', currency);
|
||||||
let obs = this.http.get<{message: string, price: any}>(this.beUrl+'price', { headers:this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.get<{message: string, price: any}>(this.beUrl+'api/price', { headers:this.reqHeaders, params: params, observe: 'response'});
|
||||||
obs.subscribe((PriceData) => {
|
obs.subscribe((PriceData) => {
|
||||||
if (PriceData.status == 200) {
|
if (PriceData.status == 200) {
|
||||||
this.dataStore.price = PriceData.body!.price.price;
|
this.dataStore.price = PriceData.body!.price.price;
|
||||||
|
@ -85,7 +92,7 @@ export class FullnodeService{
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddr() {
|
getAddr() {
|
||||||
let obs = this.http.get<{message: string, addr: string}>(this.beUrl+'getaddr', { headers: this.reqHeaders, params: this.params });
|
let obs = this.http.get<{message: string, addr: string}>(this.beUrl+'api/getaddr', { headers: this.reqHeaders });
|
||||||
|
|
||||||
obs.subscribe((AddrData) => {
|
obs.subscribe((AddrData) => {
|
||||||
this.dataStore.addr = AddrData.addr;
|
this.dataStore.addr = AddrData.addr;
|
||||||
|
|
|
@ -4,11 +4,12 @@ import { FullnodeService } from '../fullnode.service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { UserService } from '../user.service';
|
import { UserService } from '../user.service';
|
||||||
import { CancelComponent } from '../cancel/cancel.component';
|
import { CancelComponent } from '../cancel/cancel.component';
|
||||||
import { Observable } from 'rxjs';
|
import { Subscription, Observable } from 'rxjs';
|
||||||
|
|
||||||
import {Owner} from '../owner.model';
|
import {Owner} from '../owner.model';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-header',
|
selector: 'app-header',
|
||||||
|
@ -28,14 +29,25 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
|
private session: string | null = '';
|
||||||
public heightUpdate: Observable<number>;
|
public heightUpdate: Observable<number>;
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
public uZaddrUpdate: Observable<string>;
|
public uZaddrUpdate: Observable<string>;
|
||||||
|
@ -87,14 +99,14 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
msg1: this.vE.headerLogoutMsg1,
|
msg1: this.vE.headerLogoutMsg1,
|
||||||
msg2: this.vE.headerLogoutMsg2 };
|
msg2: this.vE.headerLogoutMsg2 };
|
||||||
|
|
||||||
//console.log(dialogConfig.data);
|
console.log(dialogConfig.data);
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(CancelComponent, dialogConfig);
|
const dialogRef = this.dialog.open(CancelComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe(val => {
|
dialogRef.afterClosed().subscribe(val => {
|
||||||
if(val){
|
if(val){
|
||||||
// console.log('Logout!');
|
// console.log('Logout!');
|
||||||
this.userService.deleteUser().subscribe(UserResponse => {
|
this.userService.deleteUser().subscribe(UserResponse => {
|
||||||
//console.log('Rerouting');
|
console.log('Rerouting');
|
||||||
this.userService.findUser();
|
this.userService.findUser();
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
});
|
});
|
||||||
|
@ -103,13 +115,13 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('HEADER.chgUILanguage Called ');
|
console.log('HEADER.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('header').subscribe({
|
this.languageService.getViewElements('header').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.headerLastBlock = response.data.header_last_block;
|
this.vE.headerLastBlock = response.data.header_last_block;
|
||||||
this.vE.headerGetCurrency = response.data.header_get_currency;
|
this.vE.headerGetCurrency = response.data.header_get_currency;
|
||||||
|
@ -118,8 +130,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
this.vE.headerLogoutMsg2 = response.data.header_logout_msg2;
|
this.vE.headerLogoutMsg2 = response.data.header_logout_msg2;
|
||||||
|
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,14 +89,14 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div style="height: 15px;"></div>
|
<div style="height: 15px;"></div>
|
||||||
<div *ngIf="!order.paid" width="100%"
|
<div width="100%"
|
||||||
style="font-size: 14px;
|
style="font-size: 14px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-align: center;">
|
text-align: center;">
|
||||||
{{ vE.invoiceScanQrcode }}
|
{{ vE.invoiceScanQrcode }}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!order.paid" style="text-align: center;
|
<div style="text-align: center;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
line-height: 30px;">
|
line-height: 30px;">
|
||||||
<div style="font-family: 'Spartan';
|
<div style="font-family: 'Spartan';
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { faCheck, faHourglass, faArrowUpRightFromSquare } from '@fortawesome/fre
|
||||||
import { NotifierService } from '../notifier.service';
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
var QRCode = require('easyqrcodejs');
|
var QRCode = require('easyqrcodejs');
|
||||||
var URLSafeBase64 = require('urlsafe-base64');
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
|
@ -25,12 +26,11 @@ export class InvoiceComponent implements OnInit {
|
||||||
faHourglass = faHourglass;
|
faHourglass = faHourglass;
|
||||||
faArrowUpRightFromSquare = faArrowUpRightFromSquare;
|
faArrowUpRightFromSquare = faArrowUpRightFromSquare;
|
||||||
orderId;
|
orderId;
|
||||||
orderToken: string = '';
|
|
||||||
public orderUpdate: Observable<Order>;
|
public orderUpdate: Observable<Order>;
|
||||||
public nameUpdate: Observable<string>;
|
public nameUpdate: Observable<string>;
|
||||||
name: string = '';
|
name: string = '';
|
||||||
error: boolean = false;
|
error: boolean = false;
|
||||||
codeString: string = '';
|
codeString: string = 'Test';
|
||||||
invString: string = '';
|
invString: string = '';
|
||||||
public isWCOrder : boolean = false;
|
public isWCOrder : boolean = false;
|
||||||
zcashUrl: SafeUrl = '';
|
zcashUrl: SafeUrl = '';
|
||||||
|
@ -48,7 +48,6 @@ export class InvoiceComponent implements OnInit {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -99,17 +98,13 @@ export class InvoiceComponent implements OnInit {
|
||||||
private languageService : LanguageService
|
private languageService : LanguageService
|
||||||
) {
|
) {
|
||||||
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
||||||
this._ActiveRoute.queryParams.subscribe((params) => {
|
console.log('constructor - orderId -> ' + this.orderId);
|
||||||
this.orderToken = params["token"];
|
this.orderUpdate = receiptService.orderUpdate;
|
||||||
receiptService.getOrderById(this.orderId!, this.orderToken!).subscribe(response => {
|
this.nameUpdate = receiptService.nameUpdate;
|
||||||
|
receiptService.getOrderById(this.orderId!).subscribe(response => {
|
||||||
if (response.status == 200){
|
if (response.status == 200){
|
||||||
this.error = false;
|
this.error = false;
|
||||||
if( response.body!.order.session.substring(0,1) == 'X') {
|
|
||||||
this.invString = response.body!.order.externalInvoice;
|
|
||||||
this.codeString = `zcash:${this.order.address}?amount=${this.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId!).concat(" Invoice: ").concat(this.invString)))}`;
|
|
||||||
} else {
|
|
||||||
this.codeString = `zcash:${response.body!.order.address}?amount=${response.body!.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId!)))}`;
|
this.codeString = `zcash:${response.body!.order.address}?amount=${response.body!.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId!)))}`;
|
||||||
}
|
|
||||||
var qrcode = new QRCode(document.getElementById("payment-qr"), {
|
var qrcode = new QRCode(document.getElementById("payment-qr"), {
|
||||||
text: this.codeString,
|
text: this.codeString,
|
||||||
logo: "/assets/zcash.png",
|
logo: "/assets/zcash.png",
|
||||||
|
@ -120,21 +115,21 @@ export class InvoiceComponent implements OnInit {
|
||||||
correctLevel: QRCode.CorrectLevel.H
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
});
|
});
|
||||||
this.error = false;
|
this.error = false;
|
||||||
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
|
||||||
} else {
|
} else {
|
||||||
this.error = true;
|
this.error = true;
|
||||||
this.codeString = 'Test';
|
this.codeString = 'Test';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
//console.log('constructor - orderId -> ' + this.orderId);
|
|
||||||
this.orderUpdate = receiptService.orderUpdate;
|
|
||||||
this.nameUpdate = receiptService.nameUpdate;
|
|
||||||
this.orderUpdate.subscribe(order => {
|
this.orderUpdate.subscribe(order => {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
if ( order.session.substring(0,1) == 'W') {
|
if ( order.session.substring(0,1) == 'W') {
|
||||||
this.isWCOrder = true;
|
this.isWCOrder = true;
|
||||||
}
|
}
|
||||||
|
if( order.session.substring(0,1) == 'X') {
|
||||||
|
this.invString = order.externalInvoice;
|
||||||
|
}
|
||||||
|
this.codeString = `zcash:${this.order.address}?amount=${this.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId!).concat(" Invoice: ").concat(this.invString)))}`;
|
||||||
|
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
||||||
});
|
});
|
||||||
this.nameUpdate.subscribe(name => {
|
this.nameUpdate.subscribe(name => {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
<p class="rv_price"
|
<p class="rv_price"
|
||||||
*ngIf="owner.zats">
|
*ngIf="owner.zats">
|
||||||
ⓩ {{ ((item.cost/zecPrice)*100000000).toString().substring( 0, ((item.cost/zecPrice)*100000000 ).toString().indexOf('.')) }} [{{item.cost | number: '1.02' | currency: getCurrency() }}]
|
ⓩ{{(item.cost/zecPrice)*100000000 | number: '1.0-0'}}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Input, Component, OnInit } from '@angular/core';
|
import { Input, Inject, Component, OnInit } from '@angular/core';
|
||||||
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
||||||
|
|
||||||
import { faCartShopping } from '@fortawesome/free-solid-svg-icons';
|
import { faCartShopping } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
@ -17,6 +17,7 @@ import { ItemAddComponent } from '../item-add/item-add.component';
|
||||||
import { NotifierService } from '../../notifier.service';
|
import { NotifierService } from '../../notifier.service';
|
||||||
|
|
||||||
import { LanguageService } from '../../language.service';
|
import { LanguageService } from '../../language.service';
|
||||||
|
import { LanguageData } from '../../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-item-list',
|
selector: 'app-item-list',
|
||||||
|
@ -41,13 +42,23 @@ export class ItemListComponent implements OnInit{
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
|
@ -65,7 +76,6 @@ export class ItemListComponent implements OnInit{
|
||||||
itemlistNotifClose : '',
|
itemlistNotifClose : '',
|
||||||
itemlistNotifSuccess : ''
|
itemlistNotifSuccess : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -109,7 +119,7 @@ export class ItemListComponent implements OnInit{
|
||||||
if(val != null) {
|
if(val != null) {
|
||||||
var item:Item = {_id: '', name: val.name, description: val.description, cost: val.cost, owner: this.owner.address};
|
var item:Item = {_id: '', name: val.name, description: val.description, cost: val.cost, owner: this.owner.address};
|
||||||
this.itemService.addItem(item);
|
this.itemService.addItem(item);
|
||||||
//console.log('creando item y llamando a notifier >>>');
|
console.log('creando item y llamando a notifier >>>');
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(this.vE.itemlistItemAdded ,
|
.showNotification(this.vE.itemlistItemAdded ,
|
||||||
this.vE.itemlistNotifClose,
|
this.vE.itemlistNotifClose,
|
||||||
|
@ -132,7 +142,7 @@ export class ItemListComponent implements OnInit{
|
||||||
dialogConfig.disableClose = true;
|
dialogConfig.disableClose = true;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
dialogConfig.data = item;
|
dialogConfig.data = item;
|
||||||
//console.log('Entrando a dialogo de edicion')
|
console.log('Entrando a dialogo de edicion')
|
||||||
const dialogRef = this.dialog.open(ItemEditComponent, dialogConfig);
|
const dialogRef = this.dialog.open(ItemEditComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe((val) => {
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
|
@ -143,8 +153,8 @@ export class ItemListComponent implements OnInit{
|
||||||
cost: val.cost,
|
cost: val.cost,
|
||||||
owner: this.owner.address
|
owner: this.owner.address
|
||||||
};
|
};
|
||||||
//console.log('Edit:', editItem);
|
console.log('Edit:', editItem);
|
||||||
//console.log('itemlistItemUpdated = ' + this.vE.itemlistItemUpdated);
|
console.log('itemlistItemUpdated = ' + this.vE.itemlistItemUpdated);
|
||||||
this.itemService.addItem(editItem).subscribe((response) => {
|
this.itemService.addItem(editItem).subscribe((response) => {
|
||||||
this.itemService.getItems(this.owner.address);
|
this.itemService.getItems(this.owner.address);
|
||||||
});
|
});
|
||||||
|
@ -203,7 +213,7 @@ export class ItemListComponent implements OnInit{
|
||||||
const dialogRef = this.dialog.open(ItemAddComponent, dialogConfig);
|
const dialogRef = this.dialog.open(ItemAddComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe((val) => {
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
//console.log('Adding to order', val);
|
console.log('Adding to order', val);
|
||||||
this.orderService.addToOrder(val);
|
this.orderService.addToOrder(val);
|
||||||
}
|
}
|
||||||
this.itemService.getItems(this.owner.address);
|
this.itemService.getItems(this.owner.address);
|
||||||
|
@ -215,13 +225,13 @@ export class ItemListComponent implements OnInit{
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('ITEMLIST.chgUILanguage Called ');
|
console.log('ITEMLIST.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('itemlist').subscribe({next:
|
this.languageService.getViewElements('itemlist').subscribe(
|
||||||
response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.itemlistListEmpty = response.data.itemlist_list_empty;
|
this.vE.itemlistListEmpty = response.data.itemlist_list_empty;
|
||||||
this.vE.itemlistAvailItems = response.data.itemlist_avail_items;
|
this.vE.itemlistAvailItems = response.data.itemlist_avail_items;
|
||||||
|
@ -231,9 +241,8 @@ export class ItemListComponent implements OnInit{
|
||||||
this.vE.itemlistNotifClose = response.data.itemlist_notif_close;
|
this.vE.itemlistNotifClose = response.data.itemlist_notif_close;
|
||||||
this.vE.itemlistNotifSuccess = response.data.itemlist_notif_success;
|
this.vE.itemlistNotifSuccess = response.data.itemlist_notif_success;
|
||||||
},
|
},
|
||||||
error:
|
|
||||||
error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Item } from './item.model';
|
import { Item } from './item.model';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { Subject, BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
import { ConfigData } from '../configdata';
|
import { ConfigData } from '../configdata';
|
||||||
|
@ -10,29 +10,27 @@ var Buffer = require('buffer/').Buffer;
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({providedIn: 'root'})
|
||||||
|
|
||||||
export class ItemService{
|
export class ItemService{
|
||||||
|
// beUrl = 'https://test.zgo.cash/';
|
||||||
|
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
|
|
||||||
|
// console.log(ConfigData.Be_URL);
|
||||||
|
|
||||||
private dataStore: { items: Item[] } = { items: [] } ;
|
private dataStore: { items: Item[] } = { items: [] } ;
|
||||||
private _itemsUpdated: BehaviorSubject<Item[]> = new BehaviorSubject(this.dataStore.items);
|
private _itemsUpdated: BehaviorSubject<Item[]> = new BehaviorSubject(this.dataStore.items);
|
||||||
public readonly itemsUpdated: Observable<Item[]> = this._itemsUpdated.asObservable();
|
public readonly itemsUpdated: Observable<Item[]> = this._itemsUpdated.asObservable();
|
||||||
private address:string = '';
|
private address:string = '';
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private session: null|string;
|
|
||||||
private params: HttpParams;
|
|
||||||
|
|
||||||
constructor(private http: HttpClient){
|
constructor(private http: HttpClient){
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.session = localStorage.getItem('s4z_token');
|
|
||||||
this.params = new HttpParams().append('session', this.session!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getItems(addr: string){
|
getItems(addr: string){
|
||||||
this.address = addr;
|
this.address = addr;
|
||||||
const newParams = this.params.append('address', addr);
|
const params = new HttpParams().append('address', addr);
|
||||||
let obs = this.http.get<{message: string, items: any}>(this.beUrl+'api/items', { headers:this.reqHeaders, params: newParams, observe: 'response'});
|
let obs = this.http.get<{message: string, items: any}>(this.beUrl+'api/items', { headers:this.reqHeaders, params: params, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((ItemDataResponse) => {
|
obs.subscribe((ItemDataResponse) => {
|
||||||
if (ItemDataResponse.status == 200 ) {
|
if (ItemDataResponse.status == 200 ) {
|
||||||
|
@ -41,6 +39,7 @@ export class ItemService{
|
||||||
} else {
|
} else {
|
||||||
this.dataStore.items = [];
|
this.dataStore.items = [];
|
||||||
this._itemsUpdated.next(Object.assign({},this.dataStore).items);
|
this._itemsUpdated.next(Object.assign({},this.dataStore).items);
|
||||||
|
// console.log('No items found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -48,9 +47,11 @@ export class ItemService{
|
||||||
}
|
}
|
||||||
|
|
||||||
addItem(item: Item) {
|
addItem(item: Item) {
|
||||||
let obs = this.http.post<{message: string}>(this.beUrl+'api/item', { payload: item }, { headers: this.reqHeaders, params: this.params });
|
//const params = new HttpParams().append('item', JSON.stringify(item));
|
||||||
|
let obs = this.http.post<{message: string}>(this.beUrl+'api/item', { payload: item }, { headers: this.reqHeaders });
|
||||||
|
|
||||||
obs.subscribe(() => {
|
obs.subscribe((ItemResponse) => {
|
||||||
|
// console.log('Item added');
|
||||||
this.getItems(this.address);
|
this.getItems(this.address);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,9 +59,10 @@ export class ItemService{
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteItem(id: string) {
|
deleteItem(id: string) {
|
||||||
let obs = this.http.delete<{message: string}>(this.beUrl+'api/item/'+id, { headers: this.reqHeaders, params: this.params });
|
let obs = this.http.delete<{message: string}>(this.beUrl+'api/item/'+id, { headers: this.reqHeaders });
|
||||||
|
|
||||||
obs.subscribe(() => {
|
obs.subscribe((ItemResponse) => {
|
||||||
|
// console.log('Item deleted');
|
||||||
this.getItems(this.address);
|
this.getItems(this.address);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,18 +19,10 @@ export class LanguageService {
|
||||||
//
|
//
|
||||||
// URL for access MongoDB database from remote server
|
// URL for access MongoDB database from remote server
|
||||||
private baseURL = ConfigData.Be_URL + 'api/getlang';
|
private baseURL = ConfigData.Be_URL + 'api/getlang';
|
||||||
private loginURL = ConfigData.Be_URL + 'getloginlang';
|
|
||||||
private mainURL = ConfigData.Be_URL + 'getmainlang';
|
|
||||||
private scanURL = ConfigData.Be_URL + 'getscanlang';
|
|
||||||
private invoiceURL = ConfigData.Be_URL + 'getinvoicelang';
|
|
||||||
private pmtservURL = ConfigData.Be_URL + 'getpmtservicelang';
|
|
||||||
|
|
||||||
public zgoLanguage: string = '';
|
public zgoLanguage: string = '';
|
||||||
|
|
||||||
private session: string|null = '';
|
|
||||||
|
|
||||||
constructor(private http:HttpClient) {
|
constructor(private http:HttpClient) {
|
||||||
this.session = localStorage.getItem('s4z_token');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getViewElements ( viewName:string ) {
|
getViewElements ( viewName:string ) {
|
||||||
|
@ -53,25 +45,10 @@ export class LanguageService {
|
||||||
//
|
//
|
||||||
// Get component's text data from language database
|
// Get component's text data from language database
|
||||||
//
|
//
|
||||||
const params = new HttpParams().append('session', this.session!);
|
|
||||||
if (viewName === 'login') {
|
|
||||||
return this.http.get<LanguageData>(this.loginURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
|
||||||
} else if (viewName === 'main') {
|
|
||||||
return this.http.get<LanguageData>(this.mainURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
|
||||||
} else if (viewName === 'scan') {
|
|
||||||
return this.http.get<LanguageData>(this.scanURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
|
||||||
} else if (viewName === 'invoice') {
|
|
||||||
return this.http.get<LanguageData>(this.invoiceURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
|
||||||
} else if (viewName === 'pmtservice') {
|
|
||||||
return this.http.get<LanguageData>(this.pmtservURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
|
||||||
} else {
|
|
||||||
return this.http.get<LanguageData>(this.baseURL +
|
return this.http.get<LanguageData>(this.baseURL +
|
||||||
'/?lang=' + this.zgoLanguage +
|
'/?lang=' + this.zgoLanguage +
|
||||||
'&component=' + viewName
|
'&component=' + viewName
|
||||||
,{ headers : reqHeaders
|
,{ headers : reqHeaders }
|
||||||
, params: params
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -129,8 +129,8 @@ img.icon{
|
||||||
.minibutton {
|
.minibutton {
|
||||||
font-family: 'Spartan', sans-serif;
|
font-family: 'Spartan', sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
/*background: #ff5722;*/
|
background: #ff5722;
|
||||||
/*color: white;*/
|
color: white;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{{ vE.listordersEndDate }}{{(ownerUpdate | async)!.expiration | date: 'YYYY-MM-dd'}}
|
{{ vE.listordersEndDate }}{{(ownerUpdate | async)!.expiration | date: 'YYYY-MM-dd'}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button mat-icon-button color="primary" (click)="paySession()">
|
<button mat-icon-button color="primary">
|
||||||
<mat-icon class="icon">queue</mat-icon>
|
<mat-icon class="icon">queue</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -162,10 +162,10 @@
|
||||||
padding-right: 20%;
|
padding-right: 20%;
|
||||||
margin-top: 10px;">
|
margin-top: 10px;">
|
||||||
<span>
|
<span>
|
||||||
<button mat-raised-button class="minibutton" color="primary" (click)="invoice(order)">{{ vE.listordersInvoiceBtn }}</button>
|
<button mat-stroked-button class="minibutton" color="primary" (click)="invoice(order)">{{ vE.listordersInvoiceBtn }}</button>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<button mat-raised-button class="minibutton" color="primary" (click)="receipt(order)">{{ vE.listordersReceiptBtn }}</button>
|
<button mat-stroked-button class="minibutton" color="primary" (click)="receipt(order)">{{ vE.listordersReceiptBtn }}</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { Order } from '../order/order.model';
|
||||||
import { FullnodeService } from '../fullnode.service';
|
import { FullnodeService } from '../fullnode.service';
|
||||||
import { UserService } from '../user.service';
|
import { UserService } from '../user.service';
|
||||||
import { Owner } from '../owner.model';
|
import { Owner } from '../owner.model';
|
||||||
import { User } from '../user.model';
|
|
||||||
import { OrderService } from '../order/order.service';
|
import { OrderService } from '../order/order.service';
|
||||||
|
|
||||||
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
||||||
|
@ -20,7 +19,7 @@ import { faHourglass } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
import {SessionpayComponent} from '../sessionpay/sessionpay.component';
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-orders',
|
selector: 'app-list-orders',
|
||||||
|
@ -54,20 +53,24 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
zecPrice: number = 1;
|
|
||||||
nodeAddress: string = '';
|
|
||||||
session: string = '';
|
|
||||||
addrUpdate: Observable<string>;
|
|
||||||
priceUpdate: Observable<number>;
|
|
||||||
userUpdate: Observable<User>;
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -94,24 +97,11 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
private languageService : LanguageService,
|
private languageService : LanguageService,
|
||||||
public orderService: OrderService,
|
public orderService: OrderService,
|
||||||
public userService: UserService,
|
public userService: UserService,
|
||||||
public fullnodeService: FullnodeService,
|
|
||||||
private dialog: MatDialog)
|
private dialog: MatDialog)
|
||||||
{
|
{
|
||||||
this.ownerUpdate = userService.ownerUpdate;
|
this.ownerUpdate = userService.ownerUpdate;
|
||||||
this.userUpdate = userService.userUpdate;
|
|
||||||
this.orderService.getAllOrders();
|
this.orderService.getAllOrders();
|
||||||
this.ordersUpdate = orderService.allOrdersUpdate;
|
this.ordersUpdate = orderService.allOrdersUpdate;
|
||||||
this.addrUpdate = fullnodeService.addrUpdate;
|
|
||||||
this.priceUpdate = fullnodeService.priceUpdate;
|
|
||||||
this.priceUpdate.subscribe(price => {
|
|
||||||
this.zecPrice = price;
|
|
||||||
});
|
|
||||||
this.addrUpdate.subscribe(nAddress => {
|
|
||||||
this.nodeAddress = nAddress;
|
|
||||||
});
|
|
||||||
this.userUpdate.subscribe(user => {
|
|
||||||
this.session = user.session;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
|
@ -129,7 +119,7 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
this.orders = orders;
|
this.orders = orders;
|
||||||
|
|
||||||
//console.log(this.ownerUpdate);
|
console.log(this.ownerUpdate);
|
||||||
for (let i=0; i < this.orders.length; i++){
|
for (let i=0; i < this.orders.length; i++){
|
||||||
this.total += this.orders[i].totalZec;
|
this.total += this.orders[i].totalZec;
|
||||||
//
|
//
|
||||||
|
@ -173,8 +163,7 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
dialogConfig.disableClose = true;
|
dialogConfig.disableClose = true;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
dialogConfig.data = {
|
dialogConfig.data = {
|
||||||
orderId: order._id,
|
orderId: order._id
|
||||||
orderToken: order.token
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(PromptInvoiceComponent, dialogConfig);
|
const dialogRef = this.dialog.open(PromptInvoiceComponent, dialogConfig);
|
||||||
|
@ -195,8 +184,7 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
dialogConfig.disableClose = true;
|
dialogConfig.disableClose = true;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
dialogConfig.data = {
|
dialogConfig.data = {
|
||||||
orderId: order._id,
|
orderId: order._id
|
||||||
orderToken: order.token
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(PromptReceiptComponent, dialogConfig);
|
const dialogRef = this.dialog.open(PromptReceiptComponent, dialogConfig);
|
||||||
|
@ -208,7 +196,7 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
openDbExport(){
|
openDbExport(){
|
||||||
const dialogConfig = new MatDialogConfig();
|
const dialogConfig = new MatDialogConfig();
|
||||||
|
|
||||||
//console.log('openDbExport ---');
|
console.log('openDbExport ---');
|
||||||
|
|
||||||
dialogConfig.disableClose = false;
|
dialogConfig.disableClose = false;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
|
@ -222,13 +210,13 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('LISTORDERS.chgUILanguage Called ');
|
console.log('LISTORDERS.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('listorders').subscribe({
|
this.languageService.getViewElements('listorders').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.listordersBacktoshopBtn = response.data.listorders_backtoshop_btn;
|
this.vE.listordersBacktoshopBtn = response.data.listorders_backtoshop_btn;
|
||||||
this.vE.listordersExportOrders = response.data.listorders_export_orders;
|
this.vE.listordersExportOrders = response.data.listorders_export_orders;
|
||||||
|
@ -245,21 +233,8 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
this.vE.listordersEndDate = response.data.listorders_end_date;
|
this.vE.listordersEndDate = response.data.listorders_end_date;
|
||||||
|
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
paySession() {
|
|
||||||
const dialogConfig = new MatDialogConfig();
|
|
||||||
|
|
||||||
dialogConfig.disableClose = true;
|
|
||||||
dialogConfig.autoFocus = true;
|
|
||||||
dialogConfig.data = {
|
|
||||||
addr: this.nodeAddress,
|
|
||||||
session: this.session,
|
|
||||||
zecPrice: this.zecPrice
|
|
||||||
};
|
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(SessionpayComponent, dialogConfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, OnInit, ChangeDetectorRef, ViewChild, AfterViewInit } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Injectable, ChangeDetectorRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot, ActivatedRoute } from '@angular/router';
|
||||||
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
||||||
import { UntypedFormBuilder, Validators, UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
|
||||||
import { ProgressBarMode } from '@angular/material/progress-bar';
|
import { ProgressBarMode } from '@angular/material/progress-bar';
|
||||||
import { MatStepper } from '@angular/material/stepper';
|
import { MatStepper } from '@angular/material/stepper';
|
||||||
import { UserService } from '../user.service';
|
import { UserService } from '../user.service';
|
||||||
|
@ -11,9 +11,15 @@ import { Tx } from '../tx.model';
|
||||||
import { User } from '../user.model';
|
import { User } from '../user.model';
|
||||||
import { Owner } from '../owner.model';
|
import { Owner } from '../owner.model';
|
||||||
import { Subscription, Observable } from 'rxjs';
|
import { Subscription, Observable } from 'rxjs';
|
||||||
|
import { take } from 'rxjs/operators';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
|
var QRCode = require('easyqrcodejs');
|
||||||
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
|
var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
|
@ -43,13 +49,23 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
taxValue:0,
|
taxValue:0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
private FullnodeSub: Subscription = new Subscription();
|
private FullnodeSub: Subscription = new Subscription();
|
||||||
private UserSub: Subscription = new Subscription();
|
private UserSub: Subscription = new Subscription();
|
||||||
|
@ -57,7 +73,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
public uZaddrUpdate: Observable<string>;
|
public uZaddrUpdate: Observable<string>;
|
||||||
public userUpdate: Observable<User>;
|
public userUpdate: Observable<User>;
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
//public txsUpdate: Observable<Tx[]>;
|
public txsUpdate: Observable<Tx[]>;
|
||||||
prompt: boolean = false;
|
prompt: boolean = false;
|
||||||
confirmedMemo: boolean = false;
|
confirmedMemo: boolean = false;
|
||||||
targetBlock: number = 0;
|
targetBlock: number = 0;
|
||||||
|
@ -66,6 +82,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
barMessage = 'Scanning blockchain for login memo, please wait.';
|
barMessage = 'Scanning blockchain for login memo, please wait.';
|
||||||
@ViewChild('stepper') private myStepper?: MatStepper;
|
@ViewChild('stepper') private myStepper?: MatStepper;
|
||||||
|
|
||||||
|
entryForm: UntypedFormGroup;
|
||||||
pinForm: UntypedFormGroup;
|
pinForm: UntypedFormGroup;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -95,6 +112,9 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
){
|
){
|
||||||
|
|
||||||
//this.fullnodeService.getAddr();
|
//this.fullnodeService.getAddr();
|
||||||
|
this.entryForm = fb.group({
|
||||||
|
selectedSession: [0.001, Validators.required]
|
||||||
|
});
|
||||||
this.pinForm = fb.group({
|
this.pinForm = fb.group({
|
||||||
pinValue: [null, Validators.required]
|
pinValue: [null, Validators.required]
|
||||||
});
|
});
|
||||||
|
@ -108,10 +128,10 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
this.ownerUpdate.subscribe((owner) => {
|
this.ownerUpdate.subscribe((owner) => {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
});
|
});
|
||||||
//this.txsUpdate = userService.txUpdate;
|
this.txsUpdate = userService.txUpdate;
|
||||||
//this.txsUpdate.subscribe((txs) => {
|
this.txsUpdate.subscribe((txs) => {
|
||||||
//this.txs = txs;
|
this.txs = txs;
|
||||||
//});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(){
|
ngAfterViewInit(){
|
||||||
|
@ -138,16 +158,16 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
this.intervalHolder = setInterval(() => {
|
this.intervalHolder = setInterval(() => {
|
||||||
this.fullnodeService.getHeight();
|
this.fullnodeService.getHeight();
|
||||||
|
//this.userService.findUser();
|
||||||
this.loginCheck();
|
this.loginCheck();
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
}, 1000 * 60);
|
}, 1000 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
loginCheck(){
|
loginCheck(){
|
||||||
this.userService.checkUser()!.subscribe({
|
this.userService.findUser();
|
||||||
next: (checkResponse) => {
|
this.userUpdate.subscribe((user) => {
|
||||||
if (checkResponse.status == 200) {
|
if (user.blocktime > 0) {
|
||||||
console.log('checkUser true');
|
|
||||||
if(this.myStepper!.selectedIndex === 0) {
|
if(this.myStepper!.selectedIndex === 0) {
|
||||||
this.myStepper!.next();
|
this.myStepper!.next();
|
||||||
this.myStepper!.next();
|
this.myStepper!.next();
|
||||||
|
@ -156,17 +176,16 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
this.myStepper!.next();
|
this.myStepper!.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(checkResponse.body!.validated) {
|
//console.log('Log in found in blockchain!');
|
||||||
console.log('redirecting to biz');
|
if (user.validated) {
|
||||||
this.userService.getOwner();
|
|
||||||
this.router.navigate(['/biz']);
|
|
||||||
clearInterval(this.intervalHolder);
|
clearInterval(this.intervalHolder);
|
||||||
|
if (this.owner.paid) {
|
||||||
|
this.router.navigate(['/shop']);
|
||||||
} else {
|
} else {
|
||||||
console.log('validated failed');
|
this.router.navigate(['/biz']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
error: (error) => {console.log(error);}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,13 +229,13 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('LOGIN.chgUILanguage Called ');
|
console.log('LOGIN.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('login').subscribe(
|
this.languageService.getViewElements('login').subscribe(
|
||||||
response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.loginLastBlock = response.data.login_last_block;
|
this.vE.loginLastBlock = response.data.login_last_block;
|
||||||
this.vE.loginConnectToZGo = response.data.login_connect_to_zgo;
|
this.vE.loginConnectToZGo = response.data.login_connect_to_zgo;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot } from '@angular/router';
|
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { catchError } from 'rxjs/operators';
|
import { catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@ import { FullnodeService} from './fullnode.service';
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
|
|
||||||
export class NodeResolverService {
|
export class NodeResolverService implements Resolve<any> {
|
||||||
constructor(private fullnode: FullnodeService) {}
|
constructor(private fullnode: FullnodeService) {}
|
||||||
|
|
||||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||||
//console.log('Called getAddr in resolver...', route);
|
console.log('Called getAddr in resolver...', route);
|
||||||
return this.fullnode.getAddr().pipe(
|
return this.fullnode.getAddr().pipe(
|
||||||
catchError(() => {
|
catchError(error => {
|
||||||
return of('No data');
|
return of('No data');
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -47,7 +47,6 @@ export class OrderComponent implements OnInit{
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -107,7 +106,7 @@ export class OrderComponent implements OnInit{
|
||||||
this.orderUpdate.subscribe((order) => {
|
this.orderUpdate.subscribe((order) => {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
|
|
||||||
//console.log('this.order > ' + JSON.stringify(this.order));
|
console.log('this.order > ' + JSON.stringify(this.order));
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
this.oLines = [];
|
this.oLines = [];
|
||||||
this.myLines = this.order.lines;
|
this.myLines = this.order.lines;
|
||||||
|
@ -151,7 +150,7 @@ export class OrderComponent implements OnInit{
|
||||||
const dialogRef = this.dialog.open(CancelComponent, dialogConfig);
|
const dialogRef = this.dialog.open(CancelComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe((val) => {
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
//console.log('Canceling');
|
console.log('Canceling');
|
||||||
this.orderService.cancelOrder(this.order._id!).subscribe((response) => {
|
this.orderService.cancelOrder(this.order._id!).subscribe((response) => {
|
||||||
this.orderService.getOrder();
|
this.orderService.getOrder();
|
||||||
this.notifierService
|
this.notifierService
|
||||||
|
@ -160,10 +159,9 @@ export class OrderComponent implements OnInit{
|
||||||
'success',
|
'success',
|
||||||
this.vE.orderNotservSuccess);
|
this.vE.orderNotservSuccess);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.log('Returning to page');
|
||||||
}
|
}
|
||||||
//else {
|
|
||||||
//console.log('Returning to page');
|
|
||||||
//}
|
|
||||||
this.orderService.getOrder();
|
this.orderService.getOrder();
|
||||||
this.oLines = [];
|
this.oLines = [];
|
||||||
});
|
});
|
||||||
|
@ -214,11 +212,10 @@ export class OrderComponent implements OnInit{
|
||||||
dialogConfig.disableClose = true;
|
dialogConfig.disableClose = true;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
dialogConfig.data = {
|
dialogConfig.data = {
|
||||||
orderId: this.order._id,
|
orderId: this.order._id
|
||||||
orderToken: this.order.token
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.log ('order_id : ' + this.order._id);
|
console.log ('order_id : ' + this.order._id);
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(PromptInvoiceComponent, dialogConfig);
|
const dialogRef = this.dialog.open(PromptInvoiceComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe((val) => {
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
|
@ -279,13 +276,13 @@ export class OrderComponent implements OnInit{
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('ORDER.chgUILanguage Called ');
|
console.log('ORDER.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('order').subscribe({
|
this.languageService.getViewElements('order').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.orderNoOpenorder = response.data.order_no_openorder;
|
this.vE.orderNoOpenorder = response.data.order_no_openorder;
|
||||||
this.vE.orderCancelOrder = response.data.order_cancel_order;
|
this.vE.orderCancelOrder = response.data.order_cancel_order;
|
||||||
|
@ -305,8 +302,8 @@ export class OrderComponent implements OnInit{
|
||||||
this.vE.orderCheckoutBtn = response.data.order_checkout_btn;
|
this.vE.orderCheckoutBtn = response.data.order_checkout_btn;
|
||||||
|
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,5 @@ export interface Order {
|
||||||
lines: LineItem[],
|
lines: LineItem[],
|
||||||
paid: boolean,
|
paid: boolean,
|
||||||
externalInvoice: string,
|
externalInvoice: string,
|
||||||
shortCode: string,
|
shortCode: string
|
||||||
token: string
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { Subject, BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
||||||
import { Order } from './order.model';
|
import { Order } from './order.model';
|
||||||
import { UserService } from '../user.service';
|
import { UserService } from '../user.service';
|
||||||
|
@ -35,13 +35,23 @@ export class OrderService {
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
address: '',
|
address: '',
|
||||||
|
@ -55,7 +65,6 @@ export class OrderService {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -74,8 +83,6 @@ export class OrderService {
|
||||||
public userUpdate: Observable<User>;
|
public userUpdate: Observable<User>;
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private reqParams: HttpParams;
|
|
||||||
private session: null|string;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
|
@ -83,13 +90,12 @@ export class OrderService {
|
||||||
public userService: UserService
|
public userService: UserService
|
||||||
) {
|
) {
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.session = localStorage.getItem('s4z_token');
|
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.reqParams = new HttpParams().append('session', this.session!);
|
|
||||||
this.userUpdate = userService.userUpdate;
|
this.userUpdate = userService.userUpdate;
|
||||||
this.ownerUpdate = userService.ownerUpdate;
|
this.ownerUpdate = userService.ownerUpdate;
|
||||||
this.userUpdate.subscribe((user) => {
|
this.userUpdate.subscribe((user) => {
|
||||||
this.dataStore.user = user;
|
this.dataStore.user = user;
|
||||||
|
//console.log('OS: const', user);
|
||||||
this.getOrder();
|
this.getOrder();
|
||||||
});
|
});
|
||||||
this.ownerUpdate.subscribe((owner) => {
|
this.ownerUpdate.subscribe((owner) => {
|
||||||
|
@ -98,7 +104,9 @@ export class OrderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrder() {
|
getOrder() {
|
||||||
let obs = this.http.get<{message: string, order: any}>(this.beUrl+'api/order', { headers:this.reqHeaders, params: this.reqParams, observe: 'response'});
|
var session = this.dataStore.user.session;
|
||||||
|
const params = new HttpParams().append('session', session);
|
||||||
|
let obs = this.http.get<{message: string, order: any}>(this.beUrl+'api/order', { headers:this.reqHeaders, params:params, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((OrderDataResponse) => {
|
obs.subscribe((OrderDataResponse) => {
|
||||||
if (OrderDataResponse.status == 200) {
|
if (OrderDataResponse.status == 200) {
|
||||||
|
@ -119,7 +127,7 @@ export class OrderService {
|
||||||
|
|
||||||
getAllOrders(){
|
getAllOrders(){
|
||||||
var address = this.dataStore.user.address;
|
var address = this.dataStore.user.address;
|
||||||
const params = this.reqParams.append('address', address);
|
const params = new HttpParams().append('address', address);
|
||||||
let obs = this.http.get<{message: string, orders: any}>(this.beUrl+'api/allorders', { headers:this.reqHeaders, params:params, observe: 'response'});
|
let obs = this.http.get<{message: string, orders: any}>(this.beUrl+'api/allorders', { headers:this.reqHeaders, params:params, observe: 'response'});
|
||||||
obs.subscribe((OrdersData) => {
|
obs.subscribe((OrdersData) => {
|
||||||
if (OrdersData.status == 200 ){
|
if (OrdersData.status == 200 ){
|
||||||
|
@ -137,7 +145,7 @@ export class OrderService {
|
||||||
addToOrder(lineItem: LineItem) {
|
addToOrder(lineItem: LineItem) {
|
||||||
if(this.dataStore.order._id != null) {
|
if(this.dataStore.order._id != null) {
|
||||||
this.dataStore.order.lines.push(lineItem);
|
this.dataStore.order.lines.push(lineItem);
|
||||||
let obs = this.http.post(this.beUrl+'api/order', { payload: this.dataStore.order }, { headers: this.reqHeaders, params: this.reqParams });
|
let obs = this.http.post(this.beUrl+'api/order', { payload: this.dataStore.order }, { headers: this.reqHeaders });
|
||||||
obs.subscribe((orderData) => {
|
obs.subscribe((orderData) => {
|
||||||
this.getOrder();
|
this.getOrder();
|
||||||
});
|
});
|
||||||
|
@ -160,10 +168,9 @@ export class OrderService {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [lineItem]
|
lines: [lineItem]
|
||||||
};
|
};
|
||||||
let obs = this.http.post<{message: string, order: Order}>(this.beUrl+'api/order', {payload: order}, { headers: this.reqHeaders, params: this.reqParams });
|
let obs = this.http.post<{message: string, order: Order}>(this.beUrl+'api/order', {payload: order}, { headers: this.reqHeaders });
|
||||||
obs.subscribe((orderData) => {
|
obs.subscribe((orderData) => {
|
||||||
console.log('Created order');
|
console.log('Created order');
|
||||||
this.getOrder()
|
this.getOrder()
|
||||||
|
@ -173,7 +180,7 @@ export class OrderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelOrder(id: string) {
|
cancelOrder(id: string) {
|
||||||
let obs = this.http.delete<{message: string}>(this.beUrl+'api/order/'+id, { headers: this.reqHeaders, params: this.reqParams });
|
let obs = this.http.delete<{message: string}>(this.beUrl+'api/order/'+id, { headers: this.reqHeaders });
|
||||||
|
|
||||||
obs.subscribe((OrderResponse) => {
|
obs.subscribe((OrderResponse) => {
|
||||||
console.log('Order deleted');
|
console.log('Order deleted');
|
||||||
|
@ -190,7 +197,6 @@ export class OrderService {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -211,7 +217,7 @@ export class OrderService {
|
||||||
});
|
});
|
||||||
this.dataStore.order.closed = true;
|
this.dataStore.order.closed = true;
|
||||||
this.dataStore.order.paid = paid;
|
this.dataStore.order.paid = paid;
|
||||||
let obs = this.http.post(this.beUrl+'api/order', {payload: this.dataStore.order}, { headers: this.reqHeaders, params: this.reqParams });
|
let obs = this.http.post(this.beUrl+'api/order', {payload: this.dataStore.order}, { headers: this.reqHeaders });
|
||||||
obs.subscribe((orderData) => {
|
obs.subscribe((orderData) => {
|
||||||
console.log('Closed order', orderData);
|
console.log('Closed order', orderData);
|
||||||
this.dataStore.order = {
|
this.dataStore.order = {
|
||||||
|
@ -226,7 +232,6 @@ export class OrderService {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
|
|
@ -7,11 +7,21 @@ export interface Owner {
|
||||||
taxValue: number;
|
taxValue: number;
|
||||||
vat: boolean;
|
vat: boolean;
|
||||||
vatValue: number;
|
vatValue: number;
|
||||||
|
first: string;
|
||||||
|
last: string;
|
||||||
|
email: string;
|
||||||
|
street: string;
|
||||||
|
city: string;
|
||||||
|
state: string;
|
||||||
|
postal: string;
|
||||||
|
phone: string;
|
||||||
paid: boolean;
|
paid: boolean;
|
||||||
|
website: string;
|
||||||
|
country: string;
|
||||||
zats: boolean;
|
zats: boolean;
|
||||||
invoices: boolean;
|
invoices: boolean;
|
||||||
expiration: string;
|
expiration: string;
|
||||||
payconf: boolean;
|
payconf: boolean;
|
||||||
crmToken: string;
|
|
||||||
viewkey: string;
|
viewkey: string;
|
||||||
|
crmToken: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
<div style="height: 50px;">
|
<div style="height: 50px;">
|
||||||
</div>
|
</div>
|
||||||
<div style="font-weight: 700;
|
<div style="font-weight: 700;
|
||||||
fonT-size: 25px;
|
font-size: 25px;
|
||||||
text-align: center;">
|
text-align: center;">
|
||||||
{{ vE.pmtservicePmtsrvNot }}<br>
|
{{ vE.pmtservicePmtsrvNot }}<br>
|
||||||
{{ vE.pmtserviceEnabledFor }}<br>
|
{{ vE.pmtserviceEnabledFor }}<br>
|
||||||
{{ shop }}
|
{{ owner.name}}
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 40px;">
|
<div style="height: 40px;">
|
||||||
</div>
|
</div>
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="invoiceDetail"
|
<div class="invoiceDetail"
|
||||||
*ngIf="reportType==0"
|
*ngIf="reportType==0"
|
||||||
>
|
id="invoice">
|
||||||
<div class="invoiceHdrTxt1">{{ vE.pmtserviceHdrTxt1 }}</div>
|
<div class="invoiceHdrTxt1">{{ vE.pmtserviceHdrTxt1 }}</div>
|
||||||
<div class="invoiceHdrTxt2">{{ vE.pmtserviceHdrTxt2 }}{{orderId}}</div>
|
<div class="invoiceHdrTxt2">{{ vE.pmtserviceHdrTxt2 }}{{orderId}}</div>
|
||||||
<div class="invoiceHdrTxt3">{{ vE.pmtserviceHdrTxt3 }}{{order.timestamp | date}}
|
<div class="invoiceHdrTxt3">{{ vE.pmtserviceHdrTxt3 }}{{order.timestamp | date}}
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td width="25%">
|
<td width="25%">
|
||||||
<div style="text-align: right;"
|
<div style="text-align: right;"
|
||||||
id="invoice-qr"
|
id="payment-qr"
|
||||||
*ngIf="!order.paid"></div>
|
*ngIf="!order.paid"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute} from "@angular/router";
|
import { Router, ActivatedRoute, Params } from "@angular/router";
|
||||||
import { HttpClient, HttpParams, HttpHeaders } from "@angular/common/http";
|
import { HttpClient, HttpParams, HttpHeaders } from "@angular/common/http";
|
||||||
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
import { PmtData } from "./pmtservice.model";
|
import { PmtData } from "./pmtservice.model";
|
||||||
import { XeroInvoice } from "./xeroinvoice.model";
|
import { XeroInvoice } from "./xeroinvoice.model";
|
||||||
|
import { Owner } from '../owner.model';
|
||||||
|
// import { Item } from '../items/item.model'
|
||||||
import { Order } from '../order/order.model'
|
import { Order } from '../order/order.model'
|
||||||
import { ConfigData } from '../configdata';
|
import { ConfigData } from '../configdata';
|
||||||
import { faCheck, faHourglass } from '@fortawesome/free-solid-svg-icons';
|
import { faCheck, faHourglass } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
@ -15,6 +17,7 @@ var URLSafeBase64 = require('urlsafe-base64');
|
||||||
var Buffer = require('buffer/').Buffer;
|
var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-pmtservice',
|
selector: 'app-pmtservice',
|
||||||
|
@ -30,7 +33,6 @@ export class PmtserviceComponent implements OnInit {
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private reqHeaders: HttpHeaders = new HttpHeaders();
|
private reqHeaders: HttpHeaders = new HttpHeaders();
|
||||||
|
|
||||||
public shop: string = '';
|
|
||||||
public pmtData : PmtData = {
|
public pmtData : PmtData = {
|
||||||
ownerId :'',
|
ownerId :'',
|
||||||
invoice: '',
|
invoice: '',
|
||||||
|
@ -53,6 +55,33 @@ export class PmtserviceComponent implements OnInit {
|
||||||
inv_ProcDate : new Date()
|
inv_ProcDate : new Date()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public owner: Owner = {
|
||||||
|
_id: '',
|
||||||
|
address: '',
|
||||||
|
name: '',
|
||||||
|
currency: 'usd',
|
||||||
|
tax: false,
|
||||||
|
taxValue: 0,
|
||||||
|
vat: false,
|
||||||
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
|
zats: false,
|
||||||
|
invoices: false,
|
||||||
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
|
payconf: false,
|
||||||
|
viewkey: '',
|
||||||
|
crmToken: ''
|
||||||
|
};
|
||||||
|
|
||||||
public order: Order = {
|
public order: Order = {
|
||||||
_id : '',
|
_id : '',
|
||||||
|
@ -67,7 +96,6 @@ export class PmtserviceComponent implements OnInit {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -80,10 +108,10 @@ export class PmtserviceComponent implements OnInit {
|
||||||
private invData_raw : string = '';
|
private invData_raw : string = '';
|
||||||
private invData_buff : any = null;
|
private invData_buff : any = null;
|
||||||
|
|
||||||
public reportType = 0;
|
public reportType = 1000;
|
||||||
public Status = 0;
|
public Status = 0;
|
||||||
|
|
||||||
codeString: string = 'ZGo - The Zcash Register';
|
codeString: string = '';
|
||||||
zcashUrl: SafeUrl = '';
|
zcashUrl: SafeUrl = '';
|
||||||
zPrice: number = 1.0;
|
zPrice: number = 1.0;
|
||||||
name: string = '';
|
name: string = '';
|
||||||
|
@ -138,13 +166,15 @@ export class PmtserviceComponent implements OnInit {
|
||||||
private http : HttpClient,
|
private http : HttpClient,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private notifierService : NotifierService,
|
private notifierService : NotifierService,
|
||||||
private languageService : LanguageService ){
|
private languageService : LanguageService ) {}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.activatedRoute.queryParams.subscribe((params) => {
|
this.activatedRoute.queryParams.subscribe((params) => {
|
||||||
this.pmtData.ownerId = params["owner"];
|
this.pmtData.ownerId = params["owner"];
|
||||||
this.pmtData.invoice = params["invoiceNo"];
|
this.pmtData.invoice = params["invoiceNo"];
|
||||||
this.pmtData.amount = +params["amount"];
|
this.pmtData.amount = params["amount"];
|
||||||
this.pmtData.currency = params["currency"];
|
this.pmtData.currency = params["currency"];
|
||||||
this.pmtData.shortcode = params["shortCode"];
|
this.pmtData.shortcode = params["shortCode"];
|
||||||
this.getInvoiceData( this.pmtData );
|
this.getInvoiceData( this.pmtData );
|
||||||
|
@ -152,28 +182,174 @@ export class PmtserviceComponent implements OnInit {
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
getInvoiceData( reqData : PmtData ) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Verify owner id ( Status = 1 if not exists )
|
||||||
|
// ( Status = 2 if service not available for user )
|
||||||
|
//
|
||||||
|
// console.log('getOwner -> '+ reqData.ownerId);
|
||||||
|
// console.log('received amount -> ' + reqData.amount);
|
||||||
|
const ownParams = new HttpParams().append('id', reqData.ownerId);
|
||||||
|
let obs = this.http.get<{message:string, owner: any}>
|
||||||
|
( this.beUrl+'api/ownerid',
|
||||||
|
{ headers: this.reqHeaders,
|
||||||
|
params: ownParams,
|
||||||
|
observe: 'response'});
|
||||||
|
obs.subscribe((OwnerDataResponse) => {
|
||||||
|
//console.log('api/getowner', OwnerDataResponse.status);
|
||||||
|
if (OwnerDataResponse.status == 200) {
|
||||||
|
this.owner = OwnerDataResponse.body!.owner;
|
||||||
|
console.log('Owner => ' + this.owner.name );
|
||||||
|
//
|
||||||
|
// ==> remove "== false" for production enviroment
|
||||||
|
//
|
||||||
|
if ( this.owner.invoices ) {
|
||||||
|
// process data
|
||||||
|
console.log("Owner check passed!!!");
|
||||||
|
this.getXeroInvoiceData( reqData );
|
||||||
|
} else {
|
||||||
|
console.log("Owner check failed!!!")
|
||||||
|
this.reportType = 2;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if ( OwnerDataResponse.status == 204 ) {
|
||||||
|
console.log('Res.Status = ' + OwnerDataResponse.status)
|
||||||
|
console.log('Owner id not found!!!');
|
||||||
|
this.reportType = 1;
|
||||||
|
}
|
||||||
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
getInvoiceData( reqData : PmtData ) {
|
getXeroInvoiceData( reqData : PmtData ) {
|
||||||
//this.getXeroInvoiceData( reqData );
|
|
||||||
let obs = this.http.post<{reportType: number, order: Order, shop: string}>
|
/*
|
||||||
(this.beUrl+'invdata',
|
// Call test Xero API
|
||||||
{payload: reqData},
|
let url : string = "http://localhost:3000/xero/" + reqData.invoice;
|
||||||
{headers: this.reqHeaders, observe: 'response' }
|
this.http
|
||||||
|
.get<any>(url)
|
||||||
|
*/
|
||||||
|
console.log('>> find current zcash price');
|
||||||
|
this.getPrice(this.owner.currency);
|
||||||
|
|
||||||
|
console.log('get Invoice -> ' + reqData.invoice);
|
||||||
|
let invParams = new HttpParams();
|
||||||
|
invParams = invParams.append('address', this.owner.address);
|
||||||
|
invParams = invParams.append('inv', reqData.invoice);
|
||||||
|
let inv = this.http.get<{message:string, invData: any}>
|
||||||
|
( this.beUrl+'api/invdata',
|
||||||
|
{ headers: this.reqHeaders,
|
||||||
|
params: invParams,
|
||||||
|
observe: 'response'});
|
||||||
|
inv.subscribe( invDataResponse => {
|
||||||
|
// console.log('Response from ZGo-Xero');
|
||||||
|
// console.log(invDataResponse.status);
|
||||||
|
this.invData_buff = invDataResponse.body;
|
||||||
|
this.invData.inv_Type = this.invData_buff.invdata.inv_Type;
|
||||||
|
this.invData.inv_Id = this.invData_buff.invdata.inv_Id;
|
||||||
|
this.invData.inv_No = this.invData_buff.invdata.inv_No;
|
||||||
|
this.invData.inv_Contact = this.invData_buff.invdata.inv_Contact;
|
||||||
|
this.invData.inv_Currency = this.invData_buff.invdata.inv_Currency;
|
||||||
|
this.invData.inv_CurrencyRate = this.invData_buff.invdata.inv_CurrencyRate;
|
||||||
|
this.invData.inv_Total = this.invData_buff.invdata.inv_Total;
|
||||||
|
this.invData.inv_Status = this.invData_buff.invdata.inv_Status;
|
||||||
|
this.invData.inv_Date = this.invData_buff.invdata.inv_Date;
|
||||||
|
this.invData.inv_shortCode = reqData.shortcode;
|
||||||
|
/*
|
||||||
|
console.log('>>> inv_Type -> ' + this.invData.inv_Type);
|
||||||
|
console.log('>>> inv_Id -> ' + this.invData.inv_Id);
|
||||||
|
console.log('>>> inv_No -> ' + this.invData.inv_No);
|
||||||
|
console.log('>>> inv_Contact -> ' + this.invData.inv_Contact);
|
||||||
|
console.log('>>> inv_Currency-> ' + this.invData.inv_Currency);
|
||||||
|
console.log('>>> inv_CurrencyRate -> ' + this.invData.inv_CurrencyRate);
|
||||||
|
console.log('>>> inv_Total -> ' + this.invData.inv_Total);
|
||||||
|
console.log('>>> inv_Status-> ' + this.invData.inv_Status);
|
||||||
|
console.log('>>> inv_Date -> ' + this.invData.inv_Date);
|
||||||
|
*/
|
||||||
|
if ( this.invData.inv_Type == 'ACCREC' ) {
|
||||||
|
console.log('Invoice type is correct!!');
|
||||||
|
// Test if invoice is not already paid
|
||||||
|
if ( this.invData.inv_Status == 'AUTHORISED') {
|
||||||
|
console.log('invoice is payable');
|
||||||
|
// Test if Invoice's currency is supported
|
||||||
|
if ( this.invData.inv_Currency == reqData.currency ) {
|
||||||
|
console.log('Invoice currency supported');
|
||||||
|
// Test if requested amount is as reported by Xero
|
||||||
|
if ( this.invData.inv_Total == reqData.amount ) {
|
||||||
|
console.log('Invoice amount Ok - create Order');
|
||||||
|
// =====> Create order here
|
||||||
|
this.createOrder();
|
||||||
|
//
|
||||||
|
} else {
|
||||||
|
console.log('Invoice amount does not match')
|
||||||
|
this.reportType = 8;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Invoice currency not supported');
|
||||||
|
this.reportType = 7;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Invoice already paid');
|
||||||
|
this.reportType = 6;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Invoice type is invalid' );
|
||||||
|
this.reportType = 5;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log("Error while getting invData!!!");
|
||||||
|
console.log(error);
|
||||||
|
console.log(error.status);
|
||||||
|
if ( error.status == 500 ) {
|
||||||
|
// Assume that invoice was not found by haskell server
|
||||||
|
this.reportType = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
createOrder() {
|
||||||
|
this.reportType = 0;
|
||||||
|
// console.log('Starting order generation');
|
||||||
|
// console.log('>> find current zcash price');
|
||||||
|
|
||||||
|
this.order = {
|
||||||
|
_id: '',
|
||||||
|
address: this.owner.address,
|
||||||
|
session: 'Xero-' + this.owner._id,
|
||||||
|
currency: this.owner.currency,
|
||||||
|
timestamp: new Date(Date.now()).toISOString(),
|
||||||
|
closed: true,
|
||||||
|
totalZec: this.invData.inv_Total/this.zPrice,
|
||||||
|
price: this.zPrice,
|
||||||
|
total: this.invData.inv_Total,
|
||||||
|
paid: false,
|
||||||
|
externalInvoice: this.invData.inv_No,
|
||||||
|
shortCode: this.invData.inv_shortCode,
|
||||||
|
lines: [{qty: 1,
|
||||||
|
name: 'Invoice from ' + this.owner.name + '[' + this.invData.inv_No + ']',
|
||||||
|
cost: this.invData.inv_Total}]
|
||||||
|
};
|
||||||
|
|
||||||
|
let obs = this.http.post<{message: string, order: Order}>
|
||||||
|
(this.beUrl+'api/orderx',
|
||||||
|
{payload: this.order},
|
||||||
|
{ headers: this.reqHeaders }
|
||||||
);
|
);
|
||||||
obs.subscribe((invoiceData) => {
|
obs.subscribe((orderData) => {
|
||||||
if(invoiceData.status == 201) {
|
// console.log('Order created');
|
||||||
this.reportType = invoiceData.body!.reportType;
|
|
||||||
this.order = invoiceData.body!.order;
|
// console.log(orderData.order);
|
||||||
this.shop = invoiceData.body!.shop;
|
this.order = orderData.order
|
||||||
|
console.log('>> order -> ' + JSON.stringify(this.order));
|
||||||
this.orderId = String(this.order._id);
|
this.orderId = String(this.order._id);
|
||||||
|
|
||||||
// console.log('Generating QRCode....')
|
// console.log('Generating QRCode....')
|
||||||
|
|
||||||
this.codeString = `zcash:${this.order.address}?amount=${this.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId).concat(' Invoice: ').concat(this.order.externalInvoice)))}`;
|
this.codeString = `zcash:${this.order.address}?amount=${this.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId)))}`;
|
||||||
|
|
||||||
var qrcode = new QRCode(document.getElementById("invoice-qr"), {
|
var qrcode = new QRCode(document.getElementById("payment-qr"), {
|
||||||
text: this.codeString,
|
text: this.codeString,
|
||||||
logo: "/assets/zcash.png",
|
logo: "/assets/zcash.png",
|
||||||
width: 180,
|
width: 180,
|
||||||
|
@ -183,11 +359,11 @@ export class PmtserviceComponent implements OnInit {
|
||||||
correctLevel: QRCode.CorrectLevel.H
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.codeString = `zcash:${this.order.address}?amount=${this.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId)))}`;
|
||||||
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
||||||
} else {
|
}, error => {
|
||||||
this.reportType = invoiceData.body!.reportType;
|
console.log(error.message);
|
||||||
console.log('reportType ' + invoiceData.body!.reportType + ' code ' + invoiceData.status);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +374,22 @@ export class PmtserviceComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPrice(currency: string){
|
||||||
|
//var currency = 'usd';
|
||||||
|
const params = new HttpParams().append('currency', currency);
|
||||||
|
let obs = this.http.get<{message: string, price: any}>(this.beUrl+'api/price', { headers:this.reqHeaders, params: params, observe: 'response'});
|
||||||
|
obs.subscribe((PriceData) => {
|
||||||
|
if (PriceData.status == 200) {
|
||||||
|
this.zPrice = PriceData.body!.price.price;
|
||||||
|
console.log("price", this.zPrice);
|
||||||
|
} else {
|
||||||
|
console.log('No price found for currency', currency);
|
||||||
|
this.zPrice = 1.0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return obs;
|
||||||
|
}
|
||||||
|
|
||||||
copyAddress() {
|
copyAddress() {
|
||||||
if (!navigator.clipboard) {
|
if (!navigator.clipboard) {
|
||||||
// alert("Copy functionality not supported");
|
// alert("Copy functionality not supported");
|
||||||
|
@ -218,7 +410,6 @@ export class PmtserviceComponent implements OnInit {
|
||||||
// console.error("Error", err);
|
// console.error("Error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyAmount() {
|
copyAmount() {
|
||||||
if (!navigator.clipboard) {
|
if (!navigator.clipboard) {
|
||||||
// alert("Copy functionality not supported");
|
// alert("Copy functionality not supported");
|
||||||
|
@ -250,7 +441,7 @@ export class PmtserviceComponent implements OnInit {
|
||||||
this.vE.pmtserviceNotservError);
|
this.vE.pmtserviceNotservError);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
navigator.clipboard.writeText("ZGo Order::" + this.orderId + " Invoice: " + this.order.externalInvoice);
|
navigator.clipboard.writeText("ZGo Order::" + this.orderId);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(this.vE.pmtserviceCopymemoError,
|
.showNotification(this.vE.pmtserviceCopymemoError,
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
style="text-align: left;"
|
style="text-align: left;"
|
||||||
width="94%">
|
width="94%">
|
||||||
<div>
|
<div>
|
||||||
<textarea matInput readonly
|
<textarea
|
||||||
style="border: none;
|
style="border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
width: 95%;"
|
width: 95%;"
|
||||||
cdkTextareaAutosize
|
cdkTextareaAutosize
|
||||||
cdkAutosizeMinRows="1"
|
cdkAutosizeMinRows="1"
|
||||||
cdkAutosizeMaxRows="5">{{ invoiceUrl }}
|
cdkAutosizeMaxRows="4">{{ invoiceUrl }}
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
export class PromptInvoiceComponent implements OnInit {
|
export class PromptInvoiceComponent implements OnInit {
|
||||||
orderId: string;
|
orderId: string;
|
||||||
orderToken: string = '';
|
|
||||||
invoiceUrl: string;
|
invoiceUrl: string;
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -42,11 +41,10 @@ export class PromptInvoiceComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
private languageService : LanguageService,
|
private languageService : LanguageService,
|
||||||
private dialogRef: MatDialogRef<PromptInvoiceComponent>,
|
private dialogRef: MatDialogRef<PromptInvoiceComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: {orderId: string, orderToken: string},
|
@Inject(MAT_DIALOG_DATA) public data: {orderId: string},
|
||||||
private notifierService : NotifierService ) {
|
private notifierService : NotifierService ) {
|
||||||
this.orderId = data.orderId;
|
this.orderId = data.orderId;
|
||||||
this.orderToken = data.orderToken;
|
this.invoiceUrl = 'https://app.zgo.cash/invoice/'+this.orderId;
|
||||||
this.invoiceUrl = 'https://app.zgo.cash/invoice/'+this.orderId + '?token=' + this.orderToken;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
style="text-align: left;"
|
style="text-align: left;"
|
||||||
width="94%">
|
width="94%">
|
||||||
<div>
|
<div>
|
||||||
<textarea matInput readonly
|
<textarea
|
||||||
style="border: none;
|
style="border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
width: 95%;"
|
width: 95%;"
|
||||||
cdkTextareaAutosize
|
cdkTextareaAutosize
|
||||||
cdkAutosizeMinRows="1"
|
cdkAutosizeMinRows="1"
|
||||||
cdkAutosizeMaxRows="5">{{ receiptUrl }}
|
cdkAutosizeMaxRows="4">{{ receiptUrl }}
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
export class PromptReceiptComponent implements OnInit {
|
export class PromptReceiptComponent implements OnInit {
|
||||||
orderId: string;
|
orderId: string;
|
||||||
orderToken: string;
|
|
||||||
receiptUrl: string;
|
receiptUrl: string;
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
@ -44,11 +43,10 @@ export class PromptReceiptComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
private languageService : LanguageService,
|
private languageService : LanguageService,
|
||||||
private dialogRef: MatDialogRef<PromptReceiptComponent>,
|
private dialogRef: MatDialogRef<PromptReceiptComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: {orderId: string, orderToken: string},
|
@Inject(MAT_DIALOG_DATA) public data: {orderId: string},
|
||||||
private notifierService : NotifierService ) {
|
private notifierService : NotifierService ) {
|
||||||
this.orderId = data.orderId;
|
this.orderId = data.orderId;
|
||||||
this.orderToken = data.orderToken;
|
this.receiptUrl = 'https://app.zgo.cash/receipt/'+this.orderId;
|
||||||
this.receiptUrl = 'https://app.zgo.cash/receipt/' + this.orderId + '?token=' + this.orderToken;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { Subject, BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
||||||
import { Order } from './order/order.model';
|
import { Order } from './order/order.model';
|
||||||
import { Owner } from './owner.model';
|
import { Owner } from './owner.model';
|
||||||
|
@ -14,8 +14,7 @@ var Buffer = require('buffer/').Buffer;
|
||||||
})
|
})
|
||||||
export class ReceiptService {
|
export class ReceiptService {
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private dataStore: {order: Order, owner: Owner, name: string } = {
|
private dataStore: {order: Order, owner: Owner } = {
|
||||||
name: '',
|
|
||||||
owner: {
|
owner: {
|
||||||
_id: '',
|
_id: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -25,13 +24,23 @@ export class ReceiptService {
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
address: '',
|
address: '',
|
||||||
|
@ -45,7 +54,6 @@ export class ReceiptService {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -59,30 +67,31 @@ export class ReceiptService {
|
||||||
public readonly orderUpdate: Observable<Order> = this._orderUpdated.asObservable();
|
public readonly orderUpdate: Observable<Order> = this._orderUpdated.asObservable();
|
||||||
public _nameUpdated: BehaviorSubject<string> = new BehaviorSubject(this.dataStore.owner.name);
|
public _nameUpdated: BehaviorSubject<string> = new BehaviorSubject(this.dataStore.owner.name);
|
||||||
public readonly nameUpdate: Observable<string>= this._nameUpdated.asObservable();
|
public readonly nameUpdate: Observable<string>= this._nameUpdated.asObservable();
|
||||||
//public readonly ownerUpdate;
|
public readonly ownerUpdate;
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private params: HttpParams;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
public userService: UserService
|
public userService: UserService
|
||||||
) {
|
) {
|
||||||
//this.session = localStorage.getItem('s4z_token');
|
|
||||||
this.params = new HttpParams();
|
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
//this.ownerUpdate = userService.ownerUpdate;
|
this.ownerUpdate = userService.ownerUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderById(id:string, token: string) {
|
getOrderById(id:string) {
|
||||||
let obs = this.http.get<{message: string, order: any, shop: string}>(this.beUrl+'order/'+id, { headers:this.reqHeaders, params: this.params.append("token", token), observe: 'response'});
|
//const params = new HttpParams().append('id', id);
|
||||||
|
let obs = this.http.get<{message: string, order: any}>(this.beUrl+'api/order/'+id, { headers:this.reqHeaders, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((OrderDataResponse) => {
|
obs.subscribe((OrderDataResponse) => {
|
||||||
if (OrderDataResponse.status == 200) {
|
if (OrderDataResponse.status == 200) {
|
||||||
this.dataStore.order = OrderDataResponse.body!.order;
|
this.dataStore.order = OrderDataResponse.body!.order;
|
||||||
this.dataStore.name = OrderDataResponse.body!.shop;
|
|
||||||
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
||||||
this._nameUpdated.next(Object.assign({}, this.dataStore).name);
|
this.userService.getOwner(this.dataStore.order.address);
|
||||||
|
this.ownerUpdate.subscribe((owner) => {
|
||||||
|
this.dataStore.owner = owner;
|
||||||
|
this._nameUpdated.next(Object.assign({}, this.dataStore).owner.name);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
||||||
console.log('No order found');
|
console.log('No order found');
|
||||||
|
|
|
@ -14,7 +14,6 @@ import { LanguageData } from '../language.model';
|
||||||
})
|
})
|
||||||
export class ReceiptComponent implements OnInit {
|
export class ReceiptComponent implements OnInit {
|
||||||
orderId;
|
orderId;
|
||||||
orderToken: string = '';
|
|
||||||
public orderUpdate: Observable<Order>;
|
public orderUpdate: Observable<Order>;
|
||||||
public nameUpdate: Observable<string>;
|
public nameUpdate: Observable<string>;
|
||||||
name: string = '';
|
name: string = '';
|
||||||
|
@ -31,7 +30,6 @@ export class ReceiptComponent implements OnInit {
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
token: '',
|
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
|
@ -62,15 +60,12 @@ export class ReceiptComponent implements OnInit {
|
||||||
public receiptService: ReceiptService
|
public receiptService: ReceiptService
|
||||||
) {
|
) {
|
||||||
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
||||||
this._ActiveRoute.queryParams.subscribe((params) => {
|
|
||||||
this.orderToken = params["token"];
|
|
||||||
receiptService.getOrderById(this.orderId!, this.orderToken!);
|
|
||||||
});
|
|
||||||
this.orderUpdate = receiptService.orderUpdate;
|
this.orderUpdate = receiptService.orderUpdate;
|
||||||
|
this.nameUpdate = receiptService.nameUpdate;
|
||||||
|
receiptService.getOrderById(this.orderId!);
|
||||||
this.orderUpdate.subscribe(order => {
|
this.orderUpdate.subscribe(order => {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
});
|
});
|
||||||
this.nameUpdate = receiptService.nameUpdate;
|
|
||||||
|
|
||||||
this.nameUpdate.subscribe(name => {
|
this.nameUpdate.subscribe(name => {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
import { NotifierService } from '../notifier.service';
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
var QRCode = require('easyqrcodejs');
|
var QRCode = require('easyqrcodejs');
|
||||||
var URLSafeBase64 = require('urlsafe-base64');
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
|
@ -147,14 +148,13 @@ export class ScanComponent implements OnInit{
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('SCAN.chgUILanguage Called ');
|
console.log('SCAN.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('scan').subscribe({
|
this.languageService.getViewElements('scan').subscribe(
|
||||||
next:
|
|
||||||
response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.scanScanqrCode = response.data.scan_scanqr_code;
|
this.vE.scanScanqrCode = response.data.scan_scanqr_code;
|
||||||
this.vE.scanTextInfo = response.data.scan_text_info;
|
this.vE.scanTextInfo = response.data.scan_text_info;
|
||||||
|
@ -172,8 +172,8 @@ export class ScanComponent implements OnInit{
|
||||||
this.vE.scanOrButton = response.data.scan_or_button;
|
this.vE.scanOrButton = response.data.scan_or_button;
|
||||||
|
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
* {
|
|
||||||
font-family: 'Spartan', sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-title {
|
|
||||||
font-family: 'Spartan', sans-serif;
|
|
||||||
background: #ff5722;
|
|
||||||
color: white;
|
|
||||||
font-size: 30px;
|
|
||||||
text-align: center;
|
|
||||||
padding: 5px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<div class="settings-title">Purchase Session</div>
|
|
||||||
<mat-card [formGroup]="payForm">
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Select session:</mat-label>
|
|
||||||
<mat-select formControlName="session">
|
|
||||||
<mat-option *ngFor="let ticket of tickets" [value]="ticket.value">
|
|
||||||
{{ticket.viewValue}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<div class="container">
|
|
||||||
<button mat-raised-button (click)="close()">Cancel</button>
|
|
||||||
<button mat-raised-button color="primary" [disabled]="payForm.invalid" (click)="pay()">Pay</button>
|
|
||||||
</div>
|
|
||||||
</mat-card>
|
|
|
@ -1,23 +0,0 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { SessionpayComponent } from './sessionpay.component';
|
|
||||||
|
|
||||||
describe('SessionpayComponent', () => {
|
|
||||||
let component: SessionpayComponent;
|
|
||||||
let fixture: ComponentFixture<SessionpayComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ SessionpayComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(SessionpayComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,68 +0,0 @@
|
||||||
import { Inject, Component } from '@angular/core';
|
|
||||||
import { ScanComponent } from '../scan/scan.component';
|
|
||||||
import { Validators, UntypedFormGroup, FormBuilder } from '@angular/forms';
|
|
||||||
import { MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-sessionpay',
|
|
||||||
templateUrl: './sessionpay.component.html',
|
|
||||||
styleUrls: ['./sessionpay.component.css']
|
|
||||||
})
|
|
||||||
export class SessionpayComponent {
|
|
||||||
|
|
||||||
nodeAddress: string = '';
|
|
||||||
zecPrice: number = 1;
|
|
||||||
tickets = [
|
|
||||||
{
|
|
||||||
value: 1,
|
|
||||||
viewValue: '1 day: USD $1'
|
|
||||||
},{
|
|
||||||
value: 6,
|
|
||||||
viewValue: '1 week: USD $6'
|
|
||||||
},{
|
|
||||||
value: 22,
|
|
||||||
viewValue: '1 month: USD $22'
|
|
||||||
},{
|
|
||||||
value: 30,
|
|
||||||
viewValue: '1 month Pro: USD $30'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
payForm: UntypedFormGroup;
|
|
||||||
session: string;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private dialog: MatDialog,
|
|
||||||
private dialogRef: MatDialogRef<SessionpayComponent>,
|
|
||||||
private fb: FormBuilder,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: { addr: string, session: string, zecPrice: number }
|
|
||||||
) {
|
|
||||||
this.payForm= fb.group({
|
|
||||||
session: ['', Validators.required]
|
|
||||||
});
|
|
||||||
this.session = data.session;
|
|
||||||
this.zecPrice = data.zecPrice;
|
|
||||||
this.nodeAddress = data.addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
pay(){
|
|
||||||
const dialogConfig = new MatDialogConfig();
|
|
||||||
|
|
||||||
dialogConfig.disableClose = true;
|
|
||||||
dialogConfig.autoFocus = true;
|
|
||||||
dialogConfig.data = {
|
|
||||||
totalZec: (this.payForm.get('session')!.value)/this.zecPrice,
|
|
||||||
addr: this.nodeAddress,
|
|
||||||
session: this.session,
|
|
||||||
pay: true
|
|
||||||
};
|
|
||||||
|
|
||||||
const dialogRef1 = this.dialog.open(ScanComponent, dialogConfig);
|
|
||||||
dialogRef1.afterClosed().subscribe(val => {
|
|
||||||
this.dialogRef.close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
close(){
|
|
||||||
this.dialogRef.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,7 +42,7 @@
|
||||||
<mat-form-field class="full-width"
|
<mat-form-field class="full-width"
|
||||||
appearance="fill">
|
appearance="fill">
|
||||||
<mat-label>{{ vE.settingsVkeyLbl }}</mat-label>
|
<mat-label>{{ vE.settingsVkeyLbl }}</mat-label>
|
||||||
<textarea matInput [readonly]="vKaccess" placeholder="{{ vE.settingsVkeyPlaceholder }}"
|
<textarea matInput placeholder="{{ vE.settingsVkeyPlaceholder }}"
|
||||||
formControlName="vKey">
|
formControlName="vKey">
|
||||||
</textarea>
|
</textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
||||||
import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
|
import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
|
||||||
import { Subject, Observable } from 'rxjs';
|
import { Subject, Observable } from 'rxjs';
|
||||||
|
@ -11,6 +11,7 @@ import { NotifierService } from '../notifier.service';
|
||||||
import { faCopy } from '@fortawesome/free-solid-svg-icons';
|
import { faCopy } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings',
|
selector: 'app-settings',
|
||||||
|
@ -29,10 +30,10 @@ export class SettingsComponent implements OnInit {
|
||||||
owner: Owner;
|
owner: Owner;
|
||||||
useZats: boolean;
|
useZats: boolean;
|
||||||
proVersion: boolean = false;
|
proVersion: boolean = false;
|
||||||
|
useVKey: boolean = false;
|
||||||
linkMsg: string = '';
|
linkMsg: string = '';
|
||||||
xeroAccCod: string = '';
|
xeroAccCod: string = '';
|
||||||
saveAccOk: boolean = false;
|
saveAccOk: boolean = false;
|
||||||
private viewkey: string = '';
|
|
||||||
|
|
||||||
coins = [
|
coins = [
|
||||||
{
|
{
|
||||||
|
@ -116,7 +117,6 @@ export class SettingsComponent implements OnInit {
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
languageRdy = new Subject<boolean>();
|
languageRdy = new Subject<boolean>();
|
||||||
vKaccess = true;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -126,25 +126,25 @@ export class SettingsComponent implements OnInit {
|
||||||
public xeroService: XeroService,
|
public xeroService: XeroService,
|
||||||
public wooService: WoocommerceService,
|
public wooService: WoocommerceService,
|
||||||
private dialogRef: MatDialogRef<SettingsComponent>,
|
private dialogRef: MatDialogRef<SettingsComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: {o: Owner}) {
|
@Inject(MAT_DIALOG_DATA) public data: Owner) {
|
||||||
this.useZats = data.o.zats;
|
this.useZats = data.zats;
|
||||||
|
this.useVKey = data.payconf;
|
||||||
this.settingsForm = fb.group({
|
this.settingsForm = fb.group({
|
||||||
name: [data.o.name, Validators.required],
|
name: [data.name, Validators.required],
|
||||||
currency: [data.o.currency, Validators.required],
|
currency: [data.currency, Validators.required],
|
||||||
useZats: [data.o.zats, Validators.required],
|
useZats: [data.zats, Validators.required],
|
||||||
useVKey: [data.o.payconf, Validators.required],
|
useVKey: [data.payconf, Validators.required],
|
||||||
vKey: [data.o.viewkey]
|
// proVersion: [data.invoices, Validators.required],
|
||||||
|
vKey: [data.viewkey]
|
||||||
});
|
});
|
||||||
this.accCodForm = fb.group ({
|
this.accCodForm = fb.group ({
|
||||||
xAcc: [this.xeroAccCod]
|
xAcc: [this.xeroAccCod]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.o.payconf) {
|
if (data.payconf) {
|
||||||
this.vKaccess = false;
|
this.settingsForm.get('vKey')!.enable();
|
||||||
//this.settingsForm.get('vKey')!.enable();
|
|
||||||
}
|
}
|
||||||
this.owner = data.o;
|
this.owner = data;
|
||||||
this.viewkey = data.o.viewkey;
|
|
||||||
this.proVersion = this.owner.invoices;
|
this.proVersion = this.owner.invoices;
|
||||||
if ( this.owner.crmToken !== '' ) {
|
if ( this.owner.crmToken !== '' ) {
|
||||||
this.linked2Xero = true;
|
this.linked2Xero = true;
|
||||||
|
@ -156,10 +156,10 @@ export class SettingsComponent implements OnInit {
|
||||||
this.xeroLink = `https://login.xero.com/identity/connect/authorize?response_type=code&client_id=${this.clientId}&redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fxeroauth&scope=accounting.transactions offline_access&state=${this.owner.address.substring(0, 6)}`
|
this.xeroLink = `https://login.xero.com/identity/connect/authorize?response_type=code&client_id=${this.clientId}&redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fxeroauth&scope=accounting.transactions offline_access&state=${this.owner.address.substring(0, 6)}`
|
||||||
});
|
});
|
||||||
this.accCodeUpdate = xeroService.accCodeUpdate;
|
this.accCodeUpdate = xeroService.accCodeUpdate;
|
||||||
xeroService.getXeroAccountCode();
|
xeroService.getXeroAccountCode(this.owner.address);
|
||||||
this.accCodeUpdate.subscribe(accData => {
|
this.accCodeUpdate.subscribe(accData => {
|
||||||
this.xeroAccCod = accData;
|
this.xeroAccCod = accData;
|
||||||
//console.log("xeroAccCod -> [" + this.xeroAccCod + "]");
|
console.log("xeroAccCod -> [" + this.xeroAccCod + "]");
|
||||||
this.accCodForm.get('xAcc')!.setValue(this.xeroAccCod);
|
this.accCodForm.get('xAcc')!.setValue(this.xeroAccCod);
|
||||||
});
|
});
|
||||||
this.wooOwnerUpdate = wooService.ownerUpdate;
|
this.wooOwnerUpdate = wooService.ownerUpdate;
|
||||||
|
@ -180,11 +180,10 @@ export class SettingsComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
//this.settingsForm.get('vKey')!.disable();
|
this.settingsForm.get('vKey')!.disable();
|
||||||
//
|
//
|
||||||
this.vKaccess = true;
|
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
//console.log('SETTINGS: Return from chgUILanguage()');
|
console.log('SETTINGS: Return from chgUILanguage()');
|
||||||
//
|
//
|
||||||
this.languageRdy.subscribe (
|
this.languageRdy.subscribe (
|
||||||
data => {
|
data => {
|
||||||
|
@ -206,7 +205,7 @@ export class SettingsComponent implements OnInit {
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
|
||||||
this.dialogRef.close(null);
|
this.dialogRef.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeIntegration() {
|
closeIntegration() {
|
||||||
|
@ -224,7 +223,7 @@ export class SettingsComponent implements OnInit {
|
||||||
this.owner.zats = this.settingsForm.value.useZats;
|
this.owner.zats = this.settingsForm.value.useZats;
|
||||||
this.owner.payconf = this.settingsForm.value.useVKey;
|
this.owner.payconf = this.settingsForm.value.useVKey;
|
||||||
this.owner.viewkey = this.settingsForm.value.vKey;
|
this.owner.viewkey = this.settingsForm.value.vKey;
|
||||||
//console.log('Settings component key: ' + this.owner.viewkey);
|
//this.owner.invoices = this.settingsForm.value.proVersion
|
||||||
this.dialogRef.close(this.owner);
|
this.dialogRef.close(this.owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,13 +239,12 @@ export class SettingsComponent implements OnInit {
|
||||||
// console.log("Viewing key switch is " +
|
// console.log("Viewing key switch is " +
|
||||||
// ( ob.checked ? "[ON]." : "[OFF]." ) );
|
// ( ob.checked ? "[ON]." : "[OFF]." ) );
|
||||||
|
|
||||||
if ( ob.checked ) {
|
this.useVKey = ob.checked;
|
||||||
//this.settingsForm.get('vKey')!.enable();
|
|
||||||
this.vKaccess = false;
|
if ( ob.checked )
|
||||||
} else {
|
this.settingsForm.get('vKey')!.enable();
|
||||||
//this.settingsForm.get('vKey')!.disable();
|
else
|
||||||
this.vKaccess = true;
|
this.settingsForm.get('vKey')!.disable();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,21 +332,21 @@ export class SettingsComponent implements OnInit {
|
||||||
saveAccCod() {
|
saveAccCod() {
|
||||||
|
|
||||||
this.xeroAccCod = this.accCodForm.value.xAcc;
|
this.xeroAccCod = this.accCodForm.value.xAcc;
|
||||||
//console.log(">>> " + this.xeroAccCod);
|
console.log(">>> " + this.xeroAccCod);
|
||||||
if ( this.xeroAccCod.length <= 10 ) {
|
if ( this.xeroAccCod.length <= 10 ) {
|
||||||
const obs = this.xeroService
|
const obs = this.xeroService
|
||||||
.setXeroAccountCode(this.owner.address,
|
.setXeroAccountCode(this.owner.address,
|
||||||
this.xeroAccCod);
|
this.xeroAccCod);
|
||||||
obs.subscribe({ next: responseData => {
|
obs.subscribe(responseData => {
|
||||||
if (responseData.status == 202) {
|
if (responseData.status == 202) {
|
||||||
//console.log('Account saved');
|
console.log('Account saved');
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(this.vE.settingsAcodeSaved,
|
.showNotification(this.vE.settingsAcodeSaved,
|
||||||
this.vE.settingsNotservClose,
|
this.vE.settingsNotservClose,
|
||||||
"success",
|
"success",
|
||||||
this.vE.settingsNotservSuccess);
|
this.vE.settingsNotservSuccess);
|
||||||
} else {
|
} else {
|
||||||
//console.log('Account not saved -> status[' + responseData.status + ']');
|
console.log('Account not saved -> status[' + responseData.status + ']');
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(
|
.showNotification(
|
||||||
this.vE.settingsAcodeNotsaved,
|
this.vE.settingsAcodeNotsaved,
|
||||||
|
@ -357,10 +355,9 @@ export class SettingsComponent implements OnInit {
|
||||||
this.vE.settingsNotservError);
|
this.vE.settingsNotservError);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
}, error => {
|
||||||
error: error => {
|
console.log('Error saving Account Code -> ' + error.msg)
|
||||||
//console.log('Error saving Account Code -> ' + error.msg)
|
});
|
||||||
}});
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.notifierService
|
this.notifierService
|
||||||
|
@ -379,19 +376,19 @@ export class SettingsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
checkStatus( arg : any ) {
|
checkStatus( arg : any ) {
|
||||||
//console.log('onChange - checkStatus');
|
console.log('onChange - checkStatus');
|
||||||
//console.log(arg.target.value);
|
console.log(arg.target.value);
|
||||||
this.saveAccOk = (arg.target.value != this.xeroAccCod );
|
this.saveAccOk = (arg.target.value != this.xeroAccCod );
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('SETTINGS.chgUILanguage Called ');
|
console.log('SETTINGS.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('settings').subscribe({
|
this.languageService.getViewElements('settings').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.settingsViewTitle = response.data.settings_view_title;
|
this.vE.settingsViewTitle = response.data.settings_view_title;
|
||||||
this.vE.settingsTabMainlbl = response.data.settings_tab_mainlbl;
|
this.vE.settingsTabMainlbl = response.data.settings_tab_mainlbl;
|
||||||
|
@ -435,7 +432,7 @@ export class SettingsComponent implements OnInit {
|
||||||
//
|
//
|
||||||
this.languageRdy.next(true);
|
this.languageRdy.next(true);
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { Subject, BehaviorSubject, Observable } from 'rxjs';
|
||||||
|
|
||||||
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { NotifierService } from './notifier.service';
|
||||||
import { User } from './user.model';
|
import { User } from './user.model';
|
||||||
import { Owner } from './owner.model';
|
import { Owner } from './owner.model';
|
||||||
import { Country } from './country.model';
|
import { Country } from './country.model';
|
||||||
|
import { Tx } from './tx.model';
|
||||||
|
|
||||||
import { ConfigData } from './configdata';
|
import { ConfigData } from './configdata';
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
export class UserService{
|
export class UserService{
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private dataStore: { user: User, owner: Owner, countries: Country[]} = {
|
private dataStore: { user: User, owner: Owner, txs: Tx[], countries: Country[]} = {
|
||||||
user: {
|
user: {
|
||||||
address: '',
|
address: '',
|
||||||
session: '',
|
session: '',
|
||||||
|
@ -33,30 +34,45 @@ export class UserService{
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
},
|
},
|
||||||
|
txs : [],
|
||||||
countries: []
|
countries: []
|
||||||
};
|
};
|
||||||
private uZaddr = '';
|
private uZaddr = '';
|
||||||
|
private oZaddr = '';
|
||||||
|
private uName = '';
|
||||||
private session: string | null = '';
|
private session: string | null = '';
|
||||||
private _uZaddrUpdated: BehaviorSubject<string> = new BehaviorSubject(this.uZaddr);
|
private _uZaddrUpdated: BehaviorSubject<string> = new BehaviorSubject(this.uZaddr);
|
||||||
private _userUpdated: BehaviorSubject<User> = new BehaviorSubject(this.dataStore.user);
|
private _userUpdated: BehaviorSubject<User> = new BehaviorSubject(this.dataStore.user);
|
||||||
|
private uNameUpdated = new Subject<string>();
|
||||||
private _ownerUpdated: BehaviorSubject<Owner> = new BehaviorSubject(this.dataStore.owner);
|
private _ownerUpdated: BehaviorSubject<Owner> = new BehaviorSubject(this.dataStore.owner);
|
||||||
|
private _txsUpdated: BehaviorSubject<Tx[]> = new BehaviorSubject(this.dataStore.txs);
|
||||||
private _paidUpdated: BehaviorSubject<boolean> = new BehaviorSubject(this.dataStore.owner.paid);
|
private _paidUpdated: BehaviorSubject<boolean> = new BehaviorSubject(this.dataStore.owner.paid);
|
||||||
private _countriesUpdated: BehaviorSubject<Country[]> = new BehaviorSubject(this.dataStore.countries);
|
private _countriesUpdated: BehaviorSubject<Country[]> = new BehaviorSubject(this.dataStore.countries);
|
||||||
public readonly uZaddrUpdate: Observable<string> = this._uZaddrUpdated.asObservable();
|
public readonly uZaddrUpdate: Observable<string> = this._uZaddrUpdated.asObservable();
|
||||||
public readonly ownerUpdate: Observable<Owner> = this._ownerUpdated.asObservable();
|
public readonly ownerUpdate: Observable<Owner> = this._ownerUpdated.asObservable();
|
||||||
public readonly userUpdate: Observable<User> = this._userUpdated.asObservable();
|
public readonly userUpdate: Observable<User> = this._userUpdated.asObservable();
|
||||||
|
public readonly txUpdate: Observable<Tx[]> = this._txsUpdated.asObservable();
|
||||||
public readonly paidUpdate: Observable<boolean> = this._paidUpdated.asObservable();
|
public readonly paidUpdate: Observable<boolean> = this._paidUpdated.asObservable();
|
||||||
public readonly countriesUpdate: Observable<Country[]> = this._countriesUpdated.asObservable();
|
public readonly countriesUpdate: Observable<Country[]> = this._countriesUpdated.asObservable();
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private reqParams: HttpParams;
|
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(private http: HttpClient,
|
||||||
private notifierService : NotifierService ){
|
private notifierService : NotifierService ){
|
||||||
|
@ -64,14 +80,13 @@ export class UserService{
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
//console.log('US:', this.reqHeaders);
|
//console.log('US:', this.reqHeaders);
|
||||||
this.session = localStorage.getItem('s4z_token');
|
this.session = localStorage.getItem('s4z_token');
|
||||||
this.reqParams = new HttpParams().append('session', this.session!);
|
if (this.session != null) {
|
||||||
//if (this.session != null) {
|
this.findUser();
|
||||||
//this.findUser();
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getCountries() {
|
getCountries() {
|
||||||
let obs = this.http.get<{message: string, countries: any}>(this.beUrl+'api/countries', { headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
let obs = this.http.get<{message: string, countries: any}>(this.beUrl+'api/countries', { headers: this.reqHeaders, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((CountryResponse) => {
|
obs.subscribe((CountryResponse) => {
|
||||||
if (CountryResponse.status == 200) {
|
if (CountryResponse.status == 200) {
|
||||||
|
@ -81,29 +96,20 @@ export class UserService{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
checkUser() {
|
|
||||||
if (this.session != null) {
|
|
||||||
console.log('calling checkUser');
|
|
||||||
let obs = this.http.get<{validated: boolean}>(this.beUrl + 'checkuser', {headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
|
||||||
|
|
||||||
return obs;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
findUser() {
|
findUser() {
|
||||||
|
this.session = localStorage.getItem('s4z_token');
|
||||||
if (this.session != null) {
|
if (this.session != null) {
|
||||||
let obs = this.http.get<{message: string, user: any}>(this.beUrl+'api/user', { headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
const params = new HttpParams().append('session', this.session!);
|
||||||
|
let obs = this.http.get<{message: string, user: any}>(this.beUrl+'api/user', { headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((UserDataResponse) => {
|
obs.subscribe((UserDataResponse) => {
|
||||||
//console.log(UserDataResponse.status);
|
console.log(UserDataResponse.status);
|
||||||
if (UserDataResponse.status == 200){
|
if (UserDataResponse.status == 200){
|
||||||
this.dataStore.user = UserDataResponse.body!.user;
|
this.dataStore.user = UserDataResponse.body!.user;
|
||||||
//console.log(`US: Found user, returning it`);
|
console.log(`US: Found user, returning it`);
|
||||||
this._uZaddrUpdated.next(Object.assign({},this.dataStore).user.address);
|
this._uZaddrUpdated.next(Object.assign({},this.dataStore).user.address);
|
||||||
this._userUpdated.next(Object.assign({}, this.dataStore).user);
|
this._userUpdated.next(Object.assign({}, this.dataStore).user);
|
||||||
this.getOwner();
|
this.getOwner(Object.assign({},this.dataStore.user).address);
|
||||||
} else {
|
} else {
|
||||||
this.dataStore.user = {
|
this.dataStore.user = {
|
||||||
address: '',
|
address: '',
|
||||||
|
@ -114,7 +120,7 @@ export class UserService{
|
||||||
};
|
};
|
||||||
this._uZaddrUpdated.next(Object.assign({},this.dataStore).user.address);
|
this._uZaddrUpdated.next(Object.assign({},this.dataStore).user.address);
|
||||||
this._userUpdated.next(Object.assign({}, this.dataStore).user);
|
this._userUpdated.next(Object.assign({}, this.dataStore).user);
|
||||||
//console.log('US: Did not find user');
|
console.log('US: Did not find user');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -126,8 +132,8 @@ export class UserService{
|
||||||
}
|
}
|
||||||
|
|
||||||
validateUser(pinString:string){
|
validateUser(pinString:string){
|
||||||
const params = this.reqParams.append('pin', pinString);
|
const params = new HttpParams().append('session', this.dataStore.user.session).append('pin', pinString);
|
||||||
let obs = this.http.post(this.beUrl+'validateuser', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.post(this.beUrl+'api/validateuser', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
obs.subscribe((responseData) => {
|
obs.subscribe((responseData) => {
|
||||||
if (responseData.status == 202) {
|
if (responseData.status == 202) {
|
||||||
console.log('Pin validated!');
|
console.log('Pin validated!');
|
||||||
|
@ -141,81 +147,29 @@ export class UserService{
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
addOwner(oData: {first: string, last: string, phone: string, name: string, street: string, city: string, state: string, postal: string, country: string, email: string, website: string}) {
|
addOwner(owner: Owner) {
|
||||||
|
|
||||||
let obs = this.http.post(this.beUrl+'api/owner', {payload: oData}, {headers: this.reqHeaders, params: this.reqParams});
|
owner.address = this.dataStore.user.address;
|
||||||
|
let obs = this.http.post(this.beUrl+'api/owner', {payload: owner}, {headers: this.reqHeaders});
|
||||||
|
|
||||||
obs.subscribe({
|
obs.subscribe((responseData) => {
|
||||||
next: () => {
|
|
||||||
//console.log("Entra a console log");
|
//console.log("Entra a console log");
|
||||||
this.getOwner();
|
this.getOwner(this.dataStore.user.address);
|
||||||
},
|
}, (error) => {
|
||||||
error: (error) => {
|
|
||||||
//console.log("Status is : [" + error.status + "]");
|
//console.log("Status is : [" + error.status + "]");
|
||||||
if ( error.status = 500 ) {
|
if ( error.status = 500 ) {
|
||||||
this.notifierService.showNotification("Invalid Viewing Key, changes not saved!!","Close",'error');
|
this.notifierService
|
||||||
|
.showNotification("Invalid Viewing Key, changes not saved!!","Close",'error');
|
||||||
};
|
};
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveOwnerSettings(o: Owner) {
|
getOwner(address: string) {
|
||||||
//console.log('saveOwnerSettings: ' + o.viewkey);
|
console.log('getOwner', address);
|
||||||
if(o.viewkey.length > 20) {
|
const ownParams = new HttpParams().append('address', address);
|
||||||
this.saveOwnerViewingKey(o.viewkey).subscribe({
|
let obs = this.http.get<{message:string, owner: any}>(this.beUrl+'api/owner', { headers: this.reqHeaders, params: ownParams, observe: 'response'});
|
||||||
next: () => {
|
|
||||||
let obs = this.http.post(this.beUrl + 'api/ownersettings', {payload: o}, {headers: this.reqHeaders, params: this.reqParams});
|
|
||||||
obs.subscribe({
|
|
||||||
next: () => {
|
|
||||||
this.getOwner();
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
if ( error.status == 500 ){
|
|
||||||
this.notifierService.showNotification("Saving settings failed", "Close", "error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let obs = this.http.post(this.beUrl + 'api/ownersettings', {payload: o}, {headers: this.reqHeaders, params: this.reqParams});
|
|
||||||
obs.subscribe({
|
|
||||||
next: () => {
|
|
||||||
this.getOwner();
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
if ( error.status == 500 ){
|
|
||||||
this.notifierService.showNotification("Saving settings failed", "Close", "error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
saveOwnerViewingKey(vk: string){
|
|
||||||
let obs = this.http.post(this.beUrl + 'api/ownervk', {payload: vk}, {headers: this.reqHeaders, params: this.reqParams});
|
|
||||||
obs.subscribe({
|
|
||||||
next: () => {
|
|
||||||
this.getOwner();
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
if (error.status == 400) {
|
|
||||||
this.notifierService.showNotification('Invalid viewing key, changes not saved', 'Close', 'error');
|
|
||||||
} else if (error.status == 403) {
|
|
||||||
this.notifierService.showNotification('Viewing key does not match shop, changes not saved', 'Close', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return obs;
|
|
||||||
}
|
|
||||||
|
|
||||||
getOwner() {
|
|
||||||
//console.log('getOwner', address);
|
|
||||||
//const ownParams = this.reqParams.append('address', address)
|
|
||||||
let obs = this.http.get<{message:string, owner: any}>(this.beUrl+'api/owner', { headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
|
||||||
|
|
||||||
obs.subscribe((OwnerDataResponse) => {
|
obs.subscribe((OwnerDataResponse) => {
|
||||||
//console.log('api/getowner', OwnerDataResponse.status);
|
//console.log('api/getowner', OwnerDataResponse.status);
|
||||||
|
@ -233,19 +187,16 @@ export class UserService{
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUser() {
|
deleteUser() {
|
||||||
let obs = this.http.delete<{message: string}>(this.beUrl+'api/user/'+this.dataStore.user._id, {headers: this.reqHeaders, params: this.reqParams });
|
let obs = this.http.delete<{message: string}>(this.beUrl+'api/user/'+this.dataStore.user._id, {headers: this.reqHeaders });
|
||||||
|
|
||||||
obs.subscribe({next: () => {
|
obs.subscribe(UserResponse => {
|
||||||
//console.log('User delete request sent.');
|
//console.log('User delete request sent.');
|
||||||
this.findUser();
|
this.findUser();
|
||||||
}});
|
});
|
||||||
|
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSettings(o: Owner) {
|
|
||||||
}
|
|
||||||
|
|
||||||
currentOwner() : Owner {
|
currentOwner() : Owner {
|
||||||
return this.dataStore.owner;
|
return this.dataStore.owner;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
||||||
import { UserService } from '../user.service';
|
import { UserService } from '../user.service';
|
||||||
import { FullnodeService } from '../fullnode.service';
|
import { FullnodeService } from '../fullnode.service';
|
||||||
import { Observable } from 'rxjs';
|
import { ItemService } from '../items/items.service';
|
||||||
|
import { Subscription, Observable } from 'rxjs';
|
||||||
import { SettingsComponent } from '../settings/settings.component';
|
import { SettingsComponent } from '../settings/settings.component';
|
||||||
|
|
||||||
import {Owner} from '../owner.model';
|
import {Owner} from '../owner.model';
|
||||||
import {User} from '../user.model';
|
import {User} from '../user.model';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-viewer',
|
selector: 'app-viewer',
|
||||||
|
@ -36,13 +38,23 @@ export class ViewerComponent implements OnInit {
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
public price: number = 1;
|
public price: number = 1;
|
||||||
public addrUpdate: Observable<string>;
|
public addrUpdate: Observable<string>;
|
||||||
|
@ -115,13 +127,13 @@ export class ViewerComponent implements OnInit {
|
||||||
|
|
||||||
dialogConfig.disableClose = true;
|
dialogConfig.disableClose = true;
|
||||||
dialogConfig.autoFocus = true;
|
dialogConfig.autoFocus = true;
|
||||||
dialogConfig.data = {o: this.owner};
|
dialogConfig.data = this.owner;
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(SettingsComponent, dialogConfig);
|
const dialogRef = this.dialog.open(SettingsComponent, dialogConfig);
|
||||||
dialogRef.afterClosed().subscribe((val) => {
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
//console.log('Saving settings', val);
|
//console.log('Saving settings', val);
|
||||||
this.userService.saveOwnerSettings(val);
|
this.userService.addOwner(val);
|
||||||
this.fullnodeService.getPrice(val.currency);
|
this.fullnodeService.getPrice(val.currency);
|
||||||
this.loginCheck();
|
this.loginCheck();
|
||||||
}
|
}
|
||||||
|
@ -136,7 +148,7 @@ export class ViewerComponent implements OnInit {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
//console.log('Viewer loginCheck', this.user);
|
//console.log('Viewer loginCheck', this.user);
|
||||||
if (!this.owner.paid || !this.user.validated) {
|
if (!this.owner.paid || !this.user.validated) {
|
||||||
//console.log('Log in expired!');
|
console.log('Log in expired!');
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -144,18 +156,18 @@ export class ViewerComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('VIEWER.chgUILanguage Called ');
|
console.log('VIEWER.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('viewer').subscribe({
|
this.languageService.getViewElements('viewer').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.viewerViewOrders = response.data.viewer_view_orders;
|
this.vE.viewerViewOrders = response.data.viewer_view_orders;
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,9 @@ var Buffer = require('buffer/').Buffer;
|
||||||
export class WoocommerceService {
|
export class WoocommerceService {
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private reqParams: HttpParams;
|
|
||||||
private ownerId: string = '';
|
private ownerId: string = '';
|
||||||
private token: string = '';
|
private token: string = '';
|
||||||
private siteurl: string = '';
|
private siteurl: string = '';
|
||||||
private session: null | string;
|
|
||||||
private _ownerIdUpdated: BehaviorSubject<string> = new BehaviorSubject(this.ownerId);
|
private _ownerIdUpdated: BehaviorSubject<string> = new BehaviorSubject(this.ownerId);
|
||||||
private _tokenUpdated: BehaviorSubject<string> = new BehaviorSubject(this.token);
|
private _tokenUpdated: BehaviorSubject<string> = new BehaviorSubject(this.token);
|
||||||
private _siteurlUpdated: BehaviorSubject<string> = new BehaviorSubject(this.siteurl);
|
private _siteurlUpdated: BehaviorSubject<string> = new BehaviorSubject(this.siteurl);
|
||||||
|
@ -29,15 +27,13 @@ export class WoocommerceService {
|
||||||
) {
|
) {
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.session = localStorage.getItem('s4z_token');
|
|
||||||
this.reqParams = new HttpParams().append('session', this.session!);
|
|
||||||
this._ownerIdUpdated.next(Object.assign({}, this).ownerId);
|
this._ownerIdUpdated.next(Object.assign({}, this).ownerId);
|
||||||
this._tokenUpdated.next(Object.assign({}, this).token);
|
this._tokenUpdated.next(Object.assign({}, this).token);
|
||||||
this._siteurlUpdated.next(Object.assign({}, this).siteurl);
|
this._siteurlUpdated.next(Object.assign({}, this).siteurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWooToken(ownerId: string) {
|
getWooToken(ownerId: string) {
|
||||||
const params = this.reqParams.append('ownerid', ownerId);
|
const params = new HttpParams().append('ownerid', ownerId);
|
||||||
let obs = this.http.get<{ownerid: string, token: string, siteurl: string}>(this.beUrl + 'api/wootoken', {headers: this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.get<{ownerid: string, token: string, siteurl: string}>(this.beUrl + 'api/wootoken', {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
obs.subscribe(tokenResponse => {
|
obs.subscribe(tokenResponse => {
|
||||||
if (tokenResponse.status == 200) {
|
if (tokenResponse.status == 200) {
|
||||||
|
@ -55,7 +51,7 @@ export class WoocommerceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
createWooToken(ownerId: string) {
|
createWooToken(ownerId: string) {
|
||||||
const params = this.reqParams.append('ownerid', ownerId);
|
const params = new HttpParams().append('ownerid', ownerId);
|
||||||
let obs = this.http.post(this.beUrl+'api/wootoken', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.post(this.beUrl+'api/wootoken', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
obs.subscribe(responseData => {
|
obs.subscribe(responseData => {
|
||||||
if (responseData.status == 202) {
|
if (responseData.status == 202) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ export class XeroService {
|
||||||
savedAcc : boolean = false;
|
savedAcc : boolean = false;
|
||||||
|
|
||||||
public savedAccObs = new Observable((observer) => {
|
public savedAccObs = new Observable((observer) => {
|
||||||
//console.log("starting savedAccObs");
|
console.log("starting savedAccObs");
|
||||||
setTimeout(() => {observer.next(this.savedAcc)},1000);
|
setTimeout(() => {observer.next(this.savedAcc)},1000);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -37,26 +37,24 @@ export class XeroService {
|
||||||
public readonly tokenUpdate: Observable<any> = this._tokenUpdated.asObservable();
|
public readonly tokenUpdate: Observable<any> = this._tokenUpdated.asObservable();
|
||||||
public readonly accCodeUpdate: Observable<string> = this._accCodeUpdated.asObservable();
|
public readonly accCodeUpdate: Observable<string> = this._accCodeUpdated.asObservable();
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private reqParams: HttpParams;
|
|
||||||
private session: null | string;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient
|
private http: HttpClient
|
||||||
) {
|
) {
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.session = localStorage.getItem('s4z_token');
|
|
||||||
this.reqParams = new HttpParams().append('session', this.session!);
|
|
||||||
this.getXeroConfig();
|
this.getXeroConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
getXeroConfig(){
|
getXeroConfig(){
|
||||||
let obs = this.http.get<{message: string, xeroConfig: any}>(this.beUrl+'api/xero', { headers:this.reqHeaders, observe: 'response', params: this.reqParams});
|
let obs = this.http.get<{message: string, xeroConfig: any}>(this.beUrl+'api/xero', { headers:this.reqHeaders, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe(xeroDataResponse => {
|
obs.subscribe(xeroDataResponse => {
|
||||||
if (xeroDataResponse.status == 200) {
|
if (xeroDataResponse.status == 200) {
|
||||||
this.clientId = xeroDataResponse.body!.xeroConfig.clientId;
|
this.clientId = xeroDataResponse.body!.xeroConfig.clientId;
|
||||||
|
//this.clientSecret = xeroDataResponse.body!.xeroConfig.clientSecret;
|
||||||
this._clientIdUpdated.next(Object.assign({}, this).clientId);
|
this._clientIdUpdated.next(Object.assign({}, this).clientId);
|
||||||
|
//this._clientSecretUpdated.next(Object.assign({}, this).clientSecret);
|
||||||
} else {
|
} else {
|
||||||
console.log('No config in DB!');
|
console.log('No config in DB!');
|
||||||
}
|
}
|
||||||
|
@ -65,14 +63,15 @@ export class XeroService {
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
getXeroAccessToken(code: string){
|
getXeroAccessToken(code: string, address: string){
|
||||||
const params = this.reqParams.append('code', code);
|
const params = new HttpParams().append('code', code).append('address', address);
|
||||||
let obs = this.http.get(this.beUrl + 'api/xerotoken' , {headers: this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.get(this.beUrl + 'api/xerotoken' , {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
getXeroAccountCode(){
|
getXeroAccountCode(address: string){
|
||||||
let obs = this.http.get<{message: string, code: string}>(this.beUrl + 'api/xeroaccount', {headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
const params = new HttpParams().append('address', address);
|
||||||
|
let obs = this.http.get<{message: string, code: string}>(this.beUrl + 'api/xeroaccount', {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
obs.subscribe(accountResponse => {
|
obs.subscribe(accountResponse => {
|
||||||
if (accountResponse.status == 200) {
|
if (accountResponse.status == 200) {
|
||||||
this.xeroAcc = accountResponse.body!.code;
|
this.xeroAcc = accountResponse.body!.code;
|
||||||
|
@ -86,7 +85,7 @@ export class XeroService {
|
||||||
|
|
||||||
setXeroAccountCode(address: string, code: string) {
|
setXeroAccountCode(address: string, code: string) {
|
||||||
|
|
||||||
const params = this.reqParams.append('address', address).append('code', code);
|
const params = new HttpParams().append('address', address).append('code', code);
|
||||||
let obs = this.http.post(this.beUrl + 'api/xeroaccount', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.post(this.beUrl + 'api/xeroaccount', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
/*
|
/*
|
||||||
obs.subscribe(responseData => {
|
obs.subscribe(responseData => {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { Owner } from '../owner.model';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
|
import { LanguageData } from '../language.model';
|
||||||
|
|
||||||
var Buffer = require('buffer/').Buffer;
|
var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
|
@ -26,7 +27,6 @@ async function redirect(r: Router) {
|
||||||
|
|
||||||
export class XeroRegComponent implements OnInit {
|
export class XeroRegComponent implements OnInit {
|
||||||
public owner:Owner = {
|
public owner:Owner = {
|
||||||
_id: '',
|
|
||||||
address: '',
|
address: '',
|
||||||
name: '',
|
name: '',
|
||||||
currency: '',
|
currency: '',
|
||||||
|
@ -34,13 +34,23 @@ export class XeroRegComponent implements OnInit {
|
||||||
taxValue:0,
|
taxValue:0,
|
||||||
vat: false,
|
vat: false,
|
||||||
vatValue: 0,
|
vatValue: 0,
|
||||||
|
first: '',
|
||||||
|
last: '',
|
||||||
|
email: '',
|
||||||
|
street: '',
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
postal: '',
|
||||||
|
phone: '',
|
||||||
paid: false,
|
paid: false,
|
||||||
|
website: '',
|
||||||
|
country: '',
|
||||||
zats: false,
|
zats: false,
|
||||||
invoices: false,
|
invoices: false,
|
||||||
expiration: new Date(Date.now()).toISOString(),
|
expiration: new Date(Date.now()).toISOString(),
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: '',
|
viewkey: '',
|
||||||
viewkey: ''
|
crmToken: ''
|
||||||
};
|
};
|
||||||
public ownerUpdate:Observable<Owner>;
|
public ownerUpdate:Observable<Owner>;
|
||||||
public flag: boolean = false;
|
public flag: boolean = false;
|
||||||
|
@ -75,15 +85,15 @@ export class XeroRegComponent implements OnInit {
|
||||||
this.ownerUpdate.subscribe((owner) => {
|
this.ownerUpdate.subscribe((owner) => {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.activatedRoute.queryParams.subscribe((params) => {
|
this.activatedRoute.queryParams.subscribe((params) => {
|
||||||
//console.log(params);
|
console.log(params);
|
||||||
if (params.state === this.owner.address.substring(0,6)) {
|
if (params.state === this.owner.address.substring(0,6)) {
|
||||||
this.xeroService.getXeroAccessToken(params.code).subscribe(tokenData => {
|
this.xeroService.getXeroAccessToken(params.code, this.owner.address).subscribe(tokenData => {
|
||||||
if (tokenData.status == 200) {
|
if (tokenData.status == 200) {
|
||||||
//console.log(tokenData.body!);
|
console.log(tokenData.body!);
|
||||||
this.flag = true;
|
this.flag = true;
|
||||||
redirect(this.router);
|
redirect(this.router);
|
||||||
} else {
|
} else {
|
||||||
//console.log('Error: '+tokenData.status);
|
console.log('Error: '+tokenData.status);
|
||||||
this.flag = false;
|
this.flag = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -96,20 +106,20 @@ export class XeroRegComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
//console.log('XERO.chgUILanguage Called ');
|
console.log('XERO.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('xero').subscribe({
|
this.languageService.getViewElements('xero').subscribe(
|
||||||
next: response => {
|
response => {
|
||||||
//console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
//console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
//console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
//console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.xeroConnecting2xero = response.data.xero_connecting_2xero;
|
this.vE.xeroConnecting2xero = response.data.xero_connecting_2xero;
|
||||||
this.vE.xeroConnected2xero = response.data.xero_connected_2xero;
|
this.vE.xeroConnected2xero = response.data.xero_connected_2xero;
|
||||||
|
|
||||||
},
|
},
|
||||||
error: error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ZGo - The Zcash Register</title>
|
<title>Z-Go!</title>
|
||||||
<base href="/">
|
<base href="/">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitReturns": false,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
|
|
Loading…
Reference in a new issue