-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maciej Kucmus
committed
May 14, 2019
1 parent
166cda6
commit 41c9176
Showing
44 changed files
with
1,797 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
vsf-shopware-indexer/node_modules/ | ||
vsf-shopware-indexer/node_modules | ||
vsf-shopware-indexer/*.log | ||
vsf-shopware-indexer/logs/*.log | ||
vsf-shopware-indexer/config.js | ||
logs/*.log | ||
.idea/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import AbstractAddressProxy from '../abstract/address' | ||
import {multiStoreConfig} from "./util"; | ||
import {Magento1Client} from "./module"; | ||
|
||
class AddressProxy extends AbstractAddressProxy { | ||
constructor (config, req){ | ||
super(config, req) | ||
this.api = Magento1Client(multiStoreConfig(config.magento1.api, req)); | ||
} | ||
list (customerToken) { | ||
return this.api.address.list(customerToken) | ||
} | ||
update (customerToken, addressData) { | ||
return this.api.address.update(customerToken, addressData); | ||
} | ||
get (customerToken, addressId) { | ||
return this.api.address.get(customerToken, addressId) | ||
} | ||
delete (customerToken, addressData) { | ||
return this.api.address.delete(customerToken, addressData) | ||
} | ||
} | ||
|
||
module.exports = AddressProxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import AbstractCartProxy from '../abstract/cart'; | ||
import { multiStoreConfig } from './util'; | ||
import { ShopwareClient } from './module/index'; | ||
|
||
class CartProxy extends AbstractCartProxy { | ||
constructor (config, req){ | ||
super(config, req) | ||
this.api = ShopwareClient(multiStoreConfig(config.shopware.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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import AbstractContactProxy from '../abstract/contact'; | ||
import { multiStoreConfig } from './util'; | ||
import { ShopwareClient } from './module/index'; | ||
|
||
class ContactProxy extends AbstractContactProxy { | ||
constructor (config, req){ | ||
super(config, req) | ||
this.api = ShopwareClient(multiStoreConfig(config.shopware.api, req)); | ||
} | ||
submit (form) { | ||
return this.api.contact.submit(form); | ||
} | ||
} | ||
|
||
module.exports = ContactProxy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const RestClient = require('./lib/rest_client').RestClient; | ||
const user = require('./lib/user'); | ||
const cart = require('./lib/cart'); | ||
const order = require('./lib/order'); | ||
const stock = require('./lib/stock'); | ||
const contact = require('./lib/contact'); | ||
const wishlist = require('./lib/wishlist'); | ||
const stockAlert = require('./lib/stock_alert'); | ||
const newsletter = require('./lib/newsletter'); | ||
const address = require('./lib/address'); | ||
|
||
const SHOPWARE_API_VERSION = 'v1'; | ||
|
||
module.exports.ShopwareClient = function (options) { | ||
let instance = { | ||
addMethods (key, module) { | ||
let client = RestClient(options); | ||
if (module) { | ||
if (this[key]) | ||
this[key] = Object.assign(this[key], module(client)); | ||
else | ||
this[key] = module(client); | ||
} | ||
} | ||
}; | ||
|
||
options.version = SHOPWARE_API_VERSION; | ||
|
||
let client = RestClient(options); | ||
|
||
instance.user = user(client); | ||
instance.order = order(client); | ||
instance.cart = cart(client); | ||
instance.stock = stock(client); | ||
instance.contact = contact(client); | ||
instance.wishlist = wishlist(client); | ||
instance.stockAlert = stockAlert(client); | ||
instance.newsletter = newsletter(client); | ||
instance.address = address(client); | ||
|
||
return instance; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module.exports = function (restClient) { | ||
let module = {}; | ||
let url = 'address/'; | ||
function getResponse(data){ | ||
if (data.code === 200){ | ||
return data.result; | ||
} | ||
|
||
return false; | ||
} | ||
module.list = function (customerToken) { | ||
url += `list?token=${customerToken}` | ||
return restClient.get(url).then((data)=> { | ||
return getResponse(data); | ||
}); | ||
}, | ||
module.update = function (customerToken, addressData) { | ||
url += `update?token=${customerToken}` | ||
return restClient.post(url, {address: addressData}).then((data)=> { | ||
return getResponse(data); | ||
}); | ||
} | ||
module.get = function (customerToken, addressId) { | ||
url += `get?token=${customerToken}&addressId=${addressId}` | ||
return restClient.get(url).then((data)=> { | ||
return getResponse(data); | ||
}); | ||
} | ||
module.delete = function (customerToken, addressData) { | ||
url += `delete?token=${customerToken}` | ||
return restClient.post(url, {address: addressData}).then((data)=> { | ||
return getResponse(data); | ||
}); | ||
} | ||
return module; | ||
} |
Oops, something went wrong.