| 1 |
<div class='wrap'> |
| 2 |
<h3>Gravity Forms eWAY Payments</h3> |
| 3 |
|
| 4 |
<form action="<?php echo $this->scriptURL; ?>" method="post" id="eway-settings-form"> |
| 5 |
<table class="form-table"> |
| 6 |
|
| 7 |
<tr> |
| 8 |
<th>eWAY Customer ID</th> |
| 9 |
<td> |
| 10 |
<input type='text' class="regular-text" name='customerID' value="<?php echo esc_attr($this->frm->customerID); ?>" /> |
| 11 |
</td> |
| 12 |
</tr> |
| 13 |
|
| 14 |
<tr valign='top'> |
| 15 |
<th>Use Stored Payments |
| 16 |
<span id="gfeway-opt-admin-stored-test"> |
| 17 |
<br />Stored Payments use the Direct Payments sandbox; |
| 18 |
<br />there is no Stored Payments sandbox. |
| 19 |
</span> |
| 20 |
</th> |
| 21 |
<td> |
| 22 |
<label><input type="radio" name="useStored" value="Y" <?php echo checked($this->frm->useStored, 'Y'); ?> /> yes</label> |
| 23 |
<label><input type="radio" name="useStored" value="N" <?php echo checked($this->frm->useStored, 'N'); ?> /> no</label> |
| 24 |
</td> |
| 25 |
</tr> |
| 26 |
|
| 27 |
<tr valign='top'> |
| 28 |
<th>Use Sandbox (testing environment)</th> |
| 29 |
<td> |
| 30 |
<label><input type="radio" name="useTest" value="Y" <?php echo checked($this->frm->useTest, 'Y'); ?> /> yes</label> |
| 31 |
<label><input type="radio" name="useTest" value="N" <?php echo checked($this->frm->useTest, 'N'); ?> /> no</label> |
| 32 |
</td> |
| 33 |
</tr> |
| 34 |
|
| 35 |
<tr valign='top'> |
| 36 |
<th>Round Amounts for Sandbox</th> |
| 37 |
<td> |
| 38 |
<label><input type="radio" name="roundTestAmounts" value="Y" <?php echo checked($this->frm->roundTestAmounts, 'Y'); ?> /> yes</label> |
| 39 |
<label><input type="radio" name="roundTestAmounts" value="N" <?php echo checked($this->frm->roundTestAmounts, 'N'); ?> /> no</label> |
| 40 |
</td> |
| 41 |
</tr> |
| 42 |
|
| 43 |
<tr valign='top'> |
| 44 |
<th>Force Test Customer ID in Sandbox</th> |
| 45 |
<td> |
| 46 |
<label><input type="radio" name="forceTestAccount" value="Y" <?php echo checked($this->frm->forceTestAccount, 'Y'); ?> /> yes</label> |
| 47 |
<label><input type="radio" name="forceTestAccount" value="N" <?php echo checked($this->frm->forceTestAccount, 'N'); ?> /> no</label> |
| 48 |
</td> |
| 49 |
</tr> |
| 50 |
|
| 51 |
<tr valign='top'> |
| 52 |
<th>Use <a href="http://www.eway.com.au/developers/resources/beagle-(free)-rules" target="_blank">Beagle</a> |
| 53 |
<span id="gfeway-opt-admin-stored-beagle"> |
| 54 |
<br />Beagle is not available for Stored Payments. |
| 55 |
</span> |
| 56 |
</th> |
| 57 |
<td> |
| 58 |
<label><input type="radio" name="useBeagle" value="Y" <?php echo checked($this->frm->useBeagle, 'Y'); ?> /> yes</label> |
| 59 |
<label><input type="radio" name="useBeagle" value="N" <?php echo checked($this->frm->useBeagle, 'N'); ?> /> no</label> |
| 60 |
<span id="gfeway-opt-admin-beagle-address"> |
| 61 |
<br />You will also need to add an Address field to your form, and make it required. Beagle works by comparing |
| 62 |
the country of the address with the country where the purchaser is using the Internet; if you don't set it to Required, |
| 63 |
then Beagle won't be used when submitting the form without a country selected. |
| 64 |
</span> |
| 65 |
</td> |
| 66 |
</tr> |
| 67 |
|
| 68 |
<tr valign='top'> |
| 69 |
<th>Verify remote SSL certificate<br /> |
| 70 |
(<i>only disable if your website can't be |
| 71 |
<a target="_blank" title="Stop turning off CURLOPT_SSL_VERIFYPEER and fix your PHP config" |
| 72 |
href="http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/">correctly configured</a>!</i>) |
| 73 |
</th> |
| 74 |
<td> |
| 75 |
<label><input type="radio" name="sslVerifyPeer" value="Y" <?php echo checked($this->frm->sslVerifyPeer, 'Y'); ?> /> yes</label> |
| 76 |
<label><input type="radio" name="sslVerifyPeer" value="N" <?php echo checked($this->frm->sslVerifyPeer, 'N'); ?> /> no</label> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
|
| 80 |
<tr> |
| 81 |
<th colspan="2" style="font-weight: bold">You may customise the error messages below. |
| 82 |
Leave a message blank to use the default error message.</th> |
| 83 |
</tr> |
| 84 |
|
| 85 |
<?php |
| 86 |
$errNames = array ( |
| 87 |
GFEWAY_ERROR_ALREADY_SUBMITTED, |
| 88 |
GFEWAY_ERROR_NO_AMOUNT, |
| 89 |
GFEWAY_ERROR_REQ_CARD_HOLDER, |
| 90 |
GFEWAY_ERROR_REQ_CARD_NAME, |
| 91 |
GFEWAY_ERROR_EWAY_FAIL, |
| 92 |
); |
| 93 |
foreach ($errNames as $errName) { |
| 94 |
$defmsg = esc_html($this->plugin->getErrMsg($errName, true)); |
| 95 |
$msg = esc_attr(get_option($errName)); |
| 96 |
?> |
| 97 |
|
| 98 |
<tr> |
| 99 |
<th><?php echo $defmsg; ?></th> |
| 100 |
<td><input type="text" name="<?php echo esc_attr($errName); ?>" class="large-text" value="<?php echo $msg; ?>" /></td> |
| 101 |
</tr> |
| 102 |
|
| 103 |
<?php |
| 104 |
} |
| 105 |
|
| 106 |
?> |
| 107 |
</table> |
| 108 |
<p class="submit"> |
| 109 |
<input type="submit" name="Submit" class="button-primary" value="Save Changes" /> |
| 110 |
<input type="hidden" name="action" value="save" /> |
| 111 |
<?php wp_nonce_field('save', $this->menuPage . '_wpnonce', false); ?> |
| 112 |
</p> |
| 113 |
</form> |
| 114 |
|
| 115 |
</div> |
| 116 |
|
| 117 |
<script> |
| 118 |
(function($) { |
| 119 |
|
| 120 |
/** |
| 121 |
* check whether both the sandbox (test) mode and Stored Payments are selected, |
| 122 |
* show warning message if they are |
| 123 |
*/ |
| 124 |
function setVisibility() { |
| 125 |
var useTest = ($("input[name='useTest']:checked").val() == "Y"), |
| 126 |
useBeagle = ($("input[name='useBeagle']:checked").val() == "Y"), |
| 127 |
useStored = ($("input[name='useStored']:checked").val() == "Y"); |
| 128 |
|
| 129 |
function display(element, visible) { |
| 130 |
if (visible) |
| 131 |
element.css({display: "none"}).show(750); |
| 132 |
else |
| 133 |
element.hide(); |
| 134 |
} |
| 135 |
|
| 136 |
display($("#gfeway-opt-admin-stored-test"), (useTest && useStored)); |
| 137 |
display($("#gfeway-opt-admin-stored-beagle"), (useBeagle && useStored)); |
| 138 |
display($("#gfeway-opt-admin-beagle-address"), useBeagle); |
| 139 |
} |
| 140 |
|
| 141 |
$("#eway-settings-form").on("change", "input[name='useTest'],input[name='useBeagle'],input[name='useStored']", setVisibility); |
| 142 |
|
| 143 |
setVisibility(); |
| 144 |
|
| 145 |
})(jQuery); |
| 146 |
</script> |
| 147 |
|