From c9befcd1bece7520d747de417daf095135f0b8b2 Mon Sep 17 00:00:00 2001 From: ethem Date: Mon, 30 Oct 2006 12:53:15 +0000 Subject: [PATCH] If an user's credit card cannot be captured on the internet directly, obtain authorization code over phone from customer's bank. Some users may not wish to use their credit cards on the internet directly for security reasons. In this case, you need to obtain an authorization code from user's bank. Initially, ask for credit card information from the customer like bank name, name on card, card number, expiry date and card validation code by means of phone, face-to-face or a billing application. Then, call the customer services of user's bank giving this information and demand an authorization code. Finally, after obtaining it, login as user to get the user enrolled. Alternatively, you can give it to the user saying enrol using this code. --- enrol/authorize/config.html | 7 +++++++ enrol/authorize/enrol.html | 20 ++++++++++++++++---- enrol/authorize/enrol.php | 19 +++++++++++++++---- enrol/authorize/localfuncs.php | 9 ++++++--- lang/en_utf8/enrol_authorize.php | 4 ++++ 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/enrol/authorize/config.html b/enrol/authorize/config.html index 16c2b29a3c..1326f0be0d 100755 --- a/enrol/authorize/config.html +++ b/enrol/authorize/config.html @@ -12,6 +12,7 @@ if (!isset($frm->an_password)) $frm->an_password = ''; if (!isset($frm->delete_current)) $frm->delete_current = ''; if (!isset($frm->an_referer)) $frm->an_referer = 'http://'; if (!isset($frm->an_avs)) $frm->an_avs = ''; +if (!isset($frm->an_authcode)) $frm->an_authcode = ''; if (!isset($frm->an_test)) $frm->an_test = ''; if (!isset($frm->an_review)) $frm->an_review = ''; if (!isset($frm->an_capture_day)) $frm->an_capture_day = '5'; @@ -129,6 +130,12 @@ if (!isset($frm->acceptechecktypes)) { + + an_authcode: + an_authcode)) ?>
+ + + an_test: an_test)) ?>
diff --git a/enrol/authorize/enrol.html b/enrol/authorize/enrol.html index 54f7b2aca2..966dba6419 100755 --- a/enrol/authorize/enrol.html +++ b/enrol/authorize/enrol.html @@ -32,7 +32,7 @@ function print_cc_form($classreference) global $CFG, $USER; $formvars = array( - 'ccaddress', 'cccity', 'ccstate', 'cccountry', 'cczip', + 'ccaddress', 'cccity', 'ccstate', 'cccountry', 'cczip', 'ccauthcode', 'haveauth', 'ccfirstname', 'cclastname', 'cc', 'ccexpiremm', 'ccexpireyyyy', 'cctype', 'cvv' ); foreach ($formvars as $var) { @@ -102,7 +102,18 @@ function print_cc_form($classreference) authorizeerrors['cvv'])) { formerr($classreference->authorizeerrors['cvv']); } ?> - an_avs)) { /* Address Verification System */ ?> + + an_authcode)) : /* Authorization Code */ ?> + + : + haveauth), get_string("haveauthcode", "enrol_authorize")) ?> +
+ + authorizeerrors['ccauthcode'])) { formerr($classreference->authorizeerrors['ccauthcode']); } ?> + + + + an_avs)) : /* Address Verification System */ ?> : @@ -119,7 +130,7 @@ function print_cc_form($classreference) authorizeerrors['cccountry'])) { formerr($classreference->authorizeerrors['cccountry']); } ?> - + @@ -128,7 +139,8 @@ function print_cc_form($classreference) - + + : diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index ca0569a489..8b74461d4d 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 37fd5e9f91..b6c83f05cd 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 8fc586ec18..0058e7ebe6 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'; -- 2.39.5