This commit is contained in:
Le Deng
2017-03-09 09:21:18 -05:00
parent d9e6af4125
commit e50a47f180
13 changed files with 333 additions and 82 deletions

View File

@@ -16,11 +16,11 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="PaymentResource.java" pinned="false" current-in-tab="true">
<file leaf-file-name="PaymentResource.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/PaymentResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="233">
<caret line="60" column="12" lean-forward="true" selection-start-line="60" selection-start-column="12" selection-end-line="74" selection-end-column="65" />
<state relative-caret-position="622">
<caret line="79" column="7" lean-forward="false" selection-start-line="47" selection-start-column="6" selection-end-line="79" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@@ -28,6 +28,48 @@
</provider>
</entry>
</file>
<file leaf-file-name="ShippingResource.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/ShippingResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1005">
<caret line="67" column="55" lean-forward="false" selection-start-line="67" selection-start-column="55" selection-end-line="67" selection-end-column="55" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="UserShipping.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserShipping.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="28" column="33" lean-forward="true" selection-start-line="28" selection-start-column="33" selection-end-line="28" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ShippingAddressServiceImpl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/service/impl/ShippingAddressServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="12" column="13" lean-forward="false" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="UserShippingServiceImpl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/service/impl/UserShippingServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="13" column="13" lean-forward="false" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="UserServiceImpl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/service/impl/UserServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
@@ -91,7 +133,6 @@
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/Payment.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/ShippingAddress.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/User.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserShipping.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/security/Authority.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/security/PasswordResetToken.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/security/Role.java" />
@@ -117,6 +158,8 @@
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserPayment.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserBilling.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/resource/PaymentResource.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/resource/ShippingResource.java" />
<option value="$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserShipping.java" />
</list>
</option>
</component>
@@ -914,12 +957,12 @@
<workItem from="1486538831944" duration="450000" />
<workItem from="1488378219247" duration="650000" />
<workItem from="1488461561430" duration="18419000" />
<workItem from="1488731165185" duration="19699000" />
<workItem from="1488731165185" duration="21199000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="81711000" />
<option name="totallyTimeSpent" value="83211000" />
</component>
<component name="ToolWindowManager">
<frame x="71" y="38" width="1663" height="961" extended-state="0" />
@@ -942,7 +985,7 @@
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32765958" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32681242" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Spring" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32907802" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
@@ -975,28 +1018,6 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/config/RequestFilter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="630">
<caret line="42" column="7" lean-forward="false" selection-start-line="42" selection-start-column="7" selection-end-line="42" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/domain/ShoppingCart.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="17" column="0" lean-forward="true" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/config/HttpSessionConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="21" column="0" lean-forward="false" selection-start-line="21" selection-start-column="0" selection-end-line="24" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/LoginResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
@@ -1109,13 +1130,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserShipping.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="11" column="0" lean-forward="true" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/domain/security/Authority.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
@@ -1312,15 +1326,49 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/service/impl/ShippingAddressServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="12" column="13" lean-forward="false" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/service/impl/UserShippingServiceImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="13" column="13" lean-forward="false" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/PaymentResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="233">
<caret line="60" column="12" lean-forward="true" selection-start-line="60" selection-start-column="12" selection-end-line="74" selection-end-column="65" />
<state relative-caret-position="622">
<caret line="79" column="7" lean-forward="false" selection-start-line="47" selection-start-column="6" selection-end-line="79" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/ShippingResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1005">
<caret line="67" column="55" lean-forward="false" selection-start-line="67" selection-start-column="55" selection-end-line="67" selection-end-column="55" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/domain/UserShipping.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="28" column="33" lean-forward="true" selection-start-line="28" selection-start-column="33" selection-end-line="28" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View File

@@ -1,5 +1,7 @@
package com.bookstore.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.io.Serializable;
@@ -25,6 +27,7 @@ public class UserShipping implements Serializable {
@ManyToOne
@JoinColumn(name = "user_id")
@JsonIgnore
private User user;
public Long getId() {

View File

@@ -45,39 +45,39 @@ public class PaymentResource {
return new ResponseEntity("Payment Added(Updated) Successfully!", HttpStatus.OK);
}
@RequestMapping("/update")
public ResponseEntity updateCreditCard(
@RequestBody String id, Principal principal,
Model model
) {
User user = userService.findByUsername(principal.getName());
UserPayment userPayment = userPaymentService.findById(Long.parseLong(id));
if (user.getId()!=userPayment.getUser().getId()) {
return new ResponseEntity("Invalid Request", HttpStatus.BAD_REQUEST);
} else {
model.addAttribute("user", user);
UserBilling userBilling = userPayment.getUserBilling();
model.addAttribute("userPayment", userPayment);
model.addAttribute("userBilling", userBilling);
List<String> stateList = USConstants.listOfUSStatesCode;
Collections.sort(stateList);
model.addAttribute("stateList", stateList);
model.addAttribute("addNewCreditCard", true);
model.addAttribute("classActiveBilling", true);
model.addAttribute("listOfShippingAddresses", true);
model.addAttribute("userPaymentList", user.getUserPaymentList());
model.addAttribute("userShippingList", user.getUserShippingList());
model.addAttribute("orderList", user.getOrderList());
return new ResponseEntity("Payment Added(Updated) Successfully!", HttpStatus.OK);
}
}
// @RequestMapping("/update")
// public ResponseEntity updateCreditCard(
// @RequestBody String id, Principal principal,
// Model model
// ) {
//
// User user = userService.findByUsername(principal.getName());
// UserPayment userPayment = userPaymentService.findById(Long.parseLong(id));
//
// if (user.getId()!=userPayment.getUser().getId()) {
// return new ResponseEntity("Invalid Request", HttpStatus.BAD_REQUEST);
// } else {
//
// model.addAttribute("user", user);
// UserBilling userBilling = userPayment.getUserBilling();
// model.addAttribute("userPayment", userPayment);
// model.addAttribute("userBilling", userBilling);
//
// List<String> stateList = USConstants.listOfUSStatesCode;
// Collections.sort(stateList);
// model.addAttribute("stateList", stateList);
//
// model.addAttribute("addNewCreditCard", true);
// model.addAttribute("classActiveBilling", true);
// model.addAttribute("listOfShippingAddresses", true);
// model.addAttribute("userPaymentList", user.getUserPaymentList());
// model.addAttribute("userShippingList", user.getUserShippingList());
// model.addAttribute("orderList", user.getOrderList());
//
//
// return new ResponseEntity("Payment Added(Updated) Successfully!", HttpStatus.OK);
// }
// }
@RequestMapping(value = "/remove", method = RequestMethod.POST)
public ResponseEntity removePaymentPost(

View File

@@ -0,0 +1,70 @@
package com.bookstore.resource;
import com.bookstore.domain.User;
import com.bookstore.domain.UserBilling;
import com.bookstore.domain.UserPayment;
import com.bookstore.domain.UserShipping;
import com.bookstore.service.ShippingAddressService;
import com.bookstore.service.UserPaymentService;
import com.bookstore.service.UserService;
import com.bookstore.service.UserShippingService;
import com.bookstore.utility.USConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.security.Principal;
import java.util.Collections;
import java.util.List;
/**
* Created by z00382545 on 3/9/17.
*/
@RestController
@RequestMapping("/shipping")
public class ShippingResource {
@Autowired
private UserService userService;
@Autowired
private UserShippingService userShippingService;
@RequestMapping(value = "/add", method = RequestMethod.POST)
public ResponseEntity AddNewUserShippingPost(
@RequestBody UserShipping userShipping,
Principal principal, Model model) {
User user = userService.findByUsername(principal.getName());
userService.updateUserShipping(userShipping, user);
return new ResponseEntity("Shipping Added(Updated) Successfully!", HttpStatus.OK);
}
@RequestMapping(value = "/remove", method = RequestMethod.POST)
public ResponseEntity removeUserShippingPost(
@RequestBody String id,
Principal principal, Model model) {
User user = userService.findByUsername(principal.getName());
userShippingService.removeById(Long.parseLong(id));
return new ResponseEntity("Shipping Removed Successfully!", HttpStatus.OK);
}
@RequestMapping(value = "/setDefault", method = RequestMethod.POST)
public ResponseEntity setDefaultUserShippingPost(
@RequestBody String id,
Principal principal, Model model) {
User user = userService.findByUsername(principal.getName());
userService.setUserDefaultShipping(Long.parseLong(id), user);
return new ResponseEntity("Set Default Shipping Successfully!", HttpStatus.OK);
}
}

View File

@@ -14,6 +14,7 @@ import { NavBarComponent } from './components/nav-bar/nav-bar.component';
import { LoginService } from './services/login.service';
import { UserService } from './services/user.service';
import { PaymentService } from './services/payment.service';
import { ShippingService } from './services/shipping.service';
import { MyAccountComponent } from './components/my-account/my-account.component';
import { MyProfileComponent } from './components/my-profile/my-profile.component';
@@ -35,7 +36,8 @@ import { MyProfileComponent } from './components/my-profile/my-profile.component
providers: [
LoginService,
UserService,
PaymentService
PaymentService,
ShippingService
],
bootstrap: [AppComponent]
})

View File

@@ -74,7 +74,7 @@
<br>
<div>
<p *ngIf="defaultPaymentSet">Default payment set successfully!</p>
<md-tab-group (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="selectedBillingTab">
<md-tab-group (selectedIndexChange)="selectedBillingChange($event)" [selectedIndex]="selectedBillingTab">
<md-tab label="List of Credit Cards">
<form (ngSubmit)="setDefaultPayment()" method="post">
<table class="table">
@@ -252,7 +252,7 @@
<br>
<div>
<p *ngIf="defaultShippingSet">Default shipping address set successfully!</p>
<md-tab-group (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="selectedShippingTab">
<md-tab-group (selectedIndexChange)="selectedShippingChange($event)" [selectedIndex]="selectedShippingTab">
<md-tab label="List of Shipping Addresses">
<form (ngSubmit)="setDefaultShipping()" method="post">
<table class="table">
@@ -269,7 +269,7 @@
<input type="radio" name="defaultUserShippingId" [(ngModel)]="defaultUserShippingId" [value]="userShipping.id" />
<span>default</span>
</td>
<td>Shipping Address</td>
<td>{{userShipping.userShippingStreet1}}, {{userShipping.userShippingCity}}, {{userShipping.userShippingState}}</td>
<td>
<a md-button (click)="onUpdateShipping(userShipping)"><i
class="fa fa-pencil"></i></a>
@@ -283,7 +283,7 @@
</form>
</md-tab>
<md-tab label="Add(Update) Shipping Address">
<form (ngSubmit)="onNewShippingAddress()" method="post">
<form (ngSubmit)="onNewShipping()" method="post">
<input hidden="hidden" name="id" [(ngModel)]="userShipping.id" />
<!--Shipping Address-->
<div class="form-group">
@@ -325,7 +325,7 @@
</div>
</div>
<hr/>
<button type="submit" class="btn btn-primary btn-lg">Save All</button>
<button md-raised-button type="submit" class="mat-primary">Save All</button>
</form>
</md-tab>
</md-tab-group>

View File

@@ -4,6 +4,7 @@ import {Router} from "@angular/router";
import {LoginService} from "../../services/login.service";
import {UserService} from "../../services/user.service";
import {PaymentService} from "../../services/payment.service";
import {ShippingService} from "../../services/shipping.service";
import {User} from '../../models/user';
import {UserPayment} from '../../models/user-payment';
import {UserBilling} from '../../models/user-billing';
@@ -35,19 +36,34 @@ export class MyProfileComponent implements OnInit {
private userPayment: UserPayment = new UserPayment();
private userBilling: UserBilling = new UserBilling();
private userPaymentList: UserPayment[] = [];
private stateList: string[] = [];
private userShipping: UserShipping = new UserShipping();
private userShippingList: UserShipping[] = [];
private stateList: string[] = [];
private selectedProfileTab:number = 0;
private selectedBillingTab:number = 0;
private selectedShippingTab:number = 0;
private defaultUserPaymentId:number;
private defaultPaymentSet:boolean;
constructor (private paymentService:PaymentService, private loginService: LoginService, private userService: UserService, private router: Router){
private defaultUserShippingId:number;
private defaultShippingSet: boolean;
constructor (
private paymentService:PaymentService,
private shippingService:ShippingService,
private loginService: LoginService,
private userService: UserService,
private router: Router
){
}
selectedIndexChange(val :number ){
selectedShippingChange(val :number ){
this.selectedShippingTab=val;
}
selectedBillingChange(val :number ){
this.selectedBillingTab=val;
}
@@ -118,7 +134,6 @@ export class MyProfileComponent implements OnInit {
onUpdatePayment(payment:UserPayment) {
this.userPayment = payment;
this.userBilling = payment.userBilling;
this.selectedBillingTab=1;
}
onRemovePayment(id:number) {
@@ -148,16 +163,68 @@ export class MyProfileComponent implements OnInit {
);
}
onNewShipping () {
this.shippingService.newShipping(this.userShipping).subscribe(
res => {
this.getCurrentUser();
this.selectedShippingTab = 0;
},
error => {
console.log(error.text());
}
);
}
onUpdateShipping(shipping:UserShipping) {
this.userShipping = shipping;
this.selectedShippingTab=1;
}
onRemoveShipping(id:number) {
this.shippingService.removeShipping(id).subscribe(
res => {
this.getCurrentUser();
},
error => {
console.log(error.text());
}
);
}
setDefaultShipping() {
this.defaultShippingSet=false;
this.shippingService.setDefaultShipping(this.defaultUserShippingId).subscribe(
res => {
this.getCurrentUser();
this.defaultShippingSet=true;
// this.selectedProfileTab = 2;
// this.selectedBillingTab = 0;
},
error => {
console.log(error.text());
}
);
}
getCurrentUser() {
this.userService.getCurrentUser().subscribe(
res => {
this.user=res.json();
this.userPaymentList = this.user.userPaymentList;
this.userShippingList = this.user.userShippingList;
for (let index in this.userPaymentList) {
if (this.userPaymentList[index].defaultPayment) {
this.defaultUserPaymentId=this.userPaymentList[index].id;
return;
break;
}
}
for (let i in this.userShippingList) {
if (this.userShippingList[i].userShippingDefault) {
this.defaultUserShippingId=this.userShippingList[i].id;
break;
}
}
},
@@ -191,5 +258,7 @@ export class MyProfileComponent implements OnInit {
this.defaultPaymentSet=false;
this.userShipping.userShippingState="";
this.defaultShippingSet=false;
}
}

View File

@@ -1,4 +1,5 @@
import {UserPayment} from './user-payment';
import {UserShipping} from './user-shipping';
export class User {
public id: number;
@@ -10,4 +11,5 @@ export class User {
public phone: string;
public enabled: boolean;
public userPaymentList: UserPayment[];
public userShippingList: UserShipping[];
}

View File

@@ -0,0 +1,16 @@
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { ShippingService } from './shipping.service';
describe('ShippingService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [ShippingService]
});
});
it('should ...', inject([ShippingService], (service: ShippingService) => {
expect(service).toBeTruthy();
}));
});

View File

@@ -0,0 +1,41 @@
import { Injectable } from '@angular/core';
import {AppConst} from '../constants/app-const';
import {Http, Headers} from '@angular/http';
import {UserShipping} from '../models/user-shipping';
@Injectable()
export class ShippingService {
private serverPath:string = AppConst.serverPath;
constructor(private http:Http) { }
newShipping(shipping: UserShipping) {
let url = this.serverPath+"/shipping/add";
let tokenHeader = new Headers ({
'Content-Type': 'application/json',
'x-auth-token' : localStorage.getItem("xAuthToken")
});
return this.http.post(url, JSON.stringify(shipping), {headers : tokenHeader});
}
removeShipping(id: number) {
let url = this.serverPath+"/shipping/remove";
let tokenHeader = new Headers ({
'Content-Type': 'application/json',
'x-auth-token' : localStorage.getItem("xAuthToken")
});
return this.http.post(url, id, {headers : tokenHeader});
}
setDefaultShipping(id: number) {
let url = this.serverPath+"/shipping/setDefault";
let tokenHeader = new Headers ({
'Content-Type': 'application/json',
'x-auth-token' : localStorage.getItem("xAuthToken")
});
return this.http.post(url, id, {headers : tokenHeader});
}
}