Commit 3f2818f2 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174246 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 158517b7
......@@ -65,12 +65,7 @@ export class EcmCheckoutComponent implements OnInit {
this.createUserData();
this.getCartItems();
let breadcrumb = [{label: 'Home', url: '/home'}, {label: 'Checkout', url: 'javascript:void(0)'}];
this.breadcrumbSerivce.breadcrumbs = breadcrumb;
this.cardList = this.store.select('savedCards');
this.userInfo = this.store.select('profileInfo');
//this.addressList = this.store.select('Address');
this.store.select('Address').subscribe( addressList => {
console.log( 'loadUser addressList >> ', addressList );
......@@ -78,13 +73,20 @@ export class EcmCheckoutComponent implements OnInit {
this.selectedAddress = addressList[0];
});
this.cardList.subscribe( cardList => {
this.store.select('savedCards').subscribe( cardList => {
console.log( 'loadUser cardList >> ', cardList );
this.cardList = cardList;
if(cardList[0]){
this.selectedPaymntOpt = cardList[0].lineNo;
}
});
this.stepper.selectionChange.subscribe(
selected => {
this.selectedStep = selected;
}
);
this.loginFormGroup = this._formBuilder.group({
username: ['', Validators.required],
password: ['', Validators.required]
......@@ -108,18 +110,11 @@ export class EcmCheckoutComponent implements OnInit {
}
}
onSubmit(data) {
console.log("User Email:[" +data.email +"]");
console.log("User Data :[" + JSON.stringify(data) +"]");
this.placeOrder(data);
}
getCartItems() {
this.cartItems = this.store.select('cartItems');
this.cartItems.subscribe( cartItems => {
this.store.select('cartItems').subscribe( cartItems => {
this.totalPrice = 0;
cartItems.forEach(
this.cartItems = cartItems;
this.cartItems.forEach(
item => {
this.totalPrice = this.totalPrice + (parseFloat( item.itemHeader.itemDiscountedRate ) * item.itemQuantity);
}
......@@ -155,13 +150,33 @@ export class EcmCheckoutComponent implements OnInit {
}
executePayment() {
console.log('card details: ',this.newCard);
if(this.selectedPaymntOpt == 'newcard'){
let paymentInfo;
switch(this.selectedPaymntOpt)
{
case 'newcard':
console.log('newcard');
paymentInfo = { "paymentOption":'card', "cardDetails": this.newCard};
break;
case 'netbanking':
console.log('netbanking');
paymentInfo = { "paymentOption":'netbanking', "bankDetails": ''};
break;
case 'cod':
console.log('COD');
paymentInfo = { "paymentOption":'COD'};
break;
case 'wallet':
console.log('Wallet');
paymentInfo = { "paymentOption":'wallet'};
break;
default:
console.log('DEFAULT');
paymentInfo = { "paymentOption":'card', "cardDetails": this.cardList.find(x => x.lineNo === this.selectedPaymntOpt)};
break;
}
let order = { "billAddress": this.selectedAddress };
let order = { "token_id": this.userData.TOKEN_ID, "billAddress": this.selectedAddress, "orderedItems":this.cartItems, "paymentInfo": paymentInfo};
console.log('-----order-----',order);
}
......@@ -236,7 +251,6 @@ export class EcmCheckoutComponent implements OnInit {
onAddNew(address: Address)
{
let lineNo = this.getMaxLineNo();
//this.selectedAddress = lineNo;
console.log( 'loadUser addressList >> ', lineNo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment