summaryrefslogtreecommitdiff
path: root/src/lib/checkout/api/checkoutApi.js
blob: 11c7d4c248d5040727b4d68fbc9d1952c7e9a848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import odooApi from '@/core/api/odooApi';
import { getAuth } from '@/core/utils/auth';

export const checkoutApi = async ({ data }) => {
  const auth = getAuth();
  const dataCheckout = await odooApi(
    'POST',
    `/api/v1/partner/${auth.partnerId}/sale_order/checkout`,
    data
  );
  return dataCheckout;
};

export const checkoutQuotation = async (data) => {
  const auth = getAuth();
  const qs = new URLSearchParams({ context: 'quotation' }).toString();
  return odooApi(
    'POST',
    `/api/v1/partner/${auth.partnerId}/sale_order/checkout?${qs}`,
    data
  );
};

export const getProductsCheckout = async (query) => {
  const queryParam = new URLSearchParams(query);
  const userId = getAuth()?.id;
  const url = `/api/v1/user/${userId}/sale_order/checkout?${queryParam.toString()}`;
  const result = await odooApi('GET', url);
  return result;
};

export const getProductsSla = async ({data}) => {
  const dataSLA = await odooApi(
    'GET',
    `/api/v1/product/variants/sla`,
    data
  )
  return dataSLA
}