diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b68ffc..61bb8ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Added new service for Xero integration ### Changed - +- Settings component updated to use owner's invoices field to control + integrations tab (Pro version) +- Orders list updated to show payment confirmation only when service is + activated and a viewing key exists. - Updated Order and Owner model to include new Xero integration fields ## [1.2.2] - 2022-08-05 diff --git a/src/app/listorders/listorders.component.html b/src/app/listorders/listorders.component.html index 67c6eb8..c4bc544 100644 --- a/src/app/listorders/listorders.component.html +++ b/src/app/listorders/listorders.component.html @@ -44,10 +44,11 @@
- + - {{order.timestamp | date: 'short'}} + {{order.timestamp | date: 'MM/dd/YY, hh:mm a'}}
diff --git a/src/app/listorders/listorders.component.ts b/src/app/listorders/listorders.component.ts index 6a97314..f18f492 100644 --- a/src/app/listorders/listorders.component.ts +++ b/src/app/listorders/listorders.component.ts @@ -30,7 +30,7 @@ export class ListOrdersComponent implements OnInit, OnDestroy{ public orders: Order[] = []; public ownerUpdate: Observable; public ordersUpdate: Observable; - + // ------------------------------------ // @@ -40,6 +40,32 @@ export class ListOrdersComponent implements OnInit, OnDestroy{ faCheckCircle = faCheckCircle; faHourglass = faHourglass; faTrash = faTrash; + payConf : boolean = false; + owner : Owner = { + 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: '' + }; // ------------------------------------- @@ -55,13 +81,24 @@ export class ListOrdersComponent implements OnInit, OnDestroy{ } ngOnInit(){ +// console.log('listOrders Init -->'); + this.owner = this.userService.currentOwner(); +// console.log(this.owner.name); + this.payConf = this.owner.payconf; +// this.payConf = true; +// console.log('payConf = ', this.payConf); + this.ordersUpdate.subscribe((orders) => { this.total = 0; this.todayTotal = 0; var today = new Date(); this.orders = orders; + + console.log(this.ownerUpdate); for (let i=0; i < this.orders.length; i++){ this.total += this.orders[i].totalZec; + // + var date = new Date(this.orders[i]!.timestamp!); var diff = (today.getTime() / 1000) - (date.getTime()/1000); if (diff < (24*3600)){ diff --git a/src/app/pmtservice/pmtservice.component.ts b/src/app/pmtservice/pmtservice.component.ts index 25ff5ec..1016a7c 100644 --- a/src/app/pmtservice/pmtservice.component.ts +++ b/src/app/pmtservice/pmtservice.component.ts @@ -244,9 +244,16 @@ public order: Order = { console.log('Invoice type is invalid' ); this.reportType = 5; } - }, error => { + }, + 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; + } + }); } @@ -301,6 +308,9 @@ public order: Order = { correctLevel: QRCode.CorrectLevel.H }); + }, error => { + console.log(error.message); + }); } diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index 96f56ce..caa677c 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -3,7 +3,7 @@
@@ -45,6 +45,12 @@ formControlName="vKey"> +

+					
+						Enable Integrations
+					
 
 				
 			
@@ -67,7 +73,8 @@ margin-top: 10px;"> -
diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 6cdd0a6..0914d25 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -17,6 +17,7 @@ export class SettingsComponent implements OnInit { settingsForm: UntypedFormGroup; owner: Owner; useZats: boolean; + proVersion: boolean = false; useVKey: boolean = false; coins = [ { @@ -53,6 +54,7 @@ export class SettingsComponent implements OnInit { currency: [data.currency, Validators.required], useZats: [data.zats, Validators.required], useVKey: [data.payconf, Validators.required], + proVersion: [data.invoices, Validators.required], vKey: [data.viewkey] }); if (data.payconf) { @@ -85,9 +87,8 @@ export class SettingsComponent implements OnInit { this.owner.currency = this.settingsForm.value.currency; this.owner.zats = this.settingsForm.value.useZats; this.owner.payconf = this.settingsForm.value.useVKey; - this.owner.viewkey = this.settingsForm.value.vKey; - + this.owner.invoices = this.settingsForm.value.proVersion this.dialogRef.close(this.owner); } @@ -95,6 +96,10 @@ export class SettingsComponent implements OnInit { this.useZats = ob.checked; } + onChangeProVersion(ob: MatSlideToggleChange) { + this.proVersion = ob.checked; + } + onChangeVKeyOn(ob: MatSlideToggleChange) { // console.log("Viewing key switch is " + // ( ob.checked ? "[ON]." : "[OFF]." ) ); diff --git a/src/app/user.service.ts b/src/app/user.service.ts index ba7cf35..e312dba 100644 --- a/src/app/user.service.ts +++ b/src/app/user.service.ts @@ -196,4 +196,8 @@ export class UserService{ return obs; } + currentOwner() : Owner { + return this.dataStore.owner; + } + }