| 1 |
|
| 2 |
<?php settings_errors(GFEWAY_PLUGIN_OPTIONS); ?> |
| 3 |
|
| 4 |
<h3><span><i class="fa fa-credit-card"></i> <?php _ex('eWAY Payments', 'settings page', 'gravityforms-eway'); ?></span></h3> |
| 5 |
|
| 6 |
<form action="<?php echo admin_url('options.php'); ?>" method="POST" id="eway-settings-form"> |
| 7 |
<?php settings_fields(GFEWAY_PLUGIN_OPTIONS); ?> |
| 8 |
|
| 9 |
<table class="form-table"> |
| 10 |
|
| 11 |
<tr> |
| 12 |
<th><label for="gfeway_plugin_apiKey"><?php _e('eWAY API Key', 'gravityforms-eway'); ?></label></th> |
| 13 |
<td> |
| 14 |
<input type="text" class="large-text" name="gfeway_plugin[apiKey]" id="gfeway_plugin_apiKey" value="<?php echo esc_attr($options['apiKey']); ?>" /> |
| 15 |
</td> |
| 16 |
</tr> |
| 17 |
|
| 18 |
<tr> |
| 19 |
<th><label for="gfeway_plugin_apiPassword"><?php _e('eWAY API Password', 'gravityforms-eway'); ?></label></th> |
| 20 |
<td> |
| 21 |
<input type="text" class="regular-text" name="gfeway_plugin[apiPassword]" id="gfeway_plugin_apiPassword" value="<?php echo esc_attr($options['apiPassword']); ?>" /> |
| 22 |
</td> |
| 23 |
</tr> |
| 24 |
|
| 25 |
<tr> |
| 26 |
<th><label for="gfeway_plugin_customerID"><?php _e('eWAY Customer ID', 'gravityforms-eway'); ?></label></th> |
| 27 |
<td> |
| 28 |
<input type="text" class="regular-text" name="gfeway_plugin[customerID]" id="gfeway_plugin_customerID" value="<?php echo esc_attr($options['customerID']); ?>" /> |
| 29 |
<p><em><?php _e('Required for recurring payments and legacy XML API.', 'gravityforms-eway'); ?></em></p> |
| 30 |
</td> |
| 31 |
</tr> |
| 32 |
|
| 33 |
<tr> |
| 34 |
<th><label for="gfeway_plugin_ecryptKey"><?php _e('Client Side Encryption Key', 'gravityforms-eway'); ?></label></th> |
| 35 |
<td> |
| 36 |
<textarea name="gfeway_plugin[ecryptKey]" id="gfeway_plugin_ecryptKey" rows="5" class="large-text"><?php echo esc_attr($options['ecryptKey']); ?></textarea> |
| 37 |
<p><em><?php _e("Securely encrypts sensitive credit card information in the customer's browser, so that a non-PCI certified merchant can accept the form data on their system.", 'gravityforms-eway'); ?></em></p> |
| 38 |
</td> |
| 39 |
</tr> |
| 40 |
|
| 41 |
<tr valign='top'> |
| 42 |
<th><?php _ex('Options', 'settings', 'gravityforms-eway'); ?></th> |
| 43 |
<td> |
| 44 |
|
| 45 |
<fieldset> |
| 46 |
<legend><?php _e('Payment Method', 'gravityforms-eway'); ?></legend> |
| 47 |
<input type="radio" name="gfeway_plugin[useStored]" id="gfeway_plugin_useStored_no" value="" <?php checked($options['useStored'], ''); ?> /> |
| 48 |
<label for="gfeway_plugin_useStored_no"><?php _ex('Capture', 'payment method', 'gravityforms-eway'); ?></label> |
| 49 |
<input type="radio" name="gfeway_plugin[useStored]" id="gfeway_plugin_useStored_yes" value="1" <?php checked($options['useStored'], '1'); ?> /> |
| 50 |
<label for="gfeway_plugin_useStored_yes"><?php _ex('Authorize', 'payment method', 'gravityforms-eway'); ?></label> |
| 51 |
<p id="gfeway-opt-admin-stored-test"><em><?php _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> |
| 52 |
</fieldset> |
| 53 |
|
| 54 |
<fieldset> |
| 55 |
<legend><?php _e('Use Sandbox (testing environment)', 'gravityforms-eway'); ?></legend> |
| 56 |
<input type="radio" name="gfeway_plugin[useTest]" id="gfeway_plugin_useTest_yes" value="1" <?php checked($options['useTest'], '1'); ?> /> |
| 57 |
<label for="gfeway_plugin_useTest_yes"><?php _ex('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 58 |
<input type="radio" name="gfeway_plugin[useTest]" id="gfeway_plugin_useTest_no" value="" <?php checked($options['useTest'], ''); ?> /> |
| 59 |
<label for="gfeway_plugin_useTest_no"><?php _ex('No', 'settings', 'gravityforms-eway'); ?></label> |
| 60 |
</fieldset> |
| 61 |
|
| 62 |
<fieldset> |
| 63 |
<legend><?php _e('Round Amounts for Sandbox', 'gravityforms-eway'); ?></legend> |
| 64 |
<input type="radio" name="gfeway_plugin[roundTestAmounts]" id="gfeway_plugin_roundTestAmounts_yes" value="1" <?php checked($options['roundTestAmounts'], '1'); ?> /> |
| 65 |
<label for="gfeway_plugin_roundTestAmounts_yes"><?php _ex('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 66 |
<input type="radio" name="gfeway_plugin[roundTestAmounts]" id="gfeway_plugin_roundTestAmounts_no" value="" <?php checked($options['roundTestAmounts'], ''); ?> /> |
| 67 |
<label for="gfeway_plugin_roundTestAmounts_no"><?php _ex('No', 'settings', 'gravityforms-eway'); ?></label> |
| 68 |
<p><em><?php _e('Ensures successful transactions when the sandbox behavior is set to "Use Cents Value".', 'gravityforms-eway'); ?></em></p> |
| 69 |
</fieldset> |
| 70 |
|
| 71 |
<fieldset> |
| 72 |
<legend><?php _e('Force Test Customer ID in Sandbox', 'gravityforms-eway'); ?></legend> |
| 73 |
<input type="radio" name="gfeway_plugin[forceTestAccount]" id="gfeway_plugin_forceTestAccount_yes" value="1" <?php checked($options['forceTestAccount'], '1'); ?> /> |
| 74 |
<label for="gfeway_plugin_forceTestAccount_yes"><?php _ex('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 75 |
<input type="radio" name="gfeway_plugin[forceTestAccount]" id="gfeway_plugin_forceTestAccount_no" value="" <?php checked($options['forceTestAccount'], ''); ?> /> |
| 76 |
<label for="gfeway_plugin_forceTestAccount_no"><?php _ex('No', 'settings', 'gravityforms-eway'); ?></label> |
| 77 |
</fieldset> |
| 78 |
|
| 79 |
<fieldset id="gfeway-opt-admin-beagle"> |
| 80 |
<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> |
| 81 |
<input type="radio" name="gfeway_plugin[useBeagle]" id="gfeway_plugin_useBeagle_yes" value="1" <?php checked($options['useBeagle'], '1'); ?> /> |
| 82 |
<label for="gfeway_plugin_useBeagle_yes"><?php _ex('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 83 |
<input type="radio" name="gfeway_plugin[useBeagle]" id="gfeway_plugin_useBeagle_no" value="" <?php checked($options['useBeagle'], ''); ?> /> |
| 84 |
<label for="gfeway_plugin_useBeagle_no"><?php _ex('No', 'settings', 'gravityforms-eway'); ?></label> |
| 85 |
<p id="gfeway-opt-admin-stored-beagle"><em><?php _e('Beagle Lite is not available for the Stored Payments legacy XML API.', 'gravityforms-eway'); ?></em></p> |
| 86 |
<p id="gfeway-opt-admin-beagle-address"><em><?php _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> |
| 87 |
</fieldset> |
| 88 |
|
| 89 |
<fieldset> |
| 90 |
<legend><?php _e('Verify remote SSL certificate', 'gravityforms-eway'); ?></legend> |
| 91 |
<input type="radio" name="gfeway_plugin[sslVerifyPeer]" id="gfeway_plugin_sslVerifyPeer_yes" value="Y" <?php checked($options['sslVerifyPeer'], '1'); ?> /> |
| 92 |
<label for="gfeway_plugin_sslVerifyPeer_yes"><?php _ex('Yes', 'settings', 'gravityforms-eway'); ?></label> |
| 93 |
<input type="radio" name="gfeway_plugin[sslVerifyPeer]" id="gfeway_plugin_sslVerifyPeer_no" value="N" <?php checked($options['sslVerifyPeer'], ''); ?> /> |
| 94 |
<label for="gfeway_plugin_sslVerifyPeer_no"><?php _ex('No', 'settings', 'gravityforms-eway'); ?></label> |
| 95 |
<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'), |
| 96 |
'http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/'); ?></em></p> |
| 97 |
</fieldset> |
| 98 |
|
| 99 |
</td> |
| 100 |
</tr> |
| 101 |
|
| 102 |
<tr> |
| 103 |
<th colspan="2"><?php _e('You may customize the error messages below. Leave a message blank to use the default error message.', 'gravityforms-eway'); ?></th> |
| 104 |
</tr> |
| 105 |
|
| 106 |
<tr colspan="2"> |
| 107 |
<td colspan="2"> |
| 108 |
<?php |
| 109 |
$errNames = array ( |
| 110 |
GFEWAY_ERROR_ALREADY_SUBMITTED, |
| 111 |
GFEWAY_ERROR_NO_AMOUNT, |
| 112 |
GFEWAY_ERROR_REQ_CARD_HOLDER, |
| 113 |
GFEWAY_ERROR_REQ_CARD_NAME, |
| 114 |
GFEWAY_ERROR_EWAY_FAIL, |
| 115 |
); |
| 116 |
foreach ($errNames as $errName) { |
| 117 |
$defmsg = $this->plugin->getErrMsg($errName, true); |
| 118 |
$msg = isset($options[$errName]) ? $options[$errName] : get_option($errName); |
| 119 |
?> |
| 120 |
|
| 121 |
<label for="<?php echo esc_attr($errName); ?>"><?php echo esc_html($defmsg); ?></label> |
| 122 |
<input type="text" class="large-text" id="<?php echo esc_attr($errName); ?>" name="gfeway_plugin[<?php echo esc_attr($errName); ?>]" |
| 123 |
value="<?php echo esc_attr($msg); ?>" placeholder="<?php echo esc_attr($defmsg); ?>" /> |
| 124 |
|
| 125 |
<?php |
| 126 |
} |
| 127 |
?> |
| 128 |
</td> |
| 129 |
</tr> |
| 130 |
|
| 131 |
</table> |
| 132 |
|
| 133 |
<?php submit_button(); ?> |
| 134 |
|
| 135 |
</form> |
| 136 |
|
| 137 |
<script> |
| 138 |
(function($) { |
| 139 |
|
| 140 |
function setVisibility() { |
| 141 |
var useTest = ($("input[name='gfeway_plugin[useTest]']:checked").val() === "1"), |
| 142 |
useBeagle = ($("input[name='gfeway_plugin[useBeagle]']:checked").val() === "1"), |
| 143 |
useStored = ($("input[name='gfeway_plugin[useStored]']:checked").val() === "1"), |
| 144 |
useAPI = ($("input[name='gfeway_plugin[apiKey]']").val() !== "" && $("input[name='gfeway_plugin[apiPassword]']").val() !== ""); |
| 145 |
|
| 146 |
function display(element, visible) { |
| 147 |
if (visible) |
| 148 |
element.show(); |
| 149 |
else |
| 150 |
element.hide(); |
| 151 |
} |
| 152 |
|
| 153 |
display($("#gfeway-opt-admin-stored-test"), (useTest && useStored && !useAPI)); |
| 154 |
display($("#gfeway-opt-admin-stored-beagle"), (useBeagle && useStored && !useAPI)); |
| 155 |
display($("#gfeway-opt-admin-beagle"), !useAPI); |
| 156 |
display($("#gfeway-opt-admin-beagle-address"), useBeagle); |
| 157 |
} |
| 158 |
|
| 159 |
$("#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); |
| 160 |
|
| 161 |
setVisibility(); |
| 162 |
|
| 163 |
})(jQuery); |
| 164 |
</script> |
| 165 |
|