Commit 711e6337 authored by obsidiandesign's avatar obsidiandesign

Initial import of the Authorize.Net Webform module.

parents
$Id$
Requirements
------------
Drupal 6.x, Authorize.Net account, PHP + CURL enabled
Installation
------------
1. Copy the authorizenetwebform directory to the Drupal modules directory for your site
2. Login as an administrator. Enable the module in the "Administer" -> "Build" -> "Modules"
3. Go to "Administer" -> "site configuration" -> "Authorize.Net Payment Webform"
From the Post URL dropdown, you can select the Developer (test) server, or the Main
Authorize.Net server. The default is the development server, so make sure to change
the server selection when putting the module into production.
If you have any additional fields you'd like to pass to Authorize.Net, enter them into
the 'Custom Fields' box. Enter in the format key|description. To find the correct key
name, visit the AIM Implementation Guide at http://developer.authorize.net/guides/AIM/.
Under 'Section Three - Transaction Data Requirements', in the AIM Transaction Submission
API link, is the listing of available fields you can submit.
Enter a valid Authorize.Net API Login ID - NOT your username.
Enter the corresponding Account Transaction Key - NOT your password.
Make sure that you check the 'Change Login Information' box.
Save the configuration. Note that the password will not display (for security reasons),
but is stored in the database.
4. Create or edit a webform that you would like to have users submit a payment for.
Under 'Webform Advanced Settings', add the following code for 'Additional Validation', with
the leading space removed before the <?php line:
<?php
require_once(drupal_get_path('module', 'authorizenetwebform') . '/authorizenetwebform.module');
$form_state = authorizenetwebform_process("validate", $form_id, $form_state);
?>
Then, in the 'Additional Processing' box, add the following code, again removing the leading
space removed before the <?php line:
<?php
require_once(drupal_get_path('module', 'authorizenetwebform') . '/authorizenetwebform.module');
$form_state = authorizenetwebform_process("submit", $form_id, $form_state);
?>
For each component added, you may select a Authorize.Net field to map to. The required fields
are listed for easy mapping. Custom fields must be entered into the "Administer" ->
"Site Configuration" -> "Authorize.Net Payment Webform" screen.
As the last entry in the Webform, add a hidden field 'Transaction ID'. Select 'Transaction ID'
as the Authorize.Net key to map to. The transaction ID must be mapped, or the module will not
work correctly.
Save the webform.
5. As your webform is submitted, the credit card information will be authorized and charged. There will
be a slight delay during submission while the transaction is processed. The credit card number will
not be stored in your database, for security purposes. The last 4 digits will be saved, while the
other digits will be replaced with x's.
$Id$
Description:
------------
This module extends the webform module to easily allow submitting a webform
payment through Authorize.Net. The module does require PHP to be built
with CURL enabled in order to use Authorize.Net's AIM interface.
If you are having issues with blank screens or errors on form submissions,
as a first troubleshooting step, make sure you have entered the correct
API ID and Transaction Key (NOT your username or password), and that you
followed all of the instructions in INSTALL.txt.
This module was sponsored by by Davis Applied Technology College,
http://www.datc.edu. The module was programmed by Obsidian Design LLP,
http://www.obsidiandesign.com.
; $Id$
name = Authorize.Net Payment Webform
description = Extends the Webform module to allow Webforms to be paid for using Authorize.Net
package = Integration
dependencies[] = webform
core = 6.x
\ No newline at end of file
<?php
// $Id$
/**
* @file
* Authorize.Net Webform Module Installation File
*
* Provide the required installation/uninstallation functions
* for the Authorize.Net Webform module.
*/
/**
* Implementation of hook_schema().
*/
function authorizenetwebform_schema() {
$schema['authorizenetwebform'] = array(
'description' => t('TODO'),
'fields' => array(
'vid' => array(
'description' => t('TODO'),
'type' => 'int',
'unsigned' => 1,
'not null' => TRUE,
),
'use' => array(
'description' => t('TODO'),
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('vid'),
);
return $schema;
}
/**
* Implementation of hook_install()
*/
function authorizenetwebform_install() {
$success = FALSE;
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
$success = drupal_install_schema('authorizenetwebform');
break;
case 'pgsql':
$success = drupal_install_schema('authorizenetwebform');
break;
}
if ($success[0]['success']) {
drupal_set_message(t('Authorize.Net Payment Webform module installed module tables successfully.'));
}
else {
drupal_set_message(t('The installation of Authorize.Net Payment webform module was unsuccessful.'), 'error');
}
}
/**
* Implementation of hook_uninstall().
*/
function authorizenetwebform_uninstall() {
// Remove tables.
drupal_uninstall_schema('authorizenetwebform');
variable_del("authorizenetwebform_login");
variable_del("authorizenetwebform_transaction");
variable_del("authorizenetwebform_custom_fields");
variable_del("authorizenetwebform_url");
}
\ No newline at end of file
This diff is collapsed.
<?php
// $Id$
/**
* @file
* Authorize.Net Webform Fields File
*
* Prepare and store the available linking fields for Authorize.Net, as well
* as custom fields that are defined by the user.
*/
/**
* Provide the required fields for Authorize.Net processing
*
* @return array
* Provide an array containing the fields that are required by Authorize.Net
*/
function authorizenetwebform_available_fields() {
return array(
//Special Field to block Processing
0 => '--Do Not Map to an Authorize.Net field--',
// Transaction Info
'x_amount' => 'Amount',
'x_card_num' => 'Card Number',
'x_exp_date' => 'Expiration Date (Digits Only)',
'x_description' => 'Transaction Description',
'x_trans_id' => 'Transaction ID (Must be Mapped - Hidden Field)',
//Cardholder Info
'x_first_name' => 'First Name',
'x_last_name' => 'Last Name',
'x_address' => 'Address',
'x_city' => 'City',
'x_state' => 'State',
'x_zip' => 'Zip',
'x_email' => 'Email',
);
}
/**
* Provide any custom fields that users have defined in the admin section.
*
* @return $return_fields
* Provide an array containing any fields that were created by the user.
*/
function authorizenetwebform_load_custom_fields($loadtype) {
$custom_fields = variable_get('authorizenetwebform_custom_fields', array());
$return_fields = array();
if (is_array($custom_fields)) {
if ($loadtype == "webform") {
foreach ($custom_fields as $cfkey => $cfvalue) {
$cfkey = strtolower($cfkey);
$return_fields[$cfkey] = $cfvalue;
}
}
else {
$return_fields = $custom_fields;
}
return $return_fields ;
}
else {
return array();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment