Merge branch 'zgointl' of https://git.vergara.tech/Vergara_Tech/zgo into zgointl

This commit is contained in:
Rene V. Vergara A. 2023-03-14 17:59:15 -05:00
commit 38c1d01bbc
2 changed files with 179 additions and 176 deletions

View file

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed ### Changed
- Parametrization of text elements - Parametrization of text elements
- Expanded Xero reference message to include ZEC amount
## [1.4.1] - 2023-01-09 ## [1.4.1] - 2023-01-09
@ -76,15 +77,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Convenience buttons on checkout for wallets that are not ZIP-321-compliant - Convenience buttons on checkout for wallets that are not ZIP-321-compliant
- PmtService Component first alpha version ready for testing - PmtService Component first alpha version ready for testing
- Add `crmToken` field to `owner.model.ts`
- Add `externalInvoice` field and `shortCode` field to `order.model.ts`
### Fixed ### Fixed
- Memo for checkout orders - Memo for checkout orders
## Added
- Add `crmToken` field to `owner.model.ts`
- Add `externalInvoice` field and `shortCode` field to `order.model.ts`
## [1.2.1] - 2022-08-01 ## [1.2.1] - 2022-08-01

View file

@ -31,6 +31,7 @@ export class InvoiceComponent implements OnInit {
name: string = ''; name: string = '';
error: boolean = false; error: boolean = false;
codeString: string = 'Test'; codeString: string = 'Test';
invString: string = '';
public isWCOrder : boolean = false; public isWCOrder : boolean = false;
zcashUrl: SafeUrl = ''; zcashUrl: SafeUrl = '';
externalURL: string = ''; externalURL: string = '';
@ -124,7 +125,10 @@ export class InvoiceComponent implements OnInit {
if ( order.session.substring(0,1) == 'W') { if ( order.session.substring(0,1) == 'W') {
this.isWCOrder = true; this.isWCOrder = true;
} }
this.codeString = `zcash:${this.order.address}?amount=${this.order.totalZec.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId!)))}`; 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.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
}); });
this.nameUpdate.subscribe(name => { this.nameUpdate.subscribe(name => {
@ -138,18 +142,18 @@ export class InvoiceComponent implements OnInit {
backToShop() { backToShop() {
if ( this.isWCOrder ) { if ( this.isWCOrder ) {
// console.log('External Invoice -> ' + this.order.externalInvoice ); // console.log('External Invoice -> ' + this.order.externalInvoice );
const b64URL:string = this.order.externalInvoice.substring(0,this.order.externalInvoice.indexOf("-")); const b64URL:string = this.order.externalInvoice.substring(0,this.order.externalInvoice.indexOf("-"));
// console.log('encodedURL -> ' + b64URL ); // console.log('encodedURL -> ' + b64URL );
const shopURL: string = Buffer.from(b64URL, 'base64').toString(); const shopURL: string = Buffer.from(b64URL, 'base64').toString();
const tmp_orderid = this.order.externalInvoice.substring(this.order.externalInvoice.indexOf('-')+1); const tmp_orderid = this.order.externalInvoice.substring(this.order.externalInvoice.indexOf('-')+1);
const wc_order_key = tmp_orderid.substring(tmp_orderid.indexOf('-')+1); const wc_order_key = tmp_orderid.substring(tmp_orderid.indexOf('-')+1);
const wc_orderid = tmp_orderid.substring(0,tmp_orderid.indexOf('-')); const wc_orderid = tmp_orderid.substring(0,tmp_orderid.indexOf('-'));
// console.log('wc_order_id -> ' + wc_orderid); // console.log('wc_order_id -> ' + wc_orderid);
// console.log('wc_order_key -> ' + wc_order_key); // console.log('wc_order_key -> ' + wc_order_key);
// console.log('new URL -> ' + shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key); // console.log('new URL -> ' + shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key);
if ( shopURL ) { if ( shopURL ) {
// console.log('Opening URL....' + shopURL); // console.log('Opening URL....' + shopURL);
window.open( shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key,"_blank"); window.open( shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key,"_blank");
} }
} }
@ -164,7 +168,7 @@ export class InvoiceComponent implements OnInit {
copyAddress() { copyAddress() {
if (!navigator.clipboard) { if (!navigator.clipboard) {
// alert("Copy functionality not supported"); // alert("Copy functionality not supported");
this.notifierService this.notifierService
.showNotification( .showNotification(
this.vE.invoiceCopyNotavail, this.vE.invoiceCopyNotavail,
@ -181,13 +185,13 @@ export class InvoiceComponent implements OnInit {
this.vE.invoiceNotservClose, this.vE.invoiceNotservClose,
'error', 'error',
this.vE.invoiceNotservError); this.vE.invoiceNotservError);
// console.error("Error", err); // console.error("Error", err);
} }
} }
copyAmount() { copyAmount() {
if (!navigator.clipboard) { if (!navigator.clipboard) {
// alert("Copy functionality not supported"); // alert("Copy functionality not supported");
this.notifierService this.notifierService
.showNotification( .showNotification(
this.vE.invoiceCopyNotavail, this.vE.invoiceCopyNotavail,
@ -204,13 +208,13 @@ export class InvoiceComponent implements OnInit {
this.vE.invoiceNotservClose, this.vE.invoiceNotservClose,
'error', 'error',
this.vE.invoiceNotservError); this.vE.invoiceNotservError);
// console.error("Error", err); // console.error("Error", err);
} }
} }
copyMemo() { copyMemo() {
if (!navigator.clipboard) { if (!navigator.clipboard) {
// alert("Copy functionality not supported"); // alert("Copy functionality not supported");
this.notifierService this.notifierService
.showNotification( .showNotification(
this.vE.invoiceCopyNotavail, this.vE.invoiceCopyNotavail,
@ -227,7 +231,7 @@ export class InvoiceComponent implements OnInit {
this.vE.invoiceNotservClose, this.vE.invoiceNotservClose,
'error', 'error',
this.vE.invoiceNotservError); this.vE.invoiceNotservError);
// console.error("Error", err); // console.error("Error", err);
} }
} }