Permalink
Browse files

Some UI changes.

  • Loading branch information...
1 parent 6b1d270 commit 75bb06e0aa02f37d77505be36b864bb7fe9d588b ethem committed Aug 30, 2006
Showing with 170 additions and 109 deletions.
  1. +7 −8 enrol/authorize/authorizenetlib.php
  2. +56 −61 enrol/authorize/config.html
  3. +3 −3 enrol/authorize/const.php
  4. +20 −10 enrol/authorize/enrol.html
  5. +84 −27 enrol/authorize/enrol.php
@@ -82,7 +82,7 @@ function authorize_expired(&$order)
* @param string &$message Information about error message if this function returns false.
* @param object &$extra Extra data that used for refunding and credit card information.
* @param int $action Which action will be performed. See AN_ACTION_*
- * @param int $method Transaction method. AN_METHOD_CC or AN_METHOD_ECHECK
+ * @param string $method Transaction method. AN_METHOD_CC or AN_METHOD_ECHECK
* @return bool true Transaction was successful, false otherwise. Use $message for reason.
* @author Ethem Evlice <ethem a.t evlice d.o.t com>
* @uses $CFG
@@ -92,8 +92,6 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
global $CFG;
static $conststring;
- $test = !empty($CFG->an_test);
-
if (!isset($conststring)) {
$constdata = array(
'x_version' => '3.1',
@@ -124,27 +122,28 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
$method = AN_METHOD_CC;
}
elseif ($method != AN_METHOD_CC && $method != AN_METHOD_ECHECK) {
- $message = "Missing method: $method";
+ $message = "Invalid method: $method";
return false;
}
+ $action = intval($action);
if ($method == AN_METHOD_ECHECK) {
if ($action != AN_ACTION_AUTH_CAPTURE && $action != AN_ACTION_CREDIT) {
$message = "Please perform AUTH_CAPTURE or CREDIT for echecks";
return false;
}
}
- $action = intval($action);
if ($action <= AN_ACTION_NONE or $action > AN_ACTION_VOID) {
$message = "Invalid action!";
return false;
}
$poststring = $conststring;
- $poststring .= '&x_method=' . ($method==AN_METHOD_CC ? 'CC' : 'ECHECK');
+ $poststring .= '&x_method=' . $method;
+
+ $test = !empty($CFG->an_test);
$poststring .= '&x_test_request=' . ($test ? 'TRUE' : 'FALSE');
- $timenowsettle = getsettletime(time());
switch ($action) {
case AN_ACTION_AUTH_ONLY:
@@ -362,7 +361,7 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
if ($message == '[[' . $reason . ']]') {
$message = isset($response[3]) ? $response[3] : 'unknown error';
}
- if (!empty($CFG->an_avs) and $method == AN_METHOD_CC) {
+ if ($method == AN_METHOD_CC and !empty($CFG->an_avs)) {
$avs = "avs" . strtolower($response[5]);
$stravs = get_string($avs, "enrol_authorize");
$message .= "<br />" . get_string("avsresult", "enrol_authorize", $stravs);
View
@@ -31,13 +31,8 @@
}
if (!isset($frm->acceptmethods)) {
- if (empty($CFG->an_acceptmethods)) {
- $frm->acceptmethods = array('cc');
- $CFG->an_acceptmethods = implode(',', $frm->acceptmethods);
- }
- else {
- $frm->acceptmethods = explode(',', $CFG->an_acceptmethods);
- }
+ $frm->acceptmethods = enrolment_plugin_authorize::get_list_of_payment_methods();
+ $CFG->an_acceptmethods = implode(',', $frm->acceptmethods);
}
if (!isset($frm->acceptccs)) {
@@ -50,99 +45,100 @@
<table cellspacing="0" cellpadding="5" border="0" align="center">
<tr valign="top">
- <td colspan="3" align="right"><a href="../enrol/authorize/index.php"><?php print_string("paymentmanagement", "enrol_authorize") ?></a></td>
+ <td colspan="2" align="right"><a href="../enrol/authorize/index.php"><?php print_string("paymentmanagement", "enrol_authorize") ?></a></td>
</tr>
-<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizewide", "enrol_authorize") ?></h4></td></tr>
+<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizewide", "enrol_authorize") ?></h4></td></tr>
<tr valign="top">
<td align="right">enrol_cost:</td>
- <td><input type="text" size="5" name="enrol_cost" value="<?php p($frm->enrol_cost) ?>" /></td>
- <td><?php print_string("costdefault") ?>. <?php print_string("costdefaultdesc", "enrol_authorize") ?></td>
+ <td><input type="text" size="5" name="enrol_cost" value="<?php p($frm->enrol_cost) ?>" /><br />
+ <?php print_string("costdefault") ?>. <?php print_string("costdefaultdesc", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_currency:</td>
- <td><?php choose_from_menu(get_list_of_currencies(), "enrol_currency", $frm->enrol_currency, "","", "") ?></td>
- <td><?php print_string("currency") ?>
+ <td><?php choose_from_menu(get_list_of_currencies(), "enrol_currency", $frm->enrol_currency, "","", "") ?><br />
+ <?php print_string("currency") ?>
</td>
</tr>
<?php if (substr($CFG->wwwroot, 0, 5) !== 'https') { /* https && loginhttps */ ?>
<tr valign="top">
<td align="right">loginhttps:</td>
- <td><?php echo (empty($CFG->loginhttps) ? "<font color=\"red\"><b>off</b></font>" : "<font color=\"green\">on</font>") ?></td>
<td><?php
- $a->url = "$CFG->wwwroot/$CFG->admin/config.php#configsectionsecurity";
- print_string("logindesc", "enrol_authorize", $a)
- ?></td>
+ echo (empty($CFG->loginhttps) ? "<font color=\"red\"><b>off</b></font>" : "<font color=\"green\">on</font>");
+ $a->url = "$CFG->wwwroot/$CFG->admin/config.php#configsectionsecurity";
+ echo '<br />'; print_string("logindesc", "enrol_authorize", $a);
+ ?>
+ </td>
</tr>
<?php } /* end: https && loginhttps */ ?>
-<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizesettings", "enrol_authorize") ?></h4></td></tr>
+<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizesettings", "enrol_authorize") ?></h4></td></tr>
<tr valign="top">
<td align="right">an_login:</td>
- <td><input type="text" name="an_login" value="<?php p($frm->an_login) ?>" /></td>
- <td><?php print_string("anlogin", "enrol_authorize") ?></td>
+ <td><input type="text" name="an_login" value="<?php p($frm->an_login) ?>" /><br />
+ <?php print_string("anlogin", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">#&nbsp;#&nbsp;</td>
- <td colspan="2"><?php print_string("chooseone", "enrol_authorize") ?></td>
+ <td><?php print_string("chooseone", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_tran_key:</td>
- <td><input type="text" name="an_tran_key" value="<?php p($frm->an_tran_key) ?>" /><sup>#1</sup></td>
- <td><?php print_string("antrankey", "enrol_authorize") ?></td>
+ <td><input type="text" name="an_tran_key" value="<?php p($frm->an_tran_key) ?>" /><sup>#1</sup><br />
+ <?php print_string("antrankey", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_password:</td>
- <td><input type="text" name="an_password" value="" /><sup>#2</sup></td>
- <td><?php print_string("anpassword", "enrol_authorize") ?><br />(<?php print_string("leavetokeep") ?>)</td>
+ <td><input type="text" name="an_password" value="" /><sup>#2</sup><br />
+ <?php print_string("anpassword", "enrol_authorize") ?><br />(<?php print_string("leavetokeep") ?>)</td>
</tr>
<tr valign="top">
<td align="right">delete_current:</td>
- <td><?php print_checkbox('delete_current', '1', !empty($frm->delete_current)) ?></td>
- <td><?php print_string("deletecheck", "moodle", get_string('oldpassword')) ?><br /><br /></td>
+ <td><?php print_checkbox('delete_current', '1', !empty($frm->delete_current)) ?> <br />
+ <?php print_string("deletecheck", "moodle", get_string('oldpassword')) ?><br /><br /></td>
</tr>
<tr valign="top">
<td align="right">an_referer:</td>
- <td><input type="text" name="an_referer" value="<?php p($frm->an_referer) ?>" /></td>
- <td><?php print_string("anreferer", "enrol_authorize") ?></td>
+ <td><input type="text" name="an_referer" value="<?php p($frm->an_referer) ?>" /><br />
+ <?php print_string("anreferer", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_cutoff:</td>
- <td><?php print_time_selector("an_cutoff_hour","an_cutoff_min",make_timestamp(2000,1,1,$frm->an_cutoff_hour,$frm->an_cutoff_min),5); ?></td>
- <td><?php print_string("cutofftime", "enrol_authorize") ?></td>
+ <td><?php print_time_selector("an_cutoff_hour","an_cutoff_min",make_timestamp(2000,1,1,$frm->an_cutoff_hour,$frm->an_cutoff_min),5); ?><br />
+ <?php print_string("cutofftime", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_avs:</td>
- <td><?php print_checkbox('an_avs', '1', !empty($frm->an_avs)) ?></td>
- <td><?php print_string("adminavs", "enrol_authorize") ?></td>
+ <td><?php print_checkbox('an_avs', '1', !empty($frm->an_avs)) ?><br />
+ <?php print_string("adminavs", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_test:</td>
- <td><?php print_checkbox('an_test', '1', !empty($frm->an_test)) ?></td>
- <td><?php print_string("antestmode", "enrol_authorize") ?></td>
+ <td><?php print_checkbox('an_test', '1', !empty($frm->an_test)) ?><br />
+ <?php print_string("antestmode", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_acceptmethods:</td>
<td><?php
- $allmethods = array('CC','ECHECK');
- foreach ($allmethods as $key) {
- print_checkbox('acceptmethods[]', strtolower($key), stristr($CFG->an_acceptmethods, $key) !== false, $key); echo "<br />\n";
+ $allpaymentmethods = enrolment_plugin_authorize::get_list_of_payment_methods(true);
+ $paymentmethodsenabled = enrolment_plugin_authorize::get_list_of_payment_methods();
+ foreach ($allpaymentmethods as $key) {
+ print_checkbox('acceptmethods[]', $key, in_array($key, $paymentmethodsenabled), get_string('method'.strtolower($key),'enrol_authorize')); echo "<br />\n";
}
- ?></td>
- <td><?php print_string("adminacceptmethods", "enrol_authorize") ?></td>
+ ?><br /><?php print_string("adminacceptmethods", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
@@ -152,68 +148,67 @@
foreach ($allccs as $key => $val) {
print_checkbox('acceptccs[]', $key, stristr($CFG->an_acceptccs, $key) !== false, $val); echo "<br />\n";
}
- ?></td>
- <td><?php print_string("adminacceptccs", "enrol_authorize") ?></td>
+ ?><br /><?php print_string("adminacceptccs", "enrol_authorize") ?></td>
</tr>
-<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
+<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
<?php helpbutton('orderreview', '', 'enrol/authorize'); ?>
-</h4></td></tr>
+ </h4></td></tr>
<tr valign="top">
<td align="right">an_review:</td>
<td><?php print_checkbox('an_review', '1', !empty($frm->an_review)) ?>
- <?php helpbutton('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize'); ?></td>
- <td><?php print_string("adminreview", "enrol_authorize") ?></td>
+ <?php helpbutton('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize'); ?><br />
+ <?php print_string("adminreview", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_capture_day:</td>
<td><input type="text" name="an_capture_day" size="2" maxlength="2" value="<?php p($frm->an_capture_day) ?>" />
- <?php helpbutton('captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol/authorize'); ?></td>
- <td><?php print_string("reviewday", "enrol_authorize", $frm->an_capture_day) ?></td>
+ <?php helpbutton('captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol/authorize'); ?><br />
+ <?php print_string("reviewday", "enrol_authorize", $frm->an_capture_day) ?></td>
</tr>
-<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizeemail", "enrol_authorize") ?></h4></td></tr>
+<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizeemail", "enrol_authorize") ?></h4></td></tr>
<tr valign="top">
<td align="right">an_emailexpired:</td>
- <td><input type="text" name="an_emailexpired" size="1" maxlength="1" value="<?php p($frm->an_emailexpired) ?>" /></td>
- <td><?php print_string("adminemailexpired", "enrol_authorize", $frm->an_emailexpired) ?><br />
+ <td><input type="text" name="an_emailexpired" size="1" maxlength="1" value="<?php p($frm->an_emailexpired) ?>" /><br />
+ <?php print_string("adminemailexpired", "enrol_authorize", $frm->an_emailexpired) ?><br />
<?php print_string("adminemailexpsetting", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_emailexpiredteacher:</td>
- <td><?php print_checkbox('an_emailexpiredteacher', '1', !empty($frm->an_emailexpiredteacher)) ?></td>
- <td><?php print_string("adminemailexpiredteacher", "enrol_authorize") ?></td>
+ <td><?php print_checkbox('an_emailexpiredteacher', '1', !empty($frm->an_emailexpiredteacher)) ?><br />
+ <?php print_string("adminemailexpiredteacher", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_sorttype:</td>
<td><?php
$sorts = array('ttl' => get_string('adminemailexpiredsortsum', 'enrol_authorize'),
'cnt' => get_string('adminemailexpiredsortcount', 'enrol_authorize'));
- choose_from_menu($sorts, "an_sorttype", $frm->an_sorttype, "","", "") ?></td>
- <td><?php print_string("adminemailexpiredsort", "enrol_authorize") ?></td>
+ choose_from_menu($sorts, "an_sorttype", $frm->an_sorttype, "","", "") ?><br />
+ <?php print_string("adminemailexpiredsort", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailstudents:</td>
- <td><?php print_checkbox('enrol_mailstudents', '1', !empty($frm->enrol_mailstudents)) ?></td>
- <td><?php print_string("mailstudents") ?></td>
+ <td><?php print_checkbox('enrol_mailstudents', '1', !empty($frm->enrol_mailstudents)) ?><br />
+ <?php print_string("mailstudents") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailteachers:</td>
- <td><?php print_checkbox('enrol_mailteachers', '1', !empty($frm->enrol_mailteachers)) ?></td>
- <td><?php print_string("mailteachers") ?></td>
+ <td><?php print_checkbox('enrol_mailteachers', '1', !empty($frm->enrol_mailteachers)) ?><br />
+ <?php print_string("mailteachers") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailadmins:</td>
- <td><?php print_checkbox('enrol_mailadmins', '1', !empty($frm->enrol_mailadmins)) ?></td>
- <td><?php print_string("mailadmins") ?></td>
+ <td><?php print_checkbox('enrol_mailadmins', '1', !empty($frm->enrol_mailadmins)) ?><br />
+ <?php print_string("mailadmins") ?></td>
</tr>
</table>
@@ -6,8 +6,8 @@
* Credit Card (CC)
* ECheck (ECHECK)
*/
-define('AN_METHOD_CC', 1);
-define('AN_METHOD_ECHECK', 2);
+define('AN_METHOD_CC', 'CC');
+define('AN_METHOD_ECHECK', 'ECHECK');
/**#@-*/
/**#@+
@@ -47,7 +47,7 @@
/**#@-*/
/**#@+
- * Actions used in authorizenet_action function.
+ * Actions used in authorize_action function.
*
* NONE: No action. Function always returns false.
* AUTH_ONLY: Used to authorize only, don't capture.
Oops, something went wrong.

0 comments on commit 75bb06e

Please sign in to comment.