-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcart.js
48 lines (46 loc) · 1.73 KB
/
cart.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import AbstractCartProxy from '../abstract/cart';
import { multiStoreConfig } from './util';
class CartProxy extends AbstractCartProxy {
constructor (config, req){
const OpenCart2Client = require('./opencart-vsbridge-client').OpenCart2Client;
super(config, req)
this.api = OpenCart2Client(multiStoreConfig(config.opencart2.api, req));
}
create (customerToken) {
return this.api.cart.create(customerToken);
}
update (customerToken, cartId, cartItem) {
return this.api.cart.update(customerToken, cartId, cartItem);
}
delete (customerToken, cartId, cartItem) {
return this.api.cart.delete(customerToken, cartId, cartItem);
}
pull (customerToken, cartId, params) {
return this.api.cart.pull(customerToken, cartId, params);
}
totals (customerToken, cartId, params) {
return this.api.cart.totals(customerToken, cartId, params);
}
getShippingMethods (customerToken, cartId, address) {
return this.api.cart.shippingMethods(customerToken, cartId, address);
}
getPaymentMethods (customerToken, cartId) {
return this.api.cart.paymentMethods(customerToken, cartId);
}
setShippingInformation (customerToken, cartId, address) {
return this.api.cart.shippingInformation(customerToken, cartId, address);
}
collectTotals (customerToken, cartId, shippingMethod) {
return this.api.cart.collectTotals(customerToken, cartId, shippingMethod);
}
applyCoupon (customerToken, cartId, coupon) {
return this.api.cart.applyCoupon(customerToken, cartId, coupon);
}
deleteCoupon (customerToken, cartId) {
return this.api.cart.deleteCoupon(customerToken, cartId);
}
getCoupon (customerToken, cartId) {
return this.api.cart.getCoupon(customerToken, cartId);
}
}
module.exports = CartProxy;