<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Bank
 *
 * @author user
 */
require APPPATH . '/libraries/REST_Controller.php';

class Bank extends REST_Controller {

    function __construct() {
        parent::__construct();
        $this->load->database();
        $this->load->model('Bank_modal');
        $this->load->model('Token_modal');
    }

    public function getbanklist_get() {
        $headers = $this->input->request_headers();
        $valid = $this->Token_modal->exit_token($headers['Token']);
        if ($valid != null) {
            header('Content-type: application/json');
            $bank = $this->Bank_modal->get_bank_list();
            $bank_list = array("Bank" => $bank);
            $message = array("Status" => "200",
                "BankList" => $bank_list);
            $response_message = array("GetBankListResponse" => $message);
            $this->response($response_message);
        } else {
            $message = array("Status" => "1002",
                "Message" => "Invalid token");
            $response_message = array("GetBankListResponse" => $message);
            $this->response($response_message);
        }
    }

}
