Exemplo n.º 1
0
<?php

$request_uri = $_SERVER['REQUEST_URI'];
$route = explode('/', $request_uri);
$countRoute = count($route);
if (!empty($route['4'])) {
    $client = new client();
    $client_id = $route['4'];
    $result = $client->Get_Clients_Details($client_id);
    print_r($result);
} else {
    $result['result'] = 0;
    echo json_encode($result);
}
Exemplo n.º 2
0
<?php

if ($_POST) {
    $cardid = $_POST['cardid'];
    $invoiceid = $_POST['invoiceid'];
    $nominal = $_POST['nominal'];
    $custom = new custom();
    $cekCardId = $custom->cekCardId($cardid);
    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;