<?php
/*
Generated by OutputBooks Team
*/

defined("\102\x41\123\x45\120\x41\124\x48") or exit("\116\157\40\x64\151\x72\145\x63\x74\40\163\x63\162\151\x70\x74\x20\x61\x63\143\145\163\x73\40\141\x6c\154\x6f\167\x65\144");
class EInvoice extends MY_Controller
{
    private $url = "\150\164\164\x70\72\57\x2f\x67\x73\x74\x73\141\156\144\x62\157\x78\56\x63\x68\x61\162\x74\145\162\x65\144\x69\156\x66\x6f\56\x63\157\x6d\57\145\x69\166\x69\x74\141\154\57\144\x65\143\57\x76\x31\x2e\60\64\x2f";
    private $error = '';
    public function __construct()
    {
        goto ZxCDZ;
        JeoRF:
        $this->bId = get_user_data("\x64\x65\x66\x61\165\x6c\x74\142\111\x64", true);
        goto dSyZJ;
        GFuf8:
        $this->cId = get_company("\151\x64");
        goto JeoRF;
        HjxE_:
        $this->load->model("\x45\x69\x6e\x76\157\151\x63\x65\x4d\157\x64\x65\154");
        goto UA2nd;
        UA2nd:
        $this->load->language("\x65\x69\156\x76\x6f\x69\x63\x65");
        goto chpJh;
        ZxCDZ:
        parent::__construct();
        goto HjxE_;
        chpJh:
        $auth_token = '';
        goto GFuf8;
        dSyZJ:
    }
    public function _remap($method, $params = array())
    {
        goto TXE8d;
        TXE8d:
        $licData = get_user_data("\154\x69\x63\145\x6e\163\145\x44\x61\164\141");
        goto PbAkN;
        ugg9Y:
        return call_user_func_array(array($this, $method), $params);
        goto hYvgg;
        PbAkN:
        if (!$licData || !empty($licData["\151\163\x45\170\160\x69\162\145\144"])) {
            goto QeDa9;
            vEspO:
            return false;
            goto Fm0Dh;
            QeDa9:
            if (!empty($licData["\x69\163\124\162\x69\141\154"])) {
                $this->response->error("\x4c\x69\x63\145\156\163\x65\40\x6b\145\x79\x20\x65\170\x70\151\162\x65\x64\x2e");
            } else {
                $this->response->error("\122\145\x6e\x65\167\40\x79\x6f\x75\162\40\x50\162\x6f\40\x4c\151\x63\x65\156\x73\x65\40\x6b\145\x79\x20\141\156\144\x20\147\145\x74\40\x6c\x61\164\x65\x73\164\x20\x75\160\144\141\164\145\x73\40\x66\157\x72\x20\x6e\145\170\164\40\x6f\x6e\x65\40\171\145\141\x72\x2e\x26\156\142\163\x70\x3b\46\x6e\x62\163\x70\73\46\156\x62\163\x70\x3b\x3c\141\x20\150\x72\x65\146\x3d\x22\57\x2f\x77\167\167\x2e\x6f\165\164\160\x75\164\x62\x6f\157\153\x73\x2e\143\x6f\x6d\x2f\160\162\x69\x63\x69\x6e\147\x2f\x22\40\164\x61\x72\x67\145\x74\75\x22\137\142\154\141\x6e\153\42\76\x52\145\156\145\167\40\116\157\x77\x3c\x2f\141\x3e\x26\x6e\142\x73\160\73\x26\156\x62\163\160\x3b\x26\156\142\163\x70\x3b");
            }
            goto KI0Hq;
            KI0Hq:
            $this->response->write();
            goto vEspO;
            Fm0Dh:
        }
        goto ugg9Y;
        hYvgg:
    }
    function map_irn()
    {
        goto shauR;
        shauR:
        $data = $this->request->post();
        goto GnJ_y;
        a2i0k:
        return false;
        goto nVrFF;
        GnJ_y:
        if (!($res = $this->EinvoiceModel->map_irn($data))) {
            $this->response->error($this->EinvoiceModel->message);
        } else {
            $this->response->set_data($res);
        }
        goto DdtBd;
        DdtBd:
        $this->response->write();
        goto a2i0k;
        nVrFF:
    }
    function map_ewb()
    {
        goto buVi9;
        buVi9:
        $data = $this->request->post();
        goto zKSQd;
        zKSQd:
        if (!($res = $this->EinvoiceModel->map_ewb($data))) {
            $this->response->error($this->EinvoiceModel->message);
        } else {
            $this->response->set_data($res);
        }
        goto Fd0fr;
        AB9Js:
        return false;
        goto UJnRs;
        Fd0fr:
        $this->response->write();
        goto AB9Js;
        UJnRs:
    }
    function auth_token()
    {
        goto mDSL9;
        Z_f1P:
        $this->response->write();
        goto sVPCh;
        mDSL9:
        if (!($res = $this->EinvoiceModel->get_token(false))) {
            $this->response->error($this->EinvoiceModel->message);
        } else {
            $this->response->set_data($res);
        }
        goto Z_f1P;
        sVPCh:
        return false;
        goto WASNt;
        WASNt:
    }
    public function cancel($type = '', $transId = '')
    {
        goto pqplu;
        kj8FY:
        if (!empty($result)) {
            $this->response->success("\x53\165\143\x63\145\x73\x73\146\x75\154\154\171\40\143\141\x6e\143\145\x6c");
        } else {
            $this->response->error($this->EinvoiceModel->message ? $this->EinvoiceModel->message : "\x43\141\x6e\x63\x65\154\x20\x66\x61\x69\154\145\x64\x20\x21\41\41");
        }
        goto wdzui;
        AsV7W:
        return true;
        goto G6GQv;
        MWKEk:
        $data = $this->request->post();
        goto UCpvZ;
        wdzui:
        $this->response->write();
        goto AsV7W;
        UCpvZ:
        $result = $this->EinvoiceModel->cancel($transId, $data);
        goto kj8FY;
        pqplu:
        valid_permission($type, 4);
        goto MWKEk;
        G6GQv:
    }
    public function ewb_cancel($type = '', $transId = '')
    {
        goto O3bIE;
        O3bIE:
        valid_permission($type, 4);
        goto SY9zg;
        NXfsa:
        if (!empty($result)) {
            $this->response->success("\x53\165\143\x63\x65\x73\x73\146\165\154\154\171\x20\x63\x61\x6e\x63\145\154");
        } else {
            $this->response->error($this->EinvoiceModel->message ? $this->EinvoiceModel->message : "\x43\141\x6e\x63\145\154\x20\x66\x61\151\154\145\x64\x20\x21\x21\41");
        }
        goto WddJm;
        FTsHl:
        $result = $this->EinvoiceModel->ewb_cancel($transId, $data);
        goto NXfsa;
        W_GLm:
        return true;
        goto ip0sJ;
        WddJm:
        $this->response->write();
        goto W_GLm;
        SY9zg:
        $data = $this->request->post();
        goto FTsHl;
        ip0sJ:
    }
    public function ewbpost($id)
    {
        goto dW16a;
        jwv1U:
        $this->response->write();
        goto GQ64J;
        GQ64J:
        return true;
        goto X9r2S;
        dW16a:
        if (!($res = $this->EinvoiceModel->ewbpost($id))) {
            $this->response->write($this->EinvoiceModel->message);
            return false;
        }
        goto jwv1U;
        X9r2S:
    }
    public function irn($transId, $ignore_error = 0)
    {
        goto OlFbv;
        OlFbv:
        if (!$ignore_error) {
            $error = $this->EinvoiceModel->get_einv_err_log($transId);
            if ($error) {
                goto xlufS;
                lKsQy:
                $this->response->error();
                goto hOE2s;
                hOE2s:
                $this->response->set_data("\143\x6f\156\x66\151\162\155", $error["\x61\126\141\x6c\165\x65"]);
                goto qr8rD;
                qr8rD:
                $this->response->write();
                goto jMOCa;
                xlufS:
                if ($tmp = json_decode($error["\141\126\x61\x6c\165\x65"], true)) {
                    if (!empty($tmp["\x45\162\x72\157\x72\104\145\x74\x61\x69\154\163"])) {
                        goto aJUhq;
                        atxhf:
                        JOYsO:
                        goto RgH0r;
                        RgH0r:
                        $error["\x61\x56\x61\x6c\x75\x65"] = implode("\x2c", $error["\x61\x56\141\154\165\x65"]);
                        goto Svrea;
                        mnaDO:
                        foreach ($tmp["\x45\x72\162\157\x72\104\145\x74\x61\x69\154\x73"] as $row) {
                            $error["\141\126\141\154\x75\145"][] = $row["\x45\x72\162\157\x72\x4d\145\163\163\141\x67\x65"];
                            QpgGw:
                        }
                        goto atxhf;
                        aJUhq:
                        $error["\x61\x56\141\154\165\x65"] = array();
                        goto mnaDO;
                        Svrea:
                    }
                }
                goto lKsQy;
                jMOCa:
                return false;
                goto caGsX;
                caGsX:
            }
        }
        goto K7S7J;
        EqfJ4:
        $this->response->write();
        goto KDKJj;
        qo6NW:
        if (!$result) {
            $this->response->error($this->EinvoiceModel->message);
        } else {
            $this->response->set_data("\x64\141\x74\141", $result);
        }
        goto EqfJ4;
        KDKJj:
        return true;
        goto BgEp7;
        K7S7J:
        $result = $this->EinvoiceModel->get_irn($transId);
        goto qo6NW;
        BgEp7:
    }
    public function config()
    {
        goto khsMw;
        cJU8A:
        return true;
        goto rOwdH;
        AOBOa:
        $this->response->write();
        goto cJU8A;
        GbY41:
        $provider = $einvoiceLoader->get_config(true);
        goto Wm1bN;
        npqVJ:
        $this->response->set_data("\144\x61\x74\x61", $result);
        goto AOBOa;
        Wm1bN:
        $this->response->set_data("\144\141\x74\141", $provider);
        goto cr17Y;
        rOwdH:
        require_once APPPATH . "\164\150\151\x72\144\x5f\160\141\162\164\171\57\x65\151\156\x76\157\151\143\x65\57\105\151\156\x76\x6f\x69\143\145\114\157\141\x64\145\x72\56\x70\x68\160";
        goto ozxdN;
        wTyBw:
        return true;
        goto BJFAU;
        cr17Y:
        $this->response->write();
        goto wTyBw;
        khsMw:
        $result = $this->EinvoiceModel->get_config(true);
        goto npqVJ;
        ozxdN:
        $einvoiceLoader = new EinvoiceLoader(array("\143\x6f\x75\156\x74\162\171\103\157\144\x65" => $countryCode));
        goto GbY41;
        BJFAU:
    }
    public function saveconfig()
    {
        goto YpJRT;
        YpJRT:
        $_POST = $data = $this->request->post();
        goto mUQ0O;
        KK6PL:
        return true;
        goto Uifx_;
        BnEXe:
        $user = get_user_data();
        goto ztUSR;
        ztUSR:
        if ($result && isset($user["\x65\x69\156\x76\137\x61\x75\164\x68"])) {
            unset($user["\x65\x69\x6e\166\137\x61\165\x74\150"]);
            set_user_data($user);
        }
        goto RqLkB;
        KfN9n:
        $this->response->success($this->EinvoiceModel->message);
        goto BnEXe;
        RqLkB:
        $this->response->write();
        goto KK6PL;
        mUQ0O:
        if (!($result = $this->EinvoiceModel->save_config($data))) {
            goto ynUSA;
            fJ8NQ:
            $this->response->write();
            goto K6RUY;
            ynUSA:
            $this->response->error($this->EinvoiceModel->message);
            goto fJ8NQ;
            K6RUY:
            return false;
            goto J5yPi;
            J5yPi:
        }
        goto KfN9n;
        Uifx_:
    }
    public function pendings()
    {
        goto xUxwG;
        CED_M:
        if ($result) {
            $this->response->set_data("\151\164\145\x6d\163", $result);
        }
        goto Hvhls;
        cmPSi:
        $result = $this->EinvoiceModel->pendings($data);
        goto CED_M;
        Hvhls:
        $this->response->write();
        goto c59dK;
        c59dK:
        return true;
        goto i7VXt;
        xUxwG:
        $data = $this->request->post();
        goto cmPSi;
        i7VXt:
    }
    public function gst_details($gstn = '')
    {
        goto TwINA;
        OoTLz:
        if ($gstn) {
            $result = $this->EinvoiceModel->gstn_details($gstn);
            if ($result) {
                goto msc0c;
                iiMEJ:
                $this->response->write();
                goto eKsW_;
                eKsW_:
                return true;
                goto v4q4y;
                msc0c:
                $this->response->set_data($result);
                goto iiMEJ;
                v4q4y:
            }
        }
        goto LFhnY;
        UtUbt:
        return false;
        goto D4aA6;
        fgShN:
        $this->response->write();
        goto UtUbt;
        TwINA:
        $result = array();
        goto OoTLz;
        LFhnY:
        $this->response->error($this->EinvoiceModel->message);
        goto fgShN;
        D4aA6:
    }
}
