<tr valign="top">
<td align="right"> </td>
- <td><?php print_string("logininfo", "enrol_authorize") ?></td>
+ <td><?php print_string("logininfo", "enrol_authorize") ?><br />
+ <?php if (isset($mconfig->an_login) && (isset($mconfig->an_tran_key) || isset($mconfig->an_password))) { ?>
+ <br /><a href="enrol_config.php?enrol=authorize&verifyaccount=1"><b><?php print_string("verifyaccount", "enrol_authorize") ?></b></a><br />
+ <?php } ?></td>
</tr>
<tr valign="top">
return; // notice breaks the form and xhtml later
}
+ if (optional_param('verifyaccount', 0, PARAM_INT))
+ {
+ $message = '';
+ if (AN_APPROVED == authorize_verify_account($message)) {
+ notify(get_string('verifyaccountresult', 'enrol_authorize', get_string('success')));
+ } else {
+ notify(get_string('verifyaccountresult', 'enrol_authorize', $message));
+ }
+ return;
+ }
+
if (!empty($frm->an_review)) {
$captureday = intval($frm->an_capture_day);
$emailexpired = intval($frm->an_emailexpired);
return extension_loaded('openssl');
}
+
+function authorize_verify_account(&$message)
+{
+ global $CFG, $USER, $SITE;
+ require_once('authorizenetlib.php');
+
+ $CFG->an_test = 1; // Test mode
+
+ $order = new stdClass();
+ $order->id = -1;
+ $order->paymentmethod = AN_METHOD_CC;
+ $order->refundinfo = '1111';
+ $order->ccname = 'Test User';
+ $order->courseid = $SITE->id;
+ $order->userid = $USER->id;
+ $order->status = AN_STATUS_NONE;
+ $order->settletime = 0;
+ $order->transid = 0;
+ $order->timecreated = time();
+ $order->amount = '0.01';
+ $order->currency = 'USD';
+
+ $extra = new stdClass();
+ $extra->x_card_num = '4111111111111111';
+ $extra->x_card_code = '123';
+ $extra->x_exp_date = "129999";
+ $extra->x_currency_code = $order->currency;
+ $extra->x_amount = $order->amount;
+ $extra->x_first_name = 'Test';
+ $extra->x_last_name = 'User';
+ $extra->x_country = $USER->country;
+
+ $extra->x_invoice_num = $order->id;
+ $extra->x_description = 'Verify Account';
+
+ $message = '';
+ return authorize_action($order, $message, $extra, AN_ACTION_AUTH_CAPTURE, 'vis');
+}
+
?>