Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla4/bluepaid.zip

PK�u�[zݻ%I#I#bluepaid.phpnu�[���<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikashoppaymentBluepaid extends hikashopPaymentPlugin
{
	var $accepted_currencies = array(
		'EUR','CHF','USD','GBP','JPY','CAD','AUD'
	);
	var $multiple = true;
	var $name = 'bluepaid';
	var $debugData = array();


	function onAfterOrderConfirm(&$order,&$methods,$method_id){
		parent::onAfterOrderConfirm($order, $methods, $method_id);

		$vars = array(
			"devise" => $this->currency->currency_code,
			"montant" =>
round($order->cart->full_total->prices[0]->price_value_with_tax,(int)$this->currency->currency_locale['int_frac_digits']),
		);

		$vars["email_client"]=$this->user->user_email;
		$vars["id_boutique"]=$this->payment_params->shop_id;

		$vars["langue"] = strtoupper($this->locale);
		if(!in_array($this->locale,array('EN', 'DE',
'ES', 'FR', 'IT', 'NL',
'PT')))
			$vars["langue"] = 'EN';

		if(!empty($order->cart->shipping_address->address_country->zone_code_3))
			$vars["pays_liv"]=@$order->cart->shipping_address->address_country->zone_code_3;
		else
if(!empty($order->cart->billing_address->address_country->zone_code_3))
			$vars["pays_liv"]=@$order->cart->billing_address->address_country->zone_code_3;

		$vars["id_client"]=$order->order_user_id;
		$vars["divers"]=$order->order_id;

		$this->removeCart = true;

		$this->vars = $vars;

		$this->showPage('end');
	}

	function onPaymentNotification(&$statuses){
		$vars = array();
		$data = array();
		$filter = JFilterInput::getInstance();
		foreach($_POST as $key => $value){
			$key = $filter->clean($key);
			$value = hikaInput::get()->getString($key);
			$vars[$key]=$value;
		}


		$order_id = (int)@$vars['divers'];
		$dbOrder = $this->getOrder($order_id);
		if(!empty($dbOrder)){
			$url =
HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id='.$order->order_id;
			$order_text =
"\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);
			$order_text .=
"\r\n".str_replace('<br/>',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url));
		}else{
			echo "Could not load any order for your notification
".@$vars['divers'];
			return false;
		}

		$this->loadPaymentParams($dbOrder);
		if(empty($this->payment_params))
			return false;
		$this->loadOrderData($dbOrder);

		if($this->payment_params->debug){
			echo print_r($vars,true)."\n\n\n";
			echo print_r($dbOrder,true)."\n\n\n";
		}

		if(!empty($this->payment_params->ips)){
			$ip = hikashop_getIP();
			$ips =
str_replace(array('.','*',','),array('\.','[0-9]+','|'),$this->payment_params->ips);
			if(!preg_match('#('.implode('|',$ips).')#',$ip)){
				$body =
str_replace('<br/>',"\r\n",JText::sprintf('NOTIFICATION_REFUSED_FROM_IP','Bluepaid',$ip,implode("\r\n",$this->payment_params->ips)))."\r\n\r\n".$order_text;


				$email = new stdClass();
				$email->subject =
JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Bluepaid').'
'.JText::sprintf('IP_NOT_VALID',$dbOrder->order_number);
				$email->body = $body;

				$this->modifyOrder($order_id,
$this->payment_params->invalid_status, false, $email);

				JError::raiseError( 403, JText::_( 'Access Forbidden' ));
				return false;
			}
		}

		if
($vars['secure_key']!=@$this->payment_params->secure_key)
{
			$body = JText::sprintf("Hello,\r\n A Bluepaid notification was
refused because the response from the Bluepaid server was
invalid")."\r\n\r\n".$order_text;

			$email->subject =
JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Bluepaid').'invalid
response';
			$email->body = $body;

			$this->modifyOrder($order_id,
$this->payment_params->invalid_status, false, $email);

			if($element->payment_params->debug){
				echo 'invalid response'."\n\n\n";
			}
			return false;
		}

		$vars['status'] = strtolower(@$vars['etat']);

		if(!in_array($vars['status'], array("attente",
"ok"))) {

			if($vars['status'] == "annu") {
				$vars['payment_status'] = 'Cancelled';
			} elseif($vars['status'] == "ko") {
				$vars['payment_status'] = 'Failed';
			} else {
				$vars['payment_status'] = 'Unknown';
			}

			$body =
str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS',
'Bluepaid', $vars['payment_status'])) . ' ' .
JText::_('STATUS_NOT_CHANGED') . "\r\n\r\n" .
$order_text;

			$email->subject =
JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER',
'Bluepaid', $vars['payment_status'],
$dbOrder->order_number);
			$email->body = $body;

			$this->modifyOrder($order_id, null, false, $email);

			if($element->payment_params->debug) {
				echo 'payment with code ' .
@$vars['status'].(!empty($vars['failed_reason_code'])?'
:
'.@$vars['failed_reason_code']:'')."\n\n\n";
			}
			return false;
		}

		$history = new stdClass();
		$history->notified = 0;
		$history->amount = @$vars['montant'] .
@$vars['devise'];
		$history->data = ob_get_clean();

	 	$price_check = round($dbOrder->order_full_price,
(int)$this->currency->currency_locale['int_frac_digits']) .
$this->currency->currency_code;
	 	if($price_check !=
@$vars['montant'].@$vars['devise']) {
	
		$mailer->setSubject(JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Bluepaid')
. JText::_('INVALID_AMOUNT'));
			$body =
str_replace('<br/>',"\r\n",JText::sprintf('AMOUNT_RECEIVED_DIFFERENT_FROM_ORDER','Bluepaid',$order->history->amount,$price_check))."\r\n\r\n".$order_text;

			$email->subject =
JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Bluepaid')
. JText::_('INVALID_AMOUNT');
			$email->body = $body;

			$this->modifyOrder($order_id,
$this->payment_params->invalid_status, $history, $email);

	 		return false;
	 	}

	 	if($vars['status'] == "ok") {
	 		$order_status = $this->payment_params->verified_status;
	 		$vars['payment_status'] = 'Accepted';
	 	} else {
	 		$order_status = $this->payment_params->pending_status;
	 		$order_text = "Payment is pending\r\n\r\n" . $order_text;
	 		$vars['payment_status'] = 'Pending';
	 	}

	 	$config =& hikashop_config();
		if($config->get('order_confirmed_status','confirmed')
== $order_status){
			$history->notified = 1;
		}

		$body =
str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Bluepaid',$vars['payment_status'])).'
'.JText::sprintf('ORDER_STATUS_CHANGED',$statuses[$order->order_status])."\r\n\r\n".$order_text;

		$email->subject =
JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Bluepaid',$vars['payment_status'],$dbOrder->order_number);
		$email->body = $body;

		$this->modifyOrder($order_id, $order_status, $history, $email);


		return true;
	}

	function onPaymentConfiguration(&$element) {
		$subtask = hikaInput::get()->getCmd('subtask',
'');

		if($subtask == 'ips') {
			$ips = null;
			echo implode(',', $this->_getIPList($ips));
			exit;
		}

		parent::onPaymentConfiguration($element);

		$lang = JFactory::getLanguage();
		$locale = strtoupper(substr($lang->get('tag'), 0, 2));
		$element->payment_params->status_url =
HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=bluepaid&tmpl=component&lang='.strtolower($locale);
	}

	function onPaymentConfigurationSave(&$element) {
		if(!empty($element->payment_params->ips)) {
			$element->payment_params->ips = explode(',',
$element->payment_params->ips);
		}
		return true;
	}

	function _getIPList(&$ipList) {
		$ipList = array_merge(
			gethostbynamel('securepayment.bluepaid.com'),
			gethostbynamel('securepayment1.bluepaid.com'),
			gethostbynamel('securepayment2.bluepaid.com'),
			gethostbynamel('securepayment3.bluepaid.com'),
			gethostbynamel('securepayment4.bluepaid.com'),
			gethostbynamel('securepayment5.bluepaid.com'),
			gethostbynamel('securepayment6.bluepaid.com')
		);
		if(empty($ipList))
			return $ipList;

		$newList = array('193.33.47.34','193.33.47.35');
		foreach($ipList as $k => $ip) {
			$ipParts = explode('.', $ip);
			if(!in_array($ip, $newList)) {
				$newList[] = $ip;
			}
		}
		$ipList = $newList;
		return $ipList;
	}

	function getPaymentDefaultValues(&$element) {
		$element->payment_name = 'Bluepaid';
		$element->payment_description = 'Vous pouvez payer par carte
bleue avec ce système de paiement';
		$element->payment_images =
'MasterCard,VISA,Credit_card,American_Express';

		$element->payment_params->notification=true;
		$list = null;
		$element->payment_params->ips = $this->_getIPList($list);
		$element->payment_params->url =
'https://www.bluepaid.com/in.php';
		$element->payment_params->secure_key = md5(time().rand());
		$element->payment_params->invalid_status = 'cancelled';
		$element->payment_params->pending_status = 'created';
		$element->payment_params->verified_status = 'confirmed';
	}

}
PK�u�[>�����bluepaid.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension type="plugin" version="2.5"
method="upgrade" group="hikashoppayment">
	<name>Hikashop Bluepaid Payment Plugin</name>
	<creationDate>12 février 2021</creationDate>
	<version>4.4.1</version>
	<author>Hikashop</author>
	<authorEmail>dev@hikashop.com</authorEmail>
	<authorUrl>http://www.hikashop.com</authorUrl>
	<copyright>(C) 2010-2021 HIKARI SOFTWARE. All rights
reserved.</copyright>
	<license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
	<description>This plugin enables you to setup your Bluepaid payment
system</description>
	<files>
		<filename
plugin="bluepaid">bluepaid.php</filename>
		<filename>bluepaid_configuration.php</filename>
		<filename>bluepaid_end.php</filename>
	</files>
	<params addpath="/components/com_hikashop/params">
		<param name="pluginoptions" type="pluginoptions"
default="plugin" label="hikashop"
description="HikaShop options" />
	</params>
	<config>
		<fields name="params"
addfieldpath="/components/com_hikashop/fields">
			<fieldset name="basic">
				<field id="pluginoptions" name="pluginoptions"
type="pluginoptions" label="hikashop"
description="HikaShop options" />
			</fieldset>
		</fields>
	</config>
</extension>
PK�u�[X�lggbluepaid_configuration.phpnu�[���<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><tr>
	<td class="key">
		<label for="data[payment][payment_params][url]">
			<?php echo JText::_( 'URL' ); ?>
		</label>
	</td>
	<td>
		<input type="text"
name="data[payment][payment_params][url]" value="<?php
echo @$this->element->payment_params->url; ?>" />
	</td>
</tr>
<tr>
	<td class="key">
		<label for="data[payment][payment_params][shop_id]">
			<?php echo JText::_( 'BLUEPAID_SHOP_ID' ); ?>
		</label>
	</td>
	<td>
		<input type="text"
name="data[payment][payment_params][shop_id]"
value="<?php echo
@$this->element->payment_params->shop_id; ?>" />
	</td>
</tr>
<tr>
	<td class="key">
		<label for="data[payment][payment_params][status_url]">
			<?php echo JText::sprintf(
'STATUS_URL',$this->element->payment_name ); ?>
		</label>
	</td>
	<td>
		<input type="hidden"
name="data[payment][payment_params][secure_key]"
value="<?php echo
@$this->element->payment_params->secure_key; ?>" />
		<?php echo str_replace( '&',
'&amp;',@$this->element->payment_params->status_url.'&secure_key='.@$this->element->payment_params->secure_key);
?>
	</td>
</tr>
<tr>
	<td class="key">
		<label
for="data[payment][payment_params][notification]">
			<?php echo JText::sprintf( 'ALLOW_NOTIFICATIONS_FROM_X',
$this->element->payment_name);  ?>
		</label>
	</td>
	<td>
		<?php echo JHTML::_('hikaselect.booleanlist',
"data[payment][payment_params][notification]" ,
'',@$this->element->payment_params->notification	);
?>
	</td>
</tr>
<tr>
	<td class="key">
		<label for="data[payment][payment_params][debug]">
			<?php echo JText::_( 'DEBUG' ); ?>
		</label>
	</td>
	<td>
		<?php echo JHTML::_('hikaselect.booleanlist',
"data[payment][payment_params][debug]" ,
'',@$this->element->payment_params->debug	); ?>
	</td>
</tr>
<tr>
	<td class="key">
		<label for="data[payment][payment_params][ips]">
			<?php echo JText::_( 'IPS' ); ?>
		</label>
	</td>
	<td>
		<textarea id="bluepaid_ips"
name="data[payment][payment_params][ips]" ><?php echo
(!empty($this->element->payment_params->ips) &&
is_array($this->element->payment_params->ips)?trim(implode(',',$this->element->payment_params->ips)):'');
?></textarea>
		<br/>
		<a href="#" onclick="return
refresh_ips();"><?php echo
JText::_('REFRESH_IPS');?></a>
		<script type="text/javascript">
		function refresh_ips() {
			var w = window, d = document, o = w.Oby;
			o.xRequest(
				'<?php echo
hikashop_completeLink('plugins&plugin_type=payment&task=edit&name='.$this->name.'&subtask=ips',true,true);?>',
				null,
				function(xhr) {
					d.getElementById('bluepaid_ips').value = xhr.responseText;
				}
			);
			return false;
		}
		</script>
	</td>
</tr>
<tr>
	<td class="key">
		<label
for="data[payment][payment_params][invalid_status]">
			<?php echo JText::_( 'INVALID_STATUS' ); ?>
		</label>
	</td>
	<td>
		<?php echo
$this->data['order_statuses']->display("data[payment][payment_params][invalid_status]",@$this->element->payment_params->invalid_status);
?>
	</td>
</tr>
<tr>
	<td class="key">
		<label
for="data[payment][payment_params][pending_status]">
			<?php echo JText::_( 'PENDING_STATUS' ); ?>
		</label>
	</td>
	<td>
		<?php echo
$this->data['order_statuses']->display("data[payment][payment_params][pending_status]",@$this->element->payment_params->pending_status);
?>
	</td>
</tr>
<tr>
	<td class="key">
		<label
for="data[payment][payment_params][verified_status]">
			<?php echo JText::_( 'VERIFIED_STATUS' ); ?>
		</label>
	</td>
	<td>
		<?php echo
$this->data['order_statuses']->display("data[payment][payment_params][verified_status]",@$this->element->payment_params->verified_status);
?>
	</td>
</tr>
PK�u�[��ǜ��bluepaid_end.phpnu�[���<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="hikashop_bluepaid_end"
id="hikashop_bluepaid_end">
	<span id="hikashop_bluepaid_end_message"
class="hikashop_bluepaid_end_message">
		<?php echo
JText::sprintf('PLEASE_WAIT_BEFORE_REDIRECTION_TO_X',$this->payment_name).'<br/>'.
JText::_('CLICK_ON_BUTTON_IF_NOT_REDIRECTED');?>
	</span>
	<span id="hikashop_bluepaid_end_spinner"
class="hikashop_bluepaid_end_spinner">
		<img src="<?php echo
HIKASHOP_IMAGES.'spinner.gif';?>" />
	</span>
	<br/>
	<form id="hikashop_bluepaid_form"
name="hikashop_bluepaid_form" action="<?php echo
$this->payment_params->url;?>" method="post">
		<div id="hikashop_bluepaid_end_image"
class="hikashop_bluepaid_end_image">
			<input id="hikashop_bluepaid_button"
type="submit" class="btn btn-primary"
value="<?php echo JText::_('PAY_NOW');?>"
name="" alt="<?php echo
JText::_('PAY_NOW');?>" />
		</div>
		<?php
			foreach( $this->vars as $name => $value ) {
				echo '<input type="hidden"
name="'.$name.'"
value="'.htmlspecialchars($value).'" />';
			}
			$doc = JFactory::getDocument();
			$doc->addScriptDeclaration("window.hikashop.ready( function()
{document.getElementById('hikashop_bluepaid_form').submit();});");
			hikaInput::get()->set('noform',1);
		?>
	</form>
</div>
PK�u�[�#o,,
index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�u�[zݻ%I#I#bluepaid.phpnu�[���PK�u�[>������#bluepaid.xmlnu�[���PK�u�[X�lgg�(bluepaid_configuration.phpnu�[���PK�u�[��ǜ��T8bluepaid_end.phpnu�[���PK�u�[�#o,,
�>index.htmlnu�[���PK��>