Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. function currency_exchange(){
  2.     $valid_coins = array("usd", "pen", "ars", "bob", "brl", "cop", "eur", "clp", "bsf");
  3.  
  4.     $from     = $this->input->post('from');
  5.     $to       = $this->input->post('to');
  6.     $amount   = (int) $this->input->post('amount');
  7.  
  8.     $validate_from = in_array($from, $valid_coins);
  9.     $validate_to   = in_array($to, $valid_coins);
  10.  
  11.     if($validate_from and $validate_to){
  12.         $response = $this->inkapay_model->getCalcSendMoney($from ,$to , $amount);
  13.         echo json_encode($response);
  14.     }else{
  15.         $response = array("error"=>"invalid coin");
  16.         echo json_encode($response);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement