diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 5e91973..42658f2 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -21,6 +21,7 @@ import { ItemDeleteComponent } from './items/item-delete/item-delete.component';
import { ItemAddComponent} from './items/item-add/item-add.component';
import { OrderComponent } from './order/order.component';
import { CancelComponent } from './cancel/cancel.component';
+import { CheckoutComponent } from './checkout/checkout.component';
//import { NameDialogComponent } from './namedialog/namedialog.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@@ -35,8 +36,8 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
ItemCreateComponent,
ItemDeleteComponent,
ItemAddComponent,
- CancelComponent
- //NameDialogComponent,
+ CancelComponent,
+ CheckoutComponent
],
imports: [
BrowserModule,
@@ -58,6 +59,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
],
providers: [],
bootstrap: [AppComponent],
- entryComponents: [ItemCreateComponent, ItemDeleteComponent, ItemAddComponent, CancelComponent]
+ entryComponents: [ItemCreateComponent, ItemDeleteComponent, ItemAddComponent, CancelComponent, CheckoutComponent]
})
export class AppModule { }
diff --git a/src/app/checkout/checkout.component.css b/src/app/checkout/checkout.component.css
index e69de29..8955a94 100644
--- a/src/app/checkout/checkout.component.css
+++ b/src/app/checkout/checkout.component.css
@@ -0,0 +1,3 @@
+.text {
+ font-family: "Roboto-Mono", monospace;
+}
diff --git a/src/app/checkout/checkout.component.html b/src/app/checkout/checkout.component.html
index e69de29..7034aea 100644
--- a/src/app/checkout/checkout.component.html
+++ b/src/app/checkout/checkout.component.html
@@ -0,0 +1,25 @@
+
+
Scan to make payment
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
diff --git a/src/app/checkout/checkout.component.ts b/src/app/checkout/checkout.component.ts
index e69de29..10393ed 100644
--- a/src/app/checkout/checkout.component.ts
+++ b/src/app/checkout/checkout.component.ts
@@ -0,0 +1,45 @@
+import { Inject, Component, OnInit, ViewEncapsulation} from '@angular/core';
+import { MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
+var QRCode = require('easyqrcodejs');
+var URLSafeBase64 = require('urlsafe-base64');
+var Buffer = require('buffer/').Buffer;
+
+@Component({
+ selector: 'app-checkout',
+ templateUrl: './checkout.component.html',
+ styleUrls: ['./checkout.component.css']
+})
+
+export class CheckoutComponent implements OnInit{
+ address: string;
+ total: number;
+ orderId: string;
+ codeString: string = '';
+
+ constructor(
+ private dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: { totalZec: number, addr: string, orderId: string}
+ ) {
+ this.address = data.addr;
+ this.total = data.totalZec;
+ this.orderId = data.orderId;
+ }
+
+ ngOnInit() {
+ this.codeString = `zcash:${this.address}?amount=${this.total.toFixed(6)}&memo=${URLSafeBase64.encode(Buffer.from('Z-Go Order '.concat(this.orderId)))}`;
+ var qrcode = new QRCode(document.getElementById("checkout-qr"), {
+ text: this.codeString,
+ logo: "/assets/zcash.png",
+ logoWidth: 80,
+ logoHeight: 80
+ });
+ }
+
+ confirm() {
+ this.dialogRef.close(true);
+ }
+
+ close() {
+ this.dialogRef.close(false);
+ }
+}
diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html
index e2ebb4d..7b0ed93 100644
--- a/src/app/header/header.component.html
+++ b/src/app/header/header.component.html
@@ -1,13 +1,12 @@
- Zgo!
+ Z Go!
Last block seen: {{heightUpdate | async}}
- {{(ownerUpdate | async)!.name}}
- {{ shortenZaddr((ownerUpdate | async)!.address) }}
+ {{ shortenZaddr((ownerUpdate | async)!.address) }}
diff --git a/src/app/items/item-list/item-list.component.ts b/src/app/items/item-list/item-list.component.ts
index 89b28c1..4bfab70 100644
--- a/src/app/items/item-list/item-list.component.ts
+++ b/src/app/items/item-list/item-list.component.ts
@@ -50,6 +50,9 @@ export class ItemListComponent implements OnInit{
}
ngOnInit(){
+ this.itemsUpdate.subscribe((items) => {
+ this.items = items;
+ });
}
openDialog(){
@@ -67,6 +70,9 @@ export class ItemListComponent implements OnInit{
this.itemService.addItem(item);
}
this.itemService.getItems(this.owner.address);
+ this.itemsUpdate.subscribe((items) => {
+ this.items = items;
+ });
});
}
@@ -114,8 +120,12 @@ export class ItemListComponent implements OnInit{
if (val != null) {
console.log('Deleting', val);
this.itemService.deleteItem(val);
+ this.items = [];
}
this.itemService.getItems(this.owner.address);
+ this.itemsUpdate.subscribe((items) => {
+ this.items = items;
+ });
});
}
diff --git a/src/app/items/items.service.ts b/src/app/items/items.service.ts
index c39dd40..f596f44 100644
--- a/src/app/items/items.service.ts
+++ b/src/app/items/items.service.ts
@@ -9,11 +9,13 @@ export class ItemService{
private dataStore: { items: Item[] } = { items: [] } ;
private _itemsUpdated: BehaviorSubject- = new BehaviorSubject(this.dataStore.items);
public readonly itemsUpdated: Observable
- = this._itemsUpdated.asObservable();
+ private address:string = '';
constructor(private http: HttpClient){
}
getItems(addr: string){
+ this.address = addr;
const params = new HttpParams().append('address', addr);
let obs = this.http.get<{message: string, items: any}>('http://localhost:3000/api/getitems', { headers:{}, params: params, observe: 'response'});
@@ -35,6 +37,7 @@ export class ItemService{
obs.subscribe((ItemResponse) => {
console.log('Item added');
+ this.getItems(this.address);
});
return obs;
@@ -45,6 +48,7 @@ export class ItemService{
obs.subscribe((ItemResponse) => {
console.log('Item deleted');
+ this.getItems(this.address);
});
return obs;
diff --git a/src/app/login/login.component.css b/src/app/login/login.component.css
index f6d0e97..d99b529 100644
--- a/src/app/login/login.component.css
+++ b/src/app/login/login.component.css
@@ -1,3 +1,7 @@
* {
- font-family: 'Roboto Mono', monospace;
+ font-family: 'Roboto-Mono', monospace;
+}
+mat-card.coolcard{
+ background-color: #FF5722;
+ color: #FFFFFF;
}
diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html
index 42d861f..3aa5a7c 100644
--- a/src/app/login/login.component.html
+++ b/src/app/login/login.component.html
@@ -1,27 +1,46 @@
-
-
Welcome to Zgo!
+
+
+
+
+ __||__ _____ _
+|___ / / ____| | |
+ / / | | __ ___ | |
+ / / | | |_ |/ _ \| |
+ / /__ | |__| | (_) |_|
+/__ _| \_____|\___/(_)
+ ||
+
+
+
-
+
+
- A non-custodial point-of-sale application, powered by Zcash.
+
+ A non-custodial point-of-sale application, powered by Zcash!
+
+ - Your Zcash shielded address is your login.
+ - Your customer pays directly to your wallet.
+
+
|
+
Ensure you include your Reply-To shielded address!
-
- Your shielded address is your username and all payments will be sent to it.
-
-
+
+
|
+
diff --git a/src/app/order/order.component.html b/src/app/order/order.component.html
index 7ad9f07..ba2c49d 100644
--- a/src/app/order/order.component.html
+++ b/src/app/order/order.component.html
@@ -1,8 +1,9 @@
+
0">
- {{order._id}}
Order Total: |
@@ -31,8 +32,7 @@
-
-
+
|
diff --git a/src/app/order/order.component.ts b/src/app/order/order.component.ts
index 2328c3a..5638d99 100644
--- a/src/app/order/order.component.ts
+++ b/src/app/order/order.component.ts
@@ -6,6 +6,7 @@ import { FullnodeService } from '../fullnode.service';
import { UserService } from '../user.service';
import { OrderService } from './order.service';
import { CancelComponent } from '../cancel/cancel.component';
+import { CheckoutComponent} from '../checkout/checkout.component';
@Component({
selector: 'app-order',
@@ -62,4 +63,25 @@ export class OrderComponent implements OnInit{
this.orderService.getOrder();
});
}
+
+ checkout() {
+ const dialogConfig = new MatDialogConfig();
+
+ dialogConfig.disableClose = true;
+ dialogConfig.autoFocus = true;
+ dialogConfig.data = {
+ totalZec: this.total/this.price,
+ addr: this.order.address,
+ orderId: this.order._id
+ };
+
+ const dialogRef = this.dialog.open(CheckoutComponent, dialogConfig);
+ dialogRef.afterClosed().subscribe((val) => {
+ if (val) {
+ console.log('Payment confirmed!');
+ } else {
+ console.log('Returning to order');
+ }
+ });
+ }
}