���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
/
Toman
/
Viewing: Toman.php
<?php namespace Shetabit\Multipay\Drivers\Toman; use GuzzleHttp\Client; use Shetabit\Multipay\Invoice; use Shetabit\Multipay\Receipt; use Shetabit\Multipay\RedirectionForm; use Shetabit\Multipay\Abstracts\Driver; use Shetabit\Multipay\Contracts\ReceiptInterface; use Shetabit\Multipay\Exceptions\InvalidPaymentException; use Shetabit\Multipay\Request; class Toman extends Driver { protected $client; protected $invoice; // Invoice. protected $settings; // Driver settings. protected $base_url; protected $shop_slug; protected $auth_code; protected $code; protected $auth_token; public function __construct(Invoice $invoice, $settings) { $this->invoice($invoice); // Set the invoice. $this->settings = (object) $settings; // Set settings. $this->base_url = $this->settings->base_url; $this->shop_slug = $this->settings->shop_slug; $this->auth_code = $this->settings->auth_code; $this->code = $this->shop_slug . ':' . $this->auth_code; $this->auth_token = base64_encode($this->code); $this->client = new Client(); } // Purchase the invoice, save its transactionId and finaly return it. public function purchase() { $url = $this->base_url . "/users/me/shops/" . $this->shop_slug . "/deals"; $data = $this->settings->data; $response = $this->client ->request( 'POST', $url, [ 'json' => $data, 'headers' => [ 'Authorization' => "Basic {$this->auth_token}", "Content-Type" => 'application/json' ] ] ); $result = json_decode($response->getBody()->getContents(), true); if (isset($result['trace_number'])) { $this->invoice->transactionId($result['trace_number']); return $this->invoice->getTransactionId(); } else { throw new InvalidPaymentException('پرداخت با مشکل مواجه شد، لطفا با ما در ارتباط باشید'); } } // Redirect into bank using transactionId, to complete the payment. public function pay(): RedirectionForm { $transactionId = $this->invoice->getTransactionId(); $redirect_url = $this->base_url . '/deals/' . $transactionId . '/redirect'; return $this->redirectWithForm($redirect_url, [], 'GET'); } // Verify the payment (we must verify to ensure that user has paid the invoice). public function verify(): ReceiptInterface { $state = Request::input('state'); $transactionId = $this->invoice->getTransactionId(); $verifyUrl = $this->base_url . "/users/me/shops/" . $this->shop_slug . "/deals/" . $transactionId . "/verify"; if ($state != 'funded') { throw new InvalidPaymentException('پرداخت انجام نشد'); } $this->client ->request( 'PATCH', $verifyUrl, [ 'headers' => [ 'Authorization' => "Basic {$this->auth_token}", "Content-Type" => 'application/json' ] ] ); return $this->createReceipt($transactionId); } /** * Generate the payment's receipt * * @param $referenceId * * @return Receipt */ public function createReceipt($referenceId) { return new Receipt('toman', $referenceId); } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa