Skip to content

Commit

Permalink
Added Echeck UI validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ethem committed Aug 31, 2006
1 parent c5ddc3f commit fde7c9d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
31 changes: 29 additions & 2 deletions enrol/authorize/enrol.php
Expand Up @@ -222,7 +222,7 @@ function cc_submit($form, $course)
$message = '';
$an_review = !empty($CFG->an_review);
$action = $an_review ? AN_ACTION_AUTH_ONLY : AN_ACTION_AUTH_CAPTURE;
$success = authorize_action($order, $message, $extra, $action, $form->cctype);
$success = authorize_action($order, $message, $extra, $action, AN_METHOD_CC, $form->cctype);
if (!$success) {
enrolment_plugin_authorize::email_to_admin($message, $order);
$this->authorizeerrors['header'] = $message;
Expand Down Expand Up @@ -401,6 +401,33 @@ function validate_echeck_form($form)
global $CFG;
require_once('abaval.php');

if (empty($form->abacode) || !is_numeric($form->abacode)) {
$this->authorizeerrors['abacode'] = get_string('missingaba', 'enrol_authorize');
}
elseif (!ABAVal($form->abacode)) {
$this->authorizeerrors['abacode'] = get_string('invalidaba', 'enrol_authorize');
}

if (empty($form->accnum) || !is_numeric($form->accnum)) {
$this->authorizeerrors['accnum'] = get_string('invalidaccnum', 'enrol_authorize');
}

if (empty($form->acctype) || !in_array($form->acctype, array('CHECKING','BUSINESSCHECKING','SAVINGS'))) {
$this->authorizeerrors['acctype'] = get_string('invalidacctype', 'enrol_authorize');
}

if (empty($form->bankname)) {
$this->authorizeerrors['bankname'] = get_string('missingbankname', 'enrol_authorize');
}

if (empty($form->firstname) || empty($form->lastname)) {
$this->authorizeerrors['firstlast'] = get_string('missingfullname');
}

if (!empty($this->authorizeerrors)) {
$this->authorizeerrors['header'] = get_string('someerrorswerefound');
return false;
}

return true;
}
Expand Down Expand Up @@ -810,7 +837,7 @@ function cron()
foreach ($orders as $order) {
$message = '';
$extra = NULL;
$success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE);
$success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE, AN_METHOD_CC);
if ($success) {
$timestart = $timeend = 0;
if ($order->enrolperiod) {
Expand Down
2 changes: 1 addition & 1 deletion enrol/authorize/locallib.php
Expand Up @@ -228,7 +228,7 @@ function authorize_print_order_details($orderno)
else {
$message = '';
$extra = NULL;
$success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE);
$success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE, AN_METHOD_CC);
if (!$success) {
$table->data[] = array("<b><font color='red'>$strs->error:</font></b>", $message);
}
Expand Down

0 comments on commit fde7c9d

Please sign in to comment.