@jifeline/customer-cart v0.3.0
Customer Cart library
The Customer Cart library is an implementation of the cart domain within the Jifeline Customer API. With this library, after setting the config in the @jifeline/core auth module, the prices of the different products for a given vehicle can be calculated. The subtotals and the total prices will be returned in gross and net price. Next to the totals, the discount based on vouchers and the original equipment service fee will be calculated.
Usage of the library
Import the customerCart library to make use of the different features.
import { auth } from '@jifeline/core';
import { customerCart } from '@jifeline/customer-cart';
// Configure the core lib and authenticate by login in with connector / pin or username / password.
auth.configure(config);
auth.loginPin().subscribe();
auth.loginUsername().subscribe();
// After authentication - use the customer carts library. Eg;
customerCart
.calculateCart
.calculateCart(vehicleModelId, vehicleModelVariantId, productIds)
.subscribe(cart => {
console.log(cart);
});
Features
The Customer Cart library provides the following features:
- calculate cart
- voucher
Calculate Cart
The calculate cart feature can calculate the current prices for given products based on a given vehicle. When a voucher is added, it will calculate the discount based on the voucher's value.
The following functions are supported:
- calculate cart
- get cart product ids
Voucher
The voucher feature can check if a given voucher is valid.
The following functions are supported:
- is valid voucher