|
| 1 | +import AbstractCartProxy from '../abstract/cart'; |
| 2 | +import { multiStoreConfig } from './util'; |
| 3 | +import { Magento1Client } from './module/index'; |
| 4 | + |
| 5 | +class CartProxy extends AbstractCartProxy { |
| 6 | + constructor (config, req){ |
| 7 | + super(config, req) |
| 8 | + this.api = Magento1Client(multiStoreConfig(config.magento1.api, req)); |
| 9 | + } |
| 10 | + create (customerToken) { |
| 11 | + return this.api.cart.create(customerToken); |
| 12 | + } |
| 13 | + update (customerToken, cartId, cartItem) { |
| 14 | + return this.api.cart.update(customerToken, cartId, cartItem); |
| 15 | + } |
| 16 | + delete (customerToken, cartId, cartItem) { |
| 17 | + return this.api.cart.delete(customerToken, cartId, cartItem); |
| 18 | + } |
| 19 | + pull (customerToken, cartId, params) { |
| 20 | + return this.api.cart.pull(customerToken, cartId, params); |
| 21 | + } |
| 22 | + totals (customerToken, cartId, params) { |
| 23 | + return this.api.cart.totals(customerToken, cartId, params); |
| 24 | + } |
| 25 | + getShippingMethods (customerToken, cartId, address) { |
| 26 | + return this.api.cart.shippingMethods(customerToken, cartId, address); |
| 27 | + } |
| 28 | + getPaymentMethods (customerToken, cartId) { |
| 29 | + return this.api.cart.paymentMethods(customerToken, cartId); |
| 30 | + } |
| 31 | + setShippingInformation (customerToken, cartId, address) { |
| 32 | + return this.api.cart.shippingInformation(customerToken, cartId, address); |
| 33 | + } |
| 34 | + collectTotals (customerToken, cartId, shippingMethod) { |
| 35 | + return this.api.cart.collectTotals(customerToken, cartId, shippingMethod); |
| 36 | + } |
| 37 | + applyCoupon (customerToken, cartId, coupon) { |
| 38 | + return this.api.cart.applyCoupon(customerToken, cartId, coupon); |
| 39 | + } |
| 40 | + deleteCoupon (customerToken, cartId) { |
| 41 | + return this.api.cart.deleteCoupon(customerToken, cartId); |
| 42 | + } |
| 43 | + getCoupon (customerToken, cartId) { |
| 44 | + return this.api.cart.getCoupon(customerToken, cartId); |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +module.exports = CartProxy; |
0 commit comments