Jump to content
Sign in to follow this  
Nathali

Modify Netpay payment processor. please help?

Recommended Posts

Hi,

 

I need to modify Netpay payment processor contribution and to change a little the code that I will be able to use it.

 

I tried to get some help to solve it without success :'(

 

I hope someone will be kind to help me to do that please..

 

Please, Here is the link to Netpay processor system with the information how to connect Netpay to oscommerce.

 

Thanks in advance for any help I get please...!!

 

http://www.intercash.net/site_eng/main.asp

 

Then in the "TO DEVELOPER CENTER" box press "go"

 

Email: demo12@demo.com

User name: demo12

Password: 123456

 

then press category: SILENT POST TRANSACTIONS

subcategory: CREDIT CARD

 

Here are the 3 files I installed:

netpay.php

order.php

result.php

 

in root/includes/modules/payment/netpay.php

 

netpay.php

==================================

<?php

 

class netpay {

 

var $code, $title, $description, $enabled;

 

// class constructor

function netpay() {

global $order;

 

$this->code = 'netpay';

$this->title = MODULE_PAYMENT_NETPAY_TEXT_TITLE;

$this->description = MODULE_PAYMENT_NETPAY_TEXT_DESCRIPTION;

$this->enabled = ((MODULE_PAYMENT_NETPAY_STATUS == 'True') ? true : false);

$this->sort_order = MODULE_PAYMENT_NETPAY_SORT_ORDER;

 

if ((int)MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID;

}

 

if (is_object($order)) $this->update_status();

 

$this->form_action_url = 'https://www.intercash.net/member/remote_charge.asp';

}

 

// class methods

function update_status() {

global $order;

 

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NETPAY_ZONE > 0) ) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NETPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

 

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->billing['zone_id']) {

$check_flag = true;

break;

}

}

 

if ($check_flag == false) {

$this->enabled = false;

}

}

}

 

function javascript_validation() {

$js =

' if (payment_value == "' . $this->code . '") {' . "\n" .

' var cc_owner = document.checkout_payment.netpay_cc_owner.value;' . "\n" .

' var cc_ccv = document.checkout_payment.netpay_ccv_number.value;' . "\n" .

' var cc_number = document.checkout_payment.netpay_cc_number.value;' . "\n" .

' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_NETPAY_TEXT_JS_CC_OWNER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_NETPAY_TEXT_JS_CC_NUMBER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' if (cc_ccv == "" || cc_ccv.length < ' . CC_CVV_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_NETPAY_TEXT_CCV_NUMBER_LEN . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' }' . "\n";

 

return $js;

}

 

function selection() {

global $order;

 

for ($i=1; $i<13; $i++) {

$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));

}

 

$today = getdate();

for ($i=$today['year']; $i < $today['year']+10; $i++) {

$expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));

}

 

$selection = array('id' => $this->code,

'module' => $this->title,

'fields' => array(

array('title' => 'We Accept:','field' => '<b><font size=-1>Visa, Master Card and Amex</font></b>'),

array( 'title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_OWNER,

'field' => tep_draw_input_field('netpay_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_NUMBER,

'field' => tep_draw_input_field('netpay_cc_number')),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_EXPIRES,

'field' => tep_draw_pull_down_menu('netpay_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('netpay_cc_expires_year', $expires_year)),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CCV_NUMBER,

'field' => tep_draw_input_field('netpay_ccv_number'))));

 

return $selection;

}

 

function pre_confirmation_check() {

global $HTTP_POST_VARS;

 

include(DIR_WS_CLASSES . 'cc_validation.php');

 

$cc_validation = new cc_validation();

 

$result = $cc_validation->validate(

$HTTP_POST_VARS['netpay_cc_number'], $HTTP_POST_VARS['netpay_cc_expires_month'], $HTTP_POST_VARS['netpay_cc_expires_year']);

 

$result = true;

$error = '';

 

switch ($result) {

case -1:

$error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));

break;

case -2:

case -3:

case -4:

$error = TEXT_CCVAL_ERROR_INVALID_DATE;

break;

case false:

$error = TEXT_CCVAL_ERROR_INVALID_NUMBER;

break;

}

 

if ( ($result == false) || ($result < 1) ) {

$payment_error_return =

'payment_error=' . $this->code . '&error=' . urlencode($error) .

'&netpay_cc_owner=' .urlencode($HTTP_POST_VARS['netpay_cc_owner']) .

'&netpay_cc_expires_month=' . $HTTP_POST_VARS['netpay_cc_expires_month'] .

'&netpay_cc_expires_year=' . $HTTP_POST_VARS['netpay_cc_expires_year'];

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

 

$this->cc_card_type = $cc_validation->cc_type;

$this->cc_card_number = $cc_validation->cc_number;

$this->cc_expiry_month = $cc_validation->cc_expiry_month;

$this->cc_expiry_year = $cc_validation->cc_expiry_year;

$this->cc_ccv = $HTTP_POST_VARS['netpay_ccv_number'];

}

 

function confirmation() {

global $HTTP_POST_VARS;

 

$confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,

'fields' => array(array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_OWNER,

'field' => $HTTP_POST_VARS['netpay_cc_owner']),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_NUMBER,

'field' => substr($this->cc_card_number, 0, 4) .

str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_EXPIRES,

'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['netpay_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['netpay_cc_expires_year']))),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CCV_NUMBER,

'field' => $HTTP_POST_VARS['netpay_ccv_number'])));

 

return $confirmation;

}

 

function process_button () {

global $HTTP_SERVER_VARS, $order, $customer_id,$currencies, $_SESSION;

 

 

///////////////// RAMDOMIZING SCRIPRT BY PATRIC VEVERKA \\\\\\\\\\\\\\\\\\

/*$t1 = date("mdy");

srand ((float) microtime() * 10000000);

$input = array ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");

$rand_keys = array_rand ($input, 2);

$l1 = $input[$rand_keys[0]];

$l2 = $input[$rand_keys[1]];

$r1 = rand(0,9);

 

$new_ordernum = $l1.$l2.$t1.$r1;

 

$ordernum = $new_ordernum;*/

//error_log ("new order id: " . $_SESSION['new_ordernum'], 1, "gnitzan@usa.net");

///////////////// End of Randomizing Script \\\\\\\\\\\\\\\\\\\

 

// Build a list of products to put in the comment field

for ($i=0; $i<sizeof($order->products); $i++) {

if ($i==0) {

$products_list = $products_list. "" .$order->products[$i]['name'];

} else {

$products_list = $products_list. ", " .$order->products[$i]['name'];

}

}

 

 

$sequence = rand(1, 1000);

$process_button_string = tep_draw_hidden_field('CompanyNum', MODULE_PAYMENT_NETPAY_LOGIN) .

tep_draw_hidden_field('TypeCredit', '1') . // only credit type

tep_draw_hidden_field('Currency', '1') . // only us dollars

tep_draw_hidden_field('CVV2', $this->cc_ccv) . // CVV

tep_draw_hidden_field('PersonalNum', '000000000') . // israeli id

tep_draw_hidden_field('CardNum', $this->cc_card_number) .

tep_draw_hidden_field('ExpMonth', $this->cc_expiry_month) .

tep_draw_hidden_field('ExpYear', substr($this->cc_expiry_year, -2)) .

tep_draw_hidden_field('Amount', number_format($order->info['total'], 2)) .

tep_draw_hidden_field('UserName', $customer_id) .

tep_draw_hidden_field('Member', $order->billing['firstname'] . ' ' .

$order->billing['lastname']) .

tep_draw_hidden_field('PhoneNumber', $order->customer['telephone']) .

tep_draw_hidden_field('Payments', '1') .

tep_draw_hidden_field('Order', $ordernum) .

tep_draw_hidden_field('Email', $order->customer['email_address']) .

tep_draw_hidden_field('Comment', $products_list) .

tep_draw_hidden_field('ReplyURL', 'https://www.pcmemory.co.il/checkout_process.php'); //Your Site Here!

 

$process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id());

 

return $process_button_string;

}

 

function before_process() {

global $HTTP_GET_VARS;

 

//foreach ($HTTP_GET_VARS as $key => $value) {

// echo "Key: $key; Value: $value<br>\n";

//}

 

$reply_code = $HTTP_GET_VARS['Reply'];

$my_message = "----> If you get an error and you are sure there should not be a problem, please contact us (use the contact us button in the information box on the bottom left menu). Your order is always saved so we shall check and if the transaction is processed successfuly it shall go through manualy and you shall be notified.";

 

if ( $reply_code != '000') {

if ($reply_code == '500') {

$reply_str = 'Your are not allowed to make on-line purchase';

} else if ($reply_code == '501') {

$reply_str = 'We are unable to connect to the credit card processing service';

} else if ($reply_code == '502') {

$reply_str = 'Security Code - CVV is missing';

} else if ($reply_code == '522') {

$reply_str = 'You have already made the same transaction less than 5 minutes ago';

} else if ($reply_code == '143') {

$reply_str = 'The card number you have entered is not a valid card number. Try again or use another card. (Please note, we accept only Visa, MC, AMEX).';

} else if ($reply_code == '036') {

$reply_str = 'The card has expired. Have you entered the correct Expiration Date? Try again or use another card.';

} else if ($reply_code == '033') {

$reply_str = 'The card number is bad. Have you copied your card number correctly? Try again or use another card.';

} else if ($reply_code == '039') {

$reply_str = 'The card number is bad. Have you copied your card number correctly? Try again or use another card.';

} else if ($reply_code == '003') {

$reply_str = 'Please call your credit card company.';

} else if ($reply_code == '004') {

$reply_str = 'Your credit card was declined, please use another card.';

} else {

$reply_str = 'An unknown error has occured while trying to process your card. Try again or use another card.';

}

$reply_str .= $my_message;

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE . ' code='.$reply_code.' '.$reply_str), 'SSL', true, false));

}

}

 

function after_process() {

return false;

}

 

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_PAYMENT_NETPAY_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

 

return $error;

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NETPAY_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Netpay Module', 'MODULE_PAYMENT_NETPAY_STATUS', 'True', 'Do you want to accept Netpay payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Username', 'MODULE_PAYMENT_NETPAY_LOGIN', 'testing', 'The account id used for the Netpay service', '6', '0', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_NETPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_NETPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

}

 

function keys() {

return array('MODULE_PAYMENT_NETPAY_STATUS', 'MODULE_PAYMENT_NETPAY_LOGIN', 'MODULE_PAYMENT_NETPAY_ZONE', 'MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_NETPAY_SORT_ORDER');

}

}

?>

 

=============================================

 

In root/order.php

 

order.php

=========================

 

<?php

session_start();

 

if ($flag==1){

$TypeCredit=1;

if ($Payments=="0" || $Payments==""){

$Payments=1;

}

if ($Payments>1){$TypeCredit=8;}

 

$PersonalNum=stripslashes($PersonalNum);

$PhoneNumber=stripslashes($PhoneNumber);

$Member=stripslashes($Member);

$CardNum=stripslashes($CardNum);

$ExpMonth=stripslashes($ExpMonth);

$ExpYear=stripslashes($ExpYear);

$Payments=stripslashes($Payments);

 

$PersonalNum= htmlspecialchars($PersonalNum, ENT_QUOTES);

$PhoneNumber= htmlspecialchars($PhoneNumber, ENT_QUOTES);

$Member= htmlspecialchars($Member, ENT_QUOTES);

$CardNum= htmlspecialchars($CardNum, ENT_QUOTES);

$ExpMonth= htmlspecialchars($ExpMonth, ENT_QUOTES);

$ExpYear= htmlspecialchars($ExpYear, ENT_QUOTES);

$Payments= htmlspecialchars($Payments, ENT_QUOTES);

 

 

$cashlink="https://www.intercash.net/member/remote_charge.asp?CompanyNum=1415119"; //Enter your Netpay account number here

$cashlink.="&ReplyURL=http://www.pcmemory.co.il/result.php&Order=".$sessionid; //ADD YOUR SITE

$cashlink.="&TransType=0";

$cashlink.="&CardNum=".$CardNum;

$cashlink.="&ExpMonth=".$ExpMonth;

$cashlink.="&ExpYear=".$ExpYear;

$cashlink.="&TypeCredit=".$TypeCredit;

$cashlink.="&Payments=".$Payments;

$cashlink.="&Amount=".$Amount;

$cashlink.="&Currency=0";

$cashlink.="&CVV2=000";

$cashlink.="&PersonalNum=".$PersonalNum;

$cashlink.="&PhoneNumber=".$PhoneNumber;

$cashlink.="&Member=".$Member;

$cashlink.="&UserName=".$username;

$cashlink.="&Comment=".$comment;

header ("Location: $cashlink");

}

if ($flag!=1){

 

session_register('sessionid');

 

$ses=session_id();

$sessionid = "$REMOTE_ADDR$ses";

$sessionid = str_replace(".", "", "$sessionid");

 

 

?>

 

<html>

<head>

<title> </title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">

</head>

<script LANGUAGE="JavaScript">

function sendfb(){

fb.submit();

divStep1.style.display="None";

divStep2.style.display ="Block";

}

</script>

<body>

 

<!--****************************************************************************-->

<table width="535" border="0" cellpadding="0" cellspacing="0">

<form name="fb" id="fb" method="POST" action="order.php">

 

<tr>

<td style="padding-right:23" width="35%" > : <br>

<input name="Member" type="text">

</td>

 

</tr>

<tr>

<td style="padding-right:23">.. : <br>

<input name="PersonalNum" dir=ltr type="text" maxLength=9>

</td>

 

</tr>

<tr>

<td style="padding-right:23"> : <br>

<input name="PhoneNumber" dir=ltr type="text" maxLength=10 >

</td>

 

</tr>

<tr>

<td style="padding-right:23"> : <br>

<input name="CardNum" type="text" >

</td>

 

</tr>

<tr>

<td style="padding-right:23"> : <br>

 

<SELECT name="ExpYear">

<OPTION></OPTION>

<OPTION value="2004">2004</OPTION>

<OPTION value="2005">2005</OPTION>

<OPTION value="2006">2006</OPTION>

<OPTION value="2007">2007</OPTION>

<OPTION value="2008">2008</OPTION>

<OPTION value="2009">2009</OPTION>

<OPTION value="2010">2010</OPTION>

</SELECT>

<SELECT name="ExpMonth">

<OPTION></OPTION>

<OPTION value="01">01</OPTION>

<OPTION value="02">02</OPTION>

<OPTION value="03">03</OPTION>

<OPTION value="04">04</OPTION>

<OPTION value="05">05</OPTION>

<OPTION value="06">06</OPTION>

<OPTION value="07">07</OPTION>

<OPTION value="08">08</OPTION>

<OPTION value="09">09</OPTION>

<OPTION value="10">10</OPTION>

<OPTION value="11">11</OPTION>

<OPTION value="12">12</OPTION>

</SELECT>

 

<tr>

<td style="padding-right:23"> : <br>

<SELECT name="Payments">

<OPTION value="1">1</OPTION>

<OPTION value="2">2</OPTION>

<OPTION value="3">3</OPTION>

<OPTION value="4">4</OPTION>

<OPTION value="5">5</OPTION>

<OPTION value="6">6</OPTION>

<OPTION value="7">7</OPTION>

<OPTION value="8">8</OPTION>

<OPTION value="9">9</OPTION>

<OPTION value="10">10</OPTION>

<OPTION value="11">11</OPTION>

<OPTION value="12">12</OPTION>

</SELECT>

 

 

</tr>

<tr>

<td colspan="2" style="padding-top:20; padding-right:23;padding-bottom:17">

<div id="divStep1" name="divStep1" style="display:block">

<input type="submit" value="Submit" onclick=sendfb(); >

</div>

<div id="divStep2" name="divStep2" style="display:none">

<font color='#FF0000'> , .....</font>

</div>

</td>

</tr>

<input type="hidden" name="flag" value="1">

<input type="hidden" name="Amount" value="0.00">

<input type="hidden" name="username" value="UserName">

<input type="hidden" name="comment" value="Comments">

 

</form>

</table>

 

<!--****************************************************************************-->

 

</body>

</html>

<?php

}

?>

 

========================================

 

In root/result.php

 

result.php

========================================

<?php

session_start();

 

$s=session_id();

$s="$REMOTE_ADDR$s";

$s=str_replace(".", "", "$s");

if ($Order!=$s){

session_destroy();

header ("Location: http://www.pcmemory.co.il/order.php"); //Add your site!

}else{

 

 

if ($Reply=="000"){

$text_result="äçéåá òáø áäöìçä";

}

 

if ($Reply!="000"){

$text_result="äçéåá ìà òáø áäöìçä";

}

 

?>

 

<html>

<head>

<title>Your Shop</title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">

</head>

 

<body>

 

<table width="535" border="0" cellpadding="0" cellspacing="0">

 

<tr>

<td style="padding-right:23" width="100%" ><?php print ($text_result); ?><br>

 

</td>

</tr>

<?php

if ($Reply=="000"){

?>

<tr>

<td style="padding-right:23" width="100%" >îñôø äçéåá ëôé ùðøùí áîòøëú ðèôéé<br>

<input type="text" value="<?php print ($TransID); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >äúàøéê åäùòä ùáå ðøùí äçéåá áîòøëú ðèôéé<br>

<input type="text" value="<?php print ($Date); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >îñôø äçéåá/äæîðä ëôé ùñåô÷ òì éãëí<br>

<input type="text" value="<?php print ($Order); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >ñëåí äçéåá<br>

<input type="text" value="<?php print ($Amount); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >îñôø äúùìåîéí<br>

<input type="text" value="<?php print ($Payments); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >ñåâ äîèáò<br>

<input type="text" value="<?php print ($Currency); ?>">

</td>

</tr>

<?php

}

?>

 

</table>

 

<!--****************************************************************************-->

 

</body>

</html>

<?php

}

?>

 

=========================================================

 

 

Thanks a lot for your kind attention.

 

Best Regards,

Nathali


Best Regards,

Nathali

Share this post


Link to post
Share on other sites
Hi,

 

I need to modify Netpay payment processor contribution and to change a little the code that I will be able to use it.

 

I tried to get some help to solve it without success :'(

 

I hope someone will be kind to help me to do that please..

 

Please, Here is the link to Netpay processor system with the information how to connect Netpay to oscommerce.

 

Thanks in advance for any help I get please...!!

 

http://www.intercash.net/site_eng/main.asp

 

Then in the "TO DEVELOPER CENTER" box press "go"

 

Email: demo12@demo.com

User name: demo12

Password: 123456

 

then press category: SILENT POST TRANSACTIONS

subcategory: CREDIT CARD

 

Here are the 3 files I installed:

netpay.php

order.php

result.php

 

in root/includes/modules/payment/netpay.php

 

netpay.php

==================================

<?php

 

class netpay {

 

var $code, $title, $description, $enabled;

 

// class constructor

function netpay() {

global $order;

 

$this->code = 'netpay';

$this->title = MODULE_PAYMENT_NETPAY_TEXT_TITLE;

$this->description = MODULE_PAYMENT_NETPAY_TEXT_DESCRIPTION;

$this->enabled = ((MODULE_PAYMENT_NETPAY_STATUS == 'True') ? true : false);

$this->sort_order = MODULE_PAYMENT_NETPAY_SORT_ORDER;

 

if ((int)MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID;

}

 

if (is_object($order)) $this->update_status();

 

$this->form_action_url = 'https://www.intercash.net/member/remote_charge.asp';

}

 

// class methods

function update_status() {

global $order;

 

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_NETPAY_ZONE > 0) ) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_NETPAY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

 

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->billing['zone_id']) {

$check_flag = true;

break;

}

}

 

if ($check_flag == false) {

$this->enabled = false;

}

}

}

 

function javascript_validation() {

$js =

' if (payment_value == "' . $this->code . '") {' . "\n" .

' var cc_owner = document.checkout_payment.netpay_cc_owner.value;' . "\n" .

' var cc_ccv = document.checkout_payment.netpay_ccv_number.value;' . "\n" .

' var cc_number = document.checkout_payment.netpay_cc_number.value;' . "\n" .

' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_NETPAY_TEXT_JS_CC_OWNER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_NETPAY_TEXT_JS_CC_NUMBER . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' if (cc_ccv == "" || cc_ccv.length < ' . CC_CVV_MIN_LENGTH . ') {' . "\n" .

' error_message = error_message + "' . MODULE_PAYMENT_NETPAY_TEXT_CCV_NUMBER_LEN . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n" .

' }' . "\n";

 

return $js;

}

 

function selection() {

global $order;

 

for ($i=1; $i<13; $i++) {

$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));

}

 

$today = getdate();

for ($i=$today['year']; $i < $today['year']+10; $i++) {

$expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));

}

 

$selection = array('id' => $this->code,

'module' => $this->title,

'fields' => array(

array('title' => 'We Accept:','field' => '<b><font size=-1>Visa, Master Card and Amex</font></b>'),

array( 'title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_OWNER,

'field' => tep_draw_input_field('netpay_cc_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_NUMBER,

'field' => tep_draw_input_field('netpay_cc_number')),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_EXPIRES,

'field' => tep_draw_pull_down_menu('netpay_cc_expires_month', $expires_month) . ' ' . tep_draw_pull_down_menu('netpay_cc_expires_year', $expires_year)),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CCV_NUMBER,

'field' => tep_draw_input_field('netpay_ccv_number'))));

 

return $selection;

}

 

function pre_confirmation_check() {

global $HTTP_POST_VARS;

 

include(DIR_WS_CLASSES . 'cc_validation.php');

 

$cc_validation = new cc_validation();

 

$result = $cc_validation->validate(

$HTTP_POST_VARS['netpay_cc_number'], $HTTP_POST_VARS['netpay_cc_expires_month'], $HTTP_POST_VARS['netpay_cc_expires_year']);

 

$result = true;

$error = '';

 

switch ($result) {

case -1:

$error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));

break;

case -2:

case -3:

case -4:

$error = TEXT_CCVAL_ERROR_INVALID_DATE;

break;

case false:

$error = TEXT_CCVAL_ERROR_INVALID_NUMBER;

break;

}

 

if ( ($result == false) || ($result < 1) ) {

$payment_error_return =

'payment_error=' . $this->code . '&error=' . urlencode($error) .

'&netpay_cc_owner=' .urlencode($HTTP_POST_VARS['netpay_cc_owner']) .

'&netpay_cc_expires_month=' . $HTTP_POST_VARS['netpay_cc_expires_month'] .

'&netpay_cc_expires_year=' . $HTTP_POST_VARS['netpay_cc_expires_year'];

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

 

$this->cc_card_type = $cc_validation->cc_type;

$this->cc_card_number = $cc_validation->cc_number;

$this->cc_expiry_month = $cc_validation->cc_expiry_month;

$this->cc_expiry_year = $cc_validation->cc_expiry_year;

$this->cc_ccv = $HTTP_POST_VARS['netpay_ccv_number'];

}

 

function confirmation() {

global $HTTP_POST_VARS;

 

$confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,

'fields' => array(array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_OWNER,

'field' => $HTTP_POST_VARS['netpay_cc_owner']),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_NUMBER,

'field' => substr($this->cc_card_number, 0, 4) .

str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CREDIT_CARD_EXPIRES,

'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['netpay_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['netpay_cc_expires_year']))),

array('title' => MODULE_PAYMENT_NETPAY_TEXT_CCV_NUMBER,

'field' => $HTTP_POST_VARS['netpay_ccv_number'])));

 

return $confirmation;

}

 

function process_button () {

global $HTTP_SERVER_VARS, $order, $customer_id,$currencies, $_SESSION;

///////////////// RAMDOMIZING SCRIPRT BY PATRIC VEVERKA \\\\\\\\\\\\\\\\\\

/*$t1 = date("mdy");

srand ((float) microtime() * 10000000);

$input = array ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");

$rand_keys = array_rand ($input, 2);

$l1 = $input[$rand_keys[0]];

$l2 = $input[$rand_keys[1]];

$r1 = rand(0,9);

 

$new_ordernum = $l1.$l2.$t1.$r1;

 

$ordernum = $new_ordernum;*/

//error_log ("new order id: " . $_SESSION['new_ordernum'], 1, "gnitzan@usa.net");

///////////////// End of Randomizing Script \\\\\\\\\\\\\\\\\\\

 

// Build a list of products to put in the comment field

for ($i=0; $i<sizeof($order->products); $i++) {

if ($i==0) {

$products_list = $products_list. "" .$order->products[$i]['name'];

} else {

$products_list = $products_list. ", " .$order->products[$i]['name'];

}

}

$sequence = rand(1, 1000);

$process_button_string = tep_draw_hidden_field('CompanyNum', MODULE_PAYMENT_NETPAY_LOGIN) .

tep_draw_hidden_field('TypeCredit', '1') . // only credit type

tep_draw_hidden_field('Currency', '1') . // only us dollars

tep_draw_hidden_field('CVV2', $this->cc_ccv) . // CVV

tep_draw_hidden_field('PersonalNum', '000000000') . // israeli id

tep_draw_hidden_field('CardNum', $this->cc_card_number) .

tep_draw_hidden_field('ExpMonth', $this->cc_expiry_month) .

tep_draw_hidden_field('ExpYear', substr($this->cc_expiry_year, -2)) .

tep_draw_hidden_field('Amount', number_format($order->info['total'], 2)) .

tep_draw_hidden_field('UserName', $customer_id) .

tep_draw_hidden_field('Member', $order->billing['firstname'] . ' ' .

$order->billing['lastname']) .

tep_draw_hidden_field('PhoneNumber', $order->customer['telephone']) .

tep_draw_hidden_field('Payments', '1') .

tep_draw_hidden_field('Order', $ordernum) .

tep_draw_hidden_field('Email', $order->customer['email_address']) .

tep_draw_hidden_field('Comment', $products_list) .

tep_draw_hidden_field('ReplyURL', 'https://www.pcmemory.co.il/checkout_process.php'); //Your Site Here!

 

$process_button_string .= tep_draw_hidden_field(tep_session_name(), tep_session_id());

 

return $process_button_string;

}

 

function before_process() {

global $HTTP_GET_VARS;

 

//foreach ($HTTP_GET_VARS as $key => $value) {

// echo "Key: $key; Value: $value<br>\n";

//}

 

$reply_code = $HTTP_GET_VARS['Reply'];

$my_message = "----> If you get an error and you are sure there should not be a problem, please contact us (use the contact us button in the information box on the bottom left menu). Your order is always saved so we shall check and if the transaction is processed successfuly it shall go through manualy and you shall be notified.";

 

if ( $reply_code != '000') {

if ($reply_code == '500') {

$reply_str = 'Your are not allowed to make on-line purchase';

} else if ($reply_code == '501') {

$reply_str = 'We are unable to connect to the credit card processing service';

} else if ($reply_code == '502') {

$reply_str = 'Security Code - CVV is missing';

} else if ($reply_code == '522') {

$reply_str = 'You have already made the same transaction less than 5 minutes ago';

} else if ($reply_code == '143') {

$reply_str = 'The card number you have entered is not a valid card number. Try again or use another card. (Please note, we accept only Visa, MC, AMEX).';

} else if ($reply_code == '036') {

$reply_str = 'The card has expired. Have you entered the correct Expiration Date? Try again or use another card.';

} else if ($reply_code == '033') {

$reply_str = 'The card number is bad. Have you copied your card number correctly? Try again or use another card.';

} else if ($reply_code == '039') {

$reply_str = 'The card number is bad. Have you copied your card number correctly? Try again or use another card.';

} else if ($reply_code == '003') {

$reply_str = 'Please call your credit card company.';

} else if ($reply_code == '004') {

$reply_str = 'Your credit card was declined, please use another card.';

} else {

$reply_str = 'An unknown error has occured while trying to process your card. Try again or use another card.';

}

$reply_str .= $my_message;

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_NETPAY_TEXT_ERROR_MESSAGE . ' code='.$reply_code.' '.$reply_str), 'SSL', true, false));

}

}

 

function after_process() {

return false;

}

 

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_PAYMENT_NETPAY_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

 

return $error;

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NETPAY_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Netpay Module', 'MODULE_PAYMENT_NETPAY_STATUS', 'True', 'Do you want to accept Netpay payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login Username', 'MODULE_PAYMENT_NETPAY_LOGIN', 'testing', 'The account id used for the Netpay service', '6', '0', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_NETPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_NETPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

}

 

function keys() {

return array('MODULE_PAYMENT_NETPAY_STATUS', 'MODULE_PAYMENT_NETPAY_LOGIN', 'MODULE_PAYMENT_NETPAY_ZONE', 'MODULE_PAYMENT_NETPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_NETPAY_SORT_ORDER');

}

}

?>

 

=============================================

 

In root/order.php

 

order.php

=========================

 

<?php

session_start();

 

if ($flag==1){

$TypeCredit=1;

if ($Payments=="0" || $Payments==""){

$Payments=1;

}

if ($Payments>1){$TypeCredit=8;}

 

$PersonalNum=stripslashes($PersonalNum);

$PhoneNumber=stripslashes($PhoneNumber);

$Member=stripslashes($Member);

$CardNum=stripslashes($CardNum);

$ExpMonth=stripslashes($ExpMonth);

$ExpYear=stripslashes($ExpYear);

$Payments=stripslashes($Payments);

 

$PersonalNum= htmlspecialchars($PersonalNum, ENT_QUOTES);

$PhoneNumber= htmlspecialchars($PhoneNumber, ENT_QUOTES);

$Member= htmlspecialchars($Member, ENT_QUOTES);

$CardNum= htmlspecialchars($CardNum, ENT_QUOTES);

$ExpMonth= htmlspecialchars($ExpMonth, ENT_QUOTES);

$ExpYear= htmlspecialchars($ExpYear, ENT_QUOTES);

$Payments= htmlspecialchars($Payments, ENT_QUOTES);

$cashlink="https://www.intercash.net/member/remote_charge.asp?CompanyNum=1415119"; //Enter your Netpay account number here

$cashlink.="&ReplyURL=http://www.pcmemory.co.il/result.php&Order=".$sessionid; //ADD YOUR SITE

$cashlink.="&TransType=0";

$cashlink.="&CardNum=".$CardNum;

$cashlink.="&ExpMonth=".$ExpMonth;

$cashlink.="&ExpYear=".$ExpYear;

$cashlink.="&TypeCredit=".$TypeCredit;

$cashlink.="&Payments=".$Payments;

$cashlink.="&Amount=".$Amount;

$cashlink.="&Currency=0";

$cashlink.="&CVV2=000";

$cashlink.="&PersonalNum=".$PersonalNum;

$cashlink.="&PhoneNumber=".$PhoneNumber;

$cashlink.="&Member=".$Member;

$cashlink.="&UserName=".$username;

$cashlink.="&Comment=".$comment;

header ("Location: $cashlink");

}

if ($flag!=1){

 

session_register('sessionid');

 

$ses=session_id();

$sessionid = "$REMOTE_ADDR$ses";

$sessionid = str_replace(".", "", "$sessionid");

?>

 

<html>

<head>

<title> </title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">

</head>

<script LANGUAGE="JavaScript">

function sendfb(){

fb.submit();

divStep1.style.display="None";

divStep2.style.display ="Block";

}

</script>

<body>

 

<!--****************************************************************************-->

<table width="535" border="0" cellpadding="0" cellspacing="0">

<form name="fb" id="fb" method="POST" action="order.php">

 

<tr>

<td style="padding-right:23" width="35%" > : <br>

<input name="Member" type="text">

</td>

 

</tr>

<tr>

<td style="padding-right:23">.. : <br>

<input name="PersonalNum" dir=ltr type="text" maxLength=9>

</td>

 

</tr>

<tr>

<td style="padding-right:23"> : <br>

<input name="PhoneNumber" dir=ltr type="text" maxLength=10 >

</td>

 

</tr>

<tr>

<td style="padding-right:23"> : <br>

<input name="CardNum" type="text" >

</td>

 

</tr>

<tr>

<td style="padding-right:23"> : <br>

 

<SELECT name="ExpYear">

<OPTION></OPTION>

<OPTION value="2004">2004</OPTION>

<OPTION value="2005">2005</OPTION>

<OPTION value="2006">2006</OPTION>

<OPTION value="2007">2007</OPTION>

<OPTION value="2008">2008</OPTION>

<OPTION value="2009">2009</OPTION>

<OPTION value="2010">2010</OPTION>

</SELECT>

<SELECT name="ExpMonth">

<OPTION></OPTION>

<OPTION value="01">01</OPTION>

<OPTION value="02">02</OPTION>

<OPTION value="03">03</OPTION>

<OPTION value="04">04</OPTION>

<OPTION value="05">05</OPTION>

<OPTION value="06">06</OPTION>

<OPTION value="07">07</OPTION>

<OPTION value="08">08</OPTION>

<OPTION value="09">09</OPTION>

<OPTION value="10">10</OPTION>

<OPTION value="11">11</OPTION>

<OPTION value="12">12</OPTION>

</SELECT>

 

<tr>

<td style="padding-right:23"> : <br>

<SELECT name="Payments">

<OPTION value="1">1</OPTION>

<OPTION value="2">2</OPTION>

<OPTION value="3">3</OPTION>

<OPTION value="4">4</OPTION>

<OPTION value="5">5</OPTION>

<OPTION value="6">6</OPTION>

<OPTION value="7">7</OPTION>

<OPTION value="8">8</OPTION>

<OPTION value="9">9</OPTION>

<OPTION value="10">10</OPTION>

<OPTION value="11">11</OPTION>

<OPTION value="12">12</OPTION>

</SELECT>

</tr>

<tr>

<td colspan="2" style="padding-top:20; padding-right:23;padding-bottom:17">

<div id="divStep1" name="divStep1" style="display:block">

<input type="submit" value="Submit" onclick=sendfb(); >

</div>

<div id="divStep2" name="divStep2" style="display:none">

<font color='#FF0000'> , .....</font>

</div>

</td>

</tr>

<input type="hidden" name="flag" value="1">

<input type="hidden" name="Amount" value="0.00">

<input type="hidden" name="username" value="UserName">

<input type="hidden" name="comment" value="Comments">

 

</form>

</table>

 

<!--****************************************************************************-->

 

</body>

</html>

<?php

}

?>

 

========================================

 

In root/result.php

 

result.php

========================================

<?php

session_start();

 

$s=session_id();

$s="$REMOTE_ADDR$s";

$s=str_replace(".", "", "$s");

if ($Order!=$s){

session_destroy();

header ("Location: http://www.pcmemory.co.il/order.php"); //Add your site!

}else{

if ($Reply=="000"){

$text_result="äçéåá òáø áäöìçä";

}

 

if ($Reply!="000"){

$text_result="äçéåá ìà òáø áäöìçä";

}

 

?>

 

<html>

<head>

<title>Your Shop</title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">

</head>

 

<body>

 

<table width="535" border="0" cellpadding="0" cellspacing="0">

 

<tr>

<td style="padding-right:23" width="100%" ><?php print ($text_result); ?><br>

 

</td>

</tr>

<?php

if ($Reply=="000"){

?>

<tr>

<td style="padding-right:23" width="100%" >îñôø äçéåá ëôé ùðøùí áîòøëú ðèôéé<br>

<input type="text" value="<?php print ($TransID); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >äúàøéê åäùòä ùáå ðøùí äçéåá áîòøëú ðèôéé<br>

<input type="text" value="<?php print ($Date); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >îñôø äçéåá/äæîðä ëôé ùñåô÷ òì éãëí<br>

<input type="text" value="<?php print ($Order); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >ñëåí äçéåá<br>

<input type="text" value="<?php print ($Amount); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >îñôø äúùìåîéí<br>

<input type="text" value="<?php print ($Payments); ?>">

</td>

</tr>

<tr>

<td style="padding-right:23" width="100%" >ñåâ äîèáò<br>

<input type="text" value="<?php print ($Currency); ?>">

</td>

</tr>

<?php

}

?>

 

</table>

 

<!--****************************************************************************-->

 

</body>

</html>

<?php

}

?>

 

=========================================================

Thanks a lot for your kind attention.

 

Best Regards,

Nathali

 

Any help please??

I know that it's forbidden to offer money for someone to do it for me, according to the forum rules, so I'm not allowed to do that... :-(

 

My problem is very small..

 

I need to add:

1. Identification number of a person (ID) 9 digits to the credit card form.

2. And Number of Payments that the customer input on the credit card form. from 1-3 payments

 

Thats it !

 

So if someone could be kind to help I will be very very glad!

 

Thanks for your kind attention !

 

Great day,

Nathali


Best Regards,

Nathali

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×