| 1 |
|
| 2 |
<?php settings_errors(); ?> |
| 3 |
|
| 4 |
<div class="gfeway-settings-promote"> |
| 5 |
<a target="_blank" href="https://gfeway.webaware.net.au/"><?php esc_html_e('Go Pro for more flexibility!', 'gravityforms-eway'); ?></a> |
| 6 |
</div> |
| 7 |
|
| 8 |
<h3><span><i class="fa fa-credit-card"></i> <?php echo esc_html_x('eWAY Payments', 'settings page', 'gravityforms-eway'); ?></span></h3> |
| 9 |
|
| 10 |
<form action="<?php echo admin_url('options.php'); ?>" method="POST" id="eway-settings-form"> |
| 11 |
<?php settings_fields(GFEWAY_PLUGIN_OPTIONS); ?> |
| 12 |
|
| 13 |
<h4 class="gf_settings_subgroup_title"><?php esc_html_e('Live settings', 'gravityforms-eway'); ?></h4> |
| 14 |
|
| 15 |
<table class="form-table gforms_form_settings"> |
| 16 |
|
| 17 |
<tr> |
| 18 |
<th scope="row"> |
| 19 |
<label for="gfeway_plugin_apiKey"><?php echo esc_html_x('API Key', 'settings field', 'gravityforms-eway'); ?></label> |
| 20 |
<?php gform_tooltip(esc_html__('eWAY Rapid API key, from your MYeWAY console.', 'gravityforms-eway')); ?> |
| 21 |
</th> |
| 22 |
<td> |
| 23 |
<input type="text" class="large-text" name="gfeway_plugin[apiKey]" id="gfeway_plugin_apiKey" value="<?php echo esc_attr($options['apiKey']); ?>" /> |
| 24 |
</td> |
| 25 |
</tr> |
| 26 |
|
| 27 |
<tr> |
| 28 |
<th scope="row"> |
| 29 |
<label for="gfeway_plugin_apiPassword"><?php echo esc_html_x('API Password', 'settings field', 'gravityforms-eway'); ?></label> |
| 30 |
<?php gform_tooltip(esc_html__('eWAY Rapid API password, from your MYeWAY console.', 'gravityforms-eway')); ?> |
| 31 |
</th> |
| 32 |
<td> |
| 33 |
<input type="text" class="regular-text" name="gfeway_plugin[apiPassword]" id="gfeway_plugin_apiPassword" value="<?php echo esc_attr($options['apiPassword']); ?>" /> |
| 34 |
</td> |
| 35 |
</tr> |
| 36 |
|
| 37 |
<tr> |
| 38 |
<th scope="row"> |
| 39 |
<label for="gfeway_plugin_ecryptKey"><?php echo esc_html_x('Client Side Encryption Key', 'settings field', 'gravityforms-eway'); ?></label> |
| 40 |
<?php gform_tooltip(esc_html__("Securely encrypts sensitive credit card information in the customer's browser, so that you can accept credit cards on your website without full PCI certification.", 'gravityforms-eway')); ?> |
| 41 |
</th> |
| 42 |
<td> |
| 43 |
<textarea name="gfeway_plugin[ecryptKey]" id="gfeway_plugin_ecryptKey" rows="5" class="large-text"><?php echo esc_attr($options['ecryptKey']); ?></textarea> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
|
| 47 |
<tr> |
| 48 |
<th scope="row"> |
| 49 |
<label for="gfeway_plugin_customerID"><?php echo esc_html_x('Customer ID', 'settings field', 'gravityforms-eway'); ?></label> |
| 50 |
<?php gform_tooltip(esc_html__('eWAY customer ID, required for Recurring Payments and legacy XML API; from your MYeWAY console.', 'gravityforms-eway')); ?> |
| 51 |
</th> |
| 52 |
<td> |
| 53 |
<input type="text" class="regular-text" name="gfeway_plugin[customerID]" id="gfeway_plugin_customerID" value="<?php echo esc_attr($options['customerID']); ?>" /> |
| 54 |
</td> |
| 55 |
</tr> |
| 56 |
|
| 57 |
</table> |
| 58 |
|
| 59 |
<h4 class="gf_settings_subgroup_title"><?php esc_html_e('Sandbox settings', 'gravityforms-eway'); ?></h4> |
| 60 |
|
| 61 |
<table class="form-table gforms_form_settings"> |
| 62 |
|
| 63 |
<tr> |
| 64 |
<th scope="row"> |
| 65 |
<label for="gfeway_plugin_sandboxApiKey"><?php echo esc_html_x('API Key', 'settings field', 'gravityforms-eway'); ?></label> |
| 66 |
<?php gform_tooltip(esc_html__('eWAY Rapid API key, from your MYeWAY console.', 'gravityforms-eway')); ?> |
| 67 |
</th> |
| 68 |
<td> |
| 69 |
<input type="text" class="large-text" name="gfeway_plugin[sandboxApiKey]" id="gfeway_plugin_sandboxApiKey" value="<?php echo esc_attr($options['sandboxApiKey']); ?>" /> |
| 70 |
</td> |
| 71 |
</tr> |
| 72 |
|
| 73 |
<tr> |
| 74 |
<th scope="row"> |
| 75 |
<label for="gfeway_plugin_sandboxPassword"><?php echo esc_html_x('API Password', 'settings field', 'gravityforms-eway'); ?></label> |
| 76 |
<?php gform_tooltip(esc_html__('eWAY Rapid API password, from your MYeWAY console.', 'gravityforms-eway')); ?> |
| 77 |
</th> |
| 78 |
<td> |
| 79 |
<input type="text" class="regular-text" name="gfeway_plugin[sandboxPassword]" id="gfeway_plugin_sandboxPassword" value="<?php echo esc_attr($options['sandboxPassword']); ?>" /> |
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
|
| 83 |
<tr> |
| 84 |
<th scope="row"> |
| 85 |
<label for="gfeway_plugin_sandboxEcryptKey"><?php echo esc_html_x('Client Side Encryption Key', 'settings field', 'gravityforms-eway'); ?></label> |
| 86 |
<?php gform_tooltip(esc_html__("Securely encrypts sensitive credit card information in the customer's browser, so that you can accept credit cards on your website without full PCI certification.", 'gravityforms-eway')); ?> |
| 87 |
</th> |
| 88 |
<td> |
| 89 |
<textarea name="gfeway_plugin[sandboxEcryptKey]" id="gfeway_plugin_sandboxEcryptKey" rows="5" class="large-text"><?php echo esc_attr($options['sandboxEcryptKey']); ?></textarea> |
| 90 |
</td> |
| 91 |
</tr> |
| 92 |
|
| 93 |
<tr> |
| 94 |
<th scope="row"> |
| 95 |
<label for="gfeway_plugin_sandboxCustomerID"><?php echo esc_html_x('Customer ID', 'settings field', 'gravityforms-eway'); ?></label> |
| 96 |
<?php gform_tooltip(esc_html__('eWAY customer ID, for the legacy XML API sandbox (not used for the Recurring Payments sandbox); from your MYeWAY console.', 'gravityforms-eway')); ?> |
| 97 |
</th> |
| 98 |
<td> |
| 99 |
<input type="text" class="regular-text" name="gfeway_plugin[sandboxCustomerID]" id="gfeway_plugin_sandboxCustomerID" value="<?php echo esc_attr($options['sandboxCustomerID']); ?>" /> |
| 100 |
</td> |
| 101 |
</tr> |
| 102 |
|
| 103 |
</table> |
| 104 |
|
| 105 |
<h4 class="gf_settings_subgroup_title"><?php echo esc_html_x('Options', 'settings page', 'gravityforms-eway'); ?></h4> |
| 106 |
|
| 107 |
<table class="form-table gforms_form_settings"> |
| 108 |
|
| 109 |
<tr valign='top'> |
| 110 |
<th> </th> |
| 111 |
<td> |
| 112 |
|
| 113 |
<fieldset> |
| 114 |
<legend><?php echo esc_html_x('Payment Method', 'settings field', 'gravityforms-eway'); ?></legend> |
| 115 |
<input type="radio" name="gfeway_plugin[useStored]" id="gfeway_plugin_useStored_no" value="" <?php checked($options['useStored'], ''); ?> /> |
| 116 |
<label for="gfeway_plugin_useStored_no"><?php echo esc_html_x('Capture', 'payment method', 'gravityforms-eway'); ?></label> |
| 117 |
<input type="radio" name="gfeway_plugin[useStored]" id="gfeway_plugin_useStored_yes" value="1" <?php checked($options['useStored'], '1'); ?> /> |
| 118 |
<label for="gfeway_plugin_useStored_yes"><?php echo esc_html_x('Authorize', 'payment method', 'gravityforms-eway'); ?></label> |
| 119 |
<p id="gfeway-opt-admin-stored-test"><em><?php esc_html_e('The Stored Payments legacy XML API has no sandbox, so transactions are simulated via the Direct Payments XML API sandbox. Add your API key and password to use Rapid API and see PreAuth transactions in your sandbox.', 'gravityforms-eway'); ?></em></p> |
| 120 |
</fieldset> |
| 121 |
|
| 122 |
<fieldset> |
| 123 |
<legend><?php esc_html_e('Use Sandbox (testing environment)', 'gravityforms-eway'); ?></legend> |
| 124 |
<input type="radio" name="gfeway_plugin[useTest]" id="gfeway_plugin_useTest_yes" value="1" <?php checked($options['useTest'], '1'); ?> /> |
| 125 |
<label for="gfeway_plugin_useTest_yes"><?php echo esc_html_x('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 126 |
<input type="radio" name="gfeway_plugin[useTest]" id="gfeway_plugin_useTest_no" value="" <?php checked($options['useTest'], ''); ?> /> |
| 127 |
<label for="gfeway_plugin_useTest_no"><?php echo esc_html_x('No', 'settings', 'gravityforms-eway'); ?></label> |
| 128 |
</fieldset> |
| 129 |
|
| 130 |
<fieldset> |
| 131 |
<legend><?php esc_html_e('Round Amounts for Sandbox', 'gravityforms-eway'); ?></legend> |
| 132 |
<input type="radio" name="gfeway_plugin[roundTestAmounts]" id="gfeway_plugin_roundTestAmounts_yes" value="1" <?php checked($options['roundTestAmounts'], '1'); ?> /> |
| 133 |
<label for="gfeway_plugin_roundTestAmounts_yes"><?php echo esc_html_x('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 134 |
<input type="radio" name="gfeway_plugin[roundTestAmounts]" id="gfeway_plugin_roundTestAmounts_no" value="" <?php checked($options['roundTestAmounts'], ''); ?> /> |
| 135 |
<label for="gfeway_plugin_roundTestAmounts_no"><?php echo esc_html_x('No', 'settings', 'gravityforms-eway'); ?></label> |
| 136 |
<p><em><?php esc_html_e('Ensures successful transactions when the sandbox behavior is set to "Use Cents Value".', 'gravityforms-eway'); ?></em></p> |
| 137 |
</fieldset> |
| 138 |
|
| 139 |
<fieldset> |
| 140 |
<legend><?php esc_html_e('Force Customer ID 87654321 in Sandbox', 'gravityforms-eway'); ?></legend> |
| 141 |
<input type="radio" name="gfeway_plugin[forceTestAccount]" id="gfeway_plugin_forceTestAccount_yes" value="1" <?php checked($options['forceTestAccount'], '1'); ?> /> |
| 142 |
<label for="gfeway_plugin_forceTestAccount_yes"><?php echo esc_html_x('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 143 |
<input type="radio" name="gfeway_plugin[forceTestAccount]" id="gfeway_plugin_forceTestAccount_no" value="" <?php checked($options['forceTestAccount'], ''); ?> /> |
| 144 |
<label for="gfeway_plugin_forceTestAccount_no"><?php echo esc_html_x('No', 'settings', 'gravityforms-eway'); ?></label> |
| 145 |
</fieldset> |
| 146 |
|
| 147 |
<fieldset id="gfeway-opt-admin-beagle"> |
| 148 |
<legend><?php printf(__('Use <a href="%s" target="_blank">Beagle Lite</a> for legacy XML API', 'gravityforms-eway'), 'https://eway.io/features/antifraud-beagle-lite'); ?></legend> |
| 149 |
<input type="radio" name="gfeway_plugin[useBeagle]" id="gfeway_plugin_useBeagle_yes" value="1" <?php checked($options['useBeagle'], '1'); ?> /> |
| 150 |
<label for="gfeway_plugin_useBeagle_yes"><?php echo esc_html_x('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 151 |
<input type="radio" name="gfeway_plugin[useBeagle]" id="gfeway_plugin_useBeagle_no" value="" <?php checked($options['useBeagle'], ''); ?> /> |
| 152 |
<label for="gfeway_plugin_useBeagle_no"><?php echo esc_html_x('No', 'settings', 'gravityforms-eway'); ?></label> |
| 153 |
<p id="gfeway-opt-admin-stored-beagle"><em><?php esc_html_e('Beagle Lite is not available for the Stored Payments legacy XML API.', 'gravityforms-eway'); ?></em></p> |
| 154 |
<p id="gfeway-opt-admin-beagle-address"><em><?php esc_html_e('Beagle Lite fraud detection requires an address for each transaction. Be sure to add an Address field to your forms, and make it a required field.', 'gravityforms-eway'); ?></em></p> |
| 155 |
</fieldset> |
| 156 |
|
| 157 |
<fieldset> |
| 158 |
<legend><?php esc_html_e('Verify remote SSL certificate', 'gravityforms-eway'); ?></legend> |
| 159 |
<input type="radio" name="gfeway_plugin[sslVerifyPeer]" id="gfeway_plugin_sslVerifyPeer_yes" value="Y" <?php checked($options['sslVerifyPeer'], '1'); ?> /> |
| 160 |
<label for="gfeway_plugin_sslVerifyPeer_yes"><?php echo esc_html_x('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 161 |
<input type="radio" name="gfeway_plugin[sslVerifyPeer]" id="gfeway_plugin_sslVerifyPeer_no" value="N" <?php checked($options['sslVerifyPeer'], ''); ?> /> |
| 162 |
<label for="gfeway_plugin_sslVerifyPeer_no"><?php echo esc_html_x('No', 'settings', 'gravityforms-eway'); ?></label> |
| 163 |
<p><em><?php printf(__("Only choose 'no' if you can't <a target='_blank' href='%s'>fix your website SSL configuration</a> due to a technical reason.", 'gravityforms-eway'), |
| 164 |
'http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/'); ?></em></p> |
| 165 |
</fieldset> |
| 166 |
|
| 167 |
</td> |
| 168 |
</tr> |
| 169 |
|
| 170 |
</table> |
| 171 |
|
| 172 |
<h4 class="gf_settings_subgroup_title"><?php echo esc_html_x('Error messages', 'settings', 'gravityforms-eway'); ?></h4> |
| 173 |
|
| 174 |
<table class="form-table gforms_form_settings"> |
| 175 |
|
| 176 |
<tr> |
| 177 |
<th colspan="2"><?php esc_html_e('You may customize the error messages below. Leave a message blank to use the default error message.', 'gravityforms-eway'); ?></th> |
| 178 |
</tr> |
| 179 |
|
| 180 |
<tr colspan="2"> |
| 181 |
<td colspan="2"> |
| 182 |
<?php |
| 183 |
$errNames = array ( |
| 184 |
GFEWAY_ERROR_ALREADY_SUBMITTED, |
| 185 |
GFEWAY_ERROR_NO_AMOUNT, |
| 186 |
GFEWAY_ERROR_REQ_CARD_HOLDER, |
| 187 |
GFEWAY_ERROR_REQ_CARD_NAME, |
| 188 |
GFEWAY_ERROR_EWAY_FAIL, |
| 189 |
); |
| 190 |
foreach ($errNames as $errName) { |
| 191 |
$defmsg = $this->plugin->getErrMsg($errName, true); |
| 192 |
$msg = isset($options[$errName]) ? $options[$errName] : get_option($errName); |
| 193 |
?> |
| 194 |
|
| 195 |
<label for="<?php echo esc_attr($errName); ?>"><?php echo esc_html($defmsg); ?></label> |
| 196 |
<input type="text" class="large-text" id="<?php echo esc_attr($errName); ?>" name="gfeway_plugin[<?php echo esc_attr($errName); ?>]" |
| 197 |
value="<?php echo esc_attr($msg); ?>" placeholder="<?php echo esc_attr($defmsg); ?>" /> |
| 198 |
|
| 199 |
<?php |
| 200 |
} |
| 201 |
?> |
| 202 |
</td> |
| 203 |
</tr> |
| 204 |
|
| 205 |
</table> |
| 206 |
|
| 207 |
<?php submit_button(); ?> |
| 208 |
|
| 209 |
</form> |
| 210 |
|
| 211 |
<script> |
| 212 |
(function($) { |
| 213 |
|
| 214 |
function setVisibility() { |
| 215 |
var useTest = ($("input[name='gfeway_plugin[useTest]']:checked").val() === "1"), |
| 216 |
useBeagle = ($("input[name='gfeway_plugin[useBeagle]']:checked").val() === "1"), |
| 217 |
useStored = ($("input[name='gfeway_plugin[useStored]']:checked").val() === "1"), |
| 218 |
useAPI = ($("input[name='gfeway_plugin[apiKey]']").val() !== "" && $("input[name='gfeway_plugin[apiPassword]']").val() !== ""); |
| 219 |
|
| 220 |
function display(element, visible) { |
| 221 |
if (visible) |
| 222 |
element.show(); |
| 223 |
else |
| 224 |
element.hide(); |
| 225 |
} |
| 226 |
|
| 227 |
display($("#gfeway-opt-admin-stored-test"), (useTest && useStored && !useAPI)); |
| 228 |
display($("#gfeway-opt-admin-stored-beagle"), (useBeagle && useStored && !useAPI)); |
| 229 |
display($("#gfeway-opt-admin-beagle"), !useAPI); |
| 230 |
display($("#gfeway-opt-admin-beagle-address"), useBeagle); |
| 231 |
} |
| 232 |
|
| 233 |
$("#eway-settings-form").on("change", "input[name='gfeway_plugin[apiKey]'],input[name='gfeway_plugin[apiPassword]'],input[name='gfeway_plugin[useTest]'],input[name='gfeway_plugin[useBeagle]'],input[name='gfeway_plugin[useStored]']", setVisibility); |
| 234 |
|
| 235 |
setVisibility(); |
| 236 |
|
| 237 |
})(jQuery); |
| 238 |
</script> |
| 239 |
|