diff --git a/src/app/checkout/checkout.component.ts b/src/app/checkout/checkout.component.ts index 10393ed..79698b6 100644 --- a/src/app/checkout/checkout.component.ts +++ b/src/app/checkout/checkout.component.ts @@ -1,5 +1,7 @@ import { Inject, Component, OnInit, ViewEncapsulation} from '@angular/core'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; + var QRCode = require('easyqrcodejs'); var URLSafeBase64 = require('urlsafe-base64'); var Buffer = require('buffer/').Buffer; @@ -15,18 +17,21 @@ export class CheckoutComponent implements OnInit{ total: number; orderId: string; codeString: string = ''; + zcashUrl: SafeUrl; constructor( private dialogRef: MatDialogRef, + private sanitizer: DomSanitizer, @Inject(MAT_DIALOG_DATA) public data: { totalZec: number, addr: string, orderId: string} ) { this.address = data.addr; this.total = data.totalZec; this.orderId = data.orderId; + this.codeString = `zcash:${this.address}?amount=${this.total.toFixed(6)}&memo=${URLSafeBase64.encode(Buffer.from('Z-Go Order '.concat(this.orderId)))}`; + this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString); } 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",