From: ethem Date: Fri, 10 Oct 2008 21:01:27 +0000 (+0000) Subject: + Show "Payments" and "Go to Course" buttons after purchased instead of redirect... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=781c4319e301ef20edf8e83744ab48ecaf790f74;p=moodle.git + Show "Payments" and "Go to Course" buttons after purchased instead of redirect to course. + Restore an_test to original state after account verification. If admin clicks Save Changes after account verification, all transactions go to test mode. --- diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 33f0805175..e50be2eaa3 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -69,7 +69,6 @@ class enrolment_plugin_authorize print_heading(get_string('choosemethod', 'enrol_authorize'), 'center'); } - print_box_start(); if ($USER->username == 'guest') { // only real guest user, not for users with guest role $curcost = get_course_cost($course); echo '
'; @@ -96,9 +95,11 @@ class enrolment_plugin_authorize print_error('authorizeerror', 'enrol_authorize', '', $authorizeerror); } } + + print_box_start(); $frmenrol->display(); + print_box_end(); } - print_box_end(); if ($course->password) { $password = ''; @@ -311,16 +312,17 @@ class enrolment_plugin_authorize message_to_admin("Error while trying to enrol " . fullname($USER) . " in '$course->fullname'", $order); } - if ($SESSION->wantsurl) { - $destination = $SESSION->wantsurl; - unset($SESSION->wantsurl); - } else { - $destination = "$CFG->wwwroot/course/view.php?id=$course->id"; - } - load_all_capabilities(); - redirect($destination, get_string('paymentthanks', 'moodle', $course->fullname), 10); - break; + + print_box_start('generalbox', 'notice'); + echo '

'. get_string('paymentthanks', 'moodle', $course->fullname) .'

'; + echo '
'; + print_single_button("$CFG->wwwroot/enrol/authorize/index.php", array('order'=>$order->id), get_string('payments')); + print_single_button("$CFG->wwwroot/course/view.php", array('id'=>$course->id), $course->fullname); + echo '
'; + print_box_end(); + print_footer($course); + exit; // break; } } return NULL; diff --git a/enrol/authorize/localfuncs.php b/enrol/authorize/localfuncs.php index 67c3ca0ca4..be4b7a17ef 100644 --- a/enrol/authorize/localfuncs.php +++ b/enrol/authorize/localfuncs.php @@ -130,7 +130,7 @@ function message_to_admin($subject, $data) $eventdata->fullmessage = $emailmessage; $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = ''; - $eventdata->smallmessage = ''; + $eventdata->smallmessage = ''; events_trigger('message_send', $eventdata); } @@ -188,7 +188,7 @@ function send_welcome_messages($orderdata) $a->profileurl = "$CFG->wwwroot/user/view.php?id=$lastuserid"; $a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$lastuserid"; $emailmessage = get_string('welcometocoursesemail', 'enrol_authorize', $a); - + $eventdata = new object(); $eventdata->modulename = 'moodle'; $eventdata->userfrom = $sender; @@ -197,7 +197,7 @@ function send_welcome_messages($orderdata) $eventdata->fullmessage = $emailmessage; $eventdata->fullmessageformat = FORMAT_PLAIN; $eventdata->fullmessagehtml = ''; - $eventdata->smallmessage = ''; + $eventdata->smallmessage = ''; events_trigger('message_send', $eventdata); } } @@ -219,6 +219,7 @@ function authorize_verify_account() global $CFG, $USER, $SITE; require_once('authorizenet.class.php'); + $original_antest = $CFG->an_test; $CFG->an_test = 1; // Test mode $order = new stdClass(); @@ -238,7 +239,7 @@ function authorize_verify_account() $extra = new stdClass(); $extra->x_card_num = '4111111111111111'; $extra->x_card_code = '123'; - $extra->x_exp_date = "129999"; + $extra->x_exp_date = "12" . intval(date("Y")) + 5; $extra->x_currency_code = $order->currency; $extra->x_amount = $order->amount; $extra->x_first_name = 'Test'; @@ -246,15 +247,18 @@ function authorize_verify_account() $extra->x_country = $USER->country; $extra->x_invoice_num = $order->id; - $extra->x_description = 'Verify Account'; + $extra->x_description = $SITE->shortname . ' - Authorize.net Merchant Account Verification Test'; + $ret = ''; $message = ''; if (AN_APPROVED == AuthorizeNet::process($order, $message, $extra, AN_ACTION_AUTH_CAPTURE)) { - return get_string('verifyaccountresult', 'enrol_authorize', get_string('success')); + $ret = get_string('verifyaccountresult', 'enrol_authorize', get_string('success')); } else { - return get_string('verifyaccountresult', 'enrol_authorize', $message); + $ret = get_string('verifyaccountresult', 'enrol_authorize', $message); } + $CFG->an_test = $original_antest; + return $ret; } ?>