From 2c50dc0b6396b6db34469c44569b97b57c61cefb Mon Sep 17 00:00:00 2001 From: ethem Date: Wed, 30 Aug 2006 19:12:28 +0000 Subject: [PATCH] Some UI stuff for ECHECK --- enrol/authorize/authorizenetlib.php | 7 + enrol/authorize/const.php | 18 -- enrol/authorize/enrol.html | 311 ++++++++++++++++++---------- 3 files changed, 206 insertions(+), 130 deletions(-) diff --git a/enrol/authorize/authorizenetlib.php b/enrol/authorize/authorizenetlib.php index 9f4b5ba4dc..054031a78e 100644 --- a/enrol/authorize/authorizenetlib.php +++ b/enrol/authorize/authorizenetlib.php @@ -10,6 +10,13 @@ define('AN_ERROR', '3'); define('AN_DELIM', '|'); define('AN_ENCAP', '"'); +define('AN_REASON_NOCCTYPE', 17); +define('AN_REASON_NOCCTYPE2', 28); +define('AN_REASON_NOACH', 18); +define('AN_REASON_ACHONLY', 56); +define('AN_REASON_NOACHTYPE', 245); +define('AN_REASON_NOACHTYPE2', 246); + require_once($CFG->dirroot.'/enrol/authorize/const.php'); require_once($CFG->dirroot.'/enrol/authorize/enrol.php'); diff --git a/enrol/authorize/const.php b/enrol/authorize/const.php index f092f0d7e7..4396fca8db 100644 --- a/enrol/authorize/const.php +++ b/enrol/authorize/const.php @@ -10,24 +10,6 @@ define('AN_METHOD_CC', 'CC'); define('AN_METHOD_ECHECK', 'ECHECK'); /**#@-*/ -/**#@+ - * Some useful authorize.net responses. - * Autoconfigure payment methods and credit card types. - * - * NOCCTYPE: The merchant does not accept this type of credit card. - * NOACH: ACH transactions are not accepted by this merchant. - * ACHONLY: This merchant accepts ACH transactions only; - * no credit card transactions are accepted. - * - */ -define('AN_REASON_NOCCTYPE', 17); -define('AN_REASON_NOCCTYPE2', 28); -define('AN_REASON_NOACH', 18); -define('AN_REASON_ACHONLY', 56); -define('AN_REASON_NOACHTYPE', 245); -define('AN_REASON_NOACHTYPE2', 246); -/**#@-*/ - /**#@+ * E-Check types * diff --git a/enrol/authorize/enrol.html b/enrol/authorize/enrol.html index d023c63584..1843791c1f 100755 --- a/enrol/authorize/enrol.html +++ b/enrol/authorize/enrol.html @@ -1,120 +1,207 @@ $var)) { - $form->$var = ''; +/// Get payment methods enabled and use the first method as default payment method + $paymentmethodsenabled = enrolment_plugin_authorize::get_list_of_payment_methods(); // methods enabled + $paymentmethod = optional_param('paymentmethod', $paymentmethodsenabled[0], PARAM_ALPHA); // user's payment preference + + if (!in_array($paymentmethod, $paymentmethodsenabled)) { + error("Invalid payment method: $paymentmethod"); } -} -$curcost = enrolment_plugin_authorize::get_course_cost($course); -$userfirstname = empty($form->ccfirstname) ? $USER->firstname : $form->ccfirstname; -$userlastname = empty($form->cclastname) ? $USER->lastname : $form->cclastname; -$useraddress = empty($form->ccaddress) ? $USER->address : $form->ccaddress; -$usercity = empty($form->cccity) ? $USER->city : $form->cccity; -$usercountry = empty($form->cccountry) ? $USER->country : $form->cccountry; + switch ($paymentmethod) + { + case AN_METHOD_CC: + { + print_cc_form($this); + break; + } + + case AN_METHOD_ECHECK: + { + print_eheck_form($this); + break; + } + } +?> + +$var)) { + $form->$var = ''; + } + } + + $curcost = enrolment_plugin_authorize::get_course_cost($course); + $userfirstname = empty($form->ccfirstname) ? $USER->firstname : $form->ccfirstname; + $userlastname = empty($form->cclastname) ? $USER->lastname : $form->cclastname; + $useraddress = empty($form->ccaddress) ? $USER->address : $form->ccaddress; + $usercity = empty($form->cccity) ? $USER->city : $form->cccity; + $usercountry = empty($form->cccountry) ? $USER->country : $form->cccountry; ?> + +

authorizeerrors['header'])) { formerr($classreference->authorizeerrors['header']); } ?>

+
+ +

+

+

-

authorizeerrors['header'])) { formerr($this->authorizeerrors['header']); } ?>

- -
- -

-

-

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -an_avs)) { /* Address Verification System */ ?> - - - - - - - - - - - - - - - - - - - - - -
url = 'enrol.php?id='.$course->id.'&paymentmethod='.AN_METHOD_ECHECK; - print_string("usingecheckmethod", "enrol_authorize", $a); - ?> -
: - authorizeerrors['cc'])) { formerr($this->authorizeerrors['cc']); } ?>
: - - authorizeerrors['ccfirstlast'])) { formerr($this->authorizeerrors['ccfirstlast']); } ?>
: ccexpiremm); - $nowdate = getdate(); - $nowyear = $nowdate["year"]-1; - for ($i=$nowyear; $i<=$nowyear+11; $i++) { - $years[$i] = $i; - } - choose_from_menu($years, 'ccexpireyyyy', $form->ccexpireyyyy); - if (!empty($this->authorizeerrors['ccexpire'])) { formerr($this->authorizeerrors['ccexpire']); } - ?>
: cctype); - if (!empty($this->authorizeerrors['cctype'])) { formerr($this->authorizeerrors['cctype']); } - ?> -
: - - authorizeerrors['cvv'])) { formerr($this->authorizeerrors['cvv']); } ?>
: - authorizeerrors['ccaddress'])) { formerr($this->authorizeerrors['ccaddress']); } ?>
/ : / - - authorizeerrors['cccity'])) { formerr($this->authorizeerrors['cccity']); } ?>
: - authorizeerrors['cccountry'])) { formerr($this->authorizeerrors['cccountry']); } ?>
- - - - -
: - authorizeerrors['cczip'])) { formerr($this->authorizeerrors['cczip']); } ?>
-"> -
- -
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + an_avs)) { /* Address Verification System */ ?> + + + + + + + + + + + + + + + + + + + + + +
 
: + authorizeerrors['cc'])) { formerr($classreference->authorizeerrors['cc']); } ?>
: + + authorizeerrors['ccfirstlast'])) { formerr($classreference->authorizeerrors['ccfirstlast']); } ?>
: ccexpiremm); + $nowdate = getdate(); + $nowyear = $nowdate["year"]-1; + for ($i=$nowyear; $i<=$nowyear+11; $i++) { + $years[$i] = $i; + } + choose_from_menu($years, 'ccexpireyyyy', $form->ccexpireyyyy); + if (!empty($classreference->authorizeerrors['ccexpire'])) { formerr($classreference->authorizeerrors['ccexpire']); } + ?>
: cctype); + if (!empty($classreference->authorizeerrors['cctype'])) { formerr($classreference->authorizeerrors['cctype']); } + ?> +
: + + authorizeerrors['cvv'])) { formerr($classreference->authorizeerrors['cvv']); } ?>
: + authorizeerrors['ccaddress'])) { formerr($classreference->authorizeerrors['ccaddress']); } ?>
/ : / + + authorizeerrors['cccity'])) { formerr($classreference->authorizeerrors['cccity']); } ?>
: + authorizeerrors['cccountry'])) { formerr($classreference->authorizeerrors['cccountry']); } ?>
+ + + + +
: + authorizeerrors['cczip'])) { formerr($classreference->authorizeerrors['cczip']); } ?>
+ "> +
+
+ + +$var)) { + $form->$var = ''; + } + } + + $curcost = enrolment_plugin_authorize::get_course_cost($course); + $userfirstname = empty($form->firstname) ? $USER->firstname : $form->firstname; + $userlastname = empty($form->lastname) ? $USER->lastname : $form->lastname; +?> + +

authorizeerrors['header'])) { formerr($classreference->authorizeerrors['header']); } ?>

+
+ +

+

+

+ +
+ + + + + + + + echeck form (not ready) + + +
 
+ "> +
+
+ + +id.'&paymentmethod='.AN_METHOD_ECHECK; + $stringtofetch = 'usingecheckmethod'; + } + else { + $otheravailable = in_array(AN_METHOD_CC, $paymentmethodsenabled); + $url = 'enrol.php?id='.$course->id.'&paymentmethod='.AN_METHOD_CC; + $stringtofetch = 'usingccmethod'; + } + if ($otheravailable) { + $a = new stdClass; + $a->url = $url; + print_string($stringtofetch, "enrol_authorize", $a); + } +} +?> -- 2.39.5