<?php

namespace Amwdeveloper\plugins\donate;

use Amwdeveloper\core\session;
use Amwdeveloper\model\layer;
use Amwdeveloper\model\message;
use GuzzleHttp\Client;

class expay extends layer
{
    public function __construct()
    {
        $this->message = new message();
        $this->session = new session();
        $this->api_key = payment['api_key'];
        $this->token  = payment['token'];
    }

    public function index()
    {

        $gluzze = new Client();

        $response = $gluzze->request('POST', 'https://expaybrasil.com/en/purchase/link', [
            'form_params' => [
                'merchant_key' => '$2y$10$Y8G0Z.yKxy2NCC7xXWi3yO0vqcrSFLLBuELNZsogtX.hyE.s.l3lq',
                'currency_code' => 'BRL',
                'invoice' => '{"invoice_id":"1000","invoice_description":"Descrição fatura","total":40,"devedor":"João Guedes","email":"amandanatiele.50@gmail.com","cpf_cnpj":"64597420061","notification_url":"https://meusite.com/notification/","items":[{"name":"name","price":"40.00","description":"description","qty":"1"}]}'
            ],
            'headers' => [
                'accept' => 'application/json',
                'content-type' => 'application/x-www-form-urlencoded',
            ],
        ]);

        echo $response->getBody();
    }
}
