|
|
|
@@ -42,6 +42,7 @@ export class CartPage implements OnInit { |
|
|
|
selected_promocode: string = ''; |
|
|
|
userInfo: any; |
|
|
|
mallPromoCodes: Array<any> = []; |
|
|
|
invoiceData: any; |
|
|
|
|
|
|
|
constructor( |
|
|
|
private location: Location, |
|
|
|
@@ -54,24 +55,7 @@ export class CartPage implements OnInit { |
|
|
|
ngOnInit() { |
|
|
|
this.hideMenuButton(); |
|
|
|
this.userInfo = JSON.parse(localStorage.userInfo)['User Info']; |
|
|
|
} |
|
|
|
|
|
|
|
async presentModal(url: string) { |
|
|
|
const modal = await this.modalController.create({ |
|
|
|
component: InAppBrowserPage, |
|
|
|
componentProps: { |
|
|
|
url: url |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
modal.onDidDismiss().then(() => { |
|
|
|
this.showMenuButton(); |
|
|
|
localStorage.removeItem('userCart'); |
|
|
|
this.router.navigate(['/profile']); |
|
|
|
}); |
|
|
|
|
|
|
|
return await modal.present(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
this.showMenuButton(); |
|
|
|
@@ -297,11 +281,35 @@ export class CartPage implements OnInit { |
|
|
|
}; |
|
|
|
|
|
|
|
this.orderService.generateInvoice(invoice_data).then((data: any) => { |
|
|
|
console.log(data.shorturl); |
|
|
|
this.invoiceData = data; |
|
|
|
this.presentModal(data.shorturl); |
|
|
|
}, (err) => { |
|
|
|
this.toastService.presentToast("Oops, something went wrong", "danger"); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async presentModal(url: string) { |
|
|
|
const modal = await this.modalController.create({ |
|
|
|
component: InAppBrowserPage, |
|
|
|
componentProps: { |
|
|
|
url: url |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
modal.onDidDismiss().then(() => { |
|
|
|
this.showMenuButton(); |
|
|
|
|
|
|
|
this.orderService.getPaymentDetailsByOrderID(this.invoiceData.orderId).then((paymentDetails: any) => { |
|
|
|
if (paymentDetails.Status === "paid") { |
|
|
|
this.placeOrder(); |
|
|
|
} else { |
|
|
|
this.toastService.presentToast("Payment Failed!", "danger"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return await modal.present(); |
|
|
|
} |
|
|
|
|
|
|
|
} |