Changed db column(cclastfour) as refundinfo.

Because this field will be used to refund both cc and echeck.
Business checkings can be refunded, too; so mark as 1 this field for business checkings.
That is; refundinfo: is last four digit for credit cards, business checking for echecks.

Merged from MOODLE_17_STABLE.
This commit is contained in:
ethem 2006-11-17 16:06:46 +00:00
parent dfe254ceab
commit 4902ed7c2f
5 changed files with 19 additions and 35 deletions

View File

@ -222,7 +222,7 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
$poststring .= '&x_invoice_num=' . urlencode($extra->orderid);
$poststring .= '&x_amount=' . urlencode($extra->amount);
if ($method == AN_METHOD_CC) {
$poststring .= '&x_card_num=' . sprintf("%04d", intval($order->cclastfour));
$poststring .= '&x_card_num=' . sprintf("%04d", intval($order->refundinfo));
}
break;
}

View File

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="enrol/authorize/db" VERSION="20060809" COMMENT="XMLDB file for Moodle enrol/authorize">
<XMLDB PATH="enrol/authorize/db" VERSION="20061117" COMMENT="XMLDB file for Moodle enrol/authorize"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="enrol_authorize" COMMENT="Holds all known information about authorize.net transactions" NEXT="enrol_authorize_refunds">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="paymentmethod"/>
<FIELD NAME="paymentmethod" TYPE="char" LENGTH="6" NOTNULL="true" DEFAULT="cc" SEQUENCE="false" ENUM="true" ENUMVALUES="'cc', 'echeck'" PREVIOUS="id" NEXT="cclastfour"/>
<FIELD NAME="cclastfour" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="paymentmethod" NEXT="ccname"/>
<FIELD NAME="ccname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="cclastfour" NEXT="courseid"/>
<FIELD NAME="paymentmethod" TYPE="char" LENGTH="6" NOTNULL="true" DEFAULT="cc" SEQUENCE="false" ENUM="true" ENUMVALUES="'cc', 'echeck'" PREVIOUS="id" NEXT="refundinfo"/>
<FIELD NAME="refundinfo" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="paymentmethod" NEXT="ccname"/>
<FIELD NAME="ccname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="refundinfo" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ccname" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="transid"/>
<FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>

View File

@ -1,38 +1,19 @@
<?php //$Id$
// This file keeps track of upgrades to
// the authorize enrol plugin
//
// Sometimes, changes between versions involve
// alterations to database structures and other
// major things that may break installations.
//
// The upgrade function in this file will attempt
// to perform all the necessary actions to upgrade
// your older installtion to the current version.
//
// If there's something it cannot do itself, it
// will tell you what you need to do.
//
// The commands in here will all be database-neutral,
// using the functions defined in lib/ddllib.php
function xmldb_enrol_authorize_upgrade($oldversion=0) {
global $CFG, $THEME, $db;
$result = true;
$status = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
if ($status && $oldversion < 2006101701) {
$table = new XMLDBTable('enrol_authorize');
$field = new XMLDBField('cclastfour');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'paymentmethod');
$status = $status && rename_field($table, $field, 'refundinfo');
}
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of "/lib/ddllib.php" function calls
/// }
return $result;
return $status;
}
?>

View File

@ -148,7 +148,7 @@ class enrolment_plugin_authorize
$timenow = time();
$order = new stdClass();
$order->paymentmethod = AN_METHOD_CC;
$order->cclastfour = substr($form->cc, -4);
$order->refundinfo = substr($form->cc, -4);
$order->ccname = $form->firstname . " " . $form->lastname;
$order->courseid = $course->id;
$order->userid = $USER->id;
@ -309,7 +309,7 @@ class enrolment_plugin_authorize
$timenow = time();
$order = new stdClass();
$order->paymentmethod = AN_METHOD_ECHECK;
$order->cclastfour = $isbusinesschecking ? 1 : 0;
$order->refundinfo = $isbusinesschecking ? 1 : 0;
$order->ccname = $form->firstname . ' ' . $form->lastname;
$order->courseid = $course->id;
$order->userid = $USER->id;

View File

@ -1,6 +1,6 @@
<?php // $Id$
$plugin->version = 2006101700;
$plugin->version = 2006101701;
$plugin->requires = 2006100401;
?>