From 67032ec81c8bcdc3e34efe1901a863e4ba668e81 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Wed, 15 Mar 2023 16:27:35 -0500 Subject: [PATCH] Fix QR code for Xero invoice payment --- src/app/invoice/invoice.component.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/invoice/invoice.component.ts b/src/app/invoice/invoice.component.ts index a3fffe4..09daae6 100644 --- a/src/app/invoice/invoice.component.ts +++ b/src/app/invoice/invoice.component.ts @@ -104,7 +104,12 @@ export class InvoiceComponent implements OnInit { receiptService.getOrderById(this.orderId!).subscribe(response => { if (response.status == 200){ this.error = false; - this.codeString = `zcash:${response.body!.order.address}?amount=${response.body!.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId!)))}`; + 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!)))}`; + } var qrcode = new QRCode(document.getElementById("payment-qr"), { text: this.codeString, logo: "/assets/zcash.png", @@ -125,10 +130,6 @@ export class InvoiceComponent implements OnInit { if ( order.session.substring(0,1) == 'W') { 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 => {