Convenience buttons added to PmtService invoice
This commit is contained in:
parent
3053d17740
commit
f7749cb2f7
8 changed files with 189 additions and 6 deletions
|
@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
- Added new service for Xero integration
|
- Added new service for Xero integration
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Settings component updated to use owner's invoices field to control
|
- Settings component updated to use owner's invoices field to control
|
||||||
integrations tab (Pro version)
|
integrations tab (Pro version)
|
||||||
- Orders list updated to show payment confirmation only when service is
|
- Orders list updated to show payment confirmation only when service is
|
||||||
|
|
|
@ -88,6 +88,43 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<div style="height: 15px;"></div>
|
||||||
|
<div width="100%"
|
||||||
|
style="font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: italic;
|
||||||
|
text-align: center;">
|
||||||
|
Scan the QR code with your wallet to make payment
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
line-height: 30px;">
|
||||||
|
<div style="font-family: 'Spartan';
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px;">
|
||||||
|
Can't scan?<br>Use this <a [href]="zcashUrl">wallet link</a>, or
|
||||||
|
</div>
|
||||||
|
<div style="display: flex;
|
||||||
|
justify-content: space-between;">
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyAddress()">Copy Address</button>
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyAmount()">Copy Amount</button>
|
||||||
|
</div>
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyMemo()">Copy Memo</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
import { ReceiptService } from '../receipt.service';
|
import { ReceiptService } from '../receipt.service';
|
||||||
import { Order} from '../order/order.model';
|
import { Order} from '../order/order.model';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { faCheck, faHourglass } from '@fortawesome/free-solid-svg-icons';
|
import { faCheck, faHourglass } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
var QRCode = require('easyqrcodejs');
|
var QRCode = require('easyqrcodejs');
|
||||||
var URLSafeBase64 = require('urlsafe-base64');
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
var Buffer = require('buffer/').Buffer;
|
var Buffer = require('buffer/').Buffer;
|
||||||
|
@ -24,7 +27,11 @@ export class InvoiceComponent implements OnInit {
|
||||||
error: boolean = false;
|
error: boolean = false;
|
||||||
codeString: string = 'Test';
|
codeString: string = 'Test';
|
||||||
|
|
||||||
|
zcashUrl: SafeUrl = '';
|
||||||
|
|
||||||
|
|
||||||
order:Order = {
|
order:Order = {
|
||||||
|
_id: '',
|
||||||
address: '',
|
address: '',
|
||||||
session: '',
|
session: '',
|
||||||
timestamp: '',
|
timestamp: '',
|
||||||
|
@ -48,7 +55,9 @@ export class InvoiceComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
private _ActiveRoute:ActivatedRoute,
|
private _ActiveRoute:ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
public receiptService: ReceiptService
|
private sanitizer: DomSanitizer,
|
||||||
|
public receiptService: ReceiptService,
|
||||||
|
private notifierService : NotifierService
|
||||||
) {
|
) {
|
||||||
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
||||||
this.orderUpdate = receiptService.orderUpdate;
|
this.orderUpdate = receiptService.orderUpdate;
|
||||||
|
@ -74,6 +83,9 @@ export class InvoiceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
this.orderUpdate.subscribe(order => {
|
this.orderUpdate.subscribe(order => {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
|
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.nameUpdate.subscribe(name => {
|
this.nameUpdate.subscribe(name => {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -90,4 +102,48 @@ export class InvoiceComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyAddress() {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// alert("Copy functionality not supported");
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Copy functionality not supported","Close","error");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(this.order.address);
|
||||||
|
} catch (err) {
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Error copying address","Close","error");
|
||||||
|
// console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
copyAmount() {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// alert("Copy functionality not supported");
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Copy functionality not supported","Close","error");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(this.order.totalZec.toString());
|
||||||
|
} catch (err) {
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Error while copying ammount","Close","error");
|
||||||
|
// console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
copyMemo() {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// alert("Copy functionality not supported");
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Copy functionality not supported","Close","error");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText("ZGo Order::" + this.order._id);
|
||||||
|
} catch (err) {
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Error while copying Memo","Close","error");
|
||||||
|
// console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ export class OrderComponent implements OnInit{
|
||||||
|
|
||||||
faInvoice = faFileInvoiceDollar;
|
faInvoice = faFileInvoiceDollar;
|
||||||
public order: Order = {
|
public order: Order = {
|
||||||
|
_id: '',
|
||||||
address: '',
|
address: '',
|
||||||
session: '',
|
session: '',
|
||||||
timestamp: '',
|
timestamp: '',
|
||||||
|
@ -79,6 +80,8 @@ export class OrderComponent implements OnInit{
|
||||||
this.orderUpdate = orderService.orderUpdate;
|
this.orderUpdate = orderService.orderUpdate;
|
||||||
this.orderUpdate.subscribe((order) => {
|
this.orderUpdate.subscribe((order) => {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
|
|
||||||
|
console.log('this.order > ' + JSON.stringify(this.order));
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
this.oLines = [];
|
this.oLines = [];
|
||||||
this.myLines = this.order.lines;
|
this.myLines = this.order.lines;
|
||||||
|
@ -183,6 +186,8 @@ export class OrderComponent implements OnInit{
|
||||||
orderId: this.order._id
|
orderId: 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) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
|
|
@ -53,6 +53,7 @@ export class OrderService {
|
||||||
viewkey: ''
|
viewkey: ''
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
|
_id: '',
|
||||||
address: '',
|
address: '',
|
||||||
session: '',
|
session: '',
|
||||||
timestamp: '',
|
timestamp: '',
|
||||||
|
|
|
@ -218,6 +218,34 @@
|
||||||
text-align: center;">
|
text-align: center;">
|
||||||
Scan the QR code with your wallet to make payment
|
Scan the QR code with your wallet to make payment
|
||||||
</div>
|
</div>
|
||||||
|
<div style="text-align: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
line-height: 30px;">
|
||||||
|
<div style="font-family: 'Spartan';
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px;">
|
||||||
|
Can't scan?<br>Use this <a [href]="zcashUrl">wallet link</a>, or
|
||||||
|
</div>
|
||||||
|
<div style="display: flex;
|
||||||
|
justify-content: space-between;">
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyAddress()">Copy Address</button>
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyAmount()">Copy Amount</button>
|
||||||
|
</div>
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyMemo()">Copy Memo</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router, ActivatedRoute, Params } 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 { 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 { Owner } from '../owner.model';
|
||||||
|
@ -9,6 +10,8 @@ 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';
|
||||||
|
|
||||||
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
var QRCode = require('easyqrcodejs');
|
var QRCode = require('easyqrcodejs');
|
||||||
var URLSafeBase64 = require('urlsafe-base64');
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
var Buffer = require('buffer/').Buffer;
|
var Buffer = require('buffer/').Buffer;
|
||||||
|
@ -104,14 +107,17 @@ public order: Order = {
|
||||||
public reportType = 1000;
|
public reportType = 1000;
|
||||||
public Status = 0;
|
public Status = 0;
|
||||||
|
|
||||||
|
codeString: string = '';
|
||||||
|
zcashUrl: SafeUrl = '';
|
||||||
zPrice: number = 1.0;
|
zPrice: number = 1.0;
|
||||||
name: string = '';
|
name: string = '';
|
||||||
error: boolean = false;
|
error: boolean = false;
|
||||||
codeString: string = 'Test';
|
|
||||||
orderId : string = '';
|
orderId : string = '';
|
||||||
|
|
||||||
constructor(private activatedRoute : ActivatedRoute,
|
constructor(private activatedRoute : ActivatedRoute,
|
||||||
private http : HttpClient ) {}
|
private http : HttpClient,
|
||||||
|
private sanitizer: DomSanitizer,
|
||||||
|
private notifierService : NotifierService ) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
|
@ -125,7 +131,6 @@ public order: Order = {
|
||||||
// console.log(this.pmtData);
|
// console.log(this.pmtData);
|
||||||
|
|
||||||
this.getInvoiceData( this.pmtData );
|
this.getInvoiceData( this.pmtData );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -152,7 +157,7 @@ public order: Order = {
|
||||||
//
|
//
|
||||||
// ==> remove "== false" for production enviroment
|
// ==> remove "== false" for production enviroment
|
||||||
//
|
//
|
||||||
if ( this.owner.payconf == false) {
|
if ( this.owner.invoices ) {
|
||||||
// process data
|
// process data
|
||||||
console.log("Owner check passed!!!");
|
console.log("Owner check passed!!!");
|
||||||
this.getXeroInvoiceData( reqData );
|
this.getXeroInvoiceData( reqData );
|
||||||
|
@ -308,6 +313,8 @@ public order: Order = {
|
||||||
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);
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
|
|
||||||
|
@ -336,4 +343,48 @@ public order: Order = {
|
||||||
});
|
});
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyAddress() {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// alert("Copy functionality not supported");
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Copy functionality not supported","Close","error");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(this.order.address);
|
||||||
|
} catch (err) {
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Error copying address","Close","error");
|
||||||
|
// console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
copyAmount() {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// alert("Copy functionality not supported");
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Copy functionality not supported","Close","error");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(this.order.totalZec.toString());
|
||||||
|
} catch (err) {
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Error while copying ammount","Close","error");
|
||||||
|
// console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
copyMemo() {
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// alert("Copy functionality not supported");
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Copy functionality not supported","Close","error");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText("ZGo Order::" + this.orderId);
|
||||||
|
} catch (err) {
|
||||||
|
this.notifierService
|
||||||
|
.showNotification("Error while copying Memo","Close","error");
|
||||||
|
// console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
http://localhost:4200/pmtservice?ownerid=62cca13f5530331e2a97c78e&invoiceNo=INV-0034¤cy=USD&amount=753.95&shortCode=!w8T62
|
http://localhost:4200/pmtservice?ownerid=62cca13f5530331e2a97c78e&invoiceNo=INV-0034¤cy=USD&amount=753.95&shortCode=!w8T62
|
||||||
|
|
||||||
https://test.zgo.cash/api/invdata?address=zs17faa6l5ma55s55exq9rnr32tu0wl8nmqg7xp3e6tz0m5ajn2a6yxlc09t03mqdmvyphavvf3sl8&inv=INV-0034
|
https://test.zgo.cash/api/invdata?address=zs17faa6l5ma55s55exq9rnr32tu0wl8nmqg7xp3e6tz0m5ajn2a6yxlc09t03mqdmvyphavvf3sl8&inv=INV-0034
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://app.zgo.cash/invoice/
|
Loading…
Reference in a new issue