���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
npln
/
vendor
/
shetabit
/
multipay
/
src
/
Drivers
/
Sizpay
/
Viewing: Sizpay.php
<?php namespace Shetabit\Multipay\Drivers\Sizpay; use GuzzleHttp\Client; use Shetabit\Multipay\Abstracts\Driver; use Shetabit\Multipay\Exceptions\InvalidPaymentException; use Shetabit\Multipay\Exceptions\PurchaseFailedException; use Shetabit\Multipay\Contracts\ReceiptInterface; use Shetabit\Multipay\Invoice; use Shetabit\Multipay\Receipt; use Shetabit\Multipay\RedirectionForm; use Shetabit\Multipay\Request; class Sizpay extends Driver { /** * Nextpay Client. * * @var Client */ protected $client; /** * Invoice * * @var Invoice */ protected $invoice; /** * Driver settings * * @var object */ protected $settings; /** * Nextpay constructor. * Construct the class with the relevant settings. * * @param Invoice $invoice * @param $settings */ public function __construct(Invoice $invoice, $settings) { $this->invoice($invoice); $this->settings = (object) $settings; $this->client = new Client(); } /** * Purchase Invoice. * * @return string * * @throws PurchaseFailedException * @throws \SoapFault */ public function purchase() { $client = new \SoapClient($this->settings->apiPurchaseUrl); $response = $client->GetToken2(array( 'MerchantID' => $this->settings->merchantId, 'TerminalID' => $this->settings->terminal, 'UserName' => $this->settings->username, 'Password' => $this->settings->password, 'Amount' => $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1), // convert to rial 'OrderID' => time(), 'ReturnURL' => $this->settings->callbackUrl, 'InvoiceNo' => time(), 'DocDate' => '', 'ExtraInf' => time(), 'AppExtraInf' => '', 'SignData' => $this->settings->SignData ))->GetToken2Result; $result = json_decode($response); if (! isset($result->ResCod) || ! in_array($result->ResCod, ['0', '00'])) { // error has happened $message = $result->Message ?? 'خطای ناشناخته رخ داده'; throw new PurchaseFailedException($message); } $this->invoice->transactionId($result->Token); // return the transaction's id return $this->invoice->getTransactionId(); } /** * Pay the Invoice * * @return RedirectionForm */ public function pay() : RedirectionForm { $payUrl = $this->settings->apiPaymentUrl; return $this->redirectWithForm( $payUrl, [ 'MerchantID' => $this->settings->merchantId, 'TerminalID' => $this->settings->terminal, 'Token' => $this->invoice->getTransactionId(), 'SignData' => $this->settings->SignData ], 'POST' ); } /** * Verify payment * * @return ReceiptInterface * * @throws InvalidPaymentException * @throws \GuzzleHttp\Exception\GuzzleException */ public function verify() : ReceiptInterface { $resCode = Request::input('ResCod'); if (! in_array($resCode, array('0', '00'))) { $message = 'پرداخت توسط کاربر لغو شد'; throw new InvalidPaymentException($message); } $data = array( 'MerchantID' => $this->settings->merchantId, 'TerminalID' => $this->settings->terminal, 'UserName' => $this->settings->username, 'Password' => $this->settings->password, 'Token' => Request::input('Token'), 'SignData' => $this->settings->SignData ); $client = new \SoapClient($this->settings->apiVerificationUrl); $response = $client->Confirm2($data)->Confirm2Result; $result = json_decode($response); if (! isset($result->ResCod) || ! in_array($result->ResCod, array('0', '00'))) { $message = $result->Message ?? 'خطا در انجام عملیات رخ داده است'; throw new InvalidPaymentException($message, (int)(isset($result->ResCod) ? $result->ResCod : 0)); } return $this->createReceipt($result->RefNo); } /** * Generate the payment's receipt * * @param $resCode * * @return Receipt */ protected function createReceipt($resCode) { $receipt = new Receipt('sizpay', $resCode); return $receipt; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa