Fix QR code generation for Xero invoice
This commit is contained in:
parent
a05b76ebed
commit
84c31bc824
2 changed files with 28 additions and 24 deletions
|
@ -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="payment-qr"
|
id="invoice-qr"
|
||||||
*ngIf="!order.paid"></div>
|
*ngIf="!order.paid"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -80,10 +80,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 = 1000;
|
public reportType = 0;
|
||||||
public Status = 0;
|
public Status = 0;
|
||||||
|
|
||||||
codeString: string = '';
|
codeString: string = 'ZGo - The Zcash Register';
|
||||||
zcashUrl: SafeUrl = '';
|
zcashUrl: SafeUrl = '';
|
||||||
zPrice: number = 1.0;
|
zPrice: number = 1.0;
|
||||||
name: string = '';
|
name: string = '';
|
||||||
|
@ -139,10 +139,6 @@ export class PmtserviceComponent implements OnInit {
|
||||||
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) => {
|
||||||
|
@ -156,6 +152,9 @@ export class PmtserviceComponent implements OnInit {
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
getInvoiceData( reqData : PmtData ) {
|
getInvoiceData( reqData : PmtData ) {
|
||||||
//this.getXeroInvoiceData( reqData );
|
//this.getXeroInvoiceData( reqData );
|
||||||
let obs = this.http.post<{reportType: number, order: Order, shop: string}>
|
let obs = this.http.post<{reportType: number, order: Order, shop: string}>
|
||||||
|
@ -164,6 +163,7 @@ export class PmtserviceComponent implements OnInit {
|
||||||
{headers: this.reqHeaders, observe: 'response' }
|
{headers: this.reqHeaders, observe: 'response' }
|
||||||
);
|
);
|
||||||
obs.subscribe((invoiceData) => {
|
obs.subscribe((invoiceData) => {
|
||||||
|
if(invoiceData.status == 201) {
|
||||||
this.reportType = invoiceData.body!.reportType;
|
this.reportType = invoiceData.body!.reportType;
|
||||||
this.order = invoiceData.body!.order;
|
this.order = invoiceData.body!.order;
|
||||||
this.shop = invoiceData.body!.shop;
|
this.shop = invoiceData.body!.shop;
|
||||||
|
@ -173,7 +173,7 @@ export class PmtserviceComponent implements OnInit {
|
||||||
|
|
||||||
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).concat(' Invoice: ').concat(this.order.externalInvoice)))}`;
|
||||||
|
|
||||||
var qrcode = new QRCode(document.getElementById("payment-qr"), {
|
var qrcode = new QRCode(document.getElementById("invoice-qr"), {
|
||||||
text: this.codeString,
|
text: this.codeString,
|
||||||
logo: "/assets/zcash.png",
|
logo: "/assets/zcash.png",
|
||||||
width: 180,
|
width: 180,
|
||||||
|
@ -184,6 +184,10 @@ export class PmtserviceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
||||||
|
} else {
|
||||||
|
this.reportType = invoiceData.body!.reportType;
|
||||||
|
console.log('reportType ' + invoiceData.body!.reportType + ' code ' + invoiceData.status);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue