<?php
/**
 * Created by PhpStorm.
 * User: freudmaster
 * Date: 2019-09-02
 * Time: 16:02
 */

require_once ('../database/Requester.php');

$tag="";

$postdata = file_get_contents("php://input");
$request=null;
if(isset($postdata)) {
    $request = json_decode($postdata);

}

if($postdata!=null && isset($request->tag)) {

    switch ($request->tag){
        case "add_retrait_wallet":
            addRetraitWallet($request);
            break;
        case "add_depot_wallet":
            addDepotWallet($request);
            break;
        default:
            echo json_encode($request);
    }
}
function addRetraitWallet($request){
    if(isset($request->numCarte) && isset($request->cvv) && isset($request->montant) && isset($request->taxe)){
        $lang=$request->lang;
        $req=new Requester($lang);
        echo json_encode($req->createRequestRetrait($request->numCarte,$request->cvv,$request->montant,$request->taxe,9975));
    }else
        echo json_encode(['error'=>'code parrain est absent']);

}
function addDepotWallet($request){

}


