<?php

require 'db.php';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
if(isset($postdata) && !empty($postdata))
{
    $accname = mysqli_real_escape_string($con, trim($request->form_value->account_holder_name));
    $accno = mysqli_real_escape_string($con, trim($request->form_value->account_no));
    $ifsc = mysqli_real_escape_string($con, trim($request->form_value->ifsc_code));
    $bank = mysqli_real_escape_string($con, trim($request->form_value->bank_name));
    $branch = mysqli_real_escape_string($con, trim($request->form_value->branch_name));
    $shop_id = mysqli_real_escape_string($con, trim($request->shop_id));
    $shop_code = mysqli_real_escape_string($con, trim($request->shop_code));
    
    include 'token_check.php';

    if($token_check)
    {
        $sql = "UPDATE shop_details set account_holder_name = '$accname',bank_account_no = '$accno',ifsc_code = '$ifsc',bank_name = '$bank',branch_name = '$branch',is_bank_verified = '1' where shop_id='$shop_id' and shop_code='$shop_code'";
        $result = mysqli_query($con,$sql);
        if($result)
        {
            $rows = array('status'=>true,'message' => 'Bank Details Updated');
            echo json_encode($rows);
        }
    }
    else
    {
        $rows = array('status'=>"",'message' => 'Data Error');
        echo json_encode($rows);
    }

}

?>
