Permalink
Browse files

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.
  • Loading branch information...
1 parent e5708be commit e31d492145cf6eb03b0a05f16dbc440be92ff213 ethem committed Nov 17, 2006
@@ -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;
}
@@ -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"/>
@@ -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;
-
-/// 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.
+ $status = true;
-/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
-/// $result = result of "/lib/ddllib.php" function calls
-/// }
+ 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');
+ }
- return $result;
+ return $status;
}
?>
@@ -143,7 +143,7 @@ function cc_submit($form, $course)
$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;
@@ -296,7 +296,7 @@ function echeck_submit($form, $course)
$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;
@@ -1,6 +1,6 @@
<?php // $Id$
-$plugin->version = 2006101700;
+$plugin->version = 2006101701;
$plugin->requires = 2006100401;
?>

0 comments on commit e31d492

Please sign in to comment.