Implement link alternative to QR code
This commit is contained in:
parent
172f4da6b1
commit
b88fe7fc20
1 changed files with 6 additions and 1 deletions
|
@ -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<CheckoutComponent>,
|
||||
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",
|
||||
|
|
Loading…
Reference in a new issue