Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
6
Indexable
  //Проверка карты через чекер
    static public function checkCard($request){
        $order = Order::getOneOrderUser($request->check);
        $exp = explode("/", $order->card->exp);
        
        ($exp[1] < 2000) ? $year = $exp[1] : $year = (int)$exp[1] - 2000;
        
       


        $url = '/apiv2/ck.php?cardnum='.$order->card->ccnum.'&expm='.$exp[0].'&expy='.$year.'&cvv='.$order->card->cvv.'&key='.self::api_key.'&username='.self::username;

        $client = new \GuzzleHttp\Client(['headers' => ['Content-Type' => 'application/json', 'Cache-Control' => 'no-cache']]);
        $res = $client->request('GET', self::url.$url);

        
        $result_str = $res->getBody()->getContents();
        $arr_res = json_decode($result_str);

        $checker = new CheckerCard();
        $checker->user_id = Auth::id();
        $checker->card_id = $order->card->id;
        $checker->response = $result_str;
        $checker->result = serialize($arr_res);
        $checker->status_id = Status::getId(Status::CODE_ACTIVE, CheckerCard::table);
        $checker->save();
Editor is loading...
Leave a Comment