Commit ff157922 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174508 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2c7f0b9e
...@@ -65,12 +65,7 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -65,12 +65,7 @@ export class EcmCheckoutComponent implements OnInit {
this.createUserData(); this.createUserData();
this.getCartItems(); 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.userInfo = this.store.select('profileInfo');
//this.addressList = this.store.select('Address');
this.store.select('Address').subscribe( addressList => { this.store.select('Address').subscribe( addressList => {
console.log( 'loadUser addressList >> ', addressList ); console.log( 'loadUser addressList >> ', addressList );
...@@ -78,13 +73,20 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -78,13 +73,20 @@ export class EcmCheckoutComponent implements OnInit {
this.selectedAddress = addressList[0]; this.selectedAddress = addressList[0];
}); });
this.cardList.subscribe( cardList => { this.store.select('savedCards').subscribe( cardList => {
console.log( 'loadUser cardList >> ', cardList ); console.log( 'loadUser cardList >> ', cardList );
this.cardList = cardList;
if(cardList[0]){ if(cardList[0]){
this.selectedPaymntOpt = cardList[0].lineNo; this.selectedPaymntOpt = cardList[0].lineNo;
} }
}); });
this.stepper.selectionChange.subscribe(
selected => {
this.selectedStep = selected;
}
);
this.loginFormGroup = this._formBuilder.group({ this.loginFormGroup = this._formBuilder.group({
username: ['', Validators.required], username: ['', Validators.required],
password: ['', Validators.required] password: ['', Validators.required]
...@@ -108,18 +110,11 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -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() { getCartItems() {
this.cartItems = this.store.select('cartItems'); this.store.select('cartItems').subscribe( cartItems => {
this.cartItems.subscribe( cartItems => {
this.totalPrice = 0; this.totalPrice = 0;
cartItems.forEach( this.cartItems = cartItems;
this.cartItems.forEach(
item => { item => {
this.totalPrice = this.totalPrice + (parseFloat( item.itemHeader.itemDiscountedRate ) * item.itemQuantity); this.totalPrice = this.totalPrice + (parseFloat( item.itemHeader.itemDiscountedRate ) * item.itemQuantity);
} }
...@@ -155,13 +150,33 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -155,13 +150,33 @@ export class EcmCheckoutComponent implements OnInit {
} }
executePayment() { executePayment() {
console.log('card details: ',this.newCard); let paymentInfo;
if(this.selectedPaymntOpt == 'newcard'){ 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); console.log('-----order-----',order);
} }
...@@ -236,7 +251,6 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -236,7 +251,6 @@ export class EcmCheckoutComponent implements OnInit {
onAddNew(address: Address) onAddNew(address: Address)
{ {
let lineNo = this.getMaxLineNo(); let lineNo = this.getMaxLineNo();
//this.selectedAddress = lineNo; //this.selectedAddress = lineNo;
console.log( 'loadUser addressList >> ', 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