���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
/
Etebarino
/
Viewing: Etebarino.php
<?php namespace Shetabit\Multipay\Drivers\Etebarino; use GuzzleHttp\Client; use Shetabit\Multipay\Abstracts\Driver; use Shetabit\Multipay\Exceptions\PurchaseFailedException; use Shetabit\Multipay\Contracts\ReceiptInterface; use Shetabit\Multipay\Invoice; use Shetabit\Multipay\Receipt; use Shetabit\Multipay\RedirectionForm; class Etebarino extends Driver { /** * Invoice * * @var Invoice */ protected $invoice; /** * Driver settings * * @var object */ protected $settings; /** * Etebarino 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; } /** * Purchase Invoice * * @return string * * @throws PurchaseFailedException */ public function purchase() { $this->invoice->uuid(crc32($this->invoice->getUuid())); $result = $this->token(); if (!isset($result['status_code']) or $result['status_code'] != 200) { $this->purchaseFailed($result['content']); } $this->invoice->transactionId($result['content']); // return the transaction's id return $this->invoice->getTransactionId(); } /** * Pay the Invoice * * @return RedirectionForm */ public function pay(): RedirectionForm { return $this->redirectWithForm($this->settings->apiPaymentUrl, [ 'token' => $this->invoice->getTransactionId() ], 'GET'); } /** * Verify payment * * @return ReceiptInterface * * @throws PurchaseFailedException */ public function verify(): ReceiptInterface { $result = $this->verifyTransaction(); if (!isset($result['status_code']) or $result['status_code'] != 200) { $this->purchaseFailed($result['content']); } $receipt = $this->createReceipt($this->invoice->getDetail('referenceCode')); $receipt->detail([ 'referenceNo' => $this->invoice->getDetail('referenceCode'), ]); return $receipt; } /** * send request to Etebarino * * @param $method * @param $url * @param array $data * @return array */ protected function callApi($method, $url, $data = []): array { $client = new Client(); $response = $client->request($method, $url, [ "json" => $data, "headers" => [ 'Content-Type' => 'application/json', ], "http_errors" => false, ]); return [ 'status_code' => $response->getStatusCode(), 'content' => $response->getBody()->getContents() ]; } /** * Generate the payment's receipt * * @param $referenceId * * @return Receipt */ protected function createReceipt($referenceId): Receipt { $receipt = new Receipt('etebarino', $referenceId); return $receipt; } /** * call create token request * * @return array */ public function token(): array { return $this->callApi('POST', $this->settings->apiPurchaseUrl, [ 'terminalCode' => $this->settings->terminalId, 'terminalUser' => $this->settings->username, 'merchantCode' => $this->settings->merchantId, 'terminalPass' => $this->settings->password, 'merchantRefCode' => $this->invoice->getUuid(), "description" => $this->invoice->getDetail('description'), "returnUrl" => $this->settings->callbackUrl, 'paymentItems' => $this->getItems(), ]); } /** * call verift transaction request * * @return array */ public function verifyTransaction(): array { return $this->callApi('POST', $this->settings->apiVerificationUrl, [ 'terminalCode' => $this->settings->terminalId, 'terminalUser' => $this->settings->username, 'merchantCode' => $this->settings->merchantId, 'terminalPass' => $this->settings->password, 'merchantRefCode' => $this->invoice->getDetail('uuid'), 'referenceCode' => $this->invoice->getDetail('referenceCode') ]); } /** * get Items for * * */ private function getItems() { /** * example data * * $items = [ * [ * "productGroup" => 1000, * "amount" => 1000, //Rial * "description" => "desc" * ] * ]; */ return $this->invoice->getDetails()['items']; } /** * Trigger an exception * * @param $message * * @throws PurchaseFailedException */ protected function purchaseFailed($message) { throw new PurchaseFailedException($message); } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa