Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some cleanup: Removed enrolment_plugin_authorize->authorizeerror; bec…

…ause, new forms lib handles all errors.
  • Loading branch information...
commit 8dfaffacfbc7c567cbf7e7987497675460fe7fc0 1 parent 4df4b15
ethem authored
Showing with 14 additions and 25 deletions.
  1. +14 −25 enrol/authorize/enrol.php
View
39 enrol/authorize/enrol.php
@@ -9,13 +9,6 @@
*/
class enrolment_plugin_authorize
{
- /**
- * Error message after connected authorize.net.
- *
- * @var string
- * @access public
- */
- var $authorizeerror;
/**
* Cron log.
@@ -81,23 +74,23 @@ function print_entry($course) {
}
else {
require_once($CFG->dirroot.'/enrol/authorize/enrol_form.php');
- $authorize_enrol = new authorize_enrol_form('enrol.php');
- if ($authorize_enrol->data_submitted() &&
- (AN_METHOD_CC == $form->paymentmethod || AN_METHOD_ECHECK == $form->paymentmethod)) {
+ $frmenrol = new authorize_enrol_form('enrol.php');
+ if ($frmenrol->data_submitted()) {
+ $authorizeerror = '';
switch ($form->paymentmethod) {
case AN_METHOD_CC:
- $this->cc_submit($form, $course);
- break;
+ $authorizeerror = $this->cc_submit($form, $course);
+ break;
case AN_METHOD_ECHECK:
- $this->echeck_submit($form, $course);
- break;
+ $authorizeerror = $this->echeck_submit($form, $course);
+ break;
}
- if (!empty($this->authorizeerror)) {
- error($this->authorizeerror);
+ if (!empty($authorizeerror)) {
+ error($authorizeerror);
}
}
- $authorize_enrol->display();
+ $frmenrol->display();
}
print_simple_box_end();
@@ -168,8 +161,7 @@ function cc_submit($form, $course)
$order->id = insert_record("enrol_authorize", $order);
if (!$order->id) {
email_to_admin("Error while trying to insert new data", $order);
- $this->authorizeerror = "Insert record error. Admin has been notified!";
- return;
+ return "Insert record error. Admin has been notified!";
}
$extra = new stdClass();
@@ -211,8 +203,7 @@ function cc_submit($form, $course)
$message = '';
if (AN_APPROVED != authorize_action($order, $message, $extra, $action, $form->cctype)) {
email_to_admin($message, $order);
- $this->authorizeerror = $message;
- return;
+ return $message;
}
$SESSION->ccpaid = 1; // security check: don't duplicate payment
@@ -331,8 +322,7 @@ function echeck_submit($form, $course)
$order->id = insert_record("enrol_authorize", $order);
if (!$order->id) {
email_to_admin("Error while trying to insert new data", $order);
- $this->authorizeerror = "Insert record error. Admin has been notified!";
- return;
+ return "Insert record error. Admin has been notified!";
}
$extra = new stdClass();
@@ -364,8 +354,7 @@ function echeck_submit($form, $course)
$message = '';
if (AN_REVIEW != authorize_action($order, $message, $extra, AN_ACTION_AUTH_CAPTURE)) {
email_to_admin($message, $order);
- $this->authorizeerror = $message;
- return;
+ return $message;
}
$SESSION->ccpaid = 1; // security check: don't duplicate payment
Please sign in to comment.
Something went wrong with that request. Please try again.