Merge branch 'dev' into zgointl
This commit is contained in:
commit
633e7c733b
2 changed files with 179 additions and 176 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -31,50 +31,51 @@ export class InvoiceComponent implements OnInit {
|
||||||
name: string = '';
|
name: string = '';
|
||||||
error: boolean = false;
|
error: boolean = false;
|
||||||
codeString: string = 'Test';
|
codeString: string = 'Test';
|
||||||
public isWCOrder : boolean = false;
|
invString: string = '';
|
||||||
|
public isWCOrder : boolean = false;
|
||||||
zcashUrl: SafeUrl = '';
|
zcashUrl: SafeUrl = '';
|
||||||
externalURL: string = '';
|
externalURL: string = '';
|
||||||
order:Order = {
|
order:Order = {
|
||||||
_id: '',
|
_id: '',
|
||||||
address: '',
|
address: '',
|
||||||
session: '',
|
session: '',
|
||||||
timestamp: '',
|
timestamp: '',
|
||||||
closed: false,
|
closed: false,
|
||||||
currency: '',
|
currency: '',
|
||||||
price: 0,
|
price: 0,
|
||||||
total: 0,
|
total: 0,
|
||||||
totalZec: 0,
|
totalZec: 0,
|
||||||
paid: false,
|
paid: false,
|
||||||
externalInvoice: '',
|
externalInvoice: '',
|
||||||
shortCode: '',
|
shortCode: '',
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
qty: 1,
|
qty: 1,
|
||||||
name: '',
|
name: '',
|
||||||
cost:0
|
cost:0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
//
|
//
|
||||||
// Language Support
|
// Language Support
|
||||||
//
|
//
|
||||||
vE = {
|
vE = {
|
||||||
invoiceInvoiceLbl : '',
|
invoiceInvoiceLbl : '',
|
||||||
invoiceOrderId : '',
|
invoiceOrderId : '',
|
||||||
invoiceOrderDate : '',
|
invoiceOrderDate : '',
|
||||||
invoiceZcashPrice : '',
|
invoiceZcashPrice : '',
|
||||||
invoiceQtyLbl : '',
|
invoiceQtyLbl : '',
|
||||||
invoiceOrderPrice : '',
|
invoiceOrderPrice : '',
|
||||||
invoiceInvoiceTotal : '',
|
invoiceInvoiceTotal : '',
|
||||||
invoicePaymentConfirmed : '',
|
invoicePaymentConfirmed : '',
|
||||||
invoicePaymentPending : '',
|
invoicePaymentPending : '',
|
||||||
invoiceScanQrcode : '',
|
invoiceScanQrcode : '',
|
||||||
invoiceCantScan : '',
|
invoiceCantScan : '',
|
||||||
invoiceUseThis : '',
|
invoiceUseThis : '',
|
||||||
invoiceWalletLink : '',
|
invoiceWalletLink : '',
|
||||||
invoiceDotOr : '',
|
invoiceDotOr : '',
|
||||||
invoiceCopyAddress : '',
|
invoiceCopyAddress : '',
|
||||||
invoiceCopyAmount : '',
|
invoiceCopyAmount : '',
|
||||||
invoiceCopyMemo : '',
|
invoiceCopyMemo : '',
|
||||||
invoiceReturnToshop : '',
|
invoiceReturnToshop : '',
|
||||||
|
@ -86,15 +87,15 @@ export class InvoiceComponent implements OnInit {
|
||||||
invoiceCopymemoError : '',
|
invoiceCopymemoError : '',
|
||||||
invoiceInvalidId : '',
|
invoiceInvalidId : '',
|
||||||
invoiceInfoNotavail : ''
|
invoiceInfoNotavail : ''
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
constructor(
|
constructor(
|
||||||
private _ActiveRoute:ActivatedRoute,
|
private _ActiveRoute:ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
public receiptService: ReceiptService,
|
public receiptService: ReceiptService,
|
||||||
private notifierService : NotifierService,
|
private notifierService : NotifierService,
|
||||||
private languageService : LanguageService
|
private languageService : LanguageService
|
||||||
) {
|
) {
|
||||||
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
this.orderId = this._ActiveRoute.snapshot.paramMap.get("orderId");
|
||||||
console.log('constructor - orderId -> ' + this.orderId);
|
console.log('constructor - orderId -> ' + this.orderId);
|
||||||
|
@ -105,13 +106,13 @@ export class InvoiceComponent implements OnInit {
|
||||||
this.error = false;
|
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!)))}`;
|
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"), {
|
var qrcode = new QRCode(document.getElementById("payment-qr"), {
|
||||||
text: this.codeString,
|
text: this.codeString,
|
||||||
logo: "/assets/zcash.png",
|
logo: "/assets/zcash.png",
|
||||||
width: 180,
|
width: 180,
|
||||||
height: 180,
|
height: 180,
|
||||||
logoWidth: 50,
|
logoWidth: 50,
|
||||||
logoHeight: 50,
|
logoHeight: 50,
|
||||||
correctLevel: QRCode.CorrectLevel.H
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
});
|
});
|
||||||
this.error = false;
|
this.error = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,8 +125,11 @@ 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.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
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 => {
|
this.nameUpdate.subscribe(name => {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -133,23 +137,23 @@ export class InvoiceComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,119 +161,119 @@ export class InvoiceComponent implements OnInit {
|
||||||
|
|
||||||
getIconStyle(order : Order) {
|
getIconStyle(order : Order) {
|
||||||
if( order.paid )
|
if( order.paid )
|
||||||
return "font-size: 14px; color: #72cc50; margin-bottom: -2px;";
|
return "font-size: 14px; color: #72cc50; margin-bottom: -2px;";
|
||||||
return "color: #FB4F14; margin-bottom: -2px; cursor: pointer;";
|
return "color: #FB4F14; margin-bottom: -2px; cursor: pointer;";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
this.vE.invoiceNotservClose,
|
this.vE.invoiceNotservClose,
|
||||||
'error',
|
'error',
|
||||||
this.vE.invoiceNotservError);
|
this.vE.invoiceNotservError);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
navigator.clipboard.writeText(this.order.address);
|
navigator.clipboard.writeText(this.order.address);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(
|
.showNotification(
|
||||||
this.vE.invoiceCopyaddressError,
|
this.vE.invoiceCopyaddressError,
|
||||||
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,
|
||||||
this.vE.invoiceNotservClose,
|
this.vE.invoiceNotservClose,
|
||||||
'error',
|
'error',
|
||||||
this.vE.invoiceNotservError);
|
this.vE.invoiceNotservError);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
navigator.clipboard.writeText(this.order.totalZec.toString());
|
navigator.clipboard.writeText(this.order.totalZec.toString());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(
|
.showNotification(
|
||||||
this.vE.invoiceCopyamountError,
|
this.vE.invoiceCopyamountError,
|
||||||
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,
|
||||||
this.vE.invoiceNotservClose,
|
this.vE.invoiceNotservClose,
|
||||||
'error',
|
'error',
|
||||||
this.vE.invoiceNotservError);
|
this.vE.invoiceNotservError);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
navigator.clipboard.writeText("ZGo Order::" + this.order._id);
|
navigator.clipboard.writeText("ZGo Order::" + this.order._id);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification(
|
.showNotification(
|
||||||
this.vE.invoiceCopymemoError,
|
this.vE.invoiceCopymemoError,
|
||||||
this.vE.invoiceNotservClose,
|
this.vE.invoiceNotservClose,
|
||||||
'error',
|
'error',
|
||||||
this.vE.invoiceNotservError);
|
this.vE.invoiceNotservError);
|
||||||
// console.error("Error", err);
|
// console.error("Error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
console.log('INVOICE.chgUILanguage Called ');
|
console.log('INVOICE.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('invoice').subscribe(
|
this.languageService.getViewElements('invoice').subscribe(
|
||||||
response => {
|
response => {
|
||||||
console.log('Received >> ', response );
|
console.log('Received >> ', response );
|
||||||
console.log('Language Code : ', response.language);
|
console.log('Language Code : ', response.language);
|
||||||
console.log('Component Name : ',response.component);
|
console.log('Component Name : ',response.component);
|
||||||
console.log('Language data : ',response.data);
|
console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.invoiceInvoiceLbl = response.data.invoice_invoice_lbl;
|
this.vE.invoiceInvoiceLbl = response.data.invoice_invoice_lbl;
|
||||||
this.vE.invoiceOrderId = response.data.invoice_order_id;
|
this.vE.invoiceOrderId = response.data.invoice_order_id;
|
||||||
this.vE.invoiceOrderDate = response.data.invoice_order_date;
|
this.vE.invoiceOrderDate = response.data.invoice_order_date;
|
||||||
this.vE.invoiceZcashPrice = response.data.invoice_zcash_price;
|
this.vE.invoiceZcashPrice = response.data.invoice_zcash_price;
|
||||||
this.vE.invoiceQtyLbl = response.data.invoice_qty_lbl;
|
this.vE.invoiceQtyLbl = response.data.invoice_qty_lbl;
|
||||||
this.vE.invoiceOrderPrice = response.data.invoice_order_price;
|
this.vE.invoiceOrderPrice = response.data.invoice_order_price;
|
||||||
this.vE.invoiceInvoiceTotal = response.data.invoice_invoice_total;
|
this.vE.invoiceInvoiceTotal = response.data.invoice_invoice_total;
|
||||||
this.vE.invoicePaymentConfirmed = response.data.invoice_payment_confirmed;
|
this.vE.invoicePaymentConfirmed = response.data.invoice_payment_confirmed;
|
||||||
this.vE.invoicePaymentPending = response.data.invoice_payment_pending;
|
this.vE.invoicePaymentPending = response.data.invoice_payment_pending;
|
||||||
this.vE.invoiceScanQrcode = response.data.invoice_scan_qrcode;
|
this.vE.invoiceScanQrcode = response.data.invoice_scan_qrcode;
|
||||||
this.vE.invoiceCantScan = response.data.invoice_cant_scan;
|
this.vE.invoiceCantScan = response.data.invoice_cant_scan;
|
||||||
this.vE.invoiceUseThis = response.data.invoice_use_this;
|
this.vE.invoiceUseThis = response.data.invoice_use_this;
|
||||||
this.vE.invoiceWalletLink = response.data.invoice_wallet_link;
|
this.vE.invoiceWalletLink = response.data.invoice_wallet_link;
|
||||||
this.vE.invoiceDotOr = response.data.invoice_dot_or;
|
this.vE.invoiceDotOr = response.data.invoice_dot_or;
|
||||||
this.vE.invoiceCopyAddress = response.data.invoice_copy_address;
|
this.vE.invoiceCopyAddress = response.data.invoice_copy_address;
|
||||||
this.vE.invoiceCopyAmount = response.data.invoice_copy_amount;
|
this.vE.invoiceCopyAmount = response.data.invoice_copy_amount;
|
||||||
this.vE.invoiceCopyMemo = response.data.invoice_copy_memo;
|
this.vE.invoiceCopyMemo = response.data.invoice_copy_memo;
|
||||||
this.vE.invoiceReturnToshop = response.data.invoice_return_toshop;
|
this.vE.invoiceReturnToshop = response.data.invoice_return_toshop;
|
||||||
this.vE.invoiceCopyNotavail = response.data.invoice_copy_notavail;
|
this.vE.invoiceCopyNotavail = response.data.invoice_copy_notavail;
|
||||||
this.vE.invoiceNotservClose = response.data.invoice_notserv_close;
|
this.vE.invoiceNotservClose = response.data.invoice_notserv_close;
|
||||||
this.vE.invoiceNotservError = response.data.invoice_notserv_error;
|
this.vE.invoiceNotservError = response.data.invoice_notserv_error;
|
||||||
this.vE.invoiceCopyaddressError = response.data.invoice_copyaddress_error;
|
this.vE.invoiceCopyaddressError = response.data.invoice_copyaddress_error;
|
||||||
this.vE.invoiceCopyamountError = response.data.invoice_copyamount_error;
|
this.vE.invoiceCopyamountError = response.data.invoice_copyamount_error;
|
||||||
this.vE.invoiceCopymemoError = response.data.invoice_copymemo_error;
|
this.vE.invoiceCopymemoError = response.data.invoice_copymemo_error;
|
||||||
this.vE.invoiceInvalidId = response.data.invoice_invalid_id;
|
this.vE.invoiceInvalidId = response.data.invoice_invalid_id;
|
||||||
this.vE.invoiceInfoNotavail = response.data.invoice_info_notavail;
|
this.vE.invoiceInfoNotavail = response.data.invoice_info_notavail;
|
||||||
|
|
||||||
},
|
},
|
||||||
error => { console.log('Error >> ',error); }
|
error => { console.log('Error >> ',error); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue