Linux mail.vriendennsm.nl 6.1.0-51-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.177-1 (2026-07-16) x86_64
Apache/2.4.68 (Debian)
Server IP : 217.154.75.17 & Your IP : 216.73.216.195
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
vnsm /
plugins /
j2store /
payment_paynl /
Delete
Unzip
Name
Size
Permission
Date
Action
library
[ DIR ]
drwxr-xr-x
2025-02-08 22:29
payment_paynl
[ DIR ]
drwxr-xr-x
2025-02-08 22:29
index.html
98
B
-rwxr-xr-x
2019-11-20 18:26
payment_paynl.php
1.03
KB
-rwxr-xr-x
2019-11-20 18:26
payment_paynl.xml
3.46
KB
-rwxr-xr-x
2019-11-20 18:26
paynlv2.php
18.69
KB
-rwxr-xr-x
2019-11-20 18:26
paynlv3.php
16.74
KB
-rwxr-xr-x
2019-11-20 18:26
paynlv32.php
22.63
KB
-rwxr-xr-x
2019-11-20 18:26
Save
Rename
<?php /** * -------------------------------------------------------------------------------- * Payment Plugin - paynl * -------------------------------------------------------------------------------- * @package Joomla 2.5 - 3.x * @subpackage J2 Store * @author Alagesan, J2Store <support@j2store.org> * @copyright Copyright (c) 2015 J2Store . All rights reserved. * @license GNU GPL v3 or later * @link http://j2store.org * -------------------------------------------------------------------------------- * * */ /** ensure this file is being included by a parent file */ defined ( '_JEXEC' ) or die( 'Restricted access' ); require_once ( JPATH_ADMINISTRATOR . '/components/com_j2store/library/plugins/payment.php' ); require_once ( JPath::clean ( dirname ( __FILE__ ) . "/library/vendor/autoload.php" ) ); class plgJ2StorePayment_paynl extends J2StorePaymentPlugin { /** * @var $_element string Should always correspond with the plugin's filename, * forcing it to be unique */ var $_element = 'payment_paynl'; var $_isLog = false; var $_j2version = ''; private $service_id; private $apitoken; function __construct ( & $subject, $config ) { parent::__construct ( $subject, $config ); $this->loadLanguage ( '', JPATH_ADMINISTRATOR ); $this->apitoken = trim ( $this->_getParam ( 'paynl_token' ) ); $this->service_id = trim ( $this->_getParam ( 'paynl_service_id' ) ); $this->_isLog = $this->params->get ( 'debug', 0 ); $this->_j2version = $this->getVersion (); } /** * @param $order object Order table object */ function onJ2StoreGetPaymentOptions ( $element, $order ) { // Check if this is the right plugin if ( !$this->_isMe ( $element ) ) { return null; } $status = true; // if this payment method should be available for this order, return true // if not, return false. // by default, all enabled payment methods are valid, so return true here, // but plugins may override this if ( version_compare ( $this->_j2version, '2.6.7', 'ge' ) ) { //$order = JTable::getInstance('Orders', 'Table'); $order->setAddress (); $address = $order->getBillingAddress (); $geozone_id = $this->params->get ( 'geozone_id', '0' ); //get the geozones $db = JFactory::getDbo (); $query = $db->getQuery ( true ); $query->select ( 'gz.*,gzr.*' )->from ( '#__j2store_geozones AS gz' ) ->innerJoin ( '#__j2store_geozonerules AS gzr ON gzr.geozone_id = gz.geozone_id' ) ->where ( 'gz.geozone_id=' . $geozone_id ) ->where ( 'gzr.country_id=' . $db->q ( $address[ 'country_id' ] ) . ' AND (gzr.zone_id=0 OR gzr.zone_id=' . $db->q ( $address[ 'zone_id' ] ) . ')' ); $db->setQuery ( $query ); $grows = $db->loadObjectList (); if ( !$geozone_id ) { $status = true; } elseif ( $grows ) { $status = true; } else { $status = false; } } return $status; } /** * @param $data array form post data * @return string HTML to display */ function _prePayment ( $data ) { $app = JFactory::getApplication (); $session = JFactory::getSession (); // prepare the payment form $vars = new JObject(); $vars->onbeforepayment_text = $this->params->get ( 'onbeforepayment', '' ); $vars->button_text = $this->params->get ( 'button_text', 'J2STORE_PLACE_ORDER' ); $vars->display_name = $this->params->get ( 'display_name', 'PLG_J2STORE_PAYMENT_PAYNL' ); //return, cancel and notify urls $returnUrl = JURI::root () . "index.php?option=com_j2store&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=display"; $notify_url = JRoute::_ ( "index.php?option=com_j2store&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=process&tmpl=component" ); //get the order data JTable::addIncludePath ( JPATH_ADMINISTRATOR . '/components/com_j2store/tables' ); $order = JTable::getInstance ( 'Orders', 'Table' ); $order->load ( $data[ 'orderpayment_id' ] ); $currency_values = $this->getCurrency ( $order ); $currency_code = $currency_values[ 'currency_code' ]; try { $amount = $this->getAmount ( $order->orderpayment_amount, $currency_values[ 'currency_code' ], $currency_values[ 'currency_value' ], $currency_values[ 'convert' ] ); $amount = round ( $amount, 2 ) * 100; $description = JText::_ ( "J2STORE_PAYPALPRO_ORDER_DESCRIPTION" ) . ": " . $order->order_id; $OrderItems = array(); $orderItem = array( 'name' => $description, 'id' => 1, 'qty' => 1, 'price' => $amount, 'tax' => 0 ); array_push ( $OrderItems, $orderItem ); $billing_phone = ( !empty ( $data[ 'orderinfo' ][ 'billing_phone_1' ] ) ) ? $data[ 'orderinfo' ][ 'billing_phone_1' ] : $data[ 'orderinfo' ][ 'billing_phone_2' ]; $country = $this->getCountryById ( $data[ 'orderinfo' ][ 'billing_country_id' ] ); $payment_params = array( // required 'amount' => $amount, 'returnUrl' => $returnUrl,//dirname(Paynl\Helper::getBaseUrl()) . '/return.php', // optional 'exchangeUrl' => $notify_url,//dirname(Paynl\Helper::getBaseUrl()) . '/exchange.php', //'paymentMethod' => isset($data['optionId']) && !empty($data['optionId']) ? , 'currency' => $currency_code, //'expireDate' => new DateTime('2016-04-01'), // 'bank' => 1, 'description' => $order->order_id, //'testmode' => 0, 'extra1' => $data[ 'orderpayment_id' ], //'extra2' => 'ext2', //'extra3' => 'ext3', 'ipaddress' => \Paynl\Helper::getIp (), 'invoiceDate' => new DateTime( 'now' ), //'deliveryDate' => new DateTime('2016-06-06'), // in case of tickets for an event, use the event date here 'products' => $OrderItems, 'language' => 'EN', 'enduser' => array( 'initials' => $data[ 'orderinfo' ][ 'billing_first_name' ], 'lastName' => $data[ 'orderinfo' ][ 'billing_last_name' ], //'gender' => '', //'birthDate' => '14-05-1999', 'phoneNumber' => $billing_phone, 'emailAddress' => $data[ 'orderinfo' ][ 'user_email' ], ), 'address' => array( 'streetName' => $data[ 'orderinfo' ][ 'billing_address_1' ] . " " . $data[ 'orderinfo' ][ 'billing_address_2' ], 'houseNumber' => '', 'zipCode' => $data[ 'orderinfo' ][ 'billing_zip' ], 'city' => $data[ 'orderinfo' ][ 'billing_city' ], 'country' => $country->country_isocode_2, ), 'invoiceAddress' => array( 'initials' => $data[ 'orderinfo' ][ 'billing_first_name' ], 'lastName' => $data[ 'orderinfo' ][ 'billing_last_name' ], 'streetName' => $data[ 'orderinfo' ][ 'billing_address_1' ] . " " . $data[ 'orderinfo' ][ 'billing_address_2' ], 'houseNumber' => '', 'zipCode' => $data[ 'orderinfo' ][ 'billing_zip' ], 'city' => $data[ 'orderinfo' ][ 'billing_city' ], 'country' => $country->country_isocode_2, ), ); if ( isset( $data[ 'optionId' ] ) && !empty( $data[ 'optionId' ] ) ) { $payment_params[ 'paymentMethod' ] = $data[ 'optionId' ]; } $mode = $this->params->get ( 'sandbox', 0 ); if ( $mode ) { $payment_params[ 'testmode' ] = 1; } else { $payment_params[ 'testmode' ] = 0; } \Paynl\Config::setApiToken ( $this->apitoken ); \Paynl\Config::setServiceId ( $this->service_id ); $result = \Paynl\Transaction::start ( $payment_params ); $transactionId = $result->getTransactionId (); $payment_url = $result->getRedirectUrl (); if ( isset( $transactionId ) && isset( $payment_url ) && !empty( $payment_url ) && !empty( $transactionId ) ) { $vars->payment_url = $payment_url; $order->transaction_id = $transactionId; $order->update_status ( 4 ); //now store $order->store (); } } catch (\Paynl\Error\Error $e) { $vars->error = $e->getMessage(); } $html = $this->_getLayout ( 'prepayment', $vars ); return $html; } /** * Processes the payment form * and returns HTML to be displayed to the user * generally with a success/failed message * * @param $data array form post data * @return string HTML to display */ function _postPayment ( $data ) { // Process the payment $vars = new JObject(); $app = JFactory::getApplication (); $paction = $app->input->getString ( 'paction' ); switch ( $paction ) { case "display": $vars->message = $this->_process ( $data ); $html = $this->_getLayout ( 'message', $vars ); $html .= $this->_displayArticle (); break; case 'process': $vars->message = $this->_process ( $data ); $html = $this->_getLayout ( 'message', $vars ); echo $html; // TODO Remove this $app->close (); break; default: $vars->message = $this->params->get ( 'onerrorpayment', '' ); $html = $this->_getLayout ( 'message', $vars ); break; } return $html; } /** * Prepares variables and * Renders the form for collecting payment info * * @return unknown_type */ function _renderForm ( $data ) { $vars = new JObject(); $vars->onselection_text = $this->params->get ( 'onselection', '' ); try { //Beschikbare betaalmethoden ophalen (Dit zou je kunnen cachen) //$serviceApi = new Pay_Api_Getservice(); if ( empty( $this->apitoken ) || empty( $this->service_id ) ) { $vars->error = JText::_('J2STORE_PAYNL_ENTER_APITOKEN_AND_SERVICE_ID'); } \Paynl\Config::setApiToken($this->apitoken); \Paynl\Config::setServiceId($this->service_id); $paymentMethods = \Paynl\Paymentmethods::getList(); //$serviceApi->setApiToken ( $this->apitoken ); //$serviceApi->setServiceId ( $this->service_id ); //$result = $serviceApi->doRequest (); //$basePath = $result[ 'service' ][ 'basePath' ]; $paymentOptions = array(); foreach ( $paymentMethods as $paymentOption ) { $tmpPaymentOption = array(); $tmpPaymentOption[ 'id' ] = $paymentOption[ 'id' ]; $tmpPaymentOption[ 'name' ] = $paymentOption[ 'visibleName' ]; //$tmpPaymentOption[ 'image' ] = $basePath . $paymentOption[ 'path' ] . $paymentOption[ 'img' ]; if ( !empty( $paymentOption[ 'paymentOptionSubList' ] ) ) { $tmpPaymentOption[ 'subList' ] = array(); foreach ( $paymentOption[ 'paymentOptionSubList' ] as $subItem ) { $tmpPaymentOption[ 'subList' ][ $subItem[ 'id' ] ] = array( 'id' => $subItem[ 'id' ], 'name' => $subItem[ 'visibleName' ], //'img' => $basePath . $subItem[ 'path' ] . $subItem[ 'img' ], ); } } $paymentOptions[ $tmpPaymentOption[ 'id' ] ] = $tmpPaymentOption; } $vars->paymentOptions = $paymentOptions;//Pay_Helper::sortPaymentOptions ( $paymentOptions ); } catch ( \Paynl\Error\Error $e ) { $vars->error = $e->getMessage (); } $html = $this->_getLayout ( 'form', $vars ); return $html; } function _verifyForm ( $submitted_values ) { $object = new JObject(); $object->error = false; $object->message = ''; $user = JFactory::getUser (); foreach ( $submitted_values as $key => $value ) { switch ( $key ) { case "optionId": if ( !isset( $submitted_values[ $key ] ) || !JString::strlen ( $submitted_values[ $key ] ) ) { $object->error = true; $object->message .= "<li>" . JText::_ ( "J2STORE_PAYNL_MESSAGE_PAYMENT_OPTION_REQUIRED" ) . "</li>"; } break; default: break; } } return $object; } /** * Gets a value of the plugin parameter * * @param string $name * @param string $default * @return string * @access protected */ function _getParam ( $name, $default = '' ) { $sandbox_param = "sandbox_$name"; $sb_value = $this->params->get ( $sandbox_param ); if ( $this->params->get ( 'sandbox' ) && !empty( $sb_value ) ) { $param = $this->params->get ( $sandbox_param, $default ); } else { $param = $this->params->get ( $name, $default ); } return $param; } /** * Processes the payment * * This method process only real time (simple) payments * * @return string * @access protected */ function _process ( $values ) { $app = JFactory::getApplication (); //initialise errors array $errors = array(); $post = $app->input->getArray ( $_REQUEST ); $post[ 'transaction_details' ] = $this->_getFormattedTransactionDetails ( $post ); $this->_log ( $post[ 'transaction_details' ] ); try { \Paynl\Config::setApiToken($this->apitoken); \Paynl\Config::setServiceId($this->service_id); $paction = $app->input->getString( 'paction' ); if($paction == 'display'){ $transaction = \Paynl\Transaction::getForReturn(); }elseif ($paction == 'process'){ $transaction = \Paynl\Transaction::getForExchange(); } if(!is_object ( $transaction )){ $errors[] = JText::_('J2STORE_PAYNL_INVALID_RESPONSE'); } //get the order id $order_id = $transaction->getExtra1 (); if ( $order_id > 0 && empty( $errors ) ) { //load order table JTable::addIncludePath ( JPATH_ADMINISTRATOR . '/components/com_j2store/tables' ); $order = JTable::getInstance ( 'Orders', 'Table' ); $order->load ( (int)$order_id ); if ( !empty( $order_id ) && $order->id == $order_id ) { $order->transaction_status = $post['paymentDetails']['stateName']; $order->transaction_details = $post[ 'transaction_details' ]; if($transaction->isPaid ()){ $order->order_state_id = 1; //confirmed $order->order_state = JText::_ ( 'J2STORE_CONFIRMED' ); }elseif ($transaction->isPending ()){ $order->order_state_id = 4; //PENDING $order->order_state = JText::_ ( 'J2STORE_PENDING' ); }else{ //FAILED $order->order_state_id = 3; //FAILED $order->order_state = JText::_ ( 'J2STORE_FAILED' ); } if ( !$order->store () ) { $errors[] = JText::_ ( 'J2STORE_PAYNL_ERROR_SAVING_DATA' ); } } else { $errors[] = JText::_ ( 'J2STORE_PAYNL_MESSAGE_ORDER_DOES_NOT_EXIST' ); } } } catch ( \Paynl\Error\Error $e ) { $errors[] = $e->getMessage (); } //if errors, send admin an email if ( count ( $errors ) ) { $error = implode ( "\n", $errors ); // send an emails to site's administrators with error messages $this->_sendErrorEmails ( $error, $post[ 'transaction_details' ] ); return $error; } //all went well. return JText::_ ( $this->params->get ( 'onafterpayment', '' ) ); } /** * Simple logger * * @param string $text * @param string $type * @return void */ function _log ( $text, $type = 'message' ) { if ( $this->_isLog ) { $file = JPATH_ROOT . "/cache/{$this->_element}.txt"; $date = JFactory::getDate (); $f = fopen ( $file, 'a' ); fwrite ( $f, "\n\n" . $date->format ( 'Y-m-d H:M:S' ) ); fwrite ( $f, "\n" . $type . ': ' . $text ); fclose ( $f ); } } /** * Formatts the payment data for storing * * @param array $data * @return string */ private function _getFormattedTransactionDetails ( $data ) { return json_encode ( $data ); } /** * Sends error messages to site administrators * * @param string $message * @param string $paymentData * @return boolean * @access protected */ function _sendErrorEmails ( $message, $paymentData ) { $mainframe = JFactory::getApplication (); // grab config settings for sender name and email $config = JComponentHelper::getParams ( 'com_j2store' ); $mailfrom = $config->get ( 'emails_defaultemail', $mainframe->getCfg ( 'mailfrom' ) ); $fromname = $config->get ( 'emails_defaultname', $mainframe->getCfg ( 'fromname' ) ); $sitename = $config->get ( 'sitename', $mainframe->getCfg ( 'sitename' ) ); $siteurl = $config->get ( 'siteurl', JURI::root () ); $recipients = $this->_getAdmins (); $mailer = JFactory::getMailer (); $subject = JText::sprintf ( 'J2STORE_PAYNL_EMAIL_PAYMENT_NOT_VALIDATED_SUBJECT', $sitename ); foreach ( $recipients as $recipient ) { $mailer = JFactory::getMailer (); $mailer->addRecipient ( $recipient->email ); $mailer->setSubject ( $subject ); $mailer->setBody ( JText::sprintf ( 'J2STORE_PAYNL_EMAIL_PAYMENT_FAILED_BODY', $recipient->name, $sitename, $siteurl, $message, $paymentData ) ); $mailer->setSender ( array( $mailfrom, $fromname ) ); $sent = $mailer->send (); } return true; } /** * Gets admins data * * @return array|boolean * @access protected */ function _getAdmins () { $db = JFactory::getDBO (); $query = $db->getQuery ( true ); $query->select ( 'u.name,u.email' ); $query->from ( '#__users AS u' ); $query->join ( 'LEFT', '#__user_usergroup_map AS ug ON u.id=ug.user_id' ); $query->where ( 'u.sendEmail = 1' ); $query->where ( 'ug.group_id = 8' ); $db->setQuery ( $query ); $admins = $db->loadObjectList (); if ( $error = $db->getErrorMsg () ) { JError::raiseError ( 500, $error ); return false; } return $admins; } function getCurrency ( $order ) { $results = array(); $convert = false; $params = JComponentHelper::getParams ( 'com_j2store' ); if ( version_compare ( $this->_j2version, '2.6.7', 'lt' ) ) { $currency_code = $params->get ( 'currency_code', 'USD' ); $currency_value = 1; } else { include_once ( JPATH_ADMINISTRATOR . '/components/com_j2store/library/base.php' ); $currencyObject = J2StoreFactory::getCurrencyObject (); $currency_code = $order->currency_code; $currency_value = $order->currency_value; //accepted currencies $currencies = $this->getAcceptedCurrencies (); if ( !in_array ( $order->currency_code, $currencies ) ) { $default_currency = 'EUR'; if ( $currencyObject->has ( $default_currency ) ) { $currencyObject->set ( $default_currency ); $currency_code = $default_currency; $currency_value = $currencyObject->getValue ( $default_currency ); $convert = true; } } } $results[ 'currency_code' ] = $currency_code; $results[ 'currency_value' ] = $currency_value; $results[ 'convert' ] = $convert; return $results; } function getAmount ( $value, $currency_code, $currency_value, $convert = false ) { if ( version_compare ( $this->_j2version, '2.6.7', 'lt' ) ) { return J2StoreUtilities::number ( $value, array( 'thousands' => '', 'num_decimals' => '2', 'decimal' => '.' ) ); } else { include_once ( JPATH_ADMINISTRATOR . '/components/com_j2store/library/base.php' ); $currencyObject = J2StoreFactory::getCurrencyObject (); $amount = $currencyObject->format ( $value, $currency_code, $currency_value, false ); return $amount; } } /** * get Accepted currency * */ function getAcceptedCurrencies () { return $currencies = array( 'EUR' ); } /** * get J2Store version * @return string */ function getVersion () { if ( is_null ( $this->_j2version ) ) { $xmlfile = JPATH_ADMINISTRATOR . '/components/com_j2store/manifest.xml'; $xml = JFactory::getXML ( $xmlfile ); $this->_j2version = (string)$xml->version; } return $this->_j2version; } function getCountryById($country_id) { $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('*')->from('#__j2store_countries')->where('country_id='.$db->q($country_id)); $db->setQuery($query); return $db->loadObject(); } } //end of class