@koempf/shopgate-utility
Version:
Shopgate WebCheckout utility for Kömpf
47 lines (40 loc) • 1.69 kB
JavaScript
// Login
const getTokenEndpoint = () => '/token'
// Customer
const getCustomersEndpoint = () => '/customers'
const getCustomerEndpoint = (customerId) => `/customers/${customerId}`
// Cart
const getCartsEndpoint = () => '/carts'
const getCartEndpoint = (cartId) => `/carts/${cartId}`
const getCartItemsEndpoint = (cartId) => `/carts/${cartId}/items`
const getCartItemEndpoint = (cartId, itemGroupKey) => `/carts/${cartId}/items/${itemGroupKey}`
const getCartCodesEndpoint = (cartId) => `/carts/${cartId}/cart-codes`
const getCartCodeEndpoint = (cartId, code) => `/carts/${cartId}/cart-codes/${code}`
// Guest Cart
const getGuestCartsEndpoint = () => '/guest-carts'
const getGuestCartEndpoint = (cartId) => `/guest-carts/${cartId}`
const getGuestCartItemsEndpoint = (cartId) => cartId ? `/guest-carts/${cartId}/guest-cart-items` : '/guest-cart-items'
const getGuestCartItemEndpoint = (cartId, itemGroupKey) => `/guest-carts/${cartId}/guest-cart-items/${itemGroupKey}`
const getGuestCartCodesEndpoint = (cartId) => `/guest-carts/${cartId}/cart-codes`
const getGuestCartCodeEndpoint = (cartId, code) => `/guest-carts/${cartId}/cart-codes/${code}`
// External Checkout
const getExternalCheckoutUrlEndpoint = (cartId) => `/carts/${cartId}/external-checkout-url`
module.exports = {
getTokenEndpoint,
getCustomersEndpoint,
getCustomerEndpoint,
getCartsEndpoint,
getCartEndpoint,
getCartItemsEndpoint,
getCartItemEndpoint,
getCartCodesEndpoint,
getCartCodeEndpoint,
getGuestCartsEndpoint,
getGuestCartEndpoint,
getGuestCartItemsEndpoint,
getGuestCartItemEndpoint,
getGuestCartCodesEndpoint,
getGuestCartCodeEndpoint,
getExternalCheckoutUrlEndpoint
}