* @since 1.0\r
*\r
*/\r
- global $wpdb;\r
- if(isset($_REQUEST['action']))\r
- {\r
+global $wpdb;\r
+if(isset($_REQUEST['action']))\r
+{\r
if($_REQUEST['action']=='submitpayment')\r
- { \r
+ {\r
+ // Check the form for reCaptcha\r
+ $response = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(\r
+ 'method' => 'POST',\r
+ 'timeout' => 45,\r
+ 'redirection' => 5,\r
+ 'httpversion' => '1.0',\r
+ 'blocking' => true,\r
+ 'headers' => array(),\r
+ 'body' => array(\r
+ 'secret' => '6LfUdwoUAAAAAPIZJ1_ipx0hK2Bl8XMMsmamlRDq',\r
+ 'response' => $_REQUEST['g-recaptcha-response'],\r
+ 'remoteip' => $_SERVER['REMOTE_ADDR']\r
+ ),\r
+ 'cookies' => array()\r
+ ) );\r
+ $response_code = wp_remote_retrieve_response_code( $response );\r
+ $api_response = json_decode( wp_remote_retrieve_body( $response ), true );\r
+ if ( $api_response['success'] != true ) {\r
+ $_SESSION['payment_msg'] = 'Captcha did not verify!';\r
+ header("Location:".site_url().$_SERVER['REQUEST_URI']);\r
+ exit;\r
+ }\r
$first_name = $_REQUEST['first_name'];\r
$last_name = $_REQUEST['last_name'];\r
$organization = $_REQUEST['organization'];\r
$state = $_REQUEST['state'];\r
$zip = $_REQUEST['zip'];\r
$phone = $_REQUEST['phone'];\r
- $email = $_REQUEST['email']; \r
+ $email = $_REQUEST['email'];\r
$donation_type = $_REQUEST['donation_type'];\r
$r_frequency = $_REQUEST['r_frequency'];\r
$r_times = $_REQUEST['r_times'];\r
$x_card_code = $_REQUEST['x_card_code'];\r
$comment = $_REQUEST['comment'];\r
$payment_method = $_REQUEST['payment_method'];\r
- \r
+\r
// Adjust this to point to the Authorize.Net PHP SDK\r
include dirname(__FILE__) .'/../anet_php_sdk/AuthorizeNet.php';\r
\r
define("AUTHORIZENET_API_LOGIN_ID",$mysetting[0]->api_login); // Add your API LOGIN ID\r
define("AUTHORIZENET_TRANSACTION_KEY",$mysetting[0]->key); // Add your API transaction key\r
if($mysetting[0]->mod==0){\r
- define("AUTHORIZENET_SANDBOX",true); // Set to false to test against production\r
- define("TEST_REQUEST", true); // You may want to set to true if testing against production\r
+ define("AUTHORIZENET_SANDBOX",true); // Set to false to test against production\r
+ define("TEST_REQUEST", true); // You may want to set to true if testing against production\r
}\r
else\r
{\r
define("AUTHORIZENET_SANDBOX",false); // Set to false to test against production\r
- define("TEST_REQUEST", false); \r
+ define("TEST_REQUEST", false);\r
}\r
// You only need to adjust the two variables below if testing DPM\r
define("AUTHORIZENET_MD5_SETTING",""); // Add your MD5 Setting.\r
$REQUEST = $_REQUEST;\r
if(authorizepayment($METHOD_TO_USE,$REQUEST,$address1,$city,$state,$country,$zipcode,$emailaddress,$plan))\r
{\r
- $sql = "INSERT INTO `".$wpdb->prefix."payment` (`first_name`, `last_name`, `organization`, `address`, `city`, `country`, `state`, `zip`, `phone`, `email`, `donation_type`, `amount`, `invoice_num`,`comment`, `status`,`date`) \r
+ $sql = "INSERT INTO `".$wpdb->prefix."payment` (`first_name`, `last_name`, `organization`, `address`, `city`, `country`, `state`, `zip`, `phone`, `email`, `donation_type`, `amount`, `invoice_num`,`comment`, `status`,`date`)\r
VALUES ('".$first_name."', '".$last_name."','".$organization."','".$address."','".$city."','".$country."','".$state."','".$zip."','".$phone."','".$email."','".$donation_type."','".$amount."','".$invoice_num."','".$comment."', '1',now());";\r
$wpdb->query($sql);\r
- \r
+\r
$post = get_post($post->ID);\r
$slug = $post->post_name;\r
- \r
+\r
// verification form submission to billing@gaslightmedia.com //////\r
$headers = "From: Gaslight Media <server@gaslightmedia.com>\r\n" .\r
"Reply-To: noreply@gaslightmedia.com\r\n";\r
- \r
- $clientInfo = "A payment has been made on the Gaslight Media website. Please review the billing information below\r\n" . \r
+\r
+ $clientInfo = "A payment has been made on the Gaslight Media website. Please review the billing information below\r\n" .\r
"First Name: " . $first_name . "\r\n" .\r
"Last Name: " . $last_name . "\r\n" .\r
"Invoice #: " . $invoice_num . "\r\n" .\r
"Payment Amount: $". $amount . "\r\n" .\r
"Organization: " . $organization;\r
- \r
+\r
$message = print_r($clientInfo, true);\r
mail( 'billing@gaslightmedia.com', 'GLM Payment Form', $message, $headers);\r
\r
header("Location:".site_url().$_SERVER['REQUEST_URI']);\r
exit;\r
}\r
- \r
- }\r
+\r
}\r
+}\r
\r
function glm_payment_form() {\r
+ wp_enqueue_script('reCaptcha', 'https://www.google.com/recaptcha/api.js');\r
ob_start();\r
global $wpdb;\r
?>\r
<tr><td style="color:red;" colspan="4"><?php echo $_SESSION['payment_msg']; $_SESSION['payment_msg']='';?></td></tr>\r
<tr>\r
<td colspan="2" class="msg">\r
- <p>For your convenience, you can pay your Invoices using our secured \r
- online credit card processing form. If you would like to have your \r
- Invoice automatically paid monthly via credit card, please call \r
+ <p>For your convenience, you can pay your Invoices using our secured\r
+ online credit card processing form. If you would like to have your\r
+ Invoice automatically paid monthly via credit card, please call\r
the office and we can set that up for you.\r
</p>\r
<p>\r
</tr>\r
<tr>\r
<td colspan="2" class="heading"><b>Billing information</b></td>\r
- </tr> \r
- <tr> \r
+ </tr>\r
+ <tr>\r
<td class="title_cell">First name<span class="required">*</span></td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="first_name" id="first_name" value="" size="25" />\r
</td>\r
</tr>\r
- <tr> \r
+ <tr>\r
<td class="title_cell">Last name<span class="required">*</span></td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="last_name" value="" size="25" />\r
</td>\r
</tr>\r
- <tr> \r
+ <tr>\r
<td class="title_cell">Organization</td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="organization" value="" size="30" />\r
</td>\r
</tr>\r
- <tr> \r
+ <tr>\r
<td class="title_cell">Address<span class="required">*</span></td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="address" value="" size="50" />\r
</td>\r
- </tr> \r
- <tr> \r
+ </tr>\r
+ <tr>\r
<td class="title_cell">City<span class="required">*</span></td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="city" value="" size="15" />\r
</td>\r
- </tr> \r
- <tr style="display: none"> \r
+ </tr>\r
+ <tr style="display: none">\r
<td class="title_cell">Country<span class="required">*</span></td>\r
<td class="field_cell">\r
<select id="country" name="country" onchange="updateStateList();" >\r
<option value="Zimbabwe">Zimbabwe</option>\r
</select>\r
</td>\r
- </tr> \r
- <tr> \r
+ </tr>\r
+ <tr>\r
<td class="title_cell">State<span class="required">*</span></td>\r
<td class="field_cell">\r
<select id="state" name="state" class="">\r
</select>\r
</td>\r
</tr>\r
- <tr> \r
+ <tr>\r
<td class="title_cell">Zip<span class="required">*</span></td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="zip" value="" size="15" />\r
</td>\r
</tr>\r
- <tr> \r
+ <tr>\r
<td class="title_cell">Phone</td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="phone" value="" size="15" />\r
</td>\r
- </tr> \r
- <tr> \r
+ </tr>\r
+ <tr>\r
<td class="title_cell">Email<span class="required">*</span></td>\r
<td class="field_cell">\r
<input type="text" class="inputbox" name="email" value="" size="40" />\r
</td>\r
</tr>\r
<tr>\r
- <td colspan="2" class="heading"><strong>Payment Information</strong></td> \r
+ <td colspan="2" class="heading"><strong>Payment Information</strong></td>\r
</tr>\r
- \r
- \r
+\r
+\r
<tr>\r
- <td class="title_cell" valign="top">Amount<span class="required">*</span></td> \r
+ <td class="title_cell" valign="top">Amount<span class="required">*</span></td>\r
<td id="amount_container">\r
- $ <div style="display: inline-block"> \r
+ $ <div style="display: inline-block">\r
<input type="text" class="inputbox" name="amount" value="" onchange="deSelectRadio();" size="10" style="display: inline-block" />\r
</div>\r
</td>\r
- </tr> \r
- \r
+ </tr>\r
+\r
<tr id="invoice_num" >\r
<td class="title_cell">Invoice Number</td>\r
<td class="field_cell">\r
<input type="text" name="invoice_num" class="inputbox" value="" size="20" />\r
</td>\r
</tr>\r
- \r
+\r
<tr id="tr_card_type">\r
<td class="title_cell">Card type<span class="required">*</span></td>\r
<td class="field_cell">\r
<option value="Discover">Discover</option>\r
</select>\r
</td>\r
- </tr> \r
+ </tr>\r
<tr id="tr_card_number" >\r
<td class="title_cell">Credit Card Number<span class="required">*</span></td>\r
<td class="field_cell">\r
<tr id="tr_exp_date" >\r
<td class="title_cell">Expiration Date<span class="required">*</span>\r
</td>\r
- <td class="field_cell"> \r
+ <td class="field_cell">\r
<select name="exp_month" class="inputbox exp_month" >\r
<option value="1" <?php if(date('m')=='01'){?> selected="selected"<?php }?>>01</option>\r
<option value="2" <?php if(date('m')=='02'){?> selected="selected"<?php }?>>02</option>\r
<option value="10" <?php if(date('m')=='10'){?> selected="selected"<?php }?>>10</option>\r
<option value="11" <?php if(date('m')=='11'){?> selected="selected"<?php }?>>11</option>\r
<option value="12" <?php if(date('m')=='12'){?> selected="selected"<?php }?>>12</option>\r
- </select> / \r
+ </select> /\r
<select id="exp_year" name="exp_year" class="inputbox exp_month" >\r
<?php $year = date(Y,time()); $num = 1;\r
while ( $num <= 7 ) {\r
<input type="text" name="x_card_code" class="inputbox" onKeyUp="checkNumber(this)" value="" size="20" />\r
</td>\r
</tr>\r
- \r
- \r
- <tr> \r
+\r
+\r
+ <tr>\r
<td class="title_cell">Comment</td>\r
<td class="field_cell">\r
<textarea rows="7" cols="50" name="comment" class="inputbox"></textarea>\r
</tr>\r
<tr id="submit-button">\r
<td>\r
+<div class="g-recaptcha" data-sitekey="6LfUdwoUAAAAAIgmh_g4FjYwiD0RbEpSQ34g_V9j"></div>\r
<input type="button" class="button payment_btn_submit" name="btnSubmit" value="Submit" onclick="checkData();">\r
</td>\r
</tr>\r
recurrings[3] = 1 ;\r
recurrings[4] = 1 ;\r
recurrings[5] = 1 ;\r
- var countryIds = new Array(); \r
+ var countryIds = new Array();\r
countryIds[0] = 1;\r
countryIds[1] = 2;\r
countryIds[2] = 3;\r
countryIds[242] = 243;\r
countryIds[243] = 244;\r
countryIds[244] = 245;\r
- var countryNames = new Array(); \r
+ var countryNames = new Array();\r
countryNames[0]= "Afghanistan"\r
countryNames[1]= "Albania"\r
countryNames[2]= "Algeria"\r
methods.Add(method);\r
var currentCampaign = 0 ;\r
function checkData() {\r
- var form = document.payment_form; \r
+ var form = document.payment_form;\r
var minimumAmount = 1 ;\r
var maximumAmount = 100000 ;\r
- \r
+\r
if (form.first_name.value == '') {\r
alert("Please enter your first name");\r
form.first_name.focus();\r
return ;\r
- } \r
+ }\r
if (form.last_name.value=="") {\r
alert("Please enter your last name");\r
form.last_name.focus();\r
return;\r
- } \r
+ }\r
if (form.address.value=="") {\r
alert("Please enter your address");\r
form.address.focus();\r
- return; \r
- } \r
+ return;\r
+ }\r
if (form.city.value == "") {\r
alert("Please enter your city");\r
form.city.focus();\r
- return; \r
- } \r
+ return;\r
+ }\r
if (form.state.length > 1) {\r
if (form.state.value =="") {\r
alert("Please enter your state");\r
form.state.focus();\r
- return; \r
+ return;\r
}\r
- } \r
+ }\r
if (form.zip.value == "") {\r
alert("Please enter your zip");\r
form.zip.focus();\r
return;\r
- } \r
+ }\r
// if (form.country.value == "") {\r
// alert("Please enter your country");\r
// form.country.focus();\r
-// return; \r
-// } \r
+// return;\r
+// }\r
// if (form.invoice_num.value == "") {\r
// alert("Please enter an invoice number");\r
// form.invoice_num.focus();\r
// alert("Please enter your phone");\r
// form.phone.focus();\r
// return;\r
-// } \r
- \r
+// }\r
+\r
if (form.email.value == '') {\r
alert("Please enter your email");\r
form.email.focus();\r
return;\r
}\r
- \r
- \r
+\r
+\r
var emailFilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i\r
var ret = emailFilter.test(form.email.value);\r
if (!ret) {\r
alert("Please enter a valid email");\r
form.email.focus();\r
return;\r
- } \r
+ }\r
var amountValid = false ;\r
var amount = 0 ;\r
if (form.rd_amount) {\r
if(form.rd_amount[i].checked == true) {\r
amountValid = true ;\r
amount = form.rd_amount[i].value ;\r
- } \r
- } \r
+ }\r
+ }\r
} else if (form.rd_amount.checked == true) {\r
amountValid = true ;\r
amount = form.rd_amount.value ;\r
}\r
- \r
+\r
}\r
\r
- if (!amountValid) { \r
+ if (!amountValid) {\r
if (parseFloat(form.amount.value)) {\r
amountValid = true;\r
- amount = form.amount.value ; \r
- } \r
- } \r
- \r
- \r
+ amount = form.amount.value ;\r
+ }\r
+ }\r
+\r
+\r
if (!amountValid) {\r
var msg;\r
msg = "Please choose from pre-defined amounts or enter your own amount in the textbox";\r
alert(msg);\r
- return; \r
- } \r
+ return;\r
+ }\r
\r
\r
if (parseFloat(amount) < minimumAmount) {\r
return ;\r
}\r
\r
- \r
- \r
- \r
- \r
- \r
+\r
+\r
+\r
+\r
+\r
var paymentMethod = "";\r
paymentMethod = "os_authnet";\r
- \r
- method = methods.Find(paymentMethod); \r
+\r
+ method = methods.Find(paymentMethod);\r
//Check payment method page\r
if (method.getCreditCard()) {\r
if (form.x_card_num.value == "") {\r
alert("Please enter creditcard number");\r
form.x_card_num.focus();\r
- return; \r
- } \r
+ return;\r
+ }\r
if (form.x_card_code.value == "") {\r
alert("Please enter card code");\r
form.x_card_code.focus();\r
form.card_holde_name.focus();\r
return ;\r
}\r
- } \r
+ }\r
//This check is only used for echeck payment gateway\r
if (paymentMethod == 'os_echeck') {\r
if (form.x_bank_aba_code.value == '') {\r
alert("Please enter Bank ABA Routing Number");\r
form.x_bank_aba_code.focus();\r
return ;\r
- } \r
+ }\r
if (form.x_bank_acct_num.value == '') {\r
alert("Please enter Bank Account Number");\r
form.x_bank_aba_code.focus();\r
return ;\r
- } \r
+ }\r
if (form.x_bank_name.value == '') {\r
alert("Please enter Bank Name");\r
form.x_bank_name.focus();\r
- return ; \r
- } \r
+ return ;\r
+ }\r
if (form.x_bank_acct_name.value == '') {\r
alert("Please enter Account Holder Name");\r
form.x_bank_acct_name.focus();\r
return ;\r
- } \r
- } \r
- \r
+ }\r
+ }\r
+\r
form.submit();\r
- \r
- } \r
- \r
+\r
+ }\r
+\r
function checkNumber(txtName)\r
- { \r
- var num = txtName.value \r
- if(isNaN(num)) \r
- { \r
- alert("Only number is accepted"); \r
- txtName.value = ""; \r
- txtName.focus(); \r
- } \r
+ {\r
+ var num = txtName.value\r
+ if(isNaN(num))\r
+ {\r
+ alert("Only number is accepted");\r
+ txtName.value = "";\r
+ txtName.focus();\r
+ }\r
}\r
\r
\r
function changeDonationType() {\r
var form = document.payment_form ;\r
var trFrequecy = document.getElementById('tr_frequency');\r
- var trNumberDonatons = document.getElementById('tr_number_donations'); \r
+ var trNumberDonatons = document.getElementById('tr_number_donations');\r
if (form.donation_type[0].checked == true) {\r
trFrequecy.style.display = 'none' ;\r
if (trNumberDonatons)\r
trFrequecy.style.display = '' ;\r
if (trNumberDonatons)\r
trNumberDonatons.style.display = '' ;\r
- } \r
- } \r
+ }\r
+ }\r
\r
function deSelectRadio() {\r
var form = document.payment_form ;\r
}\r
} else {\r
form.rd_amount.checked = false ;\r
- } \r
- \r
- } \r
+ }\r
+\r
+ }\r
} else {\r
form.amount.value = '';\r
}\r
function clearTextbox() {\r
var form = document.payment_form ;\r
if (form.amount)\r
- form.amount.value = ''; \r
- } \r
- \r
- function displayRecurring(show) { \r
- var form = document.payment_form ; \r
+ form.amount.value = '';\r
+ }\r
+\r
+ function displayRecurring(show) {\r
+ var form = document.payment_form ;\r
var trDonationType = document.getElementById('donation_type') ;\r
- if (!trDonationType) \r
- return ; \r
+ if (!trDonationType)\r
+ return ;\r
var trFrequency = document.getElementById('tr_frequency');\r
var trNumberDonations = document.getElementById('tr_number_donations') ;\r
if (show) {\r
if (trNumberDonations) {\r
trNumberDonations.style.display = '';\r
}\r
- } \r
+ }\r
} else {\r
trDonationType.style.display = 'none';\r
trFrequency.style.display = 'none';\r
if (trNumberDonations) {\r
trNumberDonations.style.display = 'none';\r
}\r
- } \r
+ }\r
}\r
\r
\r
- function checkCampaignRecurring() { \r
+ function checkCampaignRecurring() {\r
var form = document.payment_form ;\r
var show = 1 ;\r
var paymentMethod = "";\r
paymentMethod = "os_authnet";\r
- \r
+\r
method = methods.Find(paymentMethod);\r
if (!method.getEnableRecurring()) {\r
show = 0 ;\r
} else {\r
if (form.campaign_id.value > 0)\r
show = recurrings [form.campaign_id.value] ;\r
- } \r
+ }\r
displayRecurring(show);\r
}\r
- \r
+\r
function updateAmount() {\r
var form = document.payment_form ;\r
var campaignId = form.campaign_id.value ;\r
//Check to enable and disable recurring\r
var show = 1 ;\r
if (campaignId)\r
- show = recurrings [campaignId] ; \r
- displayRecurring(show); \r
- \r
+ show = recurrings [campaignId] ;\r
+ displayRecurring(show);\r
+\r
}\r
function updateStateList() {\r
var form = document.payment_form ;\r
list.length = 1 ;\r
var i = 0;\r
//Get the country index\r
- var country = form.country.value ; \r
+ var country = form.country.value ;\r
if (country != '') {\r
//Find index of the country\r
for (var i = 0 ; i < countryNames.length ; i++) {\r
- if (countryNames[i] == country) { \r
+ if (countryNames[i] == country) {\r
break ;\r
}\r
}\r
//We will find the states\r
- var countryId = countryIds[i] ; \r
+ var countryId = countryIds[i] ;\r
var stateNames = stateList[countryId]; ;\r
if (stateNames) {\r
var arrStates = stateNames.split(',');\r
list.options[i++] = opt;\r
}\r
list.lenght = i ;\r
- } \r
- } \r
+ }\r
+ }\r
}\r
\r
- </script> \r
- \r
+ </script>\r
+\r
<?php\r
$output = apply_filters( 'glm_payment_filter_form', ob_get_contents());\r
ob_end_clean();\r