AAAA.htaccess000066600000000177151374473770006375 0ustar00 Order allow,deny Deny from all paypal_pro.php000066600000024252151374473770007456 0ustar00 'payments', 'title' => 'Payment Gateways'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Paypal Pro', 'tooltip' => 'Communicate with the Paypal payment gateway.'); //some variables for the paypal functions usage var $_DEBUGGING; var $_TESTING; var $_API_UserName; var $_API_Password; var $_API_Signature; var $_API_Endpoint; var $_USE_PROXY; var $_PROXY_HOST; var $_PROXY_PORT; var $_version; function run($form, $actiondata){ $params = new JParameter($actiondata->params); $this->_DEBUGGING = $params->get('debugging', 0); # Display additional information to track down problems $this->_TESTING = $params->get('testing', 0); # Set the testing flag so that transactions are not live $this->_API_UserName = $params->get('API_USERNAME'); $this->_API_Password = $params->get('API_PASSWORD'); $this->_API_Signature = $params->get('API_SIGNATURE'); //$API_ENDPOINT = $params->get('API_ENDPOINT'); if((int)$params->get('testing', 0) == 1){ $this->_API_Endpoint = 'https://api-3t.sandbox.paypal.com/nvp'; }else{ $this->_API_Endpoint = 'https://api-3t.paypal.com/nvp'; } if((int)$params->get('USE_PROXY') == 1){ $this->_USE_PROXY = TRUE; }else{ $this->_USE_PROXY = FALSE; } $this->_PROXY_HOST = $params->get('PROXY_HOST', ''); $this->_PROXY_PORT = $params->get('PROXY_PORT', ''); //$PAYPAL_URL = $params->get('PAYPAL_URL; $this->_version = '56.0'; $paypal_values = array( "PAYMENTACTION" => urlencode($params->get('PAYMENTACTION') ), "EXPDATE" => str_pad(urlencode($form->data[$params->get('EXPDATE_m')]), 2, '0', STR_PAD_LEFT).urlencode($form->data[$params->get('EXPDATE_y')]), "AMT" => urlencode($form->data[$params->get('AMT')]), "CREDITCARDTYPE" => urlencode($form->data[$params->get('CREDITCARDTYPE')]), "ACCT" => urlencode($form->data[$params->get('ACCT')]), "CVV2" => urlencode($form->data[$params->get('CVV2')]), "FIRSTNAME" => urlencode($form->data[$params->get('FIRSTNAME')]), "LASTNAME" => urlencode($form->data[$params->get('LASTNAME')]), "STREET" => urlencode($form->data[$params->get('STREET')]), "CITY" => urlencode($form->data[$params->get('CITY')]), "STATE" => urlencode($form->data[$params->get('STATE')]), "ZIP" => urlencode($form->data[$params->get('ZIP')]), "COUNTRYCODE" => urlencode($form->data[$params->get('COUNTRYCODE')]), "CURRENCYCODE" => urlencode($form->data[$params->get('CURRENCYCODE')]) ); if(trim($actiondata->content1)){ $extras = explode("\n", trim($actiondata->content1)); if(!empty($extras)){ foreach($extras as $extra){ $values = array(); $values = explode("=", $extra); $paypal_values[$values[0]] = $values[0].": ".urlencode($form->data[trim($values[1])]); } } } $paypal_values["AMT"] = rand(1,4)* (int)$form->data($params->get("AMT"), ''); $fields = ""; foreach($paypal_values as $key => $value ){ $fields .= "&$key=" .$value; } if((int)$params->get('testing', 0)){ $PAYPAL_URL = 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token='; }else{ $PAYPAL_URL = 'https://www.paypal.com/webscr&cmd=_express-checkout&token='; } /* Construct the request string that will be sent to PayPal. The variable $nvpstr contains all the variables and is a name value pair string with & as a delimiter */ $nvpstr = $fields; if($params->get('debugging', 0) == 1){ echo $nvpstr; } /* Make the API call to PayPal, using API signature. The API response is stored in an associative array called $resArray */ $resArray = $this->hash_call("doDirectPayment", $nvpstr); $form->data['_PLUGINS_']['paypal_pro']['transaction_id'] = $resArray['TRANSACTIONID']; $form->data['_PLUGINS_']['paypal_pro']['error_message'] = $resArray['L_LONGMESSAGE0']; $form->data['_PLUGINS_']['paypal_pro']['error_code'] = $resArray['L_ERRORCODE0']; $form->data['_PLUGINS_']['paypal_pro']['correlation_id'] = $resArray['CORRELATIONID']; $form->data['_PLUGINS_']['paypal_pro']['avs_code'] = $resArray['AVSCODE']; /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($resArray["ACK"]); $form->data['_PLUGINS_']['paypal_pro']['payment_status'] = $ack; //set the events if($ack != "SUCCESS"){ $this->events['fail'] = 1; }else{ $this->events['success'] = 1; } //do the debug if((int)$params->get('debugging', 0) == 1){ if($ack!="SUCCESS"){ $_SESSION['reshash'] = $resArray; $this->APIERROR($resArray); }else{ $_SESSION['reshash'] = $resArray; $this->APISUCCESS($resArray); } } } function hash_call($methodName,$nvpStr){ //setting the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->_API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled. //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php if($this->_USE_PROXY) curl_setopt ($ch, CURLOPT_PROXY, $this->_PROXY_HOST.":".$this->_PROXY_PORT); //NVPRequest for submitting to server $nvpreq="METHOD=".urlencode($methodName)."&VERSION=".urlencode($this->_version)."&PWD=".urlencode($this->_API_Password)."&USER=".urlencode($this->_API_UserName)."&SIGNATURE=".urlencode($this->_API_Signature).$nvpStr; //setting the nvpreq as POST FIELD to curl curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq); //getting response from server $response = curl_exec($ch); //convrting NVPResponse to an Associative Array $nvpResArray=$this->deformatNVP($response); $nvpReqArray=$this->deformatNVP($nvpreq); $_SESSION['nvpReqArray']=$nvpReqArray; if(curl_errno($ch)){ // moving to display page to display curl errors $_SESSION['curl_error_no']=curl_errno($ch) ; $_SESSION['curl_error_msg']=curl_error($ch); //$this->APIERROR($resArray); } else { //closing the curl curl_close($ch); } return $nvpResArray; } /** This function will take NVPString and convert it to an Associative Array and it will decode the response. * It is usefull to search for a particular key and displaying arrays. * @nvpstr is NVPString. * @nvpArray is Associative Array. */ function deformatNVP($nvpstr){ $intial = 0; $nvpArray = array(); while(strlen($nvpstr)){ //postion of Key $keypos = strpos($nvpstr,'='); //position of value $valuepos = strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr); /*getting the Key and Value values and storing in a Associative Array*/ $keyval=substr($nvpstr,$intial,$keypos); $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1); //decoding the respose $nvpArray[urldecode($keyval)] =urldecode( $valval); $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr)); } return $nvpArray; } function APIERROR($resArray){ ?>
The PayPal API has returned an error!
Error Number:
Error Message:
Ack: Correlation ID: Version: Error Number: Short Message: Long Message:
Transaction ID:
Amount:
AVS:
CVV2:
'', 'PAYMENTACTION' => 'Sale', 'CREDITCARDTYPE' => '', 'ACCT' => '', 'EXPDATE_m' => '', 'EXPDATE_y' => '', 'CVV2' => '', 'FIRSTNAME' => '', 'LASTNAME' => '', 'STREET' => '', 'CITY' => '', 'STATE' => '', 'ZIP' => '', 'COUNTRYCODE' => '', 'CURRENCYCODE' => '', 'API_USERNAME' => '', 'API_PASSWORD' => '', 'API_SIGNATURE' => '', 'USE_PROXY' => 0, 'PROXY_HOST' => '', 'PROXY_PORT' => '', 'testing' => 0, 'debugging' => 0, 'content1' => '' ); } return array('action_params' => $action_params); } } ?>index.html000066600000000035151374473770006565 0ustar00 paypal_pro.ctp000066600000024402151374473770007452 0ustar00
Paypal Pro - Trial
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'paypal_pro_config_{n}'); ?> tabStart('fields'); ?> input('action_paypal_pro_{n}_PAYMENTACTION_config', array('type' => 'hidden')); ?> input('action_paypal_pro_{n}_AMT_config', array('type' => 'text', 'label' => "Amount Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_CREDITCARDTYPE_config', array('type' => 'text', 'label' => "Credit Card type Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_ACCT_config', array('type' => 'text', 'label' => "Credit Card Number Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_EXPDATE_m_config', array('type' => 'text', 'label' => "Credit Card Expiry month field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_EXPDATE_y_config', array('type' => 'text', 'label' => "Credit Card Expiry year field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_CVV2_config', array('type' => 'text', 'label' => "CVV2 field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_FIRSTNAME_config', array('type' => 'text', 'label' => "First Name Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_LASTNAME_config', array('type' => 'text', 'label' => "Last Name Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_STREET_config', array('type' => 'text', 'label' => "Street Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_CITY_config', array('type' => 'text', 'label' => "City Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_STATE_config', array('type' => 'text', 'label' => "State Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_ZIP_config', array('type' => 'text', 'label' => "Zip Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_COUNTRYCODE_config', array('type' => 'text', 'label' => "Country Code Field", 'class' => 'medium_input', 'smalldesc' => "2 Characters value, e.g: US, CA, UK..etc")); ?> input('action_paypal_pro_{n}_CURRENCYCODE_config', array('type' => 'text', 'label' => "Currency Code Field", 'class' => 'medium_input', 'smalldesc' => 'e.g: USD, GBP, EUR..etc')); ?> input('action_paypal_pro_{n}_content1_config', array('type' => 'textarea', 'label' => 'Extra fields', 'rows' => 5, 'cols' => 50)); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_paypal_pro_{n}_API_USERNAME_config', array('type' => 'text', 'label' => "API Username", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_API_PASSWORD_config', array('type' => 'text', 'label' => "API Password", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_API_SIGNATURE_config', array('type' => 'text', 'label' => "API Signature", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_USE_PROXY_config', array('type' => 'select', 'label' => 'Use Proxy ?', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_paypal_pro_{n}_PROXY_HOST_config', array('type' => 'text', 'label' => "Proxy host IP", 'class' => 'small_input', 'value' => '')); ?> input('action_paypal_pro_{n}_PROXY_PORT_config', array('type' => 'text', 'label' => "Proxy Port", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_debugging_config', array('type' => 'select', 'label' => 'Debugging', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_paypal_pro_{n}_testing_config', array('type' => 'select', 'label' => 'Testing', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>