Merge branch 'zgo-test'
This commit is contained in:
commit
614a1cfb68
12 changed files with 164 additions and 11 deletions
|
@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed order memo for checkout
|
||||||
- Fixed display of amounts in item list when using *zatoshis*
|
- Fixed display of amounts in item list when using *zatoshis*
|
||||||
- Fixed sorting of items in list
|
- Fixed sorting of items in list
|
||||||
- Fixed sorting of orders in list
|
- Fixed sorting of orders in list
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { InvoiceComponent } from './invoice/invoice.component';
|
||||||
import { ListOrdersComponent } from './listorders/listorders.component';
|
import { ListOrdersComponent } from './listorders/listorders.component';
|
||||||
import { AuthGuardService } from './auth-guard.service';
|
import { AuthGuardService } from './auth-guard.service';
|
||||||
import { NodeResolverService } from './node-resolver.service';
|
import { NodeResolverService } from './node-resolver.service';
|
||||||
|
import { PmtserviceComponent } from './pmtservice/pmtservice.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: LoginComponent, resolve: { response: NodeResolverService} },
|
{ path: '', component: LoginComponent, resolve: { response: NodeResolverService} },
|
||||||
|
@ -17,6 +18,7 @@ const routes: Routes = [
|
||||||
{ path: 'biz', component: BusinessComponent, canActivate: [AuthGuardService]},
|
{ path: 'biz', component: BusinessComponent, canActivate: [AuthGuardService]},
|
||||||
{ path: 'receipt/:orderId', component: ReceiptComponent},
|
{ path: 'receipt/:orderId', component: ReceiptComponent},
|
||||||
{ path: 'invoice/:orderId', component: InvoiceComponent},
|
{ path: 'invoice/:orderId', component: InvoiceComponent},
|
||||||
|
{ path: 'pmtservice', component: PmtserviceComponent},
|
||||||
{ path: 'login', component: LoginComponent, resolve: { response: NodeResolverService}}
|
{ path: 'login', component: LoginComponent, resolve: { response: NodeResolverService}}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||||
import { PromptInvoiceComponent } from './prompt-invoice/prompt-invoice.component';
|
import { PromptInvoiceComponent } from './prompt-invoice/prompt-invoice.component';
|
||||||
import { PromptReceiptComponent } from './prompt-receipt/prompt-receipt.component';
|
import { PromptReceiptComponent } from './prompt-receipt/prompt-receipt.component';
|
||||||
import { NotifierComponent } from './notifier/notifier.component';
|
import { NotifierComponent } from './notifier/notifier.component';
|
||||||
|
import { PmtserviceComponent } from './pmtservice/pmtservice.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -71,7 +72,8 @@ import { NotifierComponent } from './notifier/notifier.component';
|
||||||
InvoiceComponent,
|
InvoiceComponent,
|
||||||
PromptInvoiceComponent,
|
PromptInvoiceComponent,
|
||||||
PromptReceiptComponent,
|
PromptReceiptComponent,
|
||||||
NotifierComponent
|
NotifierComponent,
|
||||||
|
PmtserviceComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<div class="container" style="margin-top: 10px;">
|
<div class="container" style="font-family: 'Spartan', sans-serif;
|
||||||
|
margin-top: 10px;">
|
||||||
|
|
||||||
<div class="askPayment">
|
<div class="askPayment">
|
||||||
Scan to make payment
|
Scan to make payment
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<mat-dialog-actions>
|
<div style="margin-top: 10px;">
|
||||||
<table cellspacing="0"
|
<table cellspacing="0"
|
||||||
width="100%">
|
width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -32,6 +33,31 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</mat-dialog-actions>
|
</div>
|
||||||
|
<div style="text-align: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
line-height: 30px;">
|
||||||
|
|
||||||
|
Can't scan?<br>Use this <a [href]="zcashUrl">wallet link</a>, or
|
||||||
|
<div style="display: flex;
|
||||||
|
justify-content: space-between;">
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyAddress()">Copy Address</button>
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyAmount()">Copy Amount</button>
|
||||||
|
</div>
|
||||||
|
<button style="margin-top: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
background-color: lightgray;"
|
||||||
|
mat-raised-button
|
||||||
|
(click)="copyMemo()">Copy Memo</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { Inject, Component, OnInit, ViewEncapsulation} from '@angular/core';
|
||||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||||
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
var QRCode = require('easyqrcodejs');
|
var QRCode = require('easyqrcodejs');
|
||||||
var URLSafeBase64 = require('urlsafe-base64');
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
var Buffer = require('buffer/').Buffer;
|
var Buffer = require('buffer/').Buffer;
|
||||||
|
@ -22,12 +24,14 @@ export class CheckoutComponent implements OnInit{
|
||||||
constructor(
|
constructor(
|
||||||
private dialogRef: MatDialogRef<CheckoutComponent>,
|
private dialogRef: MatDialogRef<CheckoutComponent>,
|
||||||
private sanitizer: DomSanitizer,
|
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.address = data.addr;
|
||||||
this.total = data.totalZec;
|
this.total = data.totalZec;
|
||||||
this.orderId = data.orderId;
|
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.codeString = `zcash:${this.address}?amount=${this.total.toFixed(8)}&memo=${URLSafeBase64.encode(Buffer.from('ZGo Order::'.concat(this.orderId)))}`;
|
||||||
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
this.zcashUrl = this.sanitizer.bypassSecurityTrustUrl(this.codeString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,13 +40,13 @@ export class CheckoutComponent implements OnInit{
|
||||||
{
|
{
|
||||||
text: this.codeString,
|
text: this.codeString,
|
||||||
logo: "/assets/zcash.png",
|
logo: "/assets/zcash.png",
|
||||||
width: 220,
|
width: 230,
|
||||||
height: 220,
|
height: 230,
|
||||||
logoWidth: 60,
|
logoWidth: 60,
|
||||||
logoHeight: 60,
|
logoHeight: 60,
|
||||||
correctLevel: QRCode.CorrectLevel.H
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
});
|
});
|
||||||
// console.log(">>> " + qrcode);
|
console.log("mgOnInit - pasa");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,4 +57,48 @@ export class CheckoutComponent implements OnInit{
|
||||||
close() {
|
close() {
|
||||||
this.dialogRef.close(false);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ export class OrderComponent implements OnInit{
|
||||||
this.notifierService
|
this.notifierService
|
||||||
.showNotification("Order successfully cancelled!",
|
.showNotification("Order successfully cancelled!",
|
||||||
"Close","success");
|
"Close","success");
|
||||||
});;
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('Returning to page');
|
console.log('Returning to page');
|
||||||
}
|
}
|
||||||
|
@ -227,6 +227,12 @@ export class OrderComponent implements OnInit{
|
||||||
// + " => (" + item.name +")");
|
// + " => (" + item.name +")");
|
||||||
this.orderService.updateOrder(item.line_id,lines);
|
this.orderService.updateOrder(item.line_id,lines);
|
||||||
this.orderService.getOrder();
|
this.orderService.getOrder();
|
||||||
|
if ( this.order.lines.length == 0 ) {
|
||||||
|
this.orderService.cancelOrder(this.order._id!)
|
||||||
|
.subscribe((response) => {
|
||||||
|
this.orderService.getOrder();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Returning to order');
|
console.log('Returning to order');
|
||||||
|
|
0
src/app/pmtservice/pmtservice.component.css
Normal file
0
src/app/pmtservice/pmtservice.component.css
Normal file
1
src/app/pmtservice/pmtservice.component.html
Normal file
1
src/app/pmtservice/pmtservice.component.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<p>{{ pmtData.ownerId }}</p>
|
23
src/app/pmtservice/pmtservice.component.spec.ts
Normal file
23
src/app/pmtservice/pmtservice.component.spec.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PmtserviceComponent } from './pmtservice.component';
|
||||||
|
|
||||||
|
describe('PmtserviceComponent', () => {
|
||||||
|
let component: PmtserviceComponent;
|
||||||
|
let fixture: ComponentFixture<PmtserviceComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ PmtserviceComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(PmtserviceComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
36
src/app/pmtservice/pmtservice.component.ts
Normal file
36
src/app/pmtservice/pmtservice.component.ts
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute, Params } from "@angular/router";
|
||||||
|
import { PmtData } from "./pmtservice.model"
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-pmtservice',
|
||||||
|
templateUrl: './pmtservice.component.html',
|
||||||
|
styleUrls: ['./pmtservice.component.css']
|
||||||
|
})
|
||||||
|
|
||||||
|
export class PmtserviceComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
public pmtData : PmtData = {
|
||||||
|
ownerId :'',
|
||||||
|
invoice: '',
|
||||||
|
amount: 0,
|
||||||
|
currency: '',
|
||||||
|
shortcode: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(private activatedRoute: ActivatedRoute) {}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.activatedRoute.queryParams.subscribe((params) => {
|
||||||
|
this.pmtData.ownerId = params["ownerid"];
|
||||||
|
this.pmtData.invoice = params["invoice"];
|
||||||
|
this.pmtData.amount = params["amount"];
|
||||||
|
this.pmtData.currency = params["currency"];
|
||||||
|
this.pmtData.shortcode = params["shortcode"];
|
||||||
|
|
||||||
|
console.log(this.pmtData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
7
src/app/pmtservice/pmtservice.model.ts
Normal file
7
src/app/pmtservice/pmtservice.model.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
export interface PmtData {
|
||||||
|
ownerId: string;
|
||||||
|
invoice: string;
|
||||||
|
amount: number;
|
||||||
|
currency: string;
|
||||||
|
shortcode: string;
|
||||||
|
}
|
1
src/app/pmtservice/url.txt
Normal file
1
src/app/pmtservice/url.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
http://localhost:4200/pmtservice?ownerid=Rene&amount=30¤cy=USD&invoice=INV-003234&shortcode=abcde
|
Loading…
Reference in a new issue