Ejemplo n.º 1
0
 if ($cekCardId != 0) {
     $clientid = $custom->byCardId($cardid);
     $client = new client();
     $details = json_decode($client->Get_Clients_Details($clientid));
     $credit = explode('.', $details->client->credit);
     $credit = $credit['0'];
     if ($credit < $nominal) {
         $result['result'] = 0;
         $result['message'] = "Your Balance is not enought";
         echo json_encode($result);
     } else {
         $payments = new payments();
         $custom->updateInvoiceUserId($clientid, $invoiceid);
         $token['client_id'] = $clientid;
         $token['invoiceid'] = $invoiceid;
         $rtoken = $custom->rToken($token);
         if ($rtoken != 0) {
             $result['result'] = 1;
             $result['invoiceid'] = $invoiceid;
             $result['amount'] = $nominal;
             echo json_encode($result);
         } else {
             $result['result'] = 0;
             $result['message'] = "Error While Requesting Token/OTP";
             echo json_encode($result);
         }
     }
 } else {
     $result['result'] = 0;
     $result['message'] = "User not exist";
     echo json_encode($result);