File: D:/HostingSpaces/SBogers10/shop.komma.nl/resources/js/shopAddressService.js
import { axios } from '../../vendor/komma/kms/resources/js/global/axiosBootstrapper'
import AddressService from './services/addressService'
export default class shopAddressService extends AddressService {
/**
* Returns a promise with resolves to the shipping address that was set in the my account section
*
* @return {Promise<AxiosResponse<any>>}
*/
shippingAddress() {
return axios.get('/addresses/shipping_address');
}
/**
* Returns a promise with resolves to the shipping_address address that was entered in the beginning of the checkout process.
* That will be used for the order.
*
* @return {Promise<AxiosResponse<any>>}
*/
orderShippingAddress() {
return axios.get('/addresses/order/shipping_address');
}
/**
* Marks the given address as the shipping address.
*
* @param address
* @return {Promise<AxiosResponse<any>>}
*/
markAsShippingAddress(address) {
return axios.patch('/addresses/mark/as_shipping_address/' + address.id);
}
/**
* Clears the shipping address
*
* @return {Promise<AxiosResponse<any>>}
*/
clearShippingAddress() {
return axios.patch('/addresses/clear/shipping_address');
}
/**
* Returns a promise with resolves to the invoice address that was set in the my account section
*
* @return {Promise<AxiosResponse<any>>}
*/
invoiceAddress() {
return axios.get('/addresses/invoice_address');
}
/**
* Returns a promise with resolves to the invoice address that was entered in the beginning of the checkout process.
* That will be used for the order.
*
* @return {Promise<AxiosResponse<any>>}
*/
orderInvoiceAddress() {
return axios.get('/addresses/order/invoice_address');
}
/**
* Marks the given address as the invoice address for next orders if the user is logged in
*
* @param address
* @return {Promise<AxiosResponse<any>>}
*/
markAsInvoiceAddress(address) {
return axios.patch('/addresses/mark/as_invoice_address/' + address.id);
}
/**
* Clears the invoice address.
*
* @param address
* @return {Promise<AxiosResponse<any>>}
*/
clearInvoiceAddress() {
return axios.patch('/addresses/clear/invoice_address');
}
/**
* Put the users invoice and shipping addresses in the checkout session so that they will be used in the checkout process.
*
* @return {Promise<AxiosResponse<any>>}
*/
usersAddressesAsCheckoutAddresses() {
return axios.patch('/checkout/users_addresses_as_checkout_addresses');
}
}