From 8243b4e3f8bc4617a18c558537813ec253b4a2d0 Mon Sep 17 00:00:00 2001 From: Rene Vergara A Date: Thu, 4 Aug 2022 16:31:37 -0500 Subject: [PATCH] Add buttons to checkout component --- src/app/checkout/checkout.component.html | 32 ++++++++++++-- src/app/checkout/checkout.component.ts | 55 ++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 7 deletions(-) diff --git a/src/app/checkout/checkout.component.html b/src/app/checkout/checkout.component.html index 401da48..3d7efbe 100644 --- a/src/app/checkout/checkout.component.html +++ b/src/app/checkout/checkout.component.html @@ -1,4 +1,5 @@ -
+
Scan to make payment @@ -14,7 +15,7 @@ - +
@@ -32,6 +33,31 @@
- +
+
+ + Can't scan?
Use this wallet link, or +
+ + +
+ + +
diff --git a/src/app/checkout/checkout.component.ts b/src/app/checkout/checkout.component.ts index 815afe0..7273f13 100644 --- a/src/app/checkout/checkout.component.ts +++ b/src/app/checkout/checkout.component.ts @@ -2,6 +2,8 @@ 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'; +import { NotifierService } from '../notifier.service'; + var QRCode = require('easyqrcodejs'); var URLSafeBase64 = require('urlsafe-base64'); var Buffer = require('buffer/').Buffer; @@ -22,8 +24,9 @@ export class CheckoutComponent implements OnInit{ constructor( private dialogRef: MatDialogRef, private sanitizer: DomSanitizer, - @Inject(MAT_DIALOG_DATA) public data: { totalZec: number, addr: string, orderId: string} - ) { + @Inject(MAT_DIALOG_DATA) public data: { totalZec: number, addr: string, orderId: string}, + private notifierService : NotifierService ) { + console.log("Entra a Constructor") this.address = data.addr; this.total = data.totalZec; @@ -37,8 +40,8 @@ export class CheckoutComponent implements OnInit{ { text: this.codeString, logo: "/assets/zcash.png", - width: 220, - height: 220, + width: 230, + height: 230, logoWidth: 60, logoHeight: 60, correctLevel: QRCode.CorrectLevel.H @@ -54,4 +57,48 @@ export class CheckoutComponent implements OnInit{ close() { this.dialogRef.close(false); } + + copyAddress() { + if (!navigator.clipboard) { +// alert("Copy functionality not supported"); + this.notifierService + .showNotification("Copy functionality not supported","Close","error"); + } + try { + navigator.clipboard.writeText(this.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.total.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); + } + } }