@ -23,6 +23,7 @@ import { Subject } from 'rxjs/Subject';
@Injectable ( )
export class BasketService {
private basketUrl : string = '' ;
private purchaseUrl : string = '' ;
basket : IBasket = {
buyerId : '' ,
items : [ ]
@ -40,12 +41,14 @@ export class BasketService {
if ( this . authService . UserData ) {
this . basket . buyerId = this . authService . UserData . sub ;
if ( this . configurationService . isReady ) {
this . basketUrl = this . configurationService . serverSettings . basketUrl ;
this . basketUrl = this . configurationService . serverSettings . purchaseUrl ;
this . purchaseUrl = this . configurationService . serverSettings . purchaseUrl ;
this . loadData ( ) ;
}
else {
this . configurationService . settingsLoaded $ . subscribe ( x = > {
this . basketUrl = this . configurationService . serverSettings . basketUrl ;
this . basketUrl = this . configurationService . serverSettings . purchaseUrl ;
this . purchaseUrl = this . configurationService . serverSettings . purchaseUrl ;
this . loadData ( ) ;
} ) ;
}
@ -63,7 +66,7 @@ export class BasketService {
}
setBasket ( basket ) : Observable < boolean > {
let url = this . basket Url + '/api/v1/basket/' ;
let url = this . purchase Url + '/purchase-bff /api/v1/basket/' ;
this . basket = basket ;
return this . service . post ( url , basket ) . map ( ( response : Response ) = > {
return true ;
@ -71,7 +74,7 @@ export class BasketService {
}
setBasketCheckout ( basketCheckout ) : Observable < boolean > {
let url = this . basketUrl + '/api/v1/basket/checkout' ;
let url = this . basketUrl + '/purchase-bff/ api/v1/b /basket/checkout' ;
return this . service . postWithId ( url , basketCheckout ) . map ( ( response : Response ) = > {
this . basketEvents . orderCreated ( ) ;
return true ;
@ -79,7 +82,7 @@ export class BasketService {
}
getBasket ( ) : Observable < IBasket > {
let url = this . basketUrl + '/api/v1/basket/' + this . basket . buyerId ;
let url = this . basketUrl + '/api/v1/b/b asket/' + this . basket . buyerId ;
return this . service . get ( url ) . map ( ( response : Response ) = > {
if ( response . status === 204 ) {
return null ;