=") || !is_callable('get_option')) { // This code absolutely does not work in anything less than PHP 5, therefore, if we are using less than that, we break out of the file here. // This is also here to stop error messages on servers with Zend Accelerator, it includes all files before get_option is declared // then evidently includes them again, otherwise this code would break these modules return; exit("Something strange is happening, and \"return\" is not breaking out of a file."); } $nzshpcrt_gateways[$num]['name'] = 'eWay'; $nzshpcrt_gateways[$num]['internalname'] = 'eway'; $nzshpcrt_gateways[$num]['function'] = 'gateway_eway'; $nzshpcrt_gateways[$num]['form'] = "form_eway"; $nzshpcrt_gateways[$num]['submit_function'] = "submit_eway"; $nzshpcrt_gateways[$num]['payment_type'] = "credit_card"; if(in_array('eway',(array)get_option('custom_gateway_options'))) { $gateway_checkout_form_fields[$nzshpcrt_gateways[$num]['internalname']] = "
'.print_r($wpsc_cart, true).''); foreach($wpsc_cart->cart_items as $item){ $itemsName .= $item->product_name.', '; //exit('
'.print_r($item,true).''); } // if($_POST['collected_data'][get_option('eway_form_city')] != '') { // $data['phone'] = urlencode($_POST['collected_data'][get_option('eway_form_phone')]); // } if($_POST['collected_data'][get_option('eway_form_city')] != '') { $data['city'] = urlencode($_POST['collected_data'][get_option('eway_form_city')]); } if($_POST['collected_data'][get_option('eway_form_state')] != '') { $data['country'] = $_POST['collected_data'][get_option('eway_form_country')][1]; } if($_POST['collected_data'][get_option('eway_form_country')]!='') { $data['country'] = $_POST['collected_data'][get_option('eway_form_country')][0]; } if(is_numeric($_POST['collected_data'][get_option('eway_form_post_code')])) { $data['zip'] = $_POST['collected_data'][get_option('eway_form_post_code')]; } if($_POST['collected_data'][get_option('eway_form_email')]) { $data['email'] = $_POST['collected_data'][get_option('eway_form_email')]; } if(($_POST['collected_data'][get_option('email_form_field')] != null) && ($data['email'] == null)) { $data['email'] = $_POST['collected_data'][get_option('email_form_field')]; } // Live or Test Server? if (get_option('eway_test')) { $user = '87654321'; $gateway = false; } else { $user = get_option('ewayCustomerID_id'); $gateway = true; } if ($is_member[0]) { require_once(WPSC_GOLD_FILE_PATH.'/ewaylib/GatewayConnector.php'); $objRebill = new RebillPayment(); $objRebill->CustomerRef($purchase_log['id']); $objRebill->CustomerTitle(''); $objRebill->CustomerFirstName($data['first_name']); $objRebill->CustomerLastName($data['last_name']); $objRebill->CustomerCompany(''); $objRebill->CustomerJobDesc(''); $objRebill->CustomerEmail($data['email']); $objRebill->CustomerAddress($data['address1']); $objRebill->CustomerSuburb(''); $objRebill->CustomerState($data['state']); $objRebill->CustomerPostCode($data['zip']); $objRebill->CustomerCountry($data['country']); $objRebill->CustomerPhone1($data['phone']); $objRebill->CustomerPhone2(''); $objRebill->CustomerFax(''); $objRebill->CustomerURL(''); $objRebill->CustomerComments(''); $objRebill->RebillInvRef(''); $objRebill->RebillInvDesc(''); $objRebill->RebillCCname($data['first_name']." ".$data['last_name']); $objRebill->RebillCCNumber($_POST['card_number']); $objRebill->RebillInitAmt($purchase_log['totalprice']); $objRebill->RebillInitDate(date('d/m/Y')); $objRebill->RebillRecurAmt($purchase_log['totalprice']); $objRebill->RebillStartDate(date('d/m/Y')); $objRebill->RebillEndDate(date("d/m/Y", mktime(0, 0, 0, date('m'), date('d'), (int)date('Y')+1))); $objRebill->RebillCCExpMonth($_POST['expiry']['month']); $objRebill->RebillCCExpYear($_POST['expiry']['year']); $objRebill->RebillInterval($member_shiptype['length']); switch($member_shiptype['unit']) { case 'd': $member_ship_unit = '1'; break; case 'w': $member_ship_unit = '2'; break; case 'm': $member_ship_unit = '3'; break; case 'y': $member_ship_unit = '4'; break; } $objRebill->RebillIntervalType($member_ship_unit); $objRebill->eWAYCustomerID($user); $objConnector = new GatewayConnector($gateway); if ($objConnector->ProcessRequest($objRebill)) { $objResponse = $objConnector->Response(); if ($objResponse != null) { $lblResult = $objResponse->Result(); if ($lblResult=='Success') { wpsc_member_activate_subscriptions($purchase_log['id']); $_SESSION['nzshpcrt_cart'] = ''; $_SESSION['nzshpcrt_cart'] = Array(); header("Location:".get_option('product_list_url')); } $lblErrorDescription = $objResponse->ErrorDetails(); $lblErrorSeverity = $objResponse->ErrorSeverity(); // This is woefully inadequate!!! exit('An Error has occured >'.$lblResult ." ". $lblErrorDescription ." ". $lblErrorSeverity); } } else { exit("Rebill Gateway failed: " . $objConnector->Response() ); } } else { require(WPSC_GOLD_FILE_PATH.'/merchants/ewaylib/EwayPaymentLive.php'); //echo WPSC_GOLD_FILE_PATH.'/ewaylib/EwayPaymentLive.php'; if (get_option('eway_cvn')) { $method = 'REAL_TIME_CVN'; } else { $method = 'REAL_TIME'; } // exit('
'.print_r($purchase_log, true).''); $eway = new EwayPaymentLive($user, $method, $gateway); $amount = number_format($purchase_log['totalprice'], 2, '.', '')*100; $eway->setTransactionData("TotalAmount", $amount); //mandatory field $eway->setTransactionData("CustomerFirstName", $data['first_name']); $eway->setTransactionData("CustomerLastName", $data['last_name']); $eway->setTransactionData("CustomerEmail", $data['email']); $eway->setTransactionData("CustomerAddress", $data['address1']); $eway->setTransactionData("CustomerPostcode", $data['zip']); $eway->setTransactionData("CustomerInvoiceDescription", $itemsName); $eway->setTransactionData("CustomerInvoiceRef", $purchase_log['id']); $eway->setTransactionData("CardHoldersName", $_POST['card_number']); //mandatory field $eway->setTransactionData("CardNumber", $_POST['card_number']); //mandatory field $eway->setTransactionData("CardExpiryMonth", $_POST['expiry']['month']); //mandatory field $eway->setTransactionData("CardExpiryYear", $_POST['expiry']['year']); //mandatory field $eway->setTransactionData("TrxnNumber", $purchase_log['id']); $eway->setTransactionData("Option1", ""); $eway->setTransactionData("Option2", ""); $eway->setTransactionData("Option3", ""); //for REAL_TIME_CVN $eway->setTransactionData("CVN", $_POST['cvn']); //for GEO_IP_ANTI_FRAUD $eway->setTransactionData("CustomerIPAddress", $eway->getVisitorIP()); //mandatory field when using Geo-IP Anti-Fraud $eway->setTransactionData("CustomerBillingCountry", $data['country']); //mandatory field when using Geo-IP Anti-Fraud //special preferences for php Curl $eway->setCurlPreferences(CURLOPT_SSL_VERIFYPEER, 0); //pass a long that is set to a zero value to stop curl from verifying the peer's certificate //$eway->setCurlPreferences(CURLOPT_CAINFO, "/usr/share/ssl/certs/my.cert.crt"); //Pass a filename of a file holding one or more certificates to verify the peer with. This only makes sense when used in combination with the CURLOPT_SSL_VERIFYPEER option. //$eway->setCurlPreferences(CURLOPT_CAPATH, "/usr/share/ssl/certs/my.cert.path"); //$eway->setCurlPreferences(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); //use CURL proxy, for example godaddy.com hosting requires it //$eway->setCurlPreferences(CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128"); //use CURL proxy, for example godaddy.com hosting requires it $ewayResponseFields = $eway->doPayment(); //exit(print_r($ewayResponseFields,1)); //print_r($ewayResponseFields); if($ewayResponseFields["EWAYTRXNSTATUS"]=="False"){ $message .= "
First Name Field | |
Last Name Field | |
Address Field | |
City Field | |
State Field | |
Postal code/Zip code Field | |
Country Field | |
Email Field |