@@ -128,7 +139,8 @@ function print_cc_form($classreference)
-
+
+
:
diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php
index ca0569a4893..8b74461d4dc 100755
--- a/enrol/authorize/enrol.php
+++ b/enrol/authorize/enrol.php
@@ -184,9 +184,19 @@ class enrolment_plugin_authorize
$extra->x_phone = '';
$extra->x_fax = '';
+ $revieworder = false;
+ $action = AN_ACTION_AUTH_CAPTURE;
+
+ if (!empty($CFG->an_authcode) && !empty($form->ccauthcode)) {
+ $action = AN_ACTION_CAPTURE_ONLY;
+ $extra->x_auth_code = $form->ccauthcode;
+ }
+ elseif (!empty($CFG->an_review)) {
+ $revieworder = true;
+ $action = AN_ACTION_AUTH_ONLY;
+ }
+
$message = '';
- $an_review = !empty($CFG->an_review);
- $action = $an_review ? AN_ACTION_AUTH_ONLY : AN_ACTION_AUTH_CAPTURE;
if (AN_APPROVED != authorize_action($order, $message, $extra, $action, $form->cctype)) {
email_to_admin($message, $order);
$this->authorizeerrors['header'] = $message;
@@ -195,7 +205,7 @@ class enrolment_plugin_authorize
$SESSION->ccpaid = 1; // security check: don't duplicate payment
if ($order->transid == 0) { // TEST MODE
- if ($an_review) {
+ if ($revieworder) {
redirect($CFG->wwwroot, get_string("reviewnotify", "enrol_authorize"), '30');
}
else {
@@ -205,7 +215,7 @@ class enrolment_plugin_authorize
return;
}
- if ($an_review) { // review enabled, inform site payment managers and redirect the user who have paid to main page.
+ if ($revieworder) { // review enabled, inform site payment managers and redirect the user who have paid to main page.
$a = new stdClass;
$a->url = "$CFG->wwwroot/enrol/authorize/index.php?order=$order->id";
$a->orderid = $order->id;
@@ -453,6 +463,7 @@ class enrolment_plugin_authorize
// optional authorize.net settings
set_config('an_avs', optional_param('an_avs', 0, PARAM_BOOL));
+ set_config('an_authcode', optional_param('an_authcode', 0, PARAM_BOOL));
set_config('an_test', optional_param('an_test', 0, PARAM_BOOL));
set_config('an_referer', optional_param('an_referer', 'http://', PARAM_URL));
diff --git a/enrol/authorize/localfuncs.php b/enrol/authorize/localfuncs.php
index 37fd5e9f91d..b6c83f05cd4 100644
--- a/enrol/authorize/localfuncs.php
+++ b/enrol/authorize/localfuncs.php
@@ -244,8 +244,11 @@ function validate_cc_form($form, &$err)
$err['cctype'] = get_string('missingcctype', 'enrol_authorize');
}
- if (!empty($CFG->an_avs))
- {
+ if (!empty($CFG->an_authcode) && !empty($form->haveauth) && empty($form->ccauthcode)) {
+ $err['ccauthcode'] = get_string('missingccauthcode', 'enrol_authorize');
+ }
+
+ if (!empty($CFG->an_avs)) {
if (empty($form->ccaddress)) {
$err['ccaddress'] = get_string('missingaddress', 'enrol_authorize');
}
@@ -351,7 +354,7 @@ function send_welcome_messages($orderdata)
while ($ei !== false) {
$usercourses = array();
$lastuserid = $ei->userid;
- for ($current = $ei; $current !== false && $current->userid == $lastuserid; $current = next($emailinfo)) {
+ for ($current = $ei; $current !== false && $current->userid == $lastuserid; $current = next($emailinfo)) {
$usercourses[] = $current->fullname;
}
$ei = $current;
diff --git a/lang/en_utf8/enrol_authorize.php b/lang/en_utf8/enrol_authorize.php
index 8fc586ec185..0058e7ebe64 100644
--- a/lang/en_utf8/enrol_authorize.php
+++ b/lang/en_utf8/enrol_authorize.php
@@ -4,6 +4,7 @@
$string['adminacceptccs'] = 'Which credit card types will be accepted?';
$string['adminaccepts'] = 'Select payment methods allowed and their types';
+$string['adminauthcode'] = 'If an user\'s credit card cannot be captured on the internet directly, obtain authorization code over the phone from customer\'s bank.';
$string['adminauthorizeccapture'] = 'Order Review & Scheduled-Capture Settings';
$string['adminauthorizeemail'] = 'Email Sending Settings';
$string['adminauthorizesettings'] = 'Authorize.net Settings';
@@ -49,6 +50,7 @@ $string['antestmode'] = 'Run transactions in test mode only (no money will be dr
$string['antrankey'] = 'Authorize.net: Transaction Key';
$string['approvedreview'] = 'Approved Review';
$string['authcaptured'] = 'Authorized / Captured';
+$string['authcode'] = 'Authorization Code';
$string['authorize:managepayments'] = 'Manage payments';
$string['authorize:uploadcsv']='Upload CSV file';
$string['authorizedpendingcapture'] = 'Authorized / Pending Capture';
@@ -95,6 +97,7 @@ $string['echeckfirslasttname'] = 'Bank Account Owner';
$string['echecksavings'] = 'Savings';
$string['enrolname'] = 'Authorize.net Payment Gateway';
$string['expired'] = 'Expired';
+$string['haveauthcode'] = 'I have already an authorization code';
$string['howmuch'] = 'How much?';
$string['httpsrequired'] = 'We are sorry to inform you that your request cannot be processed now. This site\'s configuration couldn\'t be set up correctly.
Please don\'t enter your credit card number unless you see a yellow lock at the bottom of the browser. If the symbol appears, it means the page encrypts all data sent between client and server. So the information during the transaction between the two computers is protected, hence your credit card number cannot be captured over the internet.';
$string['invalidaba'] = 'Invalid ABA number';
@@ -107,6 +110,7 @@ $string['missingaba'] = 'Missing ABA number';
$string['missingaddress'] = 'Missing address';
$string['missingbankname'] = 'Missing bank name';
$string['missingcc'] = 'Missing card number';
+$string['missingccauthcode'] = 'Missing authorization code';
$string['missingccexpire'] = 'Missing expiration date';
$string['missingcctype'] = 'Missing card type';
$string['missingcvv'] = 'Missing verification number';