lin3s-sylius-shop-api-client
Version:
JavaScript client on top of SyliusShopApiPlugin to build integrations with ease.
15 lines (11 loc) • 412 B
JavaScript
import axios from 'axios';
import session from '../session';
export default config => () => {
return new Promise(resolve => {
axios.get(`${config.baseUrl}/shop-api/checkout/${session(config).Cart.id()}/payment`)
.then(response => {
const paymentMethods = response.data.payments[0].methods;
resolve(Object.keys(paymentMethods).map(key => (paymentMethods[key])));
});
});
};