summaryrefslogtreecommitdiff
path: root/src/lib/checkout/api/getVoucher.js
blob: 07cf376e52397ac0423264ea3d1097021d86a81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import odooApi from '@/core/api/odooApi'

export  const getVoucher = async (id, source) => {
  let dataVoucher = null
  if(source){
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?source=${source}`)
  }else {
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher`)
  }
  return dataVoucher
}

export const findVoucher = async (code, id, source) => {
  let dataVoucher = null
  if(source){
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}&source=${source}`)
  }else{
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}`)
  }
  return dataVoucher
}