import { Api, } from "..";
const api = Api();
export class CheckoutService {
    async fetchCheckout(authToken, checkoutId) {
        const endpoint = `checkouts/${checkoutId}`;
        return api.get({ endpoint, authToken });
    }
    async fetchCheckouts(accountId, authToken, params) {
        const endpoint = 'checkouts';
        const headers = { Account: accountId };
        return api.get({ endpoint, params, headers, authToken });
    }
    async complete(authToken, checkoutId, payment) {
        const endpoint = `checkouts/${checkoutId}/complete`;
        const body = {
            payment_mode: payment.payment_mode,
        };
        if (payment.payment_token) {
            body.payment_token = payment.payment_token;
        }
        return api.post({ endpoint, body, authToken });
    }
}
