Initial Commit of AgileBill Open Source

This commit is contained in:
unknown
2008-11-26 14:50:40 -08:00
parent ae5a0fc25e
commit 02306ccc47
2954 changed files with 410976 additions and 0 deletions

View File

@@ -0,0 +1,177 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
Be sure to set the Return Url to point to this script under 'Cart Details' and
Direct Return to 'Yes' in the 2checkout admin area
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_2CHECKOUT extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_2CHECKOUT($checkout_id=false) {
$this->name = '2CHECKOUT';
$this->type = 'redirect';
$this->recurr_only = false;
$this->support_cur = Array ('USD','GBP', 'EUR');
$this->success_url = URL . '?_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c";
$vals = Array (
Array ('x_login', $this->cfg['id']),
Array ('x_amount', $amount),
Array ('x_invoice_num', $invoice),
Array ('x_First_Name', $acct_fields['first_name']),
Array ('x_Last_Name', $acct_fields['last_name']),
Array ('x_Address', $acct_fields['address1']),
Array ('x_City', $acct_fields['city']),
Array ('x_State', $acct_fields['state']),
Array ('x_Zip', $acct_fields['zip']),
Array ('x_email', $acct_fields['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['x_invoice_num'];
$ret['transaction_id'] = $VAR['x_trans_id'];
$ret['amount'] = $VAR['total'];
$ret['status'] = true;
$ret['currency'] = DEFAULT_CURRENCY;
# needed for verification
$order_number = $VAR['x_trans_id']; // invoice_id
$order_id = $VAR['x_invoice_num']; // transaction id
$amount = $VAR['total']; // total
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Get the 2checkout settings
$sid = $this->cfg['id']; // store id
$secret_word = $this->cfg['secret']; // secret word
# Test for demo mode
if (($VAR['demo'] == "Y") && ($this->cfg['mode'] == 1)) {
$do = $false;
}
# If the secret word is set, validate it against what is posted
if(!empty($secret_word)) {
$hash_remote = strtolower($VAR['x_MD5_Hash']);
$string = $secret_word.$sid.$order_number.$amount;
$hash_local = strtolower(md5($string));
if($hash_local != $hash_remote) {
$do = false;
}
}
# Validate agains the posted 2checkout id:
if($sid != $VAR['sid']) {
$do = false;
}
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="?_page=invoice:thankyou&_next_page=invoice:user_view&id='.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_2CHECKOUT;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,190 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
Be sure to set the Return Url to point to this script under 'Cart Details' and
Direct Return to 'Yes' in the 2checkout admin area
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_2CHECKOUT_V2 extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_2CHECKOUT_V2($checkout_id=false) {
$this->name = '2CHECKOUT_V2';
$this->type = 'redirect';
$this->recurr_only = false;
$this->support_cur = Array ('USD','GBP', 'EUR');
$this->success_url = URL . '?_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
if($this->cfg['mode'] == "Y") {
$demo1 = 'demo';
$demo2 = 'Y';
} else {
$demo1 = '';
$demo2 = '';
}
$url = "https://www2.2checkout.com/2co/buyer/purchase";
$vals = Array (
Array ('sid', $this->cfg['id']),
Array ('total', $amount),
Array ('cart_order_id', $invoice),
Array ('card_holder_name', $acct_fields['first_name'] . ' ' . $acct_fields['last_name']),
Array ('street_address', $acct_fields['address1']),
Array ('city', $acct_fields['city']),
Array ('state', $acct_fields['state']),
Array ('zip', $acct_fields['zip']),
Array ('email', $acct_fields['email']),
Array ($demo1, $demo2)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['merchant_product_id'];
$ret['transaction_id'] = $VAR['order_number'];
$ret['amount'] = $VAR['total'];
$ret['status'] = true;
$ret['currency'] = DEFAULT_CURRENCY;
# needed for verification
$order_number = $VAR['merchant_product_id']; // invoice_id
$order_id = $VAR['order_number']; // transaction id
$amount = $VAR['total']; // total
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Get the 2checkout settings
$sid = $this->cfg['id']; // store id
$secret_word = $this->cfg['secret']; // secret word
# Test for demo mode
if (($VAR['demo'] == "Y") && ($this->cfg['mode'] != "Y")) {
$do = $false;
} elseif ($VAR['demo'] == "Y") {
$oid = '1';
} else {
$oid = $order_id;
}
# If the secret word is set, validate it against what is posted
if(!empty($secret_word)) {
$hash_remote = strtoupper($VAR['key']);
$string = $secret_word.$sid.$oid.$amount;
$hash_local = strtoupper(md5($string));
if($hash_local != $hash_remote) {
$do = false;
}
}
# Validate agains the posted 2checkout id:
if($sid != $VAR['sid']) {
$do = false;
}
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="?_page=invoice:thankyou&_next_page=invoice:user_view&id='.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_2CHECKOUT_V2;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,172 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_ACHCOMMERCE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_ACHCOMMERCE($checkout_id=false) {
$this->name = 'ACHCOMMERCE';
$this->type = 'gateway';
$this->eft = true;
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->getDetails($checkout_id);
$this->host = 'gateway.achcommerce.com';
$this->url = '/achgate/achgate.cgi';
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
#if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
$this->validate_eft_details($ret);
/** Determine $acctType
27 => Debit to checking account.
37 => Debit to savings account.
*/
if( $this->billing['eft_check_acct_type'] == 'b') $acctType = 27; else $acctType = 37;
if(empty($this->cfg['batchid']))
$batchid=$invoice.time();
else
$batchid=$this->cfg['batchid'];
# Set the post vars:
$vars = Array (
Array ('usermode', "cgi"),
Array ('action', "submit"),
Array ('replymode', "csv"),
Array ('login', $this->cfg['login']),
Array ('password', $this->cfg['password']),
Array ('merchantid', $this->cfg['merchantid']),
Array ('verstr', $this->cfg['verstr']),
Array ('sec', $this->cfg['sec']),
Array ('batchid', $batchid),
Array ('routing', $this->billing['eft_trn']),
Array ('account', $this->billing['eft_check_acct']),
Array ('checknum', $this->billing['eft_check_checkno']),
Array ('fname', $this->account['first_name']),
Array ('lname', $this->account['last_name']),
Array ('individualid', $invoice),
Array ('amount', round($amount,2)),
Array ('trancode', $acctType),
Array ('paymentdesc', "Payment for Invoice No. {$invoice}"),
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = explode('|', $response);
}
$return_codes = array(
'000' => 'Accepted',
'001' => 'STAR Accepted: Non PPS participant',
'002' => 'STAR Accepted: Non-DDA',
'003' => 'STAR Accepted: No account info',
'100' => 'Failed modulus check',
'101' => 'Failed Thompson Financial lookup',
'110' => 'Failed Equifax check',
'200' => 'Authentication Error',
'300' => 'Missing or invalid routing number',
'301' => 'Missing or invalid merchant id',
'302' => 'Missing or invalid batch id',
'303' => 'Missing or invalid account number',
'304' => 'Missing or invalid fname',
'305' => 'Missing or invalid lname',
'306' => 'Missing or invalid individual id',
'307' => 'Missing or invalid check number',
'308' => 'Missing or invalid amount',
'309' => 'Invalid transaction code',
'310' => 'Invalid standard entry class',
'311' => 'Invalid effective entry date',
'401' => 'STAR Failed: STAR CHEK error',
'402' => 'STAR Failed: Non-DDA',
'403' => 'STAR Failed: No account info',
'500' => 'Invalid Data, no action ',
'900' => 'Unable to connect to database',
'901' => 'Unable to query database',
'902' => 'Unable to prepare query',
'903' => 'Unable to contact STAR'
);
$response_code = $response[0];
if($response_code == '000') {
$ret['status'] = 1;
} else {
$ret['status'] = 0;
foreach($return_codes as $code=>$msg) if($code == $response_code) $ret["msg"] = $msg;
}
/*
echo "<pre>";
print_r($vars);
print_r($response);
exit;
*/
# return
if($ret['status'] == 1) {
$this->redirect = '<script language=Javascript>document.location = "?_page=invoice:thankyou&_next_page=checkout_plugin:plugin_ord_MANUAL_ALERT&id='.$invoice.'";</script>';
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveEFTDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,85 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_ANYPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_ANYPAY($checkout_id=false) {
$this->name = 'ANYPAY';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'includes/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou';
$this->decline_url = URL . '?_page=invoice:decline';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://secure.anypay.com/apmain";
$vals = Array (
Array ('interfaceId', 'LinkPaymentAccept'),
Array ('langCode', strtolower(SESS_CURRENCY)),
Array ('.email', $this->cfg['email']),
Array ('.description', "Payment For Invoice Id. ".$invoice),
Array ('.refUser', $invoice),
Array ('.amount', $amount),
Array ('.clearingMode', '1'),
Array ('.quantityEdit', "false")
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,178 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_AUTHORIZE_NET extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_AUTHORIZE_NET($checkout_id=false) {
$this->name = 'AUTHORIZE_NET';
$this->type = 'gateway';
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou';
$this->getDetails($checkout_id);
$this->host = 'secure.authorize.net';
$this->url = '/gateway/transact.dll';
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] == "100") {
$test = "FALSE";
} else {
$test = "TRUE";
}
# Set the post vars:
$vars = Array (
Array ('x_ADC_URL', "FALSE"),
Array ('x_ADC_Delim_Data', "TRUE"),
Array ('x_Version', "3.0"),
Array ('x_Version', "3.0"),
Array ('x_Currency_Code', $currency_iso),
Array ('x_Method', "CC"),
Array ('x_Type', $this->cfg['x_Transaction_Type']),
Array ('x_Test_Request', $test),
Array ('x_Password', $this->cfg['x_Password']),
Array ('x_Login', $this->cfg['x_Login']),
Array ('x_Amount', $amount),
Array ('x_Invoice_Num', $invoice),
Array ('x_Description', "Payment for Invoice No. ".$invoice),
Array ('x_Card_Code', @$this->billing["ccv"]),
Array ('x_Card_Num', $this->billing["cc_no"]),
Array ('x_Exp_Date', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('x_First_Name', $this->account["first_name"]),
Array ('x_Last_Name', $this->account["last_name"]),
Array ('x_Company', $this->account["company"]),
Array ('x_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_City', $this->account["city"]),
Array ('x_State', $this->account["state"]),
Array ('x_Zip', $this->account["zip"]),
Array ('x_Cust_ID', $acct_fields["id"]),
Array ('x_Email', $acct_fields["email"]),
Array ('x_Country', $country),
Array ('x_Ship_To_First_Name', $this->account["first_name"]),
Array ('x_Ship_To_Last_Name', $this->account["last_name"]),
Array ('x_Ship_To_Company', $this->account["company"]),
Array ('x_Ship_To_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_Ship_To_City', $this->account["city"]),
Array ('x_Ship_To_State', $this->account["state"]),
Array ('x_Ship_To_Zip', $this->account["zip"]),
Array ('x_Ship_To_Country', $country),
Array ('x_Customer_IP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = explode(',', $response);
}
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
@$ret['transaction_id'] = @$response[4];
# Message:
@$ret['msg'] = @$response[3];
# AVS Details:
if ( @$response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( @$response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( @$response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( @$response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( @$response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( @$response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( @$response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( @$response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( @$response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( @$response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( @$response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
# return
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR, $C_debug;
$C_debug->error('AUTHORIZE_NET.php','bill_checkout()', print_r($ret, true));
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,142 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_BLUEPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_BLUEPAY($checkout_id=false) {
$this->name = 'BLUEPAY';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou';
$this->host = 'secure.bluepay.com';
$this->url = '/interfaces/bp10emu';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
if($this->cfg['mode'])
$mode = 'LIVE';
else
$mode = 'TEST';
# Set the post vars:
$vars = Array (
Array ('TAMPER_PROOF_SEAL', md5($this->cfg['secret'] . $this->cfg['account'] . $this->cfg['type'] . $amount . $mode)),
Array ('MODE', $mode),
Array ('MERCHANT', $this->cfg['account']),
Array ('TRANSACTION_TYPE', $this->cfg['type']),
Array ('AMOUNT', $amount),
Array ('AMOUNT_TAX', 0),
Array ('AMOUNT_TYPE', 0),
Array ('COMMENT', ''),
Array ('PHONE', '18885551212'),
Array ('CC_NUM', $this->billing["cc_no"]),
Array ('CC_EXPIRES', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('CVCCVV2', $this->billing["ccv"]),
Array ('ORDER_ID', $invoice),
Array ('INVOICE_ID', $invoice),
Array ('NAME', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('ADDR1', $this->account["address1"]),
Array ('ADDR2', $this->account["address2"]),
Array ('CITY', $this->account["city"]),
Array ('STATE', $this->account["state"]),
Array ('ZIPCODE', $this->account["zip"]),
Array ('EMAIL', $acct_fields["email"])
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Transaction Status:
if (eregi("Result=APPROVED", $response)) {
$ret['status'] = 1;
$ret['msg'] = 'Approved!';
} else {
$ret['status'] = 0;
$ret['msg'] = $response;
}
# Transaction ID:
$tran = explode('ApprovalCode=', $response);
$tran1= explode('&', $response);
$ret['transaction_id'] = @$tran1[0];
# AVS Details:
$tran = explode('AVS=', $response);
$tran1= explode('&', $response);
if(@$tran1[0] == 'y')
$ret['avs'] = 'avs_exact';
else
$ret['avs'] = 'avs_no_match';
# return
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,259 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge,
MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to most
of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software is
covered by the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free software (and charge for this service if you wish),
that you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs; and that you know you can
do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny
you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a
fee, you must give the recipients all the rights that you have. You must make
sure that they, too, receive or can get the source code. And you must show them
these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer
you this license which gives you legal permission to copy, distribute and/or
modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients to
know that what they have is not the original, so that any problems introduced by
others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish
to avoid the danger that redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's free
use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program or
work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included without
limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is not
restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as
you receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty;
keep intact all the notices that refer to this License and to the absence of any
warranty; and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at
your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus
forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all of
these conditions:
a) You must cause the modified files to carry prominent notices stating that you
changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in
part contains or is derived from the Program or any part thereof, to be licensed
as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you
must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this License. (Exception:
if the Program itself is interactive but does not normally print such an
announcement, your work based on the Program is not required to print an
announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License, and
its terms, do not apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a whole which is a
work based on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the entire whole,
and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise the
right to control the distribution of derivative or collective works based on the
Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under Section
2) in object code or executable form under the terms of Sections 1 and 2 above
provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code,
which must be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all the
source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable.
If distribution of executable or object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the source code
from the same place counts as distribution of the source code, even though third
parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or
rights, from you under this License will not have their licenses terminated so
long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the Program
or its derivative works. These actions are prohibited by law if you do not
accept this License. Therefore, by modifying or distributing the Program (or any
work based on the Program), you indicate your acceptance of this License to do
so, and all its terms and conditions for copying, distributing or modifying the
Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor to
copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of the
rights granted herein. You are not responsible for enforcing compliance by third
parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of this
License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as a
consequence you may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by all those
who receive copies directly or indirectly through you, then the only way you
could satisfy both it and this License would be to refrain entirely from
distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and the
section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In such
case, this License incorporates the limitation as if written in the body of this
License.
9. The Free Software Foundation may publish revised and/or new versions of the
General Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new problems
or concerns.
Each version is given a distinguishing version number. If the Program specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Program does not specify a version number of this License, you may choose any
version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status of
all derivatives of our free software and of promoting the sharing and reuse of
software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE
PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED
IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS
IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View File

@@ -0,0 +1,199 @@
README.txt
1. Instructions
2. Description of fields
3. Support policy
4. License
-------------------------------------------------------------------------------
1. Instructions
-------------------------------------------------------------------------------
Please view readme_example.html for additional instructions.
-------------------------------------------------------------------------------
2. Description of fields
-------------------------------------------------------------------------------
// The description of these fields can be found at https://wwws.echo-inc.com/ISPGuide-Interface.asp
$order_type
$transaction_type
$merchant_echo_id
$merchant_pin
$isp_echo_id
$isp_pin
$billing_ip_address
$billing_prefix
$billing_name
$billing_first_name
$billing_last_name
$billing_company_name
$billing_address1
$billing_address2
$billing_city
$billing_state
$billing_zip
$billing_country
$billing_phone
$billing_fax
$billing_email
$cc_number
$ccexp_month
$ccexp_year
$counter
$debug
$ec_account
$ec_account_type
$ec_payment_type
$ec_address1
$ec_address2
$ec_bank_name
$ec_city
$ec_email
$ec_first_name
$ec_id_country
$ec_id_exp_mm
$ec_id_exp_dd
$ec_id_exp_yy
$ec_id_number
$ec_id_state
$ec_id_type
$ec_last_name
$ec_other_name
$ec_payee
$ec_rt
$ec_serial_number
$ec_state
$ec_transaction_dt
$ec_zip
$grand_total
$merchant_email
$merchant_trace_nbr
$original_amount
$original_trandate_mm
$original_trandate_dd
$original_trandate_yyyy
$original_reference
$product_description
$purchase_order_number
$sales_tax
$track1
$track2
$EchoSuccess // if this is true, it will send the order to ECHOnline
$cnp_recurring
$cnp_security
// These variables are used after a transaction has been submitted.
// You always get back all 3 responses
$EchoResponse // Show All 3 ECHOTYPE responses
$echotype1 // Show ECHOTYPE 1 response
$echotype2 // Show ECHOTYPE 2 response - HTML format
$echotype3 // Show ECHOTYPE 3 response - XML format
// ECHOTYPE3 results
$authorization
$order_number
$reference
$status
$avs_result
$security_result
$mac
$decline_code
$tran_date
$merchant_name
$version
-------------------------------------------------------------------------------
3. Support policy
-------------------------------------------------------------------------------
The software on Openecho.com, ECHOpay.com and ECHOcart.com is designed
for developers and programmers to use in programming payment processing on
Web sites or through the Internet. It is designed to operate with the ECHOnline
payment gateway.
All OpenECHO software has been tested and proven operational, and other users
have successfully set it up on their platforms. However, this cannot be guaranteed
for every platform, and we do not warrant that it will work on any other system. It is
offered as is and with no warranty.
Although all the software has been tested, we make no representations as to how
or whether it can or cannot be utilized with a merchant's specific front-end software
(shopping cart, payment form, etc.). It is our policy that the responsibility for setting
up the software lies with the merchant and/or the merchant's programmer to
assure the functionality of the software in payment processing for any given Web
site.
The potential for problems in creating and/or implementing software are extensive,
usually requiring the assistance of expert programmers to resolve. There are many
possible conflicts between shopping cart software, web hosting servers, remote
and/or virtual servers, and various server programs utilized by hosting companies,
etc. It is not ECHO's policy to offer application debugging, or code-level
programming support. It is our policy that such programming challenges are the
responsibility of the merchant and/or the merchant's programmer.
Questions
Questions can be sent to ECHO for general assistance via our developer support e-
mail as found at developer-support@echo-inc.com. Our staff will assist with your
questions, providing answers when they can. In cases where we have an
understanding of your PC or Web site environment and the issues involved, we
provide specific answers and solutions. In other cases, we can help identify the part
of the process where the problem resides, but we may not necessarily know the
exact remedy. In other cases, we may not have the knowledge to troubleshoot
problems with problems residing outside the ECHO environment.
-------------------------------------------------------------------------------
4. License
-------------------------------------------------------------------------------
In case of any license issues related to OpenECHO
please contact developer-support@echo-inc.com
OpenECHO License
* Copyright (c) 2002-2003 The OpenECHO Project. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* I. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* II. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* III. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
"This product includes software developed by the OpenECHO Project.
(http://www.openecho.com)"
* IV. The names "OpenECHO" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact developer-support@echo-inc.com
* V. Products derived from this software may not be called "OpenECHO"
nor may "OpenECHO" appear in their names without prior written
permission of the OpenECHO Project.
* VI. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes software developed by the OpenECHO Project
(http://www.openecho.com)"
* THIS SOFTWARE IS PROVIDED BY THE OpenECHO PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenECHO PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,50 @@
ECHOPHP class 1.6.9 released 01-28-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* Function version_check() was causing problems with Submit being called twice, fixed
ECHOPHP class 1.6.7 released 12-23-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* Removed Openecho ECHOTYPE3 response
ECHOPHP class 1.6.6 released 10-07-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* Removed shipping fields (discontinued)
ECHOPHP class 1.6.5 released 08-27-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* Class no longer sends unnecessary fields to ECHOnline
ECHOPHP class 1.6.4 released 07-28-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* Fix: ec_city needed urlencode()
ECHOPHP class 1.6.3 released 07-02-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* added variables:
$echoPHP->tran_date - The date on which the transaction occurred, formatted CCYYMMDD.
$echoPHP->merchant_name - The DBA name of the merchant as it is currently stored
in the ECHO merchant database.
$echoPHP->version - The version of the ECHONLINE engine that processed the transaction.
ECHOPHP class 1.6.2 released 06-11-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* removed version_compare() and added function version_check() for PHP older than 4.1.0.
ECHOPHP class 1.6.1 released 05-19-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* re-added variable $billing_name for compatibility with ECHOcart
ECHOPHP class 1.6 released 05-16-2003 (Updated by Salim Qadeer sqadeer@echo-inc.com)
* removed discontinued fields cs_factors, cs_flag, cs_host_score, cs_reference_number,
cs_response, cs_score, cs_status, ec_business_acct, ec_merchant_ref, ec_nbds_code, billing_name
* removed misspelled variable $athorization
* combined curl and openssl echophp.class classes into one. The class will automatically find a working solution.
* added variable $decline_code to check if the merchant's ECHO-ID and PIN is valid.
* added error message in a case where the server could not reach ECHOnline
03-28-2003 - updated to reflect additional status and avs_result codes (Updated by Salim Qadeer sqadeer@echo-inc.com)
03-25-2003 - added error messages for missing curl/ssl (Updated by Alex Schultz aschultz@echo-inc.com)
03-21-2003 - fixed issue with cURL 7.10.2 + Win2k (Updated by Salim Qadeer sqadeer@echo-inc.com)
02-18-2003 - the what happened to my auth code release
01-16-2003 - removed duplicate functions
12-03-2002 - added product_description, purchase_order_number
11-18-2002 - added sales_tax
03-12-2002 - added ec_transaction_dt
01-16-2002 - fixed ec_account_type (typo)
01-10-2002 - Added ec_account_type and ec_payment_type for Alex ;-)
Bugs and comments may be sent to developer-support@echo-inc.com

View File

@@ -0,0 +1,989 @@
<?php
/*==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-*/
// //
// Name: ECHOPHP v1.6.9 01-28-2004 //
// Description: PHP Class used to interface with //
// ECHO (http://www.echo-inc.com). //
// Requirements: cURL (if PHP < 4.3) - http://curl.haxx.se/ //
// OpenSSL - http://www.openssl.org //
// Refer to ECHO's documentation for more info: //
// http://www.openecho.com/echo_gateway_guide.html //
// //
// 01-29-2004 - Fixed problem when submit is called twice //
// 01-21-2004 - Fixed warnings about $s and curl_init //
// 12-23-2003 - Removed Openecho ECHOTYPE3 response //
// 10-07-2003 - Removed shipping fields (discontinued) //
// 08-26-2003 - Updated by Salim Qadeer - cleaned up code //
// 05-16-2003 - see WHATSNEW.txt in ECHOPHP class download //
// 03-28-2003 - updated to reflect additional status and //
// avs_result codes //
// 03-25-2003 - added error messages for missing curl/ssl //
// 03-21-2003 - fixed issue with cURL 7.10.2 + Win2k //
// 02-18-2003 - the what happened to my auth code release //
// 01-16-2003 - removed duplicate functions //
// 12-03-2002 - added product_description, //
// purchase_order_number //
// 11-18-2002 - added sales_tax //
// 03-12-2002 - added ec_transaction_dt //
// 01-16-2002 - fixed ec_account_type (typo) //
// 01-10-2002 - Added ec_account_type and ec_payment_type //
// for Alex ;-) //
// //
/*==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-*/
class EchoPHP {
// The description of these fields can be found at https://wwws.echo-inc.com/ISPGuide-Interface.asp
var $order_type;
var $transaction_type;
var $merchant_echo_id;
var $merchant_pin;
var $isp_echo_id;
var $isp_pin;
var $billing_ip_address;
var $billing_prefix;
var $billing_name;
var $billing_first_name;
var $billing_last_name;
var $billing_company_name;
var $billing_address1;
var $billing_address2;
var $billing_city;
var $billing_state;
var $billing_zip;
var $billing_country;
var $billing_phone;
var $billing_fax;
var $billing_email;
var $cc_number;
var $ccexp_month;
var $ccexp_year;
var $counter;
var $debug;
var $ec_account;
var $ec_account_type;
var $ec_payment_type;
var $ec_address1;
var $ec_address2;
var $ec_bank_name;
var $ec_city;
var $ec_email;
var $ec_first_name;
var $ec_id_country;
var $ec_id_exp_mm;
var $ec_id_exp_dd;
var $ec_id_exp_yy;
var $ec_id_number;
var $ec_id_state;
var $ec_id_type;
var $ec_last_name;
var $ec_other_name;
var $ec_payee;
var $ec_rt;
var $ec_serial_number;
var $ec_state;
var $ec_transaction_dt;
var $ec_zip;
var $grand_total;
var $merchant_email;
var $merchant_trace_nbr;
var $original_amount;
var $original_trandate_mm;
var $original_trandate_dd;
var $original_trandate_yyyy;
var $original_reference;
var $product_description;
var $purchase_order_number;
var $sales_tax;
var $track1;
var $track2;
var $EchoSuccess; // if this is true, it will send the order to ECHOnline
var $cnp_recurring;
var $cnp_security;
// These variables are used after a transaction has been submitted.
// You always get back all 3 responses
var $EchoResponse; // All 3 ECHOTYPE responses
var $echotype1; // Show ECHOTYPE 1 response
var $echotype2; // Show ECHOTYPE 2 response - HTML format
var $echotype3; // Show ECHOTYPE 3 response - XML format
// ECHOTYPE3 results - see section under ECHOTYPE3
var $authorization;
var $order_number;
var $reference;
var $status;
var $avs_result;
var $security_result;
var $mac;
var $decline_code;
var $tran_date;
var $merchant_name;
var $version;
function version_check($vercheck)
{
$minver = str_replace(".","", $vercheck);
$curver = str_replace(".","", phpversion());
if ($curver >= $minver)
return true;
else
return false;
}
function Submit()
{
if ($this->EchoServer) {
$URL = $this->EchoServer;
} else {
$URL = "https://wwws.echo-inc.com/scripts/INR200.EXE";
}
$this->EchoResponse = "";
$data = $this->getURLData();
// get the php version number
if (!(phpversion()))
{
die("Please email <a href=\"mailto:developer-support@echo-inc.com\">ECHO Developer Support</a> and notify them know that the echophp.class file cannot find the <a href=\"http://www.php.net\">PHP</a> version number. Please also include your server configuration.\n<br>\n<br>\nServer Software: ".$_SERVER["SERVER_SOFTWARE"]."\n<br>\nPHP Version: ".phpversion());
}
// checks to see if their php is under version 4.3. if it is, then they have to execute
// the curl statements.
if (!$this->version_check("4.3.0"))
{
// if the curl functions do not exist, they must install curl into php
if (!(function_exists(curl_init)))
{
print("Error: cURL component is missing, please install it.\n<br>\n<br>Your <a href=\"http://www.php.net\">PHP</a> currently does not have <a href=\"http://curl.haxx.se\">cURL</a> support, which is required for PHP servers older than 4.3.0. Please contact your hosting company to resolve this issue. <a href=\"http://curl.haxx.se\">cURL</a> must be configured with ./configure --with-ssl, and <a href=\"http://www.php.net\">PHP</a> must be configured with the --with-curl option.\n<br>\n<br>\nServer Software: ".$_SERVER["SERVER_SOFTWARE"]."\n<br>\nPHP Version: ".phpversion());
die("");
}
// they have curl, but it must be configured with ssl to execute curl_exec($ch)
else
{
$ch = @curl_init();
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_URL, $URL);
curl_setopt ($ch, CURLOPT_POST, $data);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
if (!($this->EchoResponse = curl_exec ($ch)))
{
print("You are receiving this error for one of the following reasons:<br><br>1) The cURL component is missing SSL support. When installing <a href=\"http://curl.haxx.se\">cURL</a>, it must be configured with ./configure --with-ssl<br>2) The server cannot establish an internet connection to the <i>ECHO</i>nline server at " . $URL . "<br><br>Please contact your hosting company to resolve this issue.\n<br>\n<br>\nServer Software: ".$_SERVER["SERVER_SOFTWARE"]."\n<br>\nPHP Version: ".phpversion());
die("");
}
curl_close ($ch);
}
}
// else their php can execute using openssl OR curl. if openssl doesn't work, try curl. if
// that doesn't work, give an error message.
else
{
// open the https:// file handle, will error out if OpenSSL support is not compiled into PHP
ini_set('allow_url_fopen', '1');
if (!($handle = @fopen($URL."?".$data, "r")))
{
if ( @function_exists(curl_init) )
{
$ch = @curl_init();
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_URL, $URL);
curl_setopt ($ch, CURLOPT_POST, $data);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
if (!($this->EchoResponse = curl_exec ($ch)))
{
print("You are receiving this error for one of the following reasons:<br><br>1) OpenSSL support is missing (needs to be configured with ./configure --with-openssl), but it found cURL instead. However, the cURL component is missing SSL support. When installing <a href=\"http://curl.haxx.se\">cURL</a>, it must be configured with ./configure --with-ssl<br>2) The server cannot establish an internet connection to the <i>ECHO</i>nline server at " . $URL . "<br><br>Please contact your hosting company to resolve this issue.\n<br>\n<br>\nServer Software: ".$_SERVER["SERVER_SOFTWARE"]."\n<br>\nPHP Version: ".phpversion());
die("");
}
curl_close ($ch);
}
else
{
print("You are receiving this error for one of the following reasons:<br><br>1) OpenSSL support is missing (needs to be configured with ./configure --with-openssl). In your phpinfo(), you are missing the section called 'OpenSSL'. Please contact your hosting company to resolve this issue. ");
if ( strcmp($_ENV["OS"],"Windows_NT") == 0 )
{
print("<br><br>Since this server is running under a Windows box, it may need some modifications. In order to take advantage of the new features in PHP 4.3.0 such as SSL url wrappers you need to install PHP with built-in SSL support. In order to do so you need to install the standard <a href=\"http://www.php.net\">PHP</a> distribution and replace php4ts.dll file with one supplied in <a href=\"http://ftp.proventum.net/pub/php/win32/misc/openssl/\">this</a> archive. ");
print("Since OpenSSL support is built-in into this file, please remember to comment out 'extension=php_openssl.dll' from your php.ini file since the external extension is no longer needed.");
}
else
{
print("<a href=\"http://www.php.net\">PHP</a> needs to be configured with ./configure --with-openssl option.");
}
print("<br><br>2) The server cannot establish an internet connection to the <i>ECHO</i>nline server at " . $URL);
print("\n<br>\n<br>\nServer Software: ".$_SERVER["SERVER_SOFTWARE"]."\n<br>\nPHP Version: ".phpversion());
die("");
}
}
else
{
// get the ECHO Response
$this->EchoResponse = "";
while (!feof ($handle))
{
$buffer = @fgets($handle, 4096);
$this->EchoResponse .= $buffer;
}
}
}
$startpos = strpos($this->EchoResponse, "<ECHOTYPE1>") + 11;
$endpos = strpos($this->EchoResponse, "</ECHOTYPE1>");
$this->echotype1 = substr($this->EchoResponse, $startpos, $endpos - $startpos);
$startpos = strpos($this->EchoResponse, "<ECHOTYPE2>") + 11;
$endpos = strpos($this->EchoResponse, "</ECHOTYPE2>");
$this->echotype2 = substr($this->EchoResponse, $startpos, $endpos - $startpos);
$startpos = strpos($this->EchoResponse, "<ECHOTYPE3>") + 11;
$endpos = strpos($this->EchoResponse, "</ECHOTYPE3>");
$this->echotype3 = substr($this->EchoResponse, $startpos, $endpos - $startpos);
// Get all the metadata.
$this->authorization = $this->GetEchoProp($this->echotype3, "auth_code");
$this->order_number = $this->GetEchoProp($this->echotype3, "order_number");
$this->reference = $this->GetEchoProp($this->echotype3, "echo_reference");
$this->status = $this->GetEchoProp($this->echotype3, "status");
$this->avs_result = $this->GetEchoProp($this->echotype3, "avs_result");
$this->security_result = $this->GetEchoProp($this->echotype3, "security_result");
$this->mac = $this->GetEchoProp($this->echotype3, "mac");
$this->decline_code = $this->GetEchoProp($this->echotype3, "decline_code");
$this->tran_date = $this->GetEchoProp($this->echotype3, "tran_date");
$this->merchant_name = $this->GetEchoProp($this->echotype3, "merchant_name");
$this->version = $this->GetEchoProp($this->echotype3, "version");
if ($this->status == "G" or $this->status == "R")
{
if ($this->transaction_type == "AD")
{
if ($this->avs_result == "X" or $this->avs_result == "Y" or
$this->avs_result == "D" or $this->avs_result == "M")
{
$this->EchoSuccess = true;
}
else
{
$this->EchoSuccess = false;
}
}
else $this->EchoSuccess = true;
}
else
{
$this->EchoSuccess = false;
}
if ($this->EchoResponse == "") {
$this->EchoSuccess = False;
}
// make sure we assign an integer to EchoSuccess
($this->EchoSuccess == true) ? ($this->EchoSuccess = true) : ($this->EchoSuccess = false);
return $this->EchoSuccess;
} // function submit
function getURLData() {
$s = "";
$s .= "order_type=" . $this->order_type;
if ($this->transaction_type) { $s .= "&transaction_type=" . $this->transaction_type; }
if ($this->merchant_echo_id) { $s .= "&merchant_echo_id=" . $this->merchant_echo_id; }
if ($this->merchant_pin) { $s .= "&merchant_pin=" . $this->merchant_pin; }
if ($this->isp_echo_id) { $s .= "&isp_echo_id=" . $this->isp_echo_id; }
if ($this->isp_pin) { $s .= "&isp_pin=" . $this->isp_pin; }
if ($this->authorization) { $s .= "&authorization=" . $this->authorization; }
if ($this->billing_ip_address) { $s .= "&billing_ip_address=" . $this->billing_ip_address; }
if ($this->billing_prefix) { $s .= "&billing_prefix=" . $this->billing_prefix; }
if ($this->billing_name) { $s .= "&billing_name=" . $this->billing_name; }
if ($this->billing_first_name) { $s .= "&billing_first_name=" . $this->billing_first_name; }
if ($this->billing_last_name) { $s .= "&billing_last_name=" . $this->billing_last_name; }
if ($this->billing_company_name) { $s .= "&billing_company_name=" . $billing_company_name; }
if ($this->billing_address1) { $s .= "&billing_address1=" . $this->billing_address1; }
if ($this->billing_address2) { $s .= "&billing_address2=" . $this->billing_address2; }
if ($this->billing_city) { $s .= "&billing_city=" . $this->billing_city; }
if ($this->billing_state) { $s .= "&billing_state=" . $this->billing_state; }
if ($this->billing_zip) { $s .= "&billing_zip=" . $this->billing_zip; }
if ($this->billing_country) { $s .= "&billing_country=" . $this->billing_country; }
if ($this->billing_phone) { $s .= "&billing_phone=" . $this->billing_phone; }
if ($this->billing_fax) { $s .= "&billing_fax=" . $this->billing_fax; }
if ($this->billing_email) { $s .= "&billing_email=" . $this->billing_email; }
if ($this->cc_number) { $s .= "&cc_number=" . $this->cc_number; }
if ($this->ccexp_month) { $s .= "&ccexp_month=" . $this->ccexp_month; }
if ($this->ccexp_year) { $s .= "&ccexp_year=" . $this->ccexp_year; }
if ($this->counter) { $s .= "&counter=" . $this->counter; }
if ($this->debug) { $s .= "&debug=" . $this->debug; }
if ($this->ec_account) { $s .= "&ec_account=" . $this->ec_account; }
if ($this->ec_account_type) { $s .= "&ec_account_type=" . $this->ec_account_type; }
if ($this->ec_payment_type) { $s .= "&ec_payment_type=" . $this->ec_payment_type; }
if ($this->ec_address1) { $s .= "&ec_address1=" . $this->ec_address1; }
if ($this->ec_address2) { $s .= "&ec_address2=" . $this->ec_address2; }
if ($this->ec_bank_name) { $s .= "&ec_bank_name=" . $this->ec_bank_name; }
if ($this->ec_city) { $s .= "&ec_city=" . $this->ec_city; }
if ($this->ec_state) { $s .= "&ec_state=" . $this->ec_state; }
if ($this->ec_email) { $s .= "&ec_email=" . $this->ec_email; }
if ($this->ec_first_name) { $s .= "&ec_first_name=" . $this->ec_first_name; }
if ($this->ec_last_name) { $s .= "&ec_last_name=" . $this->ec_last_name; }
if ($this->ec_other_name) { $s .= "&ec_other_name=" . $this->ec_other_name; }
if ($this->ec_id_country) { $s .= "&ec_id_country=" . $this->ec_id_country; }
if ($this->ec_id_exp_mm) { $s .= "&ec_id_exp_mm=" . $this->ec_id_exp_mm; }
if ($this->ec_id_exp_dd) { $s .= "&ec_id_exp_dd=" . $this->ec_id_exp_dd; }
if ($this->ec_id_exp_yy) { $s .= "&ec_id_exp_yy=" . $this->ec_id_exp_yy; }
if ($this->ec_id_exp_yy) { $s .= "&ec_id_exp_yy=" . $this->ec_id_exp_yy; }
if ($this->ec_id_number) { $s .= "&ec_id_number=" . $this->ec_id_number; }
if ($this->ec_id_state) { $s .= "&ec_id_state=" . $this->ec_id_state; }
if ($this->ec_id_type) { $s .= "&ec_id_type=" . $this->ec_id_type; }
if ($this->ec_payee) { $s .= "&ec_payee=" . $this->ec_payee; }
if ($this->ec_rt) { $s .= "&ec_rt=" . $this->ec_rt; }
if ($this->ec_serial_number) { $s .= "&ec_serial_number=" . $this->ec_serial_number; }
if ($this->ec_transaction_dt) { $s .= "&ec_transaction_dt=" . $this->ec_transaction_dt; }
if ($this->ec_zip) { $s .= "&ec_zip=" . $this->ec_zip; }
if ($this->grand_total) { $s .= "&grand_total=" . $this->grand_total; }
if ($this->merchant_email) { $s .= "&merchant_email=" . $this->merchant_email; }
if ($this->merchant_trace_nbr) { $s .= "&merchant_trace_nbr=" . $this->merchant_trace_nbr; }
if ($this->original_amount) { $s .= "&original_amount=" . $this->original_amount; }
if ($this->original_trandate_mm) { $s .= "&original_trandate_mm=" . $this->original_trandate_mm; }
if ($this->original_trandate_dd) { $s .= "&original_trandate_dd=" . $this->original_trandate_dd; }
if ($this->original_trandate_yyyy) { $s .= "&original_trandate_yyyy=" . $this->original_trandate_yyyy; }
if ($this->original_reference) { $s .= "&original_reference=" . $this->original_reference; }
if ($this->order_number) { $s .= "&order_number=" . $this->order_number; }
if ($this->product_description) { $s .= "&product_description=" . $this->product_description; }
if ($this->purchase_order_number) { $s .= "&purchase_order_number=" . $this->purchase_order_number; }
if ($this->sales_tax) { $s .= "&sales_tax=" . $this->sales_tax; }
if ($this->track1) { $s .= "&track1=" . $this->track1; }
if ($this->track2) { $s .= "&track2=" . $this->track2; }
if ($this->cnp_security) { $s .= "&cnp_security=" . $this->cnp_security; }
if ($this->cnp_recurring) { $s .= "&cnp_recurring=" . $this->cnp_recurring; }
return $s;
} // end getURLData
/**********************************************
All the get/set methods for the echo properties
***********************************************/
function set_order_type($value) {
$this->order_type = urlencode($value);
}
function get_order_type() {
return $this->order_type;
}
function set_transaction_type($value) {
$this->transaction_type = urlencode($value);
}
function get_transaction_type() {
return $this->transaction_type;
}
function set_merchant_echo_id($value) {
$this->merchant_echo_id = urlencode($value);
}
function get_merchant_echo_id() {
return $this->merchant_echo_id;
}
function set_merchant_pin($value) {
$this->merchant_pin = urlencode($value);
}
function get_merchant_pin() {
return $this->merchant_pin;
}
function set_isp_echo_id($value) {
$this->isp_echo_id = urlencode($value);
}
function get_isp_echo_id() {
return $this->isp_echo_id;
}
function set_isp_pin($value) {
$this->isp_pin = urlencode($value);
}
function get_isp_pin() {
return $this->isp_pin;
}
function set_authorization($value) {
$this->authorization = urlencode($value);
}
function get_authorization() {
return $this->authorization;
}
function set_billing_ip_address($value) {
$this->billing_ip_address = urlencode($value);
}
function get_billing_ip_address() {
return $this->billing_ip_address;
}
function set_billing_prefix($value) {
$this->billing_prefix = urlencode($value);
}
function get_billing_prefix() {
return $this->billing_prefix;
}
function set_billing_name($value) {
$this->billing_name = urlencode($value);
}
function get_billing_name() {
return $this->billing_name;
}
function set_billing_first_name($value) {
$this->billing_first_name = urlencode($value);
}
function get_billing_first_name() {
return $this->billing_first_name;
}
function set_billing_last_name($value) {
$this->billing_last_name = urlencode($value);
}
function get_billing_last_name() {
return $this->billing_last_name;
}
function set_billing_company_name($value) {
$this->billing_company_name = urlencode($value);
}
function get_billing_company_name() {
return $this->billing_company_name;
}
function set_billing_address1($value) {
$this->billing_address1 = urlencode($value);
}
function get_billing_address1() {
return $this->billing_address1;
}
function set_billing_address2($value) {
$this->billing_address2 = urlencode($value);
}
function get_billing_address2() {
return $this->billing_address2;
}
function set_billing_city($value) {
$this->billing_city = urlencode($value);
}
function get_billing_city() {
return $this->billing_city;
}
function set_billing_state($value) {
$this->billing_state = urlencode($value);
}
function get_billing_state() {
return $this->billing_state;
}
function set_billing_zip($value) {
$this->billing_zip = urlencode($value);
}
function get_billing_zip() {
return $this->billing_zip;
}
function set_billing_country($value) {
$this->billing_country = urlencode($value);
}
function get_billing_country() {
return $this->billing_country;
}
function set_billing_phone($value) {
$this->billing_phone = urlencode($value);
}
function get_billing_phone() {
return $this->billing_phone;
}
function set_billing_fax($value) {
$this->billing_fax = urlencode($value);
}
function get_billing_fax() {
return $this->billing_fax;
}
function set_billing_email($value) {
$this->billing_email = urlencode($value);
}
function get_billing_email() {
return $this->billing_email;
}
function set_cc_number($value) {
$this->cc_number = urlencode($value);
}
function get_cc_number() {
return $this->cc_number;
}
function set_ccexp_month($value) {
$this->ccexp_month = urlencode($value);
}
function get_ccexp_month() {
return $this->ccexp_month;
}
function set_ccexp_year($value) {
$this->ccexp_year = urlencode($value);
}
function get_ccexp_year() {
return $this->ccexp_year;
}
function set_counter($value) {
$this->counter = urlencode($value);
}
function get_counter() {
return $this->counter;
}
function set_debug($value) {
$this->debug = urlencode($value);
}
function get_debug() {
return $this->debug;
}
function set_ec_account($value) {
$this->ec_account = urlencode($value);
}
function get_ec_account() {
return $this->ec_account;
}
function set_ec_account_type($value) {
$this->ec_account_type = urlencode($value);
}
function get_ec_account_type() {
return $this->ec_account_type;
}
function set_ec_payment_type($value) {
$this->ec_payment_type = urlencode($value);
}
function get_ec_payment_type() {
return $this->ec_payment_type;
}
function set_ec_address1($value) {
$this->ec_address1 = urlencode($value);
}
function get_ec_address1() {
return $this->ec_address1;
}
function set_ec_address2($value) {
$this->ec_address2 = urlencode($value);
}
function get_ec_address2() {
return $this->ec_address2;
}
function set_ec_bank_name($value) {
$this->ec_bank_name = urlencode($value);
}
function get_ec_bank_name() {
return $this->ec_bank_name;
}
function set_ec_city($value) {
$this->ec_city = urlencode($value);
}
function get_ec_city() {
return $this->ec_city;
}
function set_ec_email($value) {
$this->ec_email = urlencode($value);
}
function get_ec_email() {
return $this->ec_email;
}
function set_ec_first_name($value) {
$this->ec_first_name = urlencode($value);
}
function get_ec_first_name() {
return $this->ec_first_name;
}
function set_ec_id_country($value) {
$this->ec_id_country = urlencode($value);
}
function get_ec_id_country() {
return $this->ec_id_country;
}
function set_ec_id_exp_mm($value) {
$this->ec_id_exp_mm = urlencode($value);
}
function get_ec_id_exp_mm() {
return $this->ec_id_exp_mm;
}
function set_ec_id_exp_dd($value) {
$this->ec_id_exp_dd = urlencode($value);
}
function get_ec_id_exp_dd() {
return $this->ec_id_exp_dd;
}
function set_ec_id_exp_yy($value) {
$this->ec_id_exp_yy = urlencode($value);
}
function get_ec_id_exp_yy() {
return $this->ec_id_exp_yy;
}
function set_ec_id_number($value) {
$this->ec_id_number = urlencode($value);
}
function get_ec_id_number() {
return $this->ec_id_number;
}
function set_ec_id_state($value) {
$this->ec_id_state = urlencode($value);
}
function get_ec_id_state() {
return $this->ec_id_state;
}
function set_ec_id_type($value) {
$this->ec_id_type = urlencode($value);
}
function get_ec_id_type() {
return $this->ec_id_type;
}
function set_ec_last_name($value) {
$this->ec_last_name = urlencode($value);
}
function get_ec_last_name() {
return $this->ec_last_name;
}
function set_ec_other_name($value) {
$this->ec_other_name = urlencode($value);
}
function get_ec_other_name() {
return $this->ec_other_name;
}
function set_ec_payee($value) {
$this->ec_payee = urlencode($value);
}
function get_ec_payee() {
return $this->ec_payee;
}
function set_ec_rt($value) {
$this->ec_rt = urlencode($value);
}
function get_ec_rt() {
return $this->ec_rt;
}
function set_ec_serial_number($value) {
$this->ec_serial_number = urlencode($value);
}
function get_ec_serial_number() {
return $this->ec_serial_number;
}
function set_ec_state($value) {
$this->ec_state = urlencode($value);
}
function get_ec_state() {
return $this->ec_state;
}
function set_ec_transaction_dt($value) {
$this->ec_transaction_dt = urlencode($value);
}
function get_ec_transaction_dt() {
return $this->ec_transaction_dt;
}
function set_ec_zip($value) {
$this->ec_zip = urlencode($value);
}
function get_ec_zip() {
return $this->ec_zip;
}
function set_grand_total($value) {
$this->grand_total = sprintf("%01.2f", $value);
}
function get_grand_total() {
return $this->grand_total;
}
function set_merchant_email($value) {
$this->merchant_email = urlencode($value);
}
function get_merchant_email() {
return $this->merchant_email;
}
function set_merchant_trace_nbr($value) {
$this->merchant_trace_nbr = urlencode($value);
}
function get_merchant_trace_nbr() {
return $this->merchant_trace_nbr;
}
function set_original_amount($value) {
$this->original_amount = sprintf("%01.2f", $value);
}
function get_original_amount() {
return $this->original_amount;
}
function set_original_trandate_mm($value) {
$this->original_trandate_mm = urlencode($value);
}
function get_original_trandate_mm() {
return $this->original_trandate_mm;
}
function set_original_trandate_dd($value) {
$this->original_trandate_dd = urlencode($value);
}
function get_original_trandate_dd() {
return $this->original_trandate_dd;
}
function set_original_trandate_yyyy($value) {
$this->original_trandate_yyyy = urlencode($value);
}
function get_original_trandate_yyyy() {
return $this->original_trandate_yyyy;
}
function set_original_reference($value) {
$this->original_reference = urlencode($value);
}
function get_original_reference() {
return $this->original_reference;
}
function set_order_number($value) {
$this->order_number = urlencode($value);
}
function get_order_number() {
return $this->order_number;
}
function set_product_description($value) {
$this->product_description = urlencode($value);
}
function get_product_description() {
return $this->product_description;
}
function set_purchase_order_number($value) {
$this->purchase_order_number = urlencode($value);
}
function get_purchase_order_number() {
return $this->purchase_order_number;
}
function set_sales_tax($value) {
$this->sales_tax = urlencode($value);
}
function get_sales_tax() {
return $this->sales_tax;
}
function set_track1($value) {
$this->track1 = urlencode($value);
}
function get_track1() {
return $this->track1;
}
function set_track2($value) {
$this->track2 = urlencode($value);
}
function get_track2() {
return $this->track2;
}
function set_cnp_recurring($value) {
$this->cnp_recurring = urlencode($value);
}
function set_cnp_security($value) {
$this->cnp_security = urlencode($value);
}
/************************************************
Helper functions
************************************************/
function get_version()
{
return "OpenECHO.com PHP module 1.6.9 01/28/2004";
}
function getRandomCounter() {
mt_srand ((double) microtime() * 1000000);
return mt_rand();
}
function get_EchoResponse() {
return $this->EchoResponse;
}
function get_echotype1() {
return $this->echotype1;
}
function get_echotype2() {
return $this->echotype2;
}
function get_echotype3() {
return $this->echotype3;
}
function set_EchoServer($value) {
$this->EchoServer = $value;
}
function get_avs_result() {
return $this->avs_result;
}
function get_reference() {
return $this->reference;
}
function get_EchoSuccess() {
return $this->EchoSuccess;
}
function get_status() {
return $this->status;
}
function get_security_result() {
return $this->GetEchoProp($this->echotype3, "security_result");
}
function get_mac() {
return $this->GetEchoProp($this->echotype3, "mac");
}
function get_decline_code() {
return $this->GetEchoProp($this->echotype3, "decline_code");
}
function GetEchoProp($haystack, $prop) {
// prepend garbage in case the property
// starts at position 0 .. I know, there's a better way
// to do this, right?
$haystack = "garbage" . $haystack;
if ($start_pos = strpos(strtolower($haystack), "<$prop>")) {
$start_pos = strpos(strtolower($haystack), "<$prop>") + strlen("<$prop>");
$end_pos = strpos(strtolower($haystack), "</$prop");
return substr($haystack, $start_pos, $end_pos - $start_pos);
} else {
return "";
}
}
} // end of class
?>

Binary file not shown.

View File

@@ -0,0 +1,774 @@
<?php
/* lphp.php LINKPOINT PHP MODULE */
/* A php interlocutor CLASS for
LinkPoint: LINKPOINT LSGS API using
libcurl, liblphp.so and liblpssl.so
v3.0.005 20 Aug. 2003 smoffet */
# Copyright 2003 LinkPoint International, Inc. All Rights Reserved.
#
# This software is the proprietary information of LinkPoint International, Inc.
# Use is subject to license terms.
### YOU REALLY DO NOT NEED TO EDIT THIS FILE! ###
class lphp
{
var $debugging;
###########################################
#
# F U N C T I O N p r o c e s s ( )
#
# process a hash table or XML string
# using LIBLPHP.SO and LIBLPSSL.SO
#
###########################################
function process($data)
{
$using_xml = 0;
$webspace = 1;
if (isset($data["webspace"]))
{
if ($data["webspace"] == "false") // if explicitly set to false, don't use html output
$webspace = 0;
}
if ( isset($data["debugging"]) || isset($data["debug"]) )
{
if ($data["debugging"] == "true" || $data["debug"] == "true" )
{
$this->debugging = 1;
# print out incoming hash
if ($webspace) // use html-friendly output
{
echo "at process, incoming data: <br>";
while (list($key, $value) = each($data))
echo htmlspecialchars($key) . " = " . htmlspecialchars($value) . "<BR>\n";
}
else // don't use html output
{
echo "at process, incoming data: \n";
while (list($key, $value) = each($data))
echo "$key = $value\n";
}
reset($data);
}
}
if (isset($data["xml"])) // if XML string is passed in, we'll use it
{
$using_xml = 1;
$xml = $data["xml"];
}
else
{
// otherwise convert incoming hash to XML string
$xml = $this->buildXML($data);
}
// then set up transaction variables
$key = $data["keyfile"];
$host = $data["host"];
$port = $data["port"];
# FOR PERFORMANCE, Use the 'extensions' statement in your php.ini to load
# this library at PHP startup, then comment out the next seven lines
/*
// load library
if (!extension_loaded('liblphp'))
{
if (!dl('liblphp.so'))
{
exit("cannot load liblphp.so, bye\n");
}
}
*/
if ($this->debugging)
{
if ($webspace)
echo "<br>sending xml string:<br>" . htmlspecialchars($xml) . "<br><br>";
else
echo "\nsending xml string:\n$xml\n\n";
}
// send transaction to LSGS
$retstg = send_stg($xml, $key, $host, $port);
if (strlen($retstg) < 4)
exit ("cannot connect to lsgs, exiting");
if ($this->debugging)
{
if (isset($this->webspace)) // we're web space
echo "<br>server responds:<br>" . htmlspecialchars($retstg) . "<br><br>";
else // not html output
echo "\nserver responds:\n $retstg\n\n";
}
if ($using_xml != 1)
{
// convert xml response back to hash
$retarr = $this->decodeXML($retstg);
// and send it back to caller
return ($retarr);
}
else
{
// send server response back
return $retstg;
}
}
#####################################################
#
# F U N C T I O N c u r l _ p r o c e s s ( )
#
# process hash table or xml string table using
# curl, either with PHP built-in curl methods
# or binary executable curl
#
#####################################################
function curl_process($data)
{
$using_xml = 0;
$webspace = 1;
if (isset($data["webspace"]))
{
if ($data["webspace"] == "false") // if explicitly set to false, don't use html output
$webspace = 0;
}
if (isset($data["debugging"]) || isset($data["debug"]) )
{
if ($data["debugging"] == "true" || $data["debug"] == "true" )
{
$this->debugging = 1;
# print out incoming hash
if ($webspace) // use html-friendly output
{
echo "at curl_process, incoming data: <br>";
while (list($key, $value) = each($data))
echo htmlspecialchars($key) . " = " . htmlspecialchars($value) . "<BR>\n";
}
else // don't use html output
{
echo "at curl_process, incoming data: \n";
while (list($key, $value) = each($data))
echo "$key = $value\n";
}
reset($data);
}
}
if (isset($data["xml"])) // if XML string is passed in, we'll use it
{
$using_xml = 1;
$xml = $data["xml"];
}
else
{
// otherwise convert incoming hash to XML string
$xml = $this->buildXML($data);
}
if ($this->debugging)
{
if ($webspace)
echo "<br>sending xml string:<br>" . htmlspecialchars($xml) . "<br><br>";
else
echo "\nsending xml string:\n$xml\n\n";
}
// set up transaction variables
$key = $data["keyfile"];
$port = $data["port"];
$host = "https://".$data["host"].":".$port."/LSGSXML";
if (isset($data["cbin"])) //using BINARY curl methods
{
if ($data["cbin"] == "true")
{
if (isset($data["cpath"]))
$cpath = $data["cpath"];
else // curl path has not been set, try to find curl binary
{
if (getenv("OS") == "Windows_NT")
$cpath = "c:\\curl\\curl.exe";
else
$cpath = "/usr/bin/curl";
}
// look for $cargs variable, otherwise use default curl arguments
if (isset($data["cargs"]))
$args = $data["cargs"];
else
$args = "-m 300 -s -S"; // default curl args; 5 min. timeout
# TRANSACT #
if (getenv("OS") == "Windows_NT")
{
if ($this->debugging)
$result = exec ("$cpath -v -d \"$xml\" -E $key -k $host", $retarr, $retnum);
else
$result = exec ("$cpath -d \"$xml\" -E $key -k $host", $retarr, $retnum);
}
else //*nix string
{
if ($this->debugging)
$result = exec ("'$cpath' $args -v -E '$key' -d '$xml' '$host'", $retarr, $retnum);
else
$result = exec ("'$cpath' $args -E '$key' -d '$xml' '$host'", $retarr, $retnum);
}
# EVALUATE RESPONSE #
if (strlen($result) < 2) // no response
{
$result = "<r_approved>FAILURE</r_approved><r_error>Could not connect.</r_error>";
return $result;
}
if ($this->debugging)
{
if ($this->webspace)
echo "<br>server responds:<br>" . htmlspecialchars($result) . "<br><br>";
else // non html output
echo "\nserver responds:\n $result\n\n";
}
if ($using_xml == 1)
{
// return xml string straight from server
return ($result);
}
else
{
// convert xml response back to hash
$retarr = $this->decodeXML($result);
// and send it back to caller. Done.
return ($retarr);
}
}
}
else // using BUILT-IN PHP curl methods
{
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL,$host);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt ($ch, CURLOPT_SSLCERT, $key);
# curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
# curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
if ($this->debugging)
curl_setopt ($ch, CURLOPT_VERBOSE, 1);
# use curl to send the xml SSL string
$result = curl_exec ($ch);
curl_close($ch);
if (strlen($result) < 2) # no response
{
$result = "<r_approved>FAILURE</r_approved><r_error>Could not connect.</r_error>";
return $result;
}
if ($this->debugging)
{
if ($webspace) // html-friendly output
echo "<br>server responds:<br>" . htmlspecialchars($result) . "<br><br>";
else
echo "\nserver responds:\n $result\n\n";
}
if ($using_xml)
{
# send xml response back
return $result;
}
else
{
#convert xml response to hash
$retarr = $this->decodeXML($result);
# and send it back
return ($retarr);
}
}
}
#############################################
#
# F U N C T I O N d e c o d e X M L ( )
#
# converts the LSGS response xml string
# to a hash of name-value pairs
#
#############################################
function decodeXML($xmlstg)
{
preg_match_all ("/<(.*?)>(.*?)\</", $xmlstg, $out, PREG_SET_ORDER);
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]] = strip_tags($out[$n][0]);
$n++;
}
return $retarr;
}
############################################
#
# F U N C T I O N b u i l d X M L ( )
#
# converts a hash of name-value pairs
# to the correct XML format for LSGS
#
############################################
function buildXML($pdata)
{
// while (list($key, $value) = each($pdata))
// echo htmlspecialchars($key) . " = " . htmlspecialchars($value) . "<br>\n";
### ORDEROPTIONS NODE ###
$xml = "<order><orderoptions>";
if (isset($pdata["ordertype"]))
$xml .= "<ordertype>" . $pdata["ordertype"] . "</ordertype>";
if (isset($pdata["result"]))
$xml .= "<result>" . $pdata["result"] . "</result>";
$xml .= "</orderoptions>";
### CREDITCARD NODE ###
$xml .= "<creditcard>";
if (isset($pdata["cardnumber"]))
$xml .= "<cardnumber>" . $pdata["cardnumber"] . "</cardnumber>";
if (isset($pdata["cardexpmonth"]))
$xml .= "<cardexpmonth>" . $pdata["cardexpmonth"] . "</cardexpmonth>";
if (isset($pdata["cardexpyear"]))
$xml .= "<cardexpyear>" . $pdata["cardexpyear"] . "</cardexpyear>";
if (isset($pdata["cvmvalue"]))
$xml .= "<cvmvalue>" . $pdata["cvmvalue"] . "</cvmvalue>";
if (isset($pdata["cvmindicator"]))
$xml .= "<cvmindicator>" . $pdata["cvmindicator"] . "</cvmindicator>";
if (isset($pdata["track"]))
$xml .= "<track>" . $pdata["track"] . "</track>";
$xml .= "</creditcard>";
### BILLING NODE ###
$xml .= "<billing>";
if (isset($pdata["name"]))
$xml .= "<name>" . $pdata["name"] . "</name>";
if (isset($pdata["company"]))
$xml .= "<company>" . $pdata["company"] . "</company>";
if (isset($pdata["address1"]))
$xml .= "<address1>" . $pdata["address1"] . "</address1>";
elseif (isset($pdata["address"]))
$xml .= "<address1>" . $pdata["address"] . "</address1>";
if (isset($pdata["address2"]))
$xml .= "<address2>" . $pdata["address2"] . "</address2>";
if (isset($pdata["city"]))
$xml .= "<city>" . $pdata["city"] . "</city>";
if (isset($pdata["state"]))
$xml .= "<state>" . $pdata["state"] . "</state>";
if (isset($pdata["zip"]))
$xml .= "<zip>" . $pdata["zip"] . "</zip>";
if (isset($pdata["country"]))
$xml .= "<country>" . $pdata["country"] . "</country>";
if (isset($pdata["userid"]))
$xml .= "<userid>" . $pdata["userid"] . "</userid>";
if (isset($pdata["email"]))
$xml .= "<email>" . $pdata["email"] . "</email>";
if (isset($pdata["phone"]))
$xml .= "<phone>" . $pdata["phone"] . "</phone>";
if (isset($pdata["fax"]))
$xml .= "<fax>" . $pdata["fax"] . "</fax>";
if (isset($pdata["addrnum"]))
$xml .= "<addrnum>" . $pdata["addrnum"] . "</addrnum>";
$xml .= "</billing>";
## SHIPPING NODE ##
$xml .= "<shipping>";
if (isset($pdata["sname"]))
$xml .= "<name>" . $pdata["sname"] . "</name>";
if (isset($pdata["saddress1"]))
$xml .= "<address1>" . $pdata["saddress1"] . "</address1>";
if (isset($pdata["saddress2"]))
$xml .= "<address2>" . $pdata["saddress2"] . "</address2>";
if (isset($pdata["scity"]))
$xml .= "<city>" . $pdata["scity"] . "</city>";
if (isset($pdata["sstate"]))
$xml .= "<state>" . $pdata["sstate"] . "</state>";
elseif (isset($pdata["state"]))
$xml .= "<state>" . $pdata["state"] . "</state>";
if (isset($pdata["szip"]))
$xml .= "<zip>" . $pdata["szip"] . "</zip>";
elseif (isset($pdata["zip"]))
$xml .= "<zip>" . $pdata["zip"] . "</zip>";
if (isset($pdata["scountry"]))
$xml .= "<country>" . $pdata["scountry"] . "</country>";
if (isset($pdata["scarrier"]))
$xml .= "<carrier>" . $pdata["scarrier"] . "</carrier>";
if (isset($pdata["sitems"]))
$xml .= "<items>" . $pdata["sitems"] . "</items>";
if (isset($pdata["sweight"]))
$xml .= "<weight>" . $pdata["sweight"] . "</weight>";
if (isset($pdata["stotal"]))
$xml .= "<total>" . $pdata["stotal"] . "</total>";
$xml .= "</shipping>";
### TRANSACTIONDETAILS NODE ###
$xml .= "<transactiondetails>";
if (isset($pdata["oid"]))
$xml .= "<oid>" . $pdata["oid"] . "</oid>";
if (isset($pdata["ponumber"]))
$xml .= "<ponumber>" . $pdata["ponumber"] . "</ponumber>";
if (isset($pdata["recurring"]))
$xml .= "<recurring>" . $pdata["recurring"] . "</recurring>";
if (isset($pdata["taxexempt"]))
$xml .= "<taxexempt>" . $pdata["taxexempt"] . "</taxexempt>";
if (isset($pdata["terminaltype"]))
$xml .= "<terminaltype>" . $pdata["terminaltype"] . "</terminaltype>";
if (isset($pdata["ip"]))
$xml .= "<ip>" . $pdata["ip"] . "</ip>";
if (isset($pdata["reference_number"]))
$xml .= "<reference_number>" . $pdata["reference_number"] . "</reference_number>";
if (isset($pdata["transactionorigin"]))
$xml .= "<transactionorigin>" . $pdata["transactionorigin"] . "</transactionorigin>";
if (isset($pdata["tdate"]))
$xml .= "<tdate>" . $pdata["tdate"] . "</tdate>";
$xml .= "</transactiondetails>";
### MERCHANTINFO NODE ###
$xml .= "<merchantinfo>";
if (isset($pdata["configfile"]))
$xml .= "<configfile>" . $pdata["configfile"] . "</configfile>";
if (isset($pdata["keyfile"]))
$xml .= "<keyfile>" . $pdata["keyfile"] . "</keyfile>";
if (isset($pdata["host"]))
$xml .= "<host>" . $pdata["host"] . "</host>";
if (isset($pdata["port"]))
$xml .= "<port>" . $pdata["port"] . "</port>";
if (isset($pdata["appname"]))
$xml .= "<appname>" . $pdata["appname"] . "</appname>";
$xml .= "</merchantinfo>";
### PAYMENT NODE ###
$xml .= "<payment>";
if (isset($pdata["chargetotal"]))
$xml .= "<chargetotal>" . $pdata["chargetotal"] . "</chargetotal>";
if (isset($pdata["tax"]))
$xml .= "<tax>" . $pdata["tax"] . "</tax>";
if (isset($pdata["vattax"]))
$xml .= "<vattax>" . $pdata["vattax"] . "</vattax>";
if (isset($pdata["shipping"]))
$xml .= "<shipping>" . $pdata["shipping"] . "</shipping>";
if (isset($pdata["subtotal"]))
$xml .= "<subtotal>" . $pdata["subtotal"] . "</subtotal>";
$xml .= "</payment>";
### CHECK NODE ###
if (isset($pdata["voidcheck"]))
{
$xml .= "<telecheck><void>1</void></telecheck>";
}
elseif (isset($pdata["routing"]))
{
$xml .= "<telecheck>";
$xml .= "<routing>" . $pdata["routing"] . "</routing>";
if (isset($pdata["account"]))
$xml .= "<account>" . $pdata["account"] . "</account>";
if (isset($pdata["bankname"]))
$xml .= "<bankname>" . $pdata["bankname"] . "</bankname>";
if (isset($pdata["bankstate"]))
$xml .= "<bankstate>" . $pdata["bankstate"] . "</bankstate>";
if (isset($pdata["ssn"]))
$xml .= "<ssn>" . $pdata["ssn"] . "</ssn>";
if (isset($pdata["dl"]))
$xml .= "<dl>" . $pdata["dl"] . "</dl>";
if (isset($pdata["dlstate"]))
$xml .= "<dlstate>" . $pdata["dlstate"] . "</dlstate>";
if (isset($pdata["checknumber"]))
$xml .= "<checknumber>" . $pdata["checknumber"] . "</checknumber>";
if (isset($pdata["accounttype"]))
$xml .= "<accounttype>" . $pdata["accounttype"] . "</accounttype>";
$xml .= "</telecheck>";
}
### PERIODIC NODE ###
if (isset($pdata["startdate"]))
{
$xml .= "<periodic>";
$xml .= "<startdate>" . $pdata["startdate"] . "</startdate>";
if (isset($pdata["installments"]))
$xml .= "<installments>" . $pdata["installments"] . "</installments>";
if (isset($pdata["threshold"]))
$xml .= "<threshold>" . $pdata["threshold"] . "</threshold>";
if (isset($pdata["periodicity"]))
$xml .= "<periodicity>" . $pdata["periodicity"] . "</periodicity>";
if (isset($pdata["pbcomments"]))
$xml .= "<comments>" . $pdata["pbcomments"] . "</comments>";
if (isset($pdata["action"]))
$xml .= "<action>" . $pdata["action"] . "</action>";
$xml .= "</periodic>";
}
### NOTES NODE ###
if (isset($pdata["comments"]) || isset($pdata["referred"]))
{
$xml .= "<notes>";
if (isset($pdata["comments"]))
$xml .= "<comments>" . $pdata["comments"] . "</comments>";
if (isset($pdata["referred"]))
$xml .= "<referred>" . $pdata["referred"] . "</referred>";
$xml .= "</notes>";
}
### ITEMS AND OPTIONS NODES ###
if ($this->debugging) // make it easy to see
{ // LSGS doesn't mind whitespace
reset($pdata);
while (list ($key, $val) = each ($pdata))
{
if (is_array($val))
{
$otag = 0;
$ostag = 0;
$items_array = $val;
$xml .= "\n<items>\n";
while(list($key1, $val1) = each ($items_array))
{
$xml .= "\t<item>\n";
while (list($key2, $val2) = each ($val1))
{
if (!is_array($val2))
$xml .= "\t\t<$key2>$val2</$key2>\n";
else
{
if (!$ostag)
{
$xml .= "\t\t<options>\n";
$ostag = 1;
}
$xml .= "\t\t\t<option>\n";
$otag = 1;
while (list($key3, $val3) = each ($val2))
$xml .= "\t\t\t\t<$key3>$val3</$key3>\n";
}
if ($otag)
{
$xml .= "\t\t\t</option>\n";
$otag = 0;
}
}
if ($ostag)
{
$xml .= "\t\t</options>\n";
$ostag = 0;
}
$xml .= "\t</item>\n";
}
$xml .= "</items>\n";
}
}
}
else // !debugging
{
while (list ($key, $val) = each ($pdata))
{
if (is_array($val))
{
$otag = 0;
$ostag = 0;
$items_array = $val;
$xml .= "<items>";
while(list($key1, $val1) = each ($items_array))
{
$xml .= "<item>";
while (list($key2, $val2) = each ($val1))
{
if (!is_array($val2))
$xml .= "<$key2>$val2</$key2>";
else
{
if (!$ostag)
{
$xml .= "<options>";
$ostag = 1;
}
$xml .= "<option>";
$otag = 1;
while (list($key3, $val3) = each ($val2))
$xml .= "<$key3>$val3</$key3>";
}
if ($otag)
{
$xml .= "</option>";
$otag = 0;
}
}
if ($ostag)
{
$xml .= "</options>";
$ostag = 0;
}
$xml .= "</item>";
}
$xml .= "</items>";
}
}
}
$xml .= "</order>";
return $xml;
}
}
?>

View File

@@ -0,0 +1,744 @@
<?php
#################### mpgGlobals ###########################################
class mpgGlobals{
var $Globals=array(
'MONERIS_PROTOCOL' => 'https',
'MONERIS_HOST' => 'esqa.moneris.com',
'MONERIS_PORT' =>'443',
'MONERIS_FILE' => '/gateway2/servlet/MpgRequest',
'API_VERSION' =>'MpgApi Version 2.02(php)',
'CLIENT_TIMEOUT' => '60'
);
function mpgGlobals()
{
// default
}
function getGlobals()
{
return($this->Globals);
}
}//end class mpgGlobals
###################### mpgHttpsPost #########################################
class mpgHttpsPost{
var $api_token;
var $store_id;
var $mpgRequest;
var $mpgResponse;
function mpgHttpsPost($storeid,$apitoken,$mpgRequestOBJ)
{
$this->store_id=$storeid;
$this->api_token= $apitoken;
$this->mpgRequest=$mpgRequestOBJ;
$dataToSend=$this->toXML();
//do post
$g=new mpgGlobals();
$gArray=$g->getGlobals();
$url=$gArray[MONERIS_PROTOCOL]."://".
$gArray[MONERIS_HOST].":".
$gArray[MONERIS_PORT].
$gArray[MONERIS_FILE];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$dataToSend);
curl_setopt($ch,CURLOPT_TIMEOUT,$gArray[CLIENT_TIMEOUT]);
curl_setopt($ch,CURLOPT_USERAGENT,$gArray[API_VERSION]);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response=curl_exec ($ch);
curl_close ($ch);
if(!$response)
{
$response="<?xml version=\"1.0\"?><response><receipt>".
"<ReceiptId>Global Error Receipt</ReceiptId>".
"<ReferenceNum>null</ReferenceNum><ResponseCode>null</ResponseCode>".
"<ISO>null</ISO> <AuthCode>null</AuthCode><TransTime>null</TransTime>".
"<TransDate>null</TransDate><TransType>null</TransType><Complete>false</Complete>".
"<Message>null</Message><TransAmount>null</TransAmount>".
"<CardType>null</CardType>".
"<TransID>null</TransID><TimedOut>null</TimedOut>".
"</receipt></response>";
}
$this->mpgResponse=new mpgResponse($response);
}
function getMpgResponse()
{
return $this->mpgResponse;
}
function toXML( )
{
$req=$this->mpgRequest ;
$reqXMLString=$req->toXML();
$xmlString .="<?xml version=\"1.0\"?>".
"<request>".
"<store_id>$this->store_id</store_id>".
"<api_token>$this->api_token</api_token>".
$reqXMLString.
"</request>";
return ($xmlString);
}
}//end class mpgHttpsPost
############# mpgResponse #####################################################
class mpgResponse{
var $responseData;
var $p; //parser
var $currentTag;
var $purchaseHash = array();
var $refundHash;
var $correctionHash = array();
var $isBatchTotals;
var $term_id;
var $receiptHash = array();
var $ecrHash = array();
var $CardType;
var $currentTxnType;
var $ecrs = array();
var $cards = array();
var $cardHash= array();
var $ACSUrl;
function mpgResponse($xmlString)
{
$this->p = xml_parser_create();
xml_parser_set_option($this->p,XML_OPTION_CASE_FOLDING,0);
xml_parser_set_option($this->p,XML_OPTION_TARGET_ENCODING,"UTF-8");
xml_set_object($this->p);
xml_set_element_handler($this->p,"startHandler","endHandler");
xml_set_character_data_handler($this->p,"characterHandler");
xml_parse($this->p,$xmlString);
xml_parser_free($this->p);
}//end of constructor
function getMpgResponseData(){
return($this->responseData);
}
function getRecurSuccess(){
return ($this->responseData['RecurSuccess']);
}
function getCardType(){
return ($this->responseData['CardType']);
}
function getTransAmount(){
return ($this->responseData['TransAmount']);
}
function getTxnNumber(){
return ($this->responseData['TransID']);
}
function getReceiptId(){
return ($this->responseData['ReceiptId']);
}
function getTransType(){
return ($this->responseData['TransType']);
}
function getReferenceNum(){
return ($this->responseData['ReferenceNum']);
}
function getResponseCode(){
return ($this->responseData['ResponseCode']);
}
function getISO(){
return ($this->responseData['ISO']);
}
function getBankTotals(){
return ($this->responseData['BankTotals']);
}
function getMessage(){
return ($this->responseData['Message']);
}
function getAuthCode(){
return ($this->responseData['AuthCode']);
}
function getComplete(){
return ($this->responseData['Complete']);
}
function getTransDate(){
return ($this->responseData['TransDate']);
}
function getTransTime(){
return ($this->responseData['TransTime']);
}
function getTicket(){
return ($this->responseData['Ticket']);
}
function getTimedOut(){
return ($this->responseData['TimedOut']);
}
function getTerminalStatus($ecr_no){
return ($this->ecrHash[$ecr_no]);
}
function getPurchaseAmount($ecr_no,$card_type){
return ($this->purchaseHash[$ecr_no][$card_type]['Amount']=="" ? 0:$this->purchaseHash[$ecr_no][$card_type]['Amount']);
}
function getPurchaseCount($ecr_no,$card_type){
return ($this->purchaseHash[$ecr_no][$card_type]['Count']=="" ? 0:$this->purchaseHash[$ecr_no][$card_type]['Count']);
}
function getRefundAmount($ecr_no,$card_type){
return ($this->refundHash[$ecr_no][$card_type]['Amount']=="" ? 0:$this->refundHash[$ecr_no][$card_type]['Amount']);
}
function getRefundCount($ecr_no,$card_type){
return ($this->refundHash[$ecr_no][$card_type]['Count']=="" ? 0:$this->refundHash[$ecr_no][$card_type]['Count']);
}
function getCorrectionAmount($ecr_no,$card_type){
return ($this->correctionHash[$ecr_no][$card_type]['Amount']=="" ? 0:$this->correctionHash[$ecr_no][$card_type]['Amount']);
}
function getCorrectionCount($ecr_no,$card_type){
return ($this->correctionHash[$ecr_no][$card_type]['Count']=="" ? 0:$this->correctionHash[$ecr_no][$card_type]['Count']);
}
function getTerminalIDs(){
return ($this->ecrs);
}
function getCreditCardsAll(){
return (array_keys($this->cards));
}
function getCreditCards($ecr){
return ($this->cardHash[$ecr]);
}
function characterHandler($parser,$data){
if($this->isBatchTotals)
{
switch($this->currentTag)
{
case "term_id" : {
$this->term_id=$data;
array_push($this->ecrs,$this->term_id);
$this->cardHash[$data]=array();
break;
}
case "closed" : {
$ecrHash=$this->ecrHash;
$ecrHash[$this->term_id]=$data;
$this->ecrHash = $ecrHash;
break;
}
case "CardType" : {
$this->CardType=$data;
$this->cards[$data]=$data;
array_push($this->cardHash[$this->term_id],$data) ;
break;
}
case "Amount" : {
if($this->currentTxnType == "Purchase")
{
$this->purchaseHash[$this->term_id][$this->CardType]['Amount']=$data;
}
else if( $this->currentTxnType == "Refund")
{
$this->refundHash[$this->term_id][$this->CardType]['Amount']=$data;
}
else if( $this->currentTxnType == "Correction")
{
$this->correctionHash[$this->term_id][$this->CardType]['Amount']=$data;
}
break;
}
case "Count" : {
if($this->currentTxnType == "Purchase")
{
$this->purchaseHash[$this->term_id][$this->CardType]['Count']=$data;
}
else if( $this->currentTxnType == "Refund")
{
$this->refundHash[$this->term_id][$this->CardType]['Count']=$data;
}
else if( $this->currentTxnType == "Correction")
{
$this->correctionHash[$this->term_id][$this->CardType]['Count']=$data;
}
break;
}
}
}
else
{
$this->responseData[$this->currentTag] .=$data;
}
}//end characterHandler
function startHandler($parser,$name,$attrs){
$this->currentTag=$name;
if($this->currentTag == "BankTotals")
{
$this->isBatchTotals=1;
}
else if($this->currentTag == "Purchase")
{
$this->purchaseHash[$this->term_id][$this->CardType]=array();
$this->currentTxnType="Purchase";
}
else if($this->currentTag == "Refund")
{
$this->refundHash[$this->term_id][$this->CardType]=array();
$this->currentTxnType="Refund";
}
else if($this->currentTag == "Correction")
{
$this->correctionHash[$this->term_id][$this->CardType]=array();
$this->currentTxnType="Correction";
}
}
function endHandler($parser,$name){
$this->currentTag=$name;
if($name == "BankTotals")
{
$this->isBatchTotals=0;
}
$this->currentTag="/dev/null";
}
}//end class mpgResponse
################## mpgRequest ###########################################################
class mpgRequest{
var $txnTypes =array('purchase'=> array('order_id','cust_id', 'amount', 'pan', 'expdate', 'crypt_type'),
'refund' => array('order_id', 'amount', 'txn_number', 'crypt_type'),
'ind_refund' => array('order_id','cust_id', 'amount','pan','expdate', 'crypt_type'),
'preauth' =>array('order_id','cust_id', 'amount', 'pan', 'expdate', 'crypt_type'),
'completion' => array('order_id', 'comp_amount','txn_number', 'crypt_type'),
'purchasecorrection' => array('order_id', 'txn_number', 'crypt_type'),
'opentotals' => array('ecr_number'),
'batchclose' => array('ecr_number'),
'batchcloseall' => array() ,
'cavv_purchase'=> array('order_id','cust_id', 'amount', 'pan',
'expdate', 'cavv'),
'cavv_preauth' =>array('order_id','cust_id', 'amount', 'pan',
'expdate', 'cavv')
);
var $txnArray;
function mpgRequest($txn){
if(is_array($txn))
{
$this->txnArray = $txn;
}
else
{
$temp[0]=$txn;
$this->txnArray=$temp;
}
}
function toXML(){
$tmpTxnArray=$this->txnArray;
$txnArrayLen=count($tmpTxnArray); //total number of transactions
for($x=0;$x < $txnArrayLen;$x++)
{
$txnObj=$tmpTxnArray[$x];
$txn=$txnObj->getTransaction();
$txnType=array_shift($txn);
$tmpTxnTypes=$this->txnTypes;
@$txnTypeArray=$tmpTxnTypes["$txnType"];
$txnTypeArrayLen=count($txnTypeArray); //length of a specific txn type
$txnXMLString="";
for($i=0;$i < $txnTypeArrayLen ;$i++)
{
$txnXMLString .="<$txnTypeArray[$i]>" //begin tag
.$txn[$txnTypeArray[$i]] // data
. "</$txnTypeArray[$i]>"; //end tag
}
$txnXMLString = "<$txnType>$txnXMLString";
$recur = $txnObj->getRecur();
if($recur != null)
{
$txnXMLString .= $recur->toXML();
}
$custInfo = $txnObj->getCustInfo();
if($custInfo != null)
{
$txnXMLString .= $custInfo->toXML();
}
$txnXMLString .="</$txnType>";
@$xmlString .=$txnXMLString;
}
return $xmlString;
}//end toXML
}//end class
##################### mpgCustInfo #######################################################
class mpgCustInfo{
var $level3template = array(cust_info=>
array('email','instructions',
'billing' => array ('first_name', 'last_name', 'company_name', 'address',
'city', 'province', 'postal_code', 'country',
'phone_number', 'fax','tax1', 'tax2','tax3',
'shipping_cost'),
'shipping' => array('first_name', 'last_name', 'company_name', 'address',
'city', 'province', 'postal_code', 'country',
'phone_number', 'fax','tax1', 'tax2', 'tax3',
'shipping_cost'),
'item' => array ('name', 'quantity', 'product_code', 'extended_amount')
)
);
var $level3data;
var $email;
var $instructions;
function mpgCustInfo($custinfo=0,$billing=0,$shipping=0,$items=0)
{
if($custinfo)
{
$this->setCustInfo($custinfo);
}
}
function setCustInfo($custinfo)
{
$this->level3data['cust_info']=array($custinfo);
}
function setEmail($email){
$this->email=$email;
$this->setCustInfo(array('email'=>$email,'instructions'=>$this->instructions));
}
function setInstructions($instructions){
$this->instructions=$instructions;
$this->setCustinfo(array('email'=>$this->email,'instructions'=>$instructions));
}
function setShipping($shipping)
{
$this->level3data['shipping']=array($shipping);
}
function setBilling($billing)
{
$this->level3data['billing']=array($billing);
}
function setItems($items)
{
if(! $this->level3data['item'])
{
$this->level3data['item']=array($items);
}
else
{
$index=count($this->level3data['item']);
$this->level3data['item'][$index]=$items;
}
}
function toXML()
{
$xmlString=$this->toXML_low($this->level3template,"cust_info");
return $xmlString;
}
function toXML_low($template,$txnType)
{
for($x=0;$x<count($this->level3data[$txnType]);$x++)
{
if($x>0)
{
$xmlString .="</$txnType><$txnType>";
}
$keys=array_keys($template);
for($i=0; $i < count($keys);$i++)
{
$tag=$keys[$i];
if(is_array($template[$keys[$i]]))
{
$data=$template[$tag];
if(! count($this->level3data[$tag]))
{
continue;
}
$beginTag="<$tag>";
$endTag="</$tag>";
$xmlString .=$beginTag;
#if(is_array($data))
{
$returnString=$this->toXML_low($data,$tag);
$xmlString .= $returnString;
}
$xmlString .=$endTag;
}
else
{
$tag=$template[$keys[$i]];
$beginTag="<$tag>";
$endTag="</$tag>";
$data=$this->level3data[$txnType][$x][$tag];
$xmlString .=$beginTag.$data .$endTag;
}
}//end inner for
}//end outer for
return $xmlString;
}//end toXML_low
}//end class
class mpgRecur{
var $params;
var $recurTemplate = array('recur_unit','start_now','start_date','num_recurs','period','recur_amount');
function mpgRecur($params)
{
$this->params = $params;
if( (! $this->params['period']) )
{
$this->params['period'] = 1;
}
}
function toXML()
{
$xmlString = "";
foreach($this->recurTemplate as $tag)
{
$xmlString .= "<$tag>". $this->params[$tag] ."</$tag>";
}
return "<recur>$xmlString</recur>";
}
}//end class
class mpgTransaction{
var $txn;
var $custInfo = null;
var $recur = null;
function mpgTransaction($txn){
$this->txn=$txn;
}
function getCustInfo()
{
return $this->custInfo;
}
function setCustInfo($custInfo){
$this->custInfo = $custInfo;
array_push($this->txn,$custInfo);
}
function getRecur()
{
return $this->recur;
}
function setRecur($recur)
{
$this->recur = $recur;
}
function getTransaction(){
return $this->txn;
}
}//end class
?>

View File

@@ -0,0 +1,502 @@
<?
// -----------------------------------------------------------------------------
// Skipjack PHP Interface
//
// Original version written by Greg MacLellan
// Online Creator Inc May 11, 2001
//
// This script requires the cURL Library for PHP
//
// It was tested on Apache 1.3.19 + PHP 4.0.5 + OpenSSL 0.9.6 + libcURL 7.7.3
//
// New version: July 10, 2004 - Ashbec LLC
// Syntax errors removed / debugged for updated environment:
// Linux
// Apache 1.3.28 / PHP 4.3.3 / cURL 7.10.5 / OpenSSL 0.9.6b / zlib 1.1.4
// - fixed syntax error in define
// - initialized $str before parsing
// - added new szReturnCode/Message values (-96 thru -100)
// - added current AVS return codes, handled unknown codes
// Only SkipJack_Authorize and Change_Status have been tested in the new environment.
// Status has not been tested.
//
// New version: November 29, 2004 - Ashbec LLC
// - Added code to gracefully?? exit if there is no response from Skipjack
// (Fakes a communications error.)
// - Set 60 second timeout on cURL execution
//
// Copyright 2004, Ashbec LLC. Rights to distribute and use without charge is hereby granted.
// Right to sell this version of the software is expressly reserved to Ashbec LLC.
//
// function SkipJack_Authorize($request)
// function SkipJack_Status($request)
// function SkipJack_ChangeStatus($request)
// -----------------------------------------------------------------------------
//
// protocol + host for the server
// define("SJPHPAPI_ROOT_URL", "https://developer.skipjackic.com"); // test
// define("SJPHPAPI_ROOT_URL", "https://www.skipjackic.com"); // production
// -----------------------------------------------------------------------------
function SkipJack_Authorize($request) {
$skipjackurl = SJPHPAPI_ROOT_URL."/scripts/evolvcc.dll?Authorize";
$ch = curl_init(); // initalize cURL
curl_setopt($ch, CURLOPT_URL, $skipjackurl); // connect to skipjack
// special processing:
// format the price "5352.20" => "535220"
/* $request["Transactionamount"] = number_format($request["Transactionamount"], 2, "", ""); (doesn't work) */
// take the $request array and turn it into name=value&name=value pairs
if (count($request) > 0) {
reset($request);
$str = NULL;
while (list($name, $value) = each($request)) {
$str .= "&".$name."=".$value;
}
$str = substr($str,1);
}
curl_setopt($ch, CURLOPT_POST, 1); // we're doing a post
curl_setopt($ch, CURLOPT_POSTFIELDS, $str); // name=value pairs from above
curl_setopt($ch, CURLOPT_USERAGENT, "SJ-PHP-API (Ashbec LLC)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return results
curl_setopt($ch, CURLOPT_TIMEOUT, 60); // max time
$results = curl_exec ($ch); // connect and grab the results
curl_close ($ch);
$ReturnValues = array("AUTHCODE",
"szSerialNumber",
"szTransactionAmount",
"szAuthorizationDeclinedMessage",
"szAVSResponseCode",
"szAVSResponseMessage",
"szOrderNumber",
"szAuthorizationResponseCode",
"szIsApproved",
"szCVV2ResponseCode",
"szCVV2ResponseMessage",
"szReturnCode"
);
$szReturnCode = array("1"=>"Status Complete (1)",
"0"=>"Call Failed (0)",
"-1"=>"Invalid length (-1)",
"-35"=>"Invalid credit card number (-35)",
"-37"=>"Failed communication (-37)",
"-39"=>"Serial number is too short (-39)",
"-51"=>"The zip code is invalid",
"-52"=>"The shipto zip code is invalid",
"-53"=>"Length of expiration date (-53)",
"-54"=>"Length of account number date (-54)",
"-55"=>"Length of street address (-55)",
"-56"=>"Length of shipto street address (-56)",
"-57"=>"Length of transaction amount (-57)",
"-58"=>"Length of name (-58)",
"-59"=>"Length of location (-59)",
"-60"=>"Length of state (-60)",
"-61"=>"Length of shipto state (-61)",
"-62"=>"Length of order string (-62)",
"-64"=>"Invalid phone number (-64)",
"-65"=>"Empty name (-65)",
"-66"=>"Empty email (-66)",
"-67"=>"Empty street address (-66)",
"-68"=>"Empty city (-68)",
"-69"=>"Empty state (-69)",
"-70"=>"Empty zip code (-70)",
"-71"=>"Empty order number (-71)",
"-72"=>"Empty account number (-72)",
"-73"=>"Empty expiration month (-73)",
"-74"=>"Empty expiration year (-74)",
"-75"=>"Empty serial number (-75)",
"-76"=>"Empty transaction amount (-76)",
"-79"=>"Length of customer name (-79)",
"-80"=>"Length of shipto customer name (-80)",
"-81"=>"Length of customer location (-81)",
"-82"=>"Length of customer state (-82)",
"-83"=>"Length of shipto phone (-83)",
"-84"=>"Pos Error duplicate ordernumber (-84)",
"-91"=>"Pos Error CVV2 (-91)",
"-92"=>"Pos Error Approval Code (-92)",
"-93"=>"Pos Error Blind Credits Not Allowed (-93)",
"-94"=>"Pos Error Blind Credits Failed (-94)",
"-95"=>"Pos Error Voice Authorizations Not Allowed (-95)",
"-96"=>"Voice Authorization Failed (-96)",
"-97" => "Fraud Rejection - rule violation (-97)",
"-98" => "Invalid Discount Amount (-98)",
"-99" => "Invalid Pin Block (-99)",
"-100" => "Invalid Key Serial Number (-100)"
);
$szAVSResponse = array("X" => "Exact match, 9 digit zip",
"Y" => "Exact match, 5 digit zip",
"M" => "Exact address match, international.",
"D" => "Exact address match, international.",
"A" => "Address matches, ZIP code does not",
"B" => "Address match without postal code, international.",
"W" => "ZIP Code (9) matches, address does not",
"Z" => "ZIP Code (5) matches, address does not",
"P" => "Postal code match only, international.",
"N" => "No address or zip match",
"U" => "Address verification unavailable",
"I" => "Address information not verified by issuer, international.",
"R" => "Retry - Issuer system unavailable or timed out",
"E" => "Error - AVS data is invalid",
"C" => "Incompatible address format, international.",
"G" => "Non-U.S. Issuer does not participate in AVS (verification unavailable)",
"S" => "Service not supported by US issuing Bank"
);
// parse through results for $ReturnValues in "<!--ReturnValue=value-->"
if (empty($results)) { // No response from SkipJack. Fake an error.
$response['AUTHCODE'] = NULL;
$response['szSerialNumber'] = NULL;
$response['szTransactionAmount'] = NULL;
$response['szAuthorizationDeclinedMessage'] = "No response from SkipJack financial network.";
$response['szAVSResponseCode'] = "R";
$response['szAVSResponseMessage'] = "No response from SkipJack financial network.";
$response['szOrderNumber'] = NULL;
$response['szAuthorizationResponseCode'] = 0;
$response['szIsApproved'] = 0;
$response['szCVV2ResponseCode'] = "P";
$response['szCVV2ResponseMessage'] = "Not processed";
$response['szReturnCode'] = -37;
} else { // Parse the real results
while (list($key,$code) = each($ReturnValues)) {
$pos = strpos($results, $code);
if ($pos) {
$value = substr($results, $pos + strlen($code) + 1, strpos($results, "-->", $pos) - $pos - strlen($code) - 1);
$response[$code] = $value;
}
}
}
// a couple extra response strings
if (!empty($szAVSResponse[$response['szAVSResponseCode']])) {
$response["textAVSResponseCode"] = $szAVSResponse[$response['szAVSResponseCode']];
} else {
$response["textAVSResponseCode"] = "Unknown AVS code: " . $response['szAVSResponseCode'];
}
if (!empty ($szReturnCode[$response["szReturnCode"]])) {
$response["textReturnCode"] = $szReturnCode[ $response["szReturnCode"] ];
} else {
$response["textReturnCode"] = "Unknown return code: " . $response['szReturnCode'];
}
return $response;
}
function SkipJack_Status($request) {
$skipjackurl = SJPHPAPI_ROOT_URL."/scripts/evolvcc.dll?SJAPI_TransactionStatusRequest";
$ch = curl_init(); // initalize cURL
curl_setopt($ch, CURLOPT_URL, $skipjackurl); // connect to skipjack
// take the $request array and turn it into name=value&name=value pairs
$str = NULL;
while (list($name, $value) = each($request)) {
$str .= "&".$name."=".$value;
}
$str = substr($str,1);
curl_setopt($ch, CURLOPT_POST, 1); // we're doing a post
curl_setopt($ch, CURLOPT_POSTFIELDS, $str); // name=value pairs from above
curl_setopt($ch, CURLOPT_USERAGENT, "SJ-PHP-API (Ashbec LLC)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return results
$results = curl_exec ($ch); // connect and grab the results
curl_close ($ch);
// fields in response record
$responseRecFields = array("SerialNumber",
"ErrorCode",
"NumRecs");
// response record error codes
$responseRecErrorCodes = array("0"=>"Success",
"-1"=>"Invalid Command",
"-2"=>"Parameter Missing",
"-3"=>"Failed retrieving response",
"-4"=>"Invalid Status",
"-5"=>"Failed reading security tags",
"-6"=>"Developer serial number not found",
"-7"=>"Invalid Serial Number",
"-8"=>"Expiration year not four characters",
"-9"=>"Credit card expired",
"-10"=>"Invalid starting date (recurring payment)",
"-11"=>"Failed adding recurring payment",
"-12"=>"Invalid Frequency (recurring payment)");
// fields in status records
$responseFields = array("SerialNumber",
"Amount",
"TransStatusCode",
"TransStatusMsg",
"OrderNumber",
"TransactionDate",
"TransactionID");
$StatusText = array("0"=>"Idle",
"1"=>"Authorized",
"2"=>"Denied",
"3"=>"Settled",
"4"=>"Credited",
"5"=>"Deleted",
"6"=>"Archived",
"7"=>"Pre-Auth");
$PendingStatusText = array("0"=>"Idle",
"1"=>"Pending Credit",
"2"=>"Pending Settlement",
"3"=>"Pending Delete",
"4"=>"Pending Authorization",
"5"=>"* Pending Settlement");
// first, we get the response record
$temp = substr($results, 0, strpos($results,"\n") - 1);
while (list($key,$val) = each($responseRecFields)) {
$firstquote = strpos($temp,"\"");
$secondquote = strpos($temp, "\"", $firstquote + 1);
$responserecord[$val] = substr($temp, $firstquote + 1, $secondquote - 1 - $firstquote);
$temp = substr($temp, $secondquote + 1);
}
// additional text messages
$responserecord["textErrorCode"] = $responseRecErrorCodes[$responserecord["ErrorCode"]];
// get just the results into this string
$results = substr($results, strpos($results, "\n") + 1);
// if we didn't get some error
if ($responserecord["ErrorCode"] == 0) {
// parse through results and create array
$i = 0;
while (strlen($results) > 0) {
$temp = substr($results, 0, strpos($results,"\n") - 1);
$results = substr($results, strpos($results, "\n") + 1);
// parse through individual string and create array
reset($responseFields);
while (list($key,$val) = each($responseFields)) {
$firstquote = strpos($temp,"\"");
$secondquote = strpos($temp, "\"", $firstquote + 1);
$response[$i][$val] = substr($temp, $firstquote + 1, $secondquote - 1 - $firstquote);
$temp = substr($temp, $secondquote + 1);
}
// create additional text responses
$response[$i]["intStatus"] = substr($response[$i]["TransStatusCode"],0,1);
$response[$i]["textStatus"] = $StatusText[ $response[$i]["intStatus"] ];
$response[$i]["intPendingStatus"] = substr($response[$i]["TransStatusCode"],1,1);
$response[$i]["textPendingStatus"] = $PendingStatusText[ $response[$i]["intPendingStatus"] ];
$i++;
}
return array("Status"=>$responserecord, "Response"=>$response);
} else {
return array("Status"=>$responserecord, "Text"=>$results);
}
}
function SkipJack_ChangeStatus($request) {
$skipjackurl = SJPHPAPI_ROOT_URL."/scripts/evolvcc.dll?SJAPI_TransactionChangeStatusRequest";
$ch = curl_init(); // initalize cURL
curl_setopt($ch, CURLOPT_URL, $skipjackurl); // connect to skipjack
// take the $request array and turn it into name=value&name=value pairs
$str = NULL;
while (list($name, $value) = each($request)) {
$str .= "&".$name."=".$value;
}
$str = substr($str,1);
curl_setopt($ch, CURLOPT_POST, 1); // we're doing a post
curl_setopt($ch, CURLOPT_POSTFIELDS, $str); // name=value pairs from above
curl_setopt($ch, CURLOPT_USERAGENT, "SJ-PHP-API (OnlineCreator)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return results
$results = curl_exec ($ch); // connect and grab the results
curl_close ($ch);
// fields in response record
$responseRecFields = array("SerialNumber",
"ErrorCode",
"NumRecs");
// response record error codes
$responseRecErrorCodes = array("0"=>"Success",
"-1"=>"Invalid Command",
"-2"=>"Parameter Missing",
"-3"=>"Failed retrieving response",
"-4"=>"Invalid Status",
"-5"=>"Failed reading security tags",
"-6"=>"Developer serial number not found",
"-7"=>"Invalid Serial Number",
"-8"=>"Expiration year not four characters",
"-9"=>"Credit card expired",
"-10"=>"Invalid starting date (recurring payment)",
"-11"=>"Failed adding recurring payment",
"-12"=>"Invalid Frequency (recurring payment)");
// fields in status records
$responseFields = array("SerialNumber",
"Amount",
"DesiredStatus",
"StatusResponse",
"StatusResponseMsg",
"OrderNumber",
"TransactionID");
// so we can return a 1/0 response code
$SuccessCodes = array("SUCCESSFUL"=>"1",
"UNSUCCESSFUL"=>"0",
"NOTALLOWED"=>"0");
// first, we get the response record
$temp = substr($results, 0, strpos($results,"\n") - 1);
while (list($key,$val) = each($responseRecFields)) {
$firstquote = strpos($temp,"\"");
$secondquote = strpos($temp, "\"", $firstquote + 1);
$responserecord[$val] = substr($temp, $firstquote + 1, $secondquote - 1 - $firstquote);
$temp = substr($temp, $secondquote + 1);
}
// additional text messages
$responserecord["textErrorCode"] = $responseRecErrorCodes[$responserecord["ErrorCode"]];
// get just the results into this string
$results = substr($results, strpos($results, "\n") + 1);
// if we didn't get some error
if ($responserecord["ErrorCode"] == 0) {
// parse through results and create array
// with ChangeStatusRequest, this is usually only one value,
// but for consistency, we'll handle more if we need to
$i = 0;
while (strlen($results) > 0) {
$temp = substr($results, 0, strpos($results,"\n") - 1);
$results = substr($results, strpos($results, "\n") + 1);
// parse through individual string and create array
reset($responseFields);
while (list($key,$val) = each($responseFields)) {
$firstquote = strpos($temp,"\"");
$secondquote = strpos($temp, "\"", $firstquote + 1);
$response[$i][$val] = substr($temp, $firstquote + 1, $secondquote - 1 - $firstquote);
$temp = substr($temp, $secondquote + 1);
}
// create additional text responses
$response[$i]["intSuccess"] = $SuccessCodes[ $response[$i]["StatusResponse"] ];
$i++;
}
return array("Status"=>$responserecord, "Response"=>$response);
} else {
return array("Status"=>$responserecord, "Text"=>$results);
}
}
/*
// sample transaction:
$request = array("sjname" => "Skipjack PHP Test",
"Email" => "Transaction@skipjack.com",
"Streetaddress" => "2230 Park Ave",
"City" => "Cincinnati",
"State" => "OH",
"Zipcode" => "45206",
"Country" => "USA",
"Ordernumber" => "1PHP",
"Accountnumber" => "5121212121212124",
"Month" => "03",
"Year" => "2003",
"Serialnumber" => "xxxxxxxxxxxx", // html Vital, NBova or production
"Transactionamount" => "3.45",
"Orderstring" => "1~Item 1~3.45~3~N~||",
"Shiptophone" => "888-368-8507");
echo "<pre>";
var_dump($request);
var_dump(SkipJack_Authorize($request));
echo "</pre>";
*/
/*
Sample Status Request:
$request["szSerialNumber"] = "xxxxxxxxxxxx";
$request["szDeveloperSerialNumber"] = "xxxxxxx";
//$request["szOrderNumber"] = "1PHP";
$request["szDate"] = "";
echo "<pre>";
var_dump($request);
echo "</pre><br>";
echo "<pre>";
var_dump ( SkipJack_Status($request) );
echo "</pre>";
echo "<br><hr><Br>";
*/
/*
Sample Status Change:
unset($request);
$request["szSerialNumber"] = "xxxxxxxxxxxx";
$request["szDeveloperSerialNumber"] = "xxxxxx";
$request["szOrderNumber"] = "1PHP";
$request["szDesiredStatus"] = "SETTLE";
$request["szForceSettlement"] = "1";
echo "<pre>";
var_dump($request);
echo "</pre><br>";
echo "<pre>";
var_dump ( SkipJack_ChangeStatus($request) );
echo "</pre><br>";
*/
?>

View File

@@ -0,0 +1,146 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_COMMERCEPAYMENTWINDOW;
$plg->postback($VAR);
}
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_COMMERCEPAYMENTWINDOW extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_COMMERCEPAYMENTWINDOW($checkout_id=false) {
$this->name = 'COMMERCEPAYMENTWINDOW';
$this->type = 'redirect';
$this->recurr_only = false;
$this->support_cur = Array ('USD','RM');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.commercepayment.com/PaymentWindowStd_{$currency_iso}.jsp";
$vals = Array (
Array ('MERCHANTID', $this->cfg['id']),
Array ('AMOUNT', $amount),
Array ('MERCHANT_TRANID', $invoice),
Array ('TRANSACTIONTYPE', '2'),
Array ('NEWTRANSACTION', 'Y'),
Array ('DESCRIPTION', 'INVOICE #' . $invoice),
Array ('RETURN_URL', SSL_URL.'plugins/checkout/COMMERCEPAYMENTWINDOW.php'),
Array ('REMOTEIP', USER_IP),
Array ('BILLADDRESS', $acct_fields['first_name']." ".$acct_fields['last_name'].", ".$acct_fields['address1'].", ".$acct_fields['city'].", ".$acct_fields['state']." ".$acct_fields['zip']),
Array ('SHIPADDRESS', $acct_fields['first_name']." ".$acct_fields['last_name'].", ".$acct_fields['address1'].", ".$acct_fields['city'].", ".$acct_fields['state']." ".$acct_fields['zip']),
Array ('FRAUDRISK_EMAIL', $acct_fields['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['MERCHANT_TRANID'];
$ret['transaction_id'] = $VAR['TRANSACTIONID'];
$ret['amount'] = $VAR['AMOUNT'];
$ret['currency'] = $VAR['CURRENCYCODE'];
if($VAR['TXN_STATUS'] == 'Y')
$ret['status'] = true;
else
$ret['status'] = false;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($ret['status']) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.SSL_URL.'?_page=invoice:thankyou&_next_page=invoice:user_view&id='.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.SSL_URL.'?_page=invoice:thankyou&_next_page=invoice:user_view&id='.$ret['invoice_id'].'";
</script>';
}
}
?>

View File

@@ -0,0 +1,162 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_CROWNE_GOLD extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_CROWNE_GOLD($checkout_id=false) {
$this->name = 'CROWNE_GOLD';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->support_cur = Array ('USD', 'CAD','CHF','GPB','AUD','JPY', 'EUR', 'GRD', 'FIM','EEK','LTL');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.crowne-gold.com/merchantprocesspayment.odnet";
$vals = Array (
Array ('PAYEE_ACCOUNT', $this->cfg['account']),
Array ('PAYEE_NAME', SITE_NAME),
Array ('SUGGESTED_MEMO', "Payment For Invoice No. ". $invoice),
Array ('PAYMENT_AMOUNT', $amount),
Array ('PAYMENT_ID', $invoice),
Array ('CURRENCY_CODE', $currency_iso),
Array ('PAYMENT_METAL_ID', $this->cfg['metal']),
Array ('STATUS_URL', $this->return_url),
Array ('PAYMENT_URL', $this->success_url.$invoice),
Array ('NOPAYMENT_URL', $this->decline_url.$invoice),
Array ('NOPAYMENT_URL_METHOD', "LINK"),
Array ('BAGGAGE_FIELDS', "invoice"),
Array ('invoice', $invoice)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['PAYMENT_ID'];
$ret['transaction_id'] = $VAR['TRANSACTION_NUMBER'];
$ret['amount'] = $VAR['PAYMENT_AMOUNT'];
$ret['currency'] = $VAR['CURRENCY_CODE'];
$ret['status'] = true;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Create & validate the Hash String
$con_str = $VAR['PAYMENT_UNITS'];
$con_str.= '|' . $VAR['PAYMENT_AMOUNT'];
$con_str.= '|' . $VAR['PAYEE_ACCOUNT'];
$con_str.= '|' . $VAR['DATE_TIME_GMT'];
$con_str.= '|' . $this->cfg['secret'];
$str = strtoupper(md5($con_str));
if(!empty($this->cfg['secret']) && $str != $VAR['HASH_KEY'])
$do = false;
# Validate agains the posted payee:
if($VAR['PAYEE_ACCOUNT'] != $this->cfg['account'])
$do = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_CROWNE_GOLD;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,274 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_CYBERSOURCE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_CYBERSOURCE($checkout_id=false) {
$this->name = 'CYBERSOURCE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou';
$this->getDetails($checkout_id);
}
# Is the PHP Extension loaded?
function validate_env() {
if (!extension_loaded("cybersource")) {
global $C_debug;
$C_debug->error('plg_chout_CYBERSOURCE','validate_env','The Cybersource PHP extension was not found.');
return false;
}
return true;
}
function handle_error($status, $request, $reply) {
switch ($status)
{
case CYBS_S_PHP_PARAM_ERROR:
return "Please check the parameters passed to cybs_run_transaction for correctness.";
break;
case CYBS_S_PRE_SEND_ERROR:
return "The following error occurred before the request could be sent:\n".$reply[CYBS_SK_ERROR_INFO];
break;
case CYBS_S_SEND_ERROR:
return "The following error occurred while sending the request:\n".$reply[CYBS_SK_ERROR_INFO];
break;
case CYBS_S_RECEIVE_ERROR:
return "The following error occurred while waiting for or retrieving the reply:\n".$reply[CYBS_SK_ERROR_INFO];
#handleCriticalError( $status, $request, $reply );
break;
case CYBS_S_POST_RECEIVE_ERROR:
return "The following error occurred after receiving and during processing of the reply:\n".$reply[CYBS_SK_ERROR_INFO];
#handleCriticalError( $status, $request, $reply );
break;
case CYBS_S_CRITICAL_SERVER_FAULT:
return "The server returned a CriticalServerError fault:\n".$this->getFaultContent( $reply );
#handleCriticalError( $status, $request, $reply );
break;
case CYBS_S_SERVER_FAULT:
return "The server returned a ServerError fault:\n%s\n".$this->getFaultContent( $reply );
break;
case CYBS_S_OTHER_FAULT:
return "The server returned a fault:\n".$this->getFaultContent( $reply );
break;
case CYBS_S_HTTP_ERROR:
return "An HTTP error occurred:\n%s\nResponse Body:\n".$reply[CYBS_SK_ERROR_INFO]."\n".$reply[CYBS_SK_RAW_REPLY];
break;
}
}
function getFaultContent($reply) {
$requestID = $reply[CYBS_SK_FAULT_REQUEST_ID];
if ( $requestID == "")
$requestID = "(unavailable)";
return( sprintf(
"Fault code: %s\nFault string: %s\nRequestID: %s\nFault document: %s",
$reply[CYBS_SK_FAULT_CODE], $reply[CYBS_SK_FAULT_STRING],
$requestID, $reply[CYBS_SK_FAULT_DOCUMENT] ) );
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Do we have the API available?
if (!$this->validate_env()) {
$msg = 'The CYBERSOURCE PHP extension was not detected on this system. Please install the CYBERSOURCE PHP API.';
$ret = '<script language=Javascript> alert(\''.$msg.'\'); </script>';
echo $ret;
return false;
}
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
// setup the configuration
$config = array();
$config['merchantID'] = $this->cfg['merchantID'];
$config['keysDirectory'] = $this->cfg['keysDirectory'];
$config['targetAPIVersion'] = $this->cfg['targetAPIVersion'];
if ($this->cfg['mode'] == 1)
$config['sendToProduction'] = true;
else
$config['sendToProduction'] = false;
if (strlen($this->cfg['sslCertFile']))
$config['sslCertFile'] = $this->cfg['sslCertFile'];
// set up the request by creating an array and adding fields to it
$request = array();
$request['ccAuthService_run'] = 'true';
$request['ccCaptureService_run'] = 'true';
$request['merchantReferenceCode'] = 'INVOICE-'.$invoice;
$request['billTo_firstName'] = $this->account["first_name"];
$request['billTo_lastName'] = $this->account["last_name"];
$request['billTo_street1'] = $this->account["address1"] . ' ' . $this->account["address2"];
$request['billTo_city'] = $this->account["city"];
$request['billTo_state'] = $this->account["state"];
$request['billTo_postalCode'] = $this->account["zip"];
$request['billTo_country'] = $country;
$request['billTo_email'] = $acct_fields["email"];
$request['billTo_ipAddress'] = USER_IP;
$request['shipTo_firstName'] = $this->account["first_name"];
$request['shipTo_lastName'] = $this->account["last_name"];
$request['shipTo_street1'] = $this->account["address1"] . ' ' . $this->account["address2"];
$request['shipTo_city'] = $this->account["city"];
$request['shipTo_state'] = $this->account["state"];
$request['shipTo_postalCode'] = $this->account["zip"];
$request['shipTo_country'] = $country;
$request['card_accountNumber'] = $this->billing["cc_no"];
$request['card_expirationMonth'] = $this->billing["exp_month"];
$request['card_expirationYear'] = '20'.$this->billing["exp_year"];
$request['card_cvNumber'] = $this->billing["ccv"];
$request['purchaseTotals_currency'] = $currency_iso;
$request['purchaseTotals_grandTotalAmount'] = $amount;
// add other fields here per your business needs
// send request now
$reply = array();
$status = cybs_run_transaction( $config, $request, $reply );
$ret['status'] = 0;
if ($status == 0) {
$decision = $reply['decision'];
if (strtoupper($decision) == 'ACCEPT') {
$ret['status'] = 1;
} else if (strtoupper($decision) == 'REJECT') {
@$ret['msg'] = "Card was rejected: Code ".$reply['ccAuthReply_reasonCode'];
global $C_debug;
$C_debug->error('plg_chout_CYBERSOURCE','REJECT',"Card was rejected: Code ".$reply['ccAuthReply_reasonCode']);
} else {
@$ret['msg'] = "There was an error while processing your card: Code ".$reply['ccAuthReply_reasonCode'];
global $C_debug;
$C_debug->error('plg_chout_CYBERSOURCE','ERROR',"Error: Code ".$reply['ccAuthReply_reasonCode']);
}
} else {
global $C_debug;
$msg = $this->handle_error($status, $request, $reply);
$C_debug->error('plg_chout_CYBERSOURCE','validate_env',$msg);
return false;
}
# Transaction ID:
@$ret['avs'] = $reply['requestID'];
@$ret['transaction_id'] = $reply['ccCaptureReply_reconciliationID'];
@$ret['authorization'] = $reply['ccAuthReply_authorizationCode'];
# AVS Details:
switch (@$reply['ccAuthReply_avsCode']) {
case 'A':
$ret['avs'] = 'avs_address_only';
break;
case 'E':
$ret['avs'] = 'avs_error';
break;
case 'I':
$ret['avs'] = 'avs_address_unavail';
break;
case 'N':
$ret['avs'] = 'avs_no_match';
break;
case 'S':
case 'G':
case 'C':
$ret['avs'] = 'avs_not_supported';
break;
case 'U':
$ret['avs'] = 'avs_na';
break;
case 'X':
case 'M':
case 'D':
$ret['avs'] = 'avs_exact';
break;
case 'Y':
case 'B':
$ret['avs'] = 'avs_address_zip';
break;
case 'Z':
case 'W':
case 'P':
$ret['avs'] = 'avs_fullzip_only';
break;
case '1':
case '2':
case 'R':
default:
$ret['avs'] = 'avs_error';
break;
}
# return
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,129 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_DPILINK extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_DPILINK($checkout_id=false) {
$this->name = 'DPILINK';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'www.dpisecure.com';
$this->url = '/dpilink/authpd.asp';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Test Transaction
if($this->cfg['mode'] = "1")
$test = "Y";
else
$test = "N";
# Set the post vars:
$vars = Array(
Array ( "testTransaction", $test ),
Array ( "transactionCode", $this->cfg['type']),
Array ( "DPIAccountNum", $this->cfg['account'] ),
Array ( "password", $this->cfg['password'] ),
Array ( "cardHolderName", $this->account["first_name"].''.$this->account["last_name"]),
Array ( "cardHolderEmail" , $this->account["email"] ),
Array ( "cardHolderAddress", $this->account["address1"] ),
Array ( "cardHolderCity" , $this->account["city"] ),
Array ( "cardHolderState" , $this->account["state"] ),
Array ( "cardHolderZip" , $this->account["zip"] ),
Array ( "customerNume" , $acct_fields["id"] ),
Array ( "orderNum" , $invoice ),
Array ( "cardAccountNum" , $this->billing["cc_no"] ),
Array ( "expirationDate" , $this->billing["exp_month"].''.$this->billing["exp_year"] ),
Array ( "CVV2" , $this->billing["ccv"]),
Array ( "Serialnumber" , $this->cfg['account'] ),
Array ( "transactionAmount", $amount )
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$results = $n->connect($this->host, $this->url, $vars, true, 1);
$response = explode('|', $results);
# Transaction Status:
if ($response[10] == '00') {
$ret['status'] = 1;
} else {
$ret['status'] = 0;
$ret['msg'] = 'The details you provided are invalid or declined.';
}
# Transaction ID:
$ret['transaction_id'] = $response[14];
$ret['authorization_id'] = $response[13];
# AVS Details:
$ret['avs'] = $response[22];
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

155
plugins/checkout/ECHO.php Normal file
View File

@@ -0,0 +1,155 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_ECHO extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_ECHO($checkout_id=false) {
$this->name = 'ECHO';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'https://wwws.echo-inc.com';
$this->url = '/scripts/INR200.EXE';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('three_code', $acct_fields["country_id"]);
if($this->cfg['mode'] = "0")
$test = "F";
else
$test = "T";
include_once (PATH_PLUGINS . 'checkout/CLASS_ECHO/echophp.class');
$echoPHP = new EchoPHP;
$echoPHP->set_order_type("S");
$echoPHP->set_debug($test);
$echoPHP->set_EchoServer($this->host .''. $this->url);
$echoPHP->set_transaction_type($this->cfg["type"]);
$echoPHP->set_merchant_echo_id($this->cfg["id"]);
$echoPHP->set_merchant_pin($this->cfg["pin"]);
$echoPHP->set_billing_ip_address(USER_IP);
$echoPHP->set_billing_first_name($this->account["first_name"]);
$echoPHP->set_billing_last_name($this->account["last_name"]);
$echoPHP->set_billing_address1($this->account["address1"] . ' ' . $this->account["address2"]);
$echoPHP->set_billing_city($this->account["city"]);
$echoPHP->set_billing_state($this->account["state"]);
$echoPHP->set_billing_zip($this->account["zip"]);
$echoPHP->set_billing_country($country);
$echoPHP->set_billing_email($acct_fields["email"]);
$echoPHP->set_grand_total($amount);
$echoPHP->set_ccexp_month($this->billing["exp_month"]);
$echoPHP->set_ccexp_year($this->billing["exp_year"]);
$echoPHP->set_cnp_security($this->billing["ccv"]);
$echoPHP->set_cc_number($this->billing["cc_no"]);
$echoPHP->set_counter($echoPHP->getRandomCounter());
# Set the return codes:
if (!$echoPHP->Submit()) {
if ($echoPHP->decline_code == "1013") {
$ret['status'] = 0;
$ret['msg'] = $echoPHP->avs_result . 'Echo account '.$echoPHP->merchant_echo_id.' could not be found, failed!';
} else {
$ret['status'] = 0;
$ret['msg'] = $echoPHP->echotype1;
}
} else {
$ret['status'] = 1;
$ret['transaction_id'] = $echoPHP->reference;
$ret['authorization'] = $echoPHP->authorization;
# AVS Details:
if ( $echoPHP->avs_result == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( $echoPHP->avs_result == 'E' )
$ret['avs'] = 'avs_error';
elseif ( $echoPHP->avs_result == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( $echoPHP->avs_result == 'P' )
$ret['avs'] = 'avs_na';
elseif ( $echoPHP->avs_result == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( $echoPHP->avs_result == 'S' || $echoPHP->avs_result == 'G')
$ret['avs'] = 'avs_not_supported';
elseif ( $echoPHP->avs_result == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( $echoPHP->avs_result == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( $echoPHP->avs_result == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( $echoPHP->avs_result == 'D' || $echoPHP->avs_result == 'M' )
$ret['avs'] = 'avs_address_zip';
elseif ( $echoPHP->avs_result == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
}
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,179 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_ECX_QUICKCOMMERCE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_ECX_QUICKCOMMERCE($checkout_id=false) {
$this->name = 'ECX_QUICKCOMMERCE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou';
$this->host = 'secure.quickcommerce.net';
$this->url = '/gateway/transact.dll';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$test = "FALSE";
else
$test = "TRUE";
# Set the post vars:
$vars = Array (
Array ('x_ADC_URL', "FALSE"),
Array ('x_ADC_Delim_Data', "TRUE"),
Array ('x_Version', "3.0"),
Array ('x_Version', "3.0"),
Array ('x_Currency_Code', $currency_iso),
Array ('x_Method', "CC"),
Array ('x_Transaction_Type', $this->cfg['x_Transaction_Type']),
Array ('x_Test_Request', $test),
Array ('x_Password', $this->cfg['x_Password']),
Array ('x_Login', $this->cfg['x_Login']),
Array ('x_Amount', $amount),
Array ('x_Invoice_Num', $invoice),
Array ('x_Description', "Payment for Invoice No. ".$invoice),
Array ('x_Card_Code', $this->billing["ccv"]),
Array ('x_Card_Num', $this->billing["cc_no"]),
Array ('x_Exp_Date', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('x_Cust_ID', $acct_fields["id"]),
Array ('x_First_Name', $this->account["first_name"]),
Array ('x_Last_Name', $this->account["last_name"]),
Array ('x_Company', $this->account["company"]),
Array ('x_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_City', $this->account["city"]),
Array ('x_State', $this->account["state"]),
Array ('x_Zip', $this->account["zip"]),
Array ('x_Email', $acct_fields["email"]),
Array ('x_Country', $country),
Array ('x_Ship_To_First_Name', $this->account["first_name"]),
Array ('x_Ship_To_Last_Name', $this->account["last_name"]),
Array ('x_Ship_To_Company', $this->account["company"]),
Array ('x_Ship_To_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_Ship_To_City', $this->account["city"]),
Array ('x_Ship_To_State', $this->account["state"]),
Array ('x_Ship_To_Zip', $this->account["zip"]),
Array ('x_Ship_To_Country', $country),
Array ('x_Customer_IP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$response = explode(',', $response);
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['avs'] = $response[4];
# Message:
$ret['msg'] = $response[3];
# AVS Details:
if ( $response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( $response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( $response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( $response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( $response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( $response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( $response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( $response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( $response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( $response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( $response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,81 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_EFT_MANUAL extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_EFT_MANUAL($checkout_id=false) {
$this->name = 'EFT_MANUAL';
$this->type = 'other';
$this->eft = true;
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# validate the card type and number, and exp date:
$ret=false;
$this->validate_eft_details($ret);
# AVS Details:
$ret['avs'] = 'avs_na';
# return
if($ret['status'] == 1) {
$this->redirect = '<script language=Javascript>document.location = "?_page=invoice:thankyou&_next_page=checkout_plugin:plugin_ord_MANUAL_ALERT&id='.$invoice.'";</script>';
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveEFTDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,128 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_EFT_SECURE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_EFT_SECURE($checkout_id=false) {
$this->name = 'EFT_SECURE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'va.eftsecure.net';
$this->url = '/cgi-bin/eftBankcard.dll?transaction';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Set the post vars:
$vars = Array (
Array ('M_id', $this->cfg['M_id']),
Array ('M_key', $this->cfg['M_key']),
Array ('C_name', $this->account["first_name"] . ' ' . $this->account["last_name"]),
Array ('C_address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('C_city', $this->account["city"]),
Array ('C_state', $this->account["state"]),
Array ('C_zip', $this->account["zip"]),
Array ('C_country', $country),
Array ('C_email', $acct_fields["email"]),
Array ('C_cardnumer', $this->billing["cc_no"]),
Array ('C_exp', $this->billing["exp_month"] . $this->billing["exp_year"]),
Array ('C_ccv', $this->billing["ccv"]),
Array ('T_amt', $amount),
Array ('T_code', "01"),
Array ('T_ordernum', $invoice)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
echo $response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
}
# Transaction Status:
if ($response{1} == 'A')
$ret['status'] = 1;
else
$ret['status'] = 0;
# AVS
@$ret['avs'] = @$response{45};
# Message:
$ret['msg'] = $response{2}.$response{3}.$response{4}.$response{5}.$response{6}.$response{7}. " - ";
for($i=8; $i<=39; $i++)
$ret['msg'] .= $response{$i};
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

175
plugins/checkout/EGOLD.php Normal file
View File

@@ -0,0 +1,175 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_EGOLD extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_EGOLD($checkout_id=false) {
$this->name = 'EGOLD';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD', 'CAD','FRF','CHF','GPB','DEM','AUD','JPY','EUR','BEF','ATS', 'GRD','ESP','IEP','ITL','LUF','NLG','PTE','FIM','EEK','LTL');
$this->support_arr = Array ('1', '2','33','41','44','49','61','81','85','86','87', '88','89','90','91','92','93','94','95','96','97');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.e-gold.com/sci_asp/payments.asp";
$vals = Array (
Array ('PAYEE_ACCOUNT', $this->cfg['account']),
Array ('PAYEE_NAME', SITE_NAME),
Array ('SUGGESTED_MEMO', "Payment For Invoice No. ". $invoice),
Array ('PAYMENT_AMOUNT', $amount),
Array ('ORDER_ID', $invoice),
Array ('PAYMENT_UNITS', $PAYMENT_UNITS),
Array ('PAYMENT_METAL_ID', $this->cfg['metal']),
Array ('STATUS_URL', $this->return_url),
Array ('PAYMENT_URL', $this->success_url.$invoice),
Array ('NOPAYMENT_URL', $this->decline_url.$invoice),
Array ('NOPAYMENT_URL_METHOD', "LINK"),
Array ('BAGGAGE_FIELDS', "invoice"),
Array ('invoice', $invoice)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['invoice'];
$ret['transaction_id'] = $VAR['PAYMENT_BATCH_NUM'];
$ret['amount'] = $VAR['PAYMENT_AMOUNT'];
$ret['currency'] = FALSE;
$ret['status'] = true;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Create & validate the Hash String
if(!empty($this->cfg['secret']))
{
$con_str = $VAR['PAYMENT_ID'];
$con_str.= ':' . $VAR['PAYEE_ACCOUNT'];
$con_str.= ':' . $VAR['PAYMENT_AMOUNT'];
$con_str.= ':' . $VAR['PAYMENT_UNITS'];
$con_str.= ':' . $VAR['PAYMENT_METAL_ID'];
$con_str.= ':' . $VAR['PAYMENT_BATCH_NUM'];
$con_str.= ':' . $VAR['PAYER_ACCOUNT'];
$con_str.= ':' . strtoupper(md5($this->cfg['secret']));
$con_str.= ':' . $VAR['ACTUAL_PAYMENT_OUNCES'];
$con_str.= ':' . $VAR['USD_PER_OUNCE'];
$con_str.= ':' . $VAR['FEEWEIGHT'];
$con_str.= ':' . $VAR['TIMESTAMPGMT'];
$str = strtoupper(md5($con_str));
if($str != $VAR['V2_HASH'])
$do = false;
}
# Get the currency:
for($i=0; $i<count($this->support_cur); $i++)
if ($VAR['PAYMENT_UNITS'] = $this->support_arr[$i])
$ret['currency'] = $this->support_cur[$i];
# Validate against the posted payee:
if($VAR['PAYEE_ACCOUNT'] != $this->cfg['account'])
$do = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_EGOLD;
$plg->postback($VAR);
}
?>

231
plugins/checkout/EPDQ.php Normal file
View File

@@ -0,0 +1,231 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_EPDQ extends base_checkout_plugin
{
function plg_chout_EPDQ($checkout_id=false) {
$this->name = 'EPDQ';
$this->type = 'redirect';
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('GBP');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
$currencycode=826;
/************ start ePDQ encryption ***************/
$server="secure2.epdq.co.uk";
$url="/cgi-bin/CcxBarclaysEpdqEncTool.e";
#the following parameters have been obtained earlier in the merchant's webstore clientid, passphrase, oid, currencycode, total
$params="clientid={$this->cfg['clientid']}"; /* ePDQ administrative service ClientID (also Store ID) */
$params.="&password={$this->cfg['passphrase']}"; /* ePDQ administrative service passphrase */
$params.="&oid=$invoice";
$params.="&chargetype={$this->cfg['chargetype']}"; /* Auth (immediate shipment) , PreAuth (delayed shipment) */
$params.="&currencycode=$currencycode";
$params.="&total=1.00";
#perform the HTTP Post
$response = epdqPullpage( $server,$url,$params );
#split the response into separate lines
$response_lines=explode("\n",$response);
print_r($response_lines);
#exit;
#for each line in the response check for the presence of the string 'epdqdata' this line contains the encrypted string
$response_line_count=count($response_lines);
for ($i=0;$i<$response_line_count;$i++){
if (preg_match('/epdqdata/',$response_lines[$i])){
$strEPDQ=$response_lines[$i];
}
}
/************** end ePDQ encryption ***************/
$this->redirect = '<form name="checkout_redirect" method="POST" action="https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdqEncTool.e" target="_parent">';
$this->redirect .= "$strEPDQ";
$this->redirect .= '<INPUT type="hidden" name="returnurl" value="'.$this->success_url.$invoice.'">';
$this->redirect .= '<INPUT type="hidden" name="merchantdisplayname" value="'.SITE_NAME.'">';
$this->redirect .= '<INPUT TYPE="submit" VALUE="purchase">';
$this->redirect .= '<script language="JavaScript">document.checkout_redirect.submit();</script>';
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback()
{
# read the post from PayPal system and add 'cmd'
global $_POST;
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
# post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
# needed for validation
$this->status = $_POST['payment_status'];
# needed for return
$ret['invoice_id'] = $_POST['invoice'];
$ret['transaction_id'] = $_POST['txn_id'];
$ret['amount'] = $_POST['mc_gross'];
$ret['currency'] = $_POST['mc_currency'];
$do = true;
# validate vars
if ($fp) {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0)
{
# check the payment_status is Completed
if($this->status == 'Completed' || $this->status == 'Canceled_Reversal')
$ret['status'] = true;
else
$ret['status'] = false;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($_POST['receiver_email'] == $this->cfg['email'])
{
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
return;
}
$rs->MoveNext();
}
}
}
fclose ($fp);
}
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do'])) {
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
$C_debug = new CORE_debugger;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYPAL;
$plg->postback();
}
#the following function performs a HTTP Post and returns the whole response
function epdqPullpage( $host, $usepath, $postdata = "" ) {
# open socket to filehandle(epdq encryption cgi)
$fp = fsockopen( $host, 80, &$errno, &$errstr, 60 );
#check that the socket has been opened successfully
if( !$fp ) {
print "$errstr ($errno)<br>\n";
}
else {
#write the data to the encryption cgi
fputs( $fp, "POST $usepath HTTP/1.0\n");
$strlength = strlen( $postdata );
fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
fputs( $fp, "Content-length: ".$strlength."\n\n" );
fputs( $fp, $postdata."\n\n" );
#clear the response data
$output = "";
#read the response from the remote cgi
#while content exists, keep retrieving document in 1K chunks
while( !feof( $fp ) ) {
$output .= fgets( $fp, 1024);
}
#close the socket connection
fclose( $fp);
}
#return the response
return $output;
}
?>

View File

@@ -0,0 +1,178 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_EPROCESSING_NETWORK extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_EPROCESSING_NETWORK($checkout_id=false) {
$this->name = 'EPROCESSING_NETWORK';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'www.eprocessingnetwork.com';
$this->url = '/cgi-bin/an/order.pl';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$test = "FALSE";
else
$test = "TRUE";
# Set the post vars:
$vars = Array (
Array ('x_ADC_URL', "FALSE"),
Array ('x_ADC_Delim_Data', "TRUE"),
Array ('x_Version', "3.0"),
Array ('x_Version', "3.0"),
Array ('x_Currency_Code', $currency_iso),
Array ('x_Method', "CC"),
Array ('x_Transaction_Type', $this->cfg['x_Transaction_Type']),
Array ('x_Test_Request', $test),
Array ('x_Password', $this->cfg['x_Password']),
Array ('x_Login', $this->cfg['x_Login']),
Array ('x_Amount', $amount),
Array ('x_Invoice_Num', $invoice),
Array ('x_Description', "Payment for Invoice No. ".$invoice),
Array ('x_Card_Code', $this->billing["ccv"]),
Array ('x_Card_Num', $this->billing["cc_no"]),
Array ('x_Exp_Date', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('x_Cust_ID', $acct_fields["id"]),
Array ('x_First_Name', $this->account["first_name"]),
Array ('x_Last_Name', $this->account["last_name"]),
Array ('x_Company', $this->account["company"]),
Array ('x_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_City', $this->account["city"]),
Array ('x_State', $this->account["state"]),
Array ('x_Zip', $this->account["zip"]),
Array ('x_Email', $acct_fields["email"]),
Array ('x_Country', $country),
Array ('x_Ship_To_First_Name', $this->account["first_name"]),
Array ('x_Ship_To_Last_Name', $this->account["last_name"]),
Array ('x_Ship_To_Company', $this->account["company"]),
Array ('x_Ship_To_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_Ship_To_City', $this->account["city"]),
Array ('x_Ship_To_State', $this->account["state"]),
Array ('x_Ship_To_Zip', $this->account["zip"]),
Array ('x_Ship_To_Country', $country),
Array ('x_Customer_IP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$response = explode(',', $response);
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['avs'] = $response[4];
# Message:
$ret['msg'] = $response[3];
# AVS Details:
if ( $response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( $response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( $response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( $response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( $response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( $response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( $response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( $response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( $response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( $response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( $response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

141
plugins/checkout/EWAY.php Normal file
View File

@@ -0,0 +1,141 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_EWAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_EWAY($checkout_id=false) {
$this->name = 'EWAY';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('AUD');
$this->host = 'www.eway.com.au';
$this->url = '/gateway/xmlpayment.asp';
$this->url_test = '/gateway/xmltest/testpage.asp';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] == "100")
$this->url = $this->url;
else
$this->url = $this->url_test;
$amount *= 100;
$xml_request = '<ewaygateway>'.
'<ewayCustomerID>'.$this->cfg['customer_id'].'</ewayCustomerID>'.
'<ewayTotalAmount>'.$amount.'</ewayTotalAmount>'.
'<ewayCustomerFirstName>'.$this->account["first_name"].'</ewayCustomerFirstName>'.
'<ewayCustomerLastName>'.$this->account["last_name"].'</ewayCustomerLastName>'.
'<ewayCustomerEmail>'.$acct_fields["email"].'</ewayCustomerEmail>'.
'<ewayCustomerAddress>'.$this->account["address1"].'</ewayCustomerAddress>'.
'<ewayCustomerPostcode>'.$this->account["zip"].'</ewayCustomerPostcode>'.
'<ewayCustomerInvoiceDescription>Payment for Invoice No. '.$invoice.'</ewayCustomerInvoiceDescription>'.
'<ewayCustomerInvoiceRef>'.$invoice.'</ewayCustomerInvoiceRef>'.
'<ewayCardHoldersName>'.$this->account["first_name"].' '.$this->account["last_name"].'</ewayCardHoldersName>'.
'<ewayCardNumber>'.$this->billing["cc_no"].'</ewayCardNumber>'.
'<ewayCardExpiryMonth>'.$this->billing["exp_month"].'</ewayCardExpiryMonth>'.
'<ewayCardExpiryYear>'.$this->billing["exp_year"].'</ewayCardExpiryYear>'.
'<ewayTrxnNumber></ewayTrxnNumber>'.
'<ewayOption1>'.$invoice.'</ewayOption1>'.
'<ewayOption2></ewayOption2>'.
'<ewayOption3></ewayOption3>'.
'</ewaygateway>';
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $xml_request, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
}
# Transaction Status:
if (eregi('<ewayTrxnStatus>True</ewayTrxnStatus>', $response)) {
$ret['status'] = 1;
}
else
{
$ret['status'] = 0;
$ret['msg'] = 'Transaction failed, please verify your details.';
}
# Transaction ID:
$ret['transaction_id'] = '';
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

65
plugins/checkout/FREE.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_FREE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_FREE($checkout_id=false) {
$this->name = 'FREE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
$ret['status'] = 1;
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,167 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_GOEMERCHANT extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_GOEMERCHANT($checkout_id=false) {
$this->name = 'GOEMERCHANT';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'secure.goemerchant1.com';
$this->url = '/cgi-bin/gateway/gateway.cgi';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('two_code', $acct_fields["country_id"]);
# Test Transaction
if($this->cfg['mode'] != "1")
$test = "TRUE";
else
$test = "FALSE";
# Split up the credit card number the way goemerchant likes it. :(
# They sure are weird aren't they? Who else does this? It sure is
# harder to take a string apart than to put it together. End of rant.
$cc1 = substr($this->billing['cc_no'], 0, 4);
$cc2 = substr($this->billing['cc_no'], 4, 4);
$cc3 = substr($this->billing['cc_no'], 8, 4);
$cc4 = substr($this->billing['cc_no'], 12, 4);
# Get the card type, apparently goemerchant does not know how to do
# this on their end. Woe is me! (Visa, Amex, Discover, MasterCard)
if (ereg ('^4(.{12}|.{15})$', $cc_no))
$cardname = 'Visa';
elseif (ereg ('^5[1-5].{14}$', $cc_no))
$cardname = 'MasterCard';
elseif (ereg ('^3[47].{13}$', $cc_no))
$cardname = 'Amex';
elseif (ereg ('^6011.{12}$', $cc_no))
$cardname = 'Discover';
# Set the post vars:
$vars = Array (
Array ('operation_type', 'auth'),
Array ('password', $this->cfg['x_Password']),
Array ('merchant', $this->cfg['x_Login']),
Array ('total', $amount),
Array ('orderid', $invoice),
Array ('cardname', $cardname),
Array ('cardnum1', $cc1),
Array ('cardnum2', $cc2),
Array ('cardnum3', $cc3),
Array ('cardnum4', $cc4),
Array ('CCV2', $this->billing["ccv"]),
Array ('cardexpm', $this->billing["exp_month"]),
Array ('cardexpy', $this->billing["exp_year"]),
Array ('nameoncard', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('cardstreet', $this->account["address1"] .' '.$this->account["address2"]),
Array ('cardcity', $this->account["city"]),
Array ('cardstate', $this->account["state"]),
Array ('cardzip', $this->account["zip"]),
Array ('cardcountry', $country)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Test Mode
if($this->cfg['mode'] == "1")
echo '<script language=Javascript>alert(\'Gateway response: '.$response.'\') </script>';
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = explode('|', $response);
}
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
@$ret['avs'] = @$response[4];
# Message:
@$ret['msg'] = @$response[2];
# AVS Details:
if ( @$response[3] == 'Y' )
$ret['avs'] = 'avs_exact';
else
$ret['avs'] = 'avs_no_match';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,175 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_GOLDMONEY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_GOLDMONEY($checkout_id=false) {
$this->name = 'GOLDMONEY';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('AUD', 'BRL', 'GBP', 'CAD', 'CNY', 'DEM', 'EUR', 'FRF', 'HDK', 'INR', 'ITL', 'JPY', 'KWD', 'MXN', 'NZD', 'RUR', 'ZAR', 'CHF', 'TRL', 'USD');
$this->support_arr = Array ('36', '986', '826', '124', '156', '280', '978', '250', '344', '356', '380', '392', '414', '484', '554', '810', '710', '756', '792', '840');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.goldmoney.com/omi/omipmt.asp";
$vals = Array (
Array ('OMI_MERCHANT_HLD_NO', $this->cfg['account']),
Array ('OMI_MERCHANT_MEMO', "Payment For Invoice No. ". $invoice),
Array ('OMI_CURRENCY_AMT', $amount),
Array ('OMI_CURRENCY_CODE', $CURRENCY_CODE),
Array ('OMI_MODE', $this->cfg['mode']),
Array ('OMI_RESULT_URL', $this->return_url),
Array ('OMI_SUCCESS_URL', $this->success_url.$invoice),
Array ('OMI_SUCCESS_URL_METHOD',"LINK"),
Array ('OMI_FAIL_URL', $this->decline_url.$invoice),
Array ('OMI_FAIL_URL_METHOD', "LINK"),
Array ('OMI_MERCHANT_REF_NO', $invoice)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['OMI_MERCHANT_REF_NO'];
$ret['transaction_id'] = $VAR['OMI_TXN_ID'];
$ret['amount'] = $VAR['OMI_CURRENCY_AMT'];
$ret['currency'] = FALSE;
$ret['status'] = true;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Test for test mode
if($this->cfg['mode'] == 1 && $VAR['OMI_MODE'] != "LIVE")
$do = false;
# Create & validate the Hash String
if(!empty($this->cfg['secret']))
{
$con_str = $VAR['OMI_MERCHANT_REF_NO'];
$con_str.= '?' . $VAR['OMI_MODE'];
$con_str.= '?' . $VAR['OMI_MERCHANT_HLD_NO'];
$con_str.= '?' . $VAR['OMI_PAYER_HLD_NO'];
$con_str.= '?' . $VAR['OMI_CURRENCY_CODE'];
$con_str.= '?' . $VAR['OMI_CURRENCY_AMT'];
$con_str.= '?' . $VAR['OMI_GOLDGRAM_AMT'];
$con_str.= '?' . $VAR['OMI_TXN_ID'];
$con_str.= '?' . $VAR['OMI_TXN_DATETIME'];
$con_str.= '?' . $VAR['OMI_MERCHANT_STRG_FEE'];
$con_str.= '?' . $this->cfg['secret'];
$str = strtoupper(md5($con_str));
if($str != $VAR['OMI_HASH'])
$do = false;
}
# Get the currency:
for($i=0; $i<count($this->support_cur); $i++)
if ($VAR['OMI_CURRENCY_CODE'] = $this->support_arr[$i])
$ret['currency'] = $this->support_cur[$i];
# Validate against the posted payee:
if($VAR['OMI_MERCHANT_HLD_NO'] != $this->cfg['account'])
$do = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_GOLDMONEY;
$plg->postback($VAR);
}
?>

141
plugins/checkout/IBILL.php Normal file
View File

@@ -0,0 +1,141 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_IBILL extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_IBILL($checkout_id=false) {
$this->name = 'IBILL';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'secure.ibill.com';
$this->url = '/cgi-win/ccard/tpcard.exe';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$test = "FALSE";
else
$test = "TRUE";
# Set the post vars:
$vars = Array (
Array ('reqtype', "authorize"),
Array ('saletype', "sale"),
Array ('account', $this->cfg['account']),
Array ('password', $this->cfg['password']),
Array ('amount', $amount),
Array ('crefnum', $invoice),
Array ('cardnum', $this->billing["cc_no"]),
Array ('cardexp', $this->billing["exp_month"] . '' . $this->billing["exp_year"]),
Array ('noc', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('address1', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('zipcode', $this->account["zip"])
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$response = explode(',', $response);
# Transaction Status:
if ($response[0] == 'authorized')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Auth code:
$ret['authorization_id'] = $response[1];
# Transaction ID:
$ret['transaction_id'] = $response[4];
# Message:
$ret['msg'] = $response[1];
# AVS Details:
if ( $response[6] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( $response[6] == 'X' )
$ret['avs'] = 'avs_na';
elseif ( $response[6] == 'Y' )
$ret['avs'] = 'avs_address_zip';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

170
plugins/checkout/IKOBO.php Normal file
View File

@@ -0,0 +1,170 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
This module currently does not work since IKobo will not respond and their
documentation is incorrect.
In your Ikobo account area, under 'sell online' set your IPN format to Ampersand & Delimited
and your IPN URL to http://www.<yoursite.com>/path/to/agilebill/plugins/checkout/IKOBO.php
Also, set the IPN password as well.
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_IKOBO extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_IKOBO($checkout_id=false) {
$this->name = 'IKOBO';
$this->type = 'redirect';
$this->recurr_only = false;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.ikobo.com/store/index.php";
$vals = Array (
Array ('cmd', 'cart'),
Array ('poid', $this->cfg['id']),
Array ('item', 'Payment for Invoice No. '.$invoice),
Array ('price', $amount),
Array ('custom', $invoice),
Array ('firstname', $acct_fields['first_name']),
Array ('lastname', $acct_fields['last_name']),
Array ('address', $acct_fields['address1']),
Array ('city', $acct_fields['city']),
Array ('state', $acct_fields['state']),
Array ('zip', $acct_fields['zip']),
Array ('email', $acct_fields['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['custom'];
$ret['transaction_id'] = $VAR['confirmation'];
$ret['amount'] = $VAR['total'];
if($VAR['func'] == "PURCHASE") // PURCHASE, REVERSAL, CANCELLATION
$ret['status'] = true;
else
$ret['status'] = false;
$ret['currency'] = DEFAULT_CURRENCY;
# needed for verification
$order_number = $VAR['x_trans_id']; // invoice_id
$order_id = $VAR['x_invoice_num']; // transaction id
$amount = $VAR['total']; // total
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# check the account number
if($VAR['pwd'] != $this->cfg['ipn_pass'])
return false;
# check the seller account
if($VAR['account_no'] != $this->cfg['id'])
return false;
# update
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_IKOBO;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,173 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_INTERNETSECURE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_INTERNETSECURE($checkout_id=false) {
$this->name = 'INTERNETSECURE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'secure.internetsecure.com';
$this->url = '/process.cgi';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Set the post vars:
$vars = Array (
Array ('x_ADC_URL', "FALSE"),
Array ('x_ADC_Delim_Data', "TRUE"),
Array ('x_Version', "3.0"),
Array ('x_Currency_Code', $currency_iso),
Array ('x_Method', "CC"),
Array ('x_Transaction_Type', $this->cfg['x_Transaction_Type']),
Array ('x_Login', $this->cfg['x_Login']),
Array ('x_Invoice_Num', $invoice),
Array ('xxxRequestMode', "A"),
Array ('template', "0"),
Array ('MerchantNumber', $this->cfg['x_Login']),
Array ('Products', "$amount::1::P001::Payment%20for%20Invoice%20No.%$invoice::"),
Array ('CVV2', $this->billing["ccv"]),
Array ('xxxCard_Number', $this->billing["cc_no"]),
Array ('xxxCCMonth', $this->billing["exp_month"]),
Array ('xxxCCYear', $this->billing["exp_year"]),
Array ('xxxCustomerID', $acct_fields["id"]),
Array ('xxxName', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('xxxCard_Name', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('xxxCompany', $this->account["company"]),
Array ('xxxAddress', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('xxxCity', $this->account["city"]),
Array ('xxxProvince', $this->account["state"]),
Array ('xxxPostal', $this->account["zip"]),
Array ('xxxEmail', $acct_fields["email"]),
Array ('xxxCountry', $country),
Array ('xxxShippingName', $this->account["first_name"] . ' ' .$this->account["last_name"]),
Array ('xxxShippingCompany', $this->account["company"]),
Array ('xxxShippingAddress', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('xxxShippingCity', $this->account["city"]),
Array ('xxxShippingProvince', $this->account["state"]),
Array ('xxxShippingPostal', $this->account["zip"]),
Array ('xxxShippingCountry', $country),
Array ('xxxCustomerIP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
echo $response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = explode(',', $response);
}
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
@$ret['avs'] = @$response[4];
# Message:
@$ret['msg'] = @$response[3];
# AVS Details:
if ( @$response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( @$response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( @$response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( @$response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( @$response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( @$response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( @$response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( @$response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( @$response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( @$response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( @$response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,125 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_LINKPOINT extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_LINKPOINT ($checkout_id=false) {
$this->name = 'LINKPOINT';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Linkpoint Class
include_once (PATH_PLUGINS . 'checkout/CLASS_LINKPOINT/lphp.php');
$mylphp=new lphp;
$myorder["host"] = "secure.linkpt.net";
$myorder["port"] = "1129";
$myorder["keyfile"] = PATH_PLUGINS . 'checkout/CLASS_LINKPOINT/'.$this->cfg["cert"];
$myorder["configfile"] = $this->cfg["account"];
$myorder["ordertype"] = "SALE";
$myorder["cardnumber"] = $this->billing["cc_no"];
$myorder["cardexpmonth"]= $this->billing["exp_month"];
$myorder["cardexpyear"] = $this->billing["exp_year"];
$myorder["cvmindicator"]= "provided";
$myorder["cvmvalue"] = $this->billing["ccv"];
$myorder["addrnum"] = $this->account["address1"];
$myorder["zip"] = $this->account["zip"];
$myorder["chargetotal"] = $amount;
$myorder["name"] = $this->account['first_name'].' '.$this->account['last_name'];
$myorder["company"] = $this->account['company'];
$myorder["address1"] = $this->account['address1'];
$myorder["address2"] = $this->account['address2'];
$myorder["city"] = $this->account['city'];
$myorder["state"] = $this->account['state'];
$myorder["email"] = $acct_fields['email'];
$myorderp["ip"] = USER_IP;
$myorder["comments"] = "Invoice $invoice";
#if($this->cfg['mode'] == "1")
#$myorder["result"] = "GOOD"; # For a test, set result to GOOD, DECLINE, or DUPLICATE
#if($this->cfg['mode'] == "1")
#$myorder["debugging"] = true;
#$myorder["cbin"] = false; // use binary curl?
# Send transaction. Use one of two possible methods #
$result = $mylphp->process($myorder); # use shared library model
#$result = $mylphp->curl_process($myorder); # use curl methods
if ($result["r_approved"] != "APPROVED") {
$ret['status'] = 0;
$ret['msg'] = 'The information provided is invalid or has declined';
} else {
$ret['status'] = 1;
$ret['avs'] = $result['r_code'];
$ret['transaction_id'] = $result['r_ordernum'];
}
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,80 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_MANUAL extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_MANUAL($checkout_id=false) {
$this->name = 'MANUAL';
$this->type = 'other'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# validate the card type and number, and exp date:
$ret=false;
$this->validate_card_details($ret);
# AVS Details:
$ret['avs'] = 'avs_na';
# return
if($ret['status'] == 1) {
$this->redirect = '<script language=Javascript>document.location = "?_page=invoice:thankyou&_next_page=checkout_plugin:plugin_ord_MANUAL_ALERT&id='.$invoice.'";</script>';
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,195 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_MONERIS_ESELECT extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_MONERIS_ESELECT($checkout_id=false) {
$this->name = 'MONERIS_ESELECT';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou';
$this->host = 'secure.authorize.net';
$this->url = '/gateway/transact.dll';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] == "1")
$test = "TRUE";
else
$test = "FALSE";
require_once("CLASS_MONERIS/mpgClasses.php");
$storeid=$this->cfg['user'];
$apitoken=$this->cfg['pass'];
$txnArray=array('type' =>$this->cfg['type'],
'order_id' => $invoice,
'amount' => $amount,
'pan' => $this->billing["cc_no"],
'expdate' => $this->billing["exp_year"].$this->billing["exp_month"],
'crypt_type' => '7' );
$mpgTxn = new mpgTransaction($txnArray);
/*
$mpgCustInfo = new mpgCustInfo();
$billing = Array( 'first_name' => $this->account["first_name"],
'last_name' => $this->account["last_name"],
'company_name' => $this->account["company"],
'address' => $this->account["address1"] . ' ' . $this->account["address2"],
'city' => $this->account["city"],
'province' => $this->account["state"],
'postal_code' => $this->account["zip"],
'country' => $country);
$mpgCustInfo->setBilling($billing);
$mpgCustInfo->setEmail($acct_fields["email"]);
$mpgTxn->setCustInfo($mpgCustInfo);
*/
$mpgRequest = new mpgRequest($mpgTxn);
$mpgHttpPost = new mpgHttpsPost($storeid,$apitoken,$mpgRequest);
$mpgResponse=$mpgHttpPost->getMpgResponse();
## step 6) retrieve data using get methods
print ("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
# Test Mode
if($this->cfg['mode'] == "1")
echo '<script language=Javascript>alert(\'Gateway response: '.$response.'\') </script>';
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = explode(',', $response);
}
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
@$ret['avs'] = @$response[4];
# Message:
@$ret['msg'] = @$response[3];
# AVS Details:
if ( @$response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( @$response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( @$response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( @$response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( @$response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( @$response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( @$response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( @$response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( @$response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( @$response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( @$response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,161 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_MONEYBOOKERS extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_MONEYBOOKERS($checkout_id=false) {
$this->name = 'MONEYBOOKERS';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
$url = "https://www.moneybookers.com/app/payment.pl";
$vals = Array (
Array ('pay_to_email', $this->cfg['account']),
Array ('detail1_description',"Payment For Invoice No. ". $invoice),
Array ('amount', $amount),
Array ('currency', $currency_iso),
Array ('status_url', $this->return_url),
Array ('return_url', $this->success_url.$invoice),
Array ('cancel_url', $this->decline_url.$invoice),
Array ('firstname', $acct_fields["first_name"]),
Array ('lastname', $acct_fields["last_name"]),
Array ('address', $acct_fields["address1"]),
Array ('postal_code', $acct_fields["zip"]),
Array ('city', $acct_fields["city"]),
Array ('state', $acct_fields["state"]),
Array ('transaction_id', $invoice)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['transaction_id'];
$ret['transaction_id'] = $VAR['mb_transaction_id'];
$ret['amount'] = $VAR['mb_amount'];
$ret['currency'] = $VAR['mb_currency'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# If the secret word is set, validate it against what is posted
if(!empty($this->cfg['secret'])) {
$hash = $VAR['merchant_id'];
$hash .= $VAR['transaction_id'];
$hash .= strtoupper(md5($this->cfg['secret']));
$hash .= $VAR['mb_amount'];
$hash .= $VAR['mb_currency'];
$hash .= $VAR['status'];
$hash = strtoupper(md5($hash));
if($hash != strtoupper($VAR['md5sig'])) {
$do = false;
}
}
# Validate against the posted seller:
if($this->cfg['account'] != $VAR['pay_to_email']) {
$do = false;
}
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_MONEYBOOKERS;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,225 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_MONEYBOOKERS_RECURRING extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_MONEYBOOKERS_RECURRING($checkout_id=false) {
$this->name = 'MONEYBOOKERS_RECURRING';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if($sched == 0) {
$rec_period = '7';
} elseif ($sched == 1) {
$rec_period = '30';
} elseif ($sched == 2) {
$rec_period = '91';
} elseif ($sched == 3) {
$rec_period = '182';
} elseif ($sched == 4) {
$rec_period = '365';
} elseif ($sched == 5) {
return false;
}
$url = "https://www.moneybookers.com/app/payment.pl";
# Get the next bill date for this subscription:
if($recurr_bill_arr[0]["recurr_type"] == "1")
{
# Pro-rate billing:
include_once ( PATH_MODULES . 'checkout/checkout.inc.php' );
$checkout = new checkout;
$arr = $checkout->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$rec_start_date = date("d/m/Y", $arr["end"]);
$end = $arr["end"]+(86400*365*10);
$rec_end_date = date("d/m/Y", $end);
$vals = Array (
Array ('pay_to_email', $this->cfg['account']),
Array ('detail1_description',"Payment For Invoice No. ". $invoice),
Array ('amount', $amount),
Array ('currency', $currency_iso),
Array ('status_url', $this->return_url),
Array ('return_url', $this->success_url.$invoice),
Array ('cancel_url', $this->decline_url.$invoice),
Array ('firstname', $acct_fields["first_name"]),
Array ('lastname', $acct_fields["last_name"]),
Array ('address', $acct_fields["address1"]),
Array ('postal_code', $acct_fields["zip"]),
Array ('city', $acct_fields["city"]),
Array ('state', $acct_fields["state"]),
Array ('transaction_id', $invoice),
Array ('rec_amount', $total_recurring),
Array ('rec_start_date', $rec_start_date),
Array ('rec_end_date', $rec_end_date),
Array ('rec_period', $rec_period),
);
}
else
{
# Bill on anniversary:
$rec_start_date = date("d/m/Y", time());
$end = time()+(86400*365*10);
$rec_end_date = date("d/m/Y", $end);
$vals = Array (
Array ('pay_to_email', $this->cfg['account']),
Array ('detail1_description',"Payment For Invoice No. ". $invoice),
Array ('amount', $amount),
Array ('currency', $currency_iso),
Array ('status_url', $this->return_url),
Array ('return_url', $this->success_url),
Array ('cancel_url', $this->decline_url),
Array ('firstname', $acct_fields["first_name"]),
Array ('lastname', $acct_fields["last_name"]),
Array ('address', $acct_fields["address1"]),
Array ('postal_code', $acct_fields["zip"]),
Array ('city', $acct_fields["city"]),
Array ('state', $acct_fields["state"]),
Array ('transaction_id', $invoice),
Array ('rec_amount', $total_recurring),
Array ('rec_start_date', $rec_start_date),
Array ('rec_end_date', $rec_end_date),
Array ('rec_period', $rec_period),
);
}
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['transaction_id'];
$ret['transaction_id'] = $VAR['mb_transaction_id'];
$ret['amount'] = $VAR['mb_amount'];
$ret['currency'] = $VAR['mb_currency'];
$ret['status'] = true;
$ret['subscription_id'] = $VAR['transaction_id'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# If the secret word is set, validate it against what is posted
if(!empty($this->cfg['secret'])) {
$hash = $VAR['merchant_id'];
$hash .= $VAR['transaction_id'];
$hash .= strtoupper(md5($this->cfg['secret']));
$hash .= $VAR['mb_amount'];
$hash .= $VAR['mb_currency'];
$hash .= $VAR['status'];
$hash = strtoupper(md5($hash));
if($hash != strtoupper($VAR['md5sig'])) {
$do = false;
}
}
# Validate against the posted seller:
if($this->cfg['account'] != $VAR['pay_to_email']) {
$do = false;
}
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_MONEYBOOKERS_RECURRING;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,136 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_NETBILLING extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_NETBILLING($checkout_id=false) {
$this->name = 'NETBILLING';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'secure.netbilling.com';
$this->url = '/gw/native/direct2.1';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Set the post vars:
$vars = Array (
Array ('GEN_DESCRIPTION', "Payment For Invoice ".$invoice),
Array ('GEN_TRANS_TYPE', "SALE"),
Array ('GEN_PAYMENT_TYPE', "C"),
Array ('GEN_ACCOUNT', $this->cfg['account']),
Array ('GEN_SITETAG', $this->cfg['sitetag']),
Array ('CARD_NUMBER', $this->billing["cc_no"]),
Array ('CARD_EXPIRE', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('CVV2', $this->billing["ccv"]),
Array ('GEN_AMOUNT', $amount),
Array ('CUST_NAME1', $this->account["first_name"]),
Array ('CUST_NAME2', $this->account["last_name"]),
Array ('CUST_ADDR_STREET', $this->account["address1"].' '.$this->account["address2"]),
Array ('CUST_ADDR_CITY', $this->account["city"]),
Array ('CUST_ADDR_STATE', $this->account["state"]),
Array ('CUST_ADDR_ZIP', $this->account["zip"]),
Array ('CUST_ADDR_COUNTRY', $country),
Array ('CUST_EMAIL', $acct_fields["email"]),
Array ('CUST_IP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Transaction Status:
if (eregi("RET_STATUS=1", $response)) {
$ret['status'] = 1;
} elseif (eregi("RET_STATUS=0",$response)) {
$ret['status'] = 0;
$mydata = split("\&",$response);
foreach($mydata as $key=>$value)
{
$newdata = split('=', $value);
$ret[$newdata[0]] = $newdata[1];
}
$reason = urldecode($ret['RET_AUTH_MSG']);
$ret['msg'] = @$reason;
} else {
$ret['status'] = 0;
$ret['msg'] = 'SORRY, THE TRANSACTION FAILED';
}
# Transaction ID:
$ret['transaction_id'] = 0;
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,158 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_NETPAYMENTS extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_NETPAYMENTS($checkout_id=false) {
$this->name = 'NETPAYMENTS';
$this->type = 'redirect';
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('GBP', 'CAD', 'HKD', 'NIS', 'EUR', 'USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.netshopperuk.com/sec/nsauth.cfm";
if($this->cfg['mode'] == 0)
$mode = "Mtestransaction=1";
else
$mode = "Mtestransaction=0";
$vals = Array (
Array ('NSACCESS', $this->cfg['id']),
Array ('MtestTransaction', $mode),
Array ('Amount', $amount),
Array ('OrderString', 'Payment for Invoice No. '.$invoice),
Array ('OrderId', $invoice),
Array ('CustomerName', $acct_fields["first_name"] . ' ' . $acct_fields["last_name"]),
Array ('CustomerAddress01', $acct_fields["address1"]),
Array ('CustomerTown', $acct_fields["city"]),
Array ('CustomerCounty', $acct_fields["state"]),
Array ('CustomerPostcode', $acct_fields["zip"]),
Array ('CustomerEmail', $acct_fields["email"]),
Array ('ResponseURL', $this->return_url),
Array ('ApproveURL', $this->success_url.$url),
Array ('RejectURL', $this->decline_url.$url)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['OrderID'];
$ret['transaction_id'] = $VAR['nsTransID'];
$ret['amount'] = $VAR['Amount'];
$ret['currency'] = DEFAULT_CURRENCY;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Validate against the posted payee:
if($VAR['nsrAuth'] == 1)
$ret['status'] = true;
else
$ret['status'] = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_EGOLD;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,174 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_NOCHEXS extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_NOCHEXS($checkout_id=false) {
$this->name = 'NOCHEXS';
$this->type = 'redirect';
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('GBP');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.nochex.com/nochex.dll/checkout";
$vals = Array (
Array ('email', $this->cfg['email']),
Array ('amount', $amount),
Array ('description', 'Payment for Invoice No. '.$invoice),
Array ('ordernumber', $invoice),
Array ('returnurl', $this->success_url.$invoice),
Array ('cancelurl', $this->decline_url.$invoice),
Array ('responderurl', $this->return_url),
Array ('firstname', $acct_fields['first_name']),
Array ('lastname', $acct_fields['last_name']),
Array ('firstline', $acct_fields['address1']),
Array ('town', $acct_fields['city']),
Array ('county', $acct_fields['state']),
Array ('postcode', $acct_fields['zip']),
Array ('email_address_sender', $acct_fields['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['order_id'];
$ret['transaction_id'] = $VAR['transaction_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Validate agains the posted 2checkout id:
if($this->cfg['email'] != $VAR['to_email']) {
$do = false;
}
# Contact the nochex server for validation
if($do) {
$this->host = 'www.nochex.com';
$this->url = '/nochex.dll/apc/apc';
while (list($key,$value) = each($VAR))
$vars[] = Array ($key, $value);
# POST the variables back to NOCHEX:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
if(empty($response) || eregi("DECLINED", $response)) {
$do = false;
} elseif (eregi("AUTHORISED", $response)) {
$do = true;
} else {
$do = false;
}
}
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.'&id='.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.'&id='.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_NOCHEXS;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,189 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_OPTIMALPAYMENTS extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_OPTIMALPAYMENTS($checkout_id=false) {
$this->name = 'OPTIMALPAYMENTS';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD','CAD','GBP');
$this->success_url = URL . '?_page=invoice:thankyou';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('two_code', $acct_fields["country_id"]);
# Test Transaction
if($this->cfg['mode'] != "1") {
$this->host = 'realtime.test.firepay.com';
$this->url = '/servlet/DPServlet';
} else {
$this->host = 'realtime.firepay.com';
$this->url = '/servlet/DPServlet';
}
if(empty($this->billing["ccv"]))
$cvdind = 0;
else
$cvdind = 1;
switch (@$this->billing["card_type"]) {
case 'visa':
$ctype = 'VI'; break;
case 'mc':
$ctype = 'MC'; break;
case 'amex':
$ctype = 'AM'; break;
case 'discover':
$ctype = 'DI'; break;
case 'delta':
$ctype = ''; break;
case 'solo':
$ctype = 'SO'; break;
case 'switch':
$ctype = 'SW'; break;
case 'jcb':
$ctype = ''; break;
case 'diners':
$ctype = 'DC'; break;
case 'carteblanche':
$ctype = ''; break;
case 'enroute':
$ctype = ''; break;
}
# Set the post vars:
$vars = Array (
Array ('account', $this->cfg['account']),
Array ('merchantTxn', $invoice . microtime()),
Array ('merchantId', $this->cfg['merchantId']),
Array ('merchantPwd', $this->cfg['merchantPwd']),
Array ('merchantData', "AgileBill Invoice Id : " . $invoice),
Array ('amount', $amount * 100),
Array ('cardNumber', $this->billing["cc_no"]),
Array ('cardExp', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('cvdIndicator', $cvdind),
Array ('cvdValue', $this->billing["ccv"]),
Array ('cardType', $ctype),
Array ('operation', 'P'),
Array ('clientVersion', '1.1'),
Array ('custName1', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('StreetAddr', $this->account["address1"]),
Array ('StreetAddr2', $this->account["address2"]),
Array ('email', $acct_fields["email"]),
Array ('city', $this->account["city"]),
Array ('province', $this->account["state"]),
Array ('zip', $this->account["zip"]),
Array ('country', $country),
Array ('phone', '18885551212')
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = ereg_replace('\+', ' ', $response);
$response = explode('&', $response);
foreach($response as $var)
$item[] = explode("=", $var);
foreach($item as $var)
$$var[0] = $var[1];
}
/*
if($this->cfg['mode'] != "1") {
print_r($response);
print_r($item);
exit;
}
*/
# Transaction Status:
if (@$status == 'SP')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
@$ret['transaction_id'] = @$authCode;
# Message:
@$ret['msg'] = @$avsInfo;
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,86 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PAYBYCHECK_BASIC extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYBYCHECK_BASIC($checkout_id=false) {
$this->name = 'PAYBYCHECK_BASIC';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://paybycheck.com/";
$vals = Array (
Array ('id', $this->cfg['id']),
Array ('i', "Invoice No:". $invoice),
Array ('a', $amount),
Array ('s', $this->success_url.$invoice),
Array ('name', $acct_fields['first_name'].' '.$acct_fields['last_name']),
Array ('address1', $acct_fields['address1'].' '.$acct_fields['address2']),
Array ('city', $acct_fields['city']),
Array ('state', $acct_fields['state']),
Array ('zip', $acct_fields['zip']),
Array ('email', $acct_fields['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,195 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PAYFUSE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYFUSE($checkout_id=false) {
$this->name = 'PAYFUSE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] == "0") {
$this->host = 'test5x.clearcommerce.com:11500';
$mode = 'Y';
} else {
$mode = 'P';
$this->host = 'xmlic.payfuse.com';
}
$xml = "<EngineDocList>
<DocVersion>1.0</DocVersion>
<EngineDoc>
<ContentType>OrderFormDoc</ContentType>
<User>
<Name>{$this->cfg['name']}</Name>
<Password>{$this->cfg['password']}</Password>
<Alias>{$this->cfg['alias']}</Alias>
</User>
<Instructions>
<Pipeline>Payment</Pipeline>
</Instructions>
<OrderFormDoc>
<Mode>{$mode}</Mode>
<Comments/>
<Consumer>
<Email/>
<PaymentMech>
<CreditCard>
<Number>{$this->billing["cc_no"]}</Number>
<Expires DataType=\"ExpirationDate\" Locale=\"840\">{$this->billing["exp_month"]}/{$this->billing["exp_year"]}</Expires>
<Cvv2Val>{$this->billing["ccv"]}</Cvv2Val>
<Cvv2Indicator>1</Cvv2Indicator>
</CreditCard>
</PaymentMech>
<BillTo>
<Location>
<TelVoice/>
<TelFax/>
<Address>
<Name>{$this->account["first_name"]} {$acct_fields["last_name"]}</Name>
<Street1>{$this->account["address1"]}</Street1>
<Street2>{$this->account["address2"]}</Street2>
<City>{$this->account["city"]}</City>
<StateProv>{$this->account["state"]}</StateProv>
<PostalCode>{$this->account["zip"]}</PostalCode>
<Country>840</Country>
<Company/>
</Address>
</Location>
</BillTo>
</Consumer>
<Transaction>
<Type>Auth</Type>
<CurrentTotals>
<Totals>
<Total DataType=\"Money\" Currency=\"840\">". $amount * 100 ."</Total>
</Totals>
</CurrentTotals>
</Transaction>
</OrderFormDoc>
</EngineDoc>
</EngineDocList>";
$vars = Array ( Array ('xml', $xml) );
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, '', $vars, true, 1);
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
preg_match_all ("/<(.*?)>(.*?)\</", $response, $out, PREG_SET_ORDER);
$n = 0;
while (isset($out[$n])) {
$arr[$out[$n][1]] = strip_tags($out[$n][0]);
$n++;
}
}
/*
echo '<pre>';
print_r($arr);
print_r($response);
exit;
*/
# Transaction Status:
$str = 'CcErrCode DataType="S32"';
if ($arr["$str"] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# AVS:
$str = 'FraudResult DataType="String"';
@$ret['avs'] = @$arr["$str"];
# Message:
$str = 'CcReturnMsg DataType="String"';
@$ret['msg'] = @$arr["$str"];
# Transaction ID
$str = 'TransactionId DataType="String"';
@$ret['transaction_id'] = $arr["$str"];
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,147 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYMATE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYMATE($checkout_id=false) {
$this->name = 'PAYMATE';
$this->type = 'redirect';
$this->recurr_only = false;
$this->support_cur = Array ('USD','AUD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.paymate.com.au/PayMate/ExpressPayment";
$vals = Array (
Array ('mid', $this->cfg['mid']),
Array ('amt', $amount),
Array ('ref', $invoice),
Array ('currency', $currency_iso),
Array ('return', SSL_URL . 'plugins/checkout/PAYMATE.php'),
Array ('pop', 'false'),
Array ('pmt_contact_firstname', $acct_fields['first_name']),
Array ('pmt_contact_surname', $acct_fields['last_name']),
Array ('regindi_address1', $acct_fields['address1']),
Array ('regindi_sub', $acct_fields['city']),
Array ('regindi_pcode', $acct_fields['zip']),
Array ('pmt_sender_email', $acct_fields['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['ref'];
$ret['transaction_id'] = $VAR['transactionID'];
$ret['amount'] = $VAR['paymentAmount'];
$ret['status'] = true;
$ret['currency'] = $VAR['currency'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# Test for response code
/*
if($VAR['responseCode'] != "PP")
$do = false;
*/
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.URL.'?_page=invoice:thankyou&_next_page=invoice:user_view&id='.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.URL.'?_page=checkout:checkout";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYMATE;
$plg->postback($VAR);
}
?>

180
plugins/checkout/PAYPAL.php Normal file
View File

@@ -0,0 +1,180 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYPAL extends base_checkout_plugin
{
function plg_chout_PAYPAL($checkout_id=false) {
$this->name = 'PAYPAL';
$this->type = 'redirect';
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('AUD', 'USD', 'GBP', 'EUR', 'CAD', 'JPY');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
# Special JPY formatting:
if($currency_iso == 'JPY') $amount = round($amount);
# Set the vars
$vals = Array (
Array ('cmd', '_xclick'),
Array ('bn', 'Agileco.AgileBill'),
Array ('business', $this->cfg['email']),
Array ('item_name', SITE_NAME. ' - Invoice # '.$invoice),
Array ('amount', $amount),
Array ('return', $this->success_url.$invoice),
Array ('cancel_return', $this->decline_url.$invoice),
Array ('notify_url', $this->return_url),
Array ('currency_code', $currency_iso),
Array ('invoice', $invoice),
Array ('first_name', $acct_fields['first_name']),
Array ('last_name', $acct_fields['last_name']),
Array ('payer_business_name', $acct_fields['company']),
Array ('address_street', $acct_fields['address1']),
Array ('address_city', $acct_fields['city']),
Array ('address_state', $acct_fields['state']),
Array ('address_zip', $acct_fields['zip']),
Array ('address_country', $acct_fields['country_id']),
Array ('payer_email', $acct_fields['email']),
Array ('payer_id', $acct_fields['id'])
);
$this->post_vars("https://www.paypal.com/cgi-bin/webscr", $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback()
{
# read the post from PayPal system and add 'cmd'
global $_POST;
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
# post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
# needed for validation
$this->status = $_POST['payment_status'];
# needed for return
$ret['invoice_id'] = $_POST['invoice'];
$ret['transaction_id'] = $_POST['txn_id'];
$ret['amount'] = $_POST['mc_gross'];
$ret['currency'] = $_POST['mc_currency'];
$do = true;
# validate vars
if ($fp) {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0)
{
# check the payment_status is Completed
if($this->status == 'Completed' || $this->status == 'Canceled_Reversal')
$ret['status'] = true;
else
$ret['status'] = false;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($_POST['receiver_email'] == $this->cfg['email'])
{
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
return;
}
$rs->MoveNext();
}
}
}
fclose ($fp);
}
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do'])) {
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
$C_debug = new CORE_debugger;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYPAL;
$plg->postback();
}
?>

View File

@@ -0,0 +1,308 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYPAL_RECURRING extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYPAL_RECURRING($checkout_id=false) {
$this->name = 'PAYPAL_RECURRING';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('AUD', 'USD', 'GBP', 'EUR', 'CAD', 'JPY');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
# Special JPY formatting:
if($currency_iso == 'JPY') $amount = round($amount);
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if($sched == 0) {
$p3 = '1';
$t3 = 'W';
} elseif ($sched == 1) {
$p3 = '1';
$t3 = 'M';
} elseif ($sched == 2) {
$p3 = '3';
$t3 = 'M';
} elseif ($sched == 3) {
$p3 = '6';
$t3 = 'M';
} elseif ($sched == 4) {
$p3 = '1';
$t3 = 'Y';
} elseif ($sched == 5) {
$p3 = '2';
$t3 = 'Y';
}
$url = "https://www.paypal.com/cgi-bin/webscr";
# Get the next bill date for this subscription:
if($recurr_bill_arr[0]["recurr_type"] == "1")
{
# Pro-rate billing:
include_once ( PATH_MODULES . 'checkout/checkout.inc.php' );
$checkout = new checkout;
$arr = $checkout->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$remain_time = $arr['end'] - time();
$period1 = round($remain_time/86400);
$subscr_date = date("Y-m-d", $arr["end"]);
$vals = Array (
Array ('cmd', '_xclick-subscriptions'),
Array ('bn', 'Agileco.AgileBill'),
Array ('business', $this->cfg['email']),
Array ('item_name', "Invoice No:". $invoice),
Array ('return', $this->success_url.$invoice),
Array ('cancel_return', $this->decline_url.$invoice),
Array ('notify_url', $this->return_url),
Array ('currency_code', $currency_iso),
Array ('invoice', $invoice),
Array ('first_name', $acct_fields['first_name']),
Array ('last_name', $acct_fields['last_name']),
Array ('payer_business_name', $acct_fields['company']),
Array ('address_street', $acct_fields['address1']),
Array ('address_city', $acct_fields['city']),
Array ('address_state', $acct_fields['state']),
Array ('address_zip', $acct_fields['zip']),
Array ('address_country', $acct_fields['country_id']),
Array ('payer_email', $acct_fields['email']),
Array ('payer_id', $acct_fields['id']) ,
Array ('txn_type', 'subscr_signup'),
Array ('a1', $amount),
Array ('p1', $period1),
Array ('t1', 'D'),
Array ('a3', $total_recurring),
Array ('p3', $p3),
Array ('t3', $t3),
Array ('src', "1"),
Array ('sra', "1")
);
}
else
{
# Bill on anniversary:
$vals = Array (
Array ('cmd', '_xclick-subscriptions'),
Array ('business', $this->cfg['email']),
Array ('item_name', "Invoice No:". $invoice),
Array ('return', $this->success_url.$invoice),
Array ('cancel_return', $this->decline_url.$invoice),
Array ('notify_url', $this->return_url),
Array ('currency_code', $currency_iso),
Array ('invoice', $invoice),
Array ('first_name', $acct_fields['first_name']),
Array ('last_name', $acct_fields['last_name']),
Array ('payer_business_name', $acct_fields['company']),
Array ('address_street', $acct_fields['address1']),
Array ('address_city', $acct_fields['city']),
Array ('address_state', $acct_fields['state']),
Array ('address_zip', $acct_fields['zip']),
Array ('address_country', $acct_fields['country_id']),
Array ('payer_email', $acct_fields['email']),
Array ('payer_id', $acct_fields['id']) ,
Array ('txn_type', 'subscr_signup'),
Array ('a1', $amount),
Array ('p1', $p3),
Array ('t1', $t3),
Array ('a3', $total_recurring),
Array ('p3', $p3),
Array ('t3', $t3),
Array ('src', "1"),
Array ('sra', "1")
);
}
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback()
{
# read the post from PayPal system and add 'cmd'
global $_POST, $C_debug;
# Log paypal postback:
foreach ($_POST as $key => $value) @$debug .= "\r\n$key=$value";
$C_debug->error('PAYPAL_RECUR:'. $_POST['txn_type'], 'Invoice: '. $_POST['invoice'], "$debug" );
# Assemble postback string
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
# post back to PayPal system to validate
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$domain = 'www.paypal.com';
#$domain = 'www.sandbox.paypal.com';
$fp = fsockopen ($domain, 80, $errno, $errstr, 30);
# needed for validation
$ret['invoice_id'] = $_POST['invoice'];
$ret['transaction_id'] = $_POST['txn_id'];
$ret['currency'] = $_POST['mc_currency'];
$ret['subscription_id'] = $_POST['subscr_id'];
if (!empty($_POST['mc_gross']))
$ret['amount'] = $_POST['mc_gross'];
else
$ret['amount'] = $_POST['payment_gross'];
# validate
$do = true;
$force = true; // force approved reply
if (!$fp)
{
# HTTP ERROR:
$C_debug->error('PAYPAL_RECURRING.php', 'postback()', "Unable to connect to domain $domain" );
}
else
{
fputs ($fp, $header . $req);
while (!feof($fp))
{
$res = fgets ($fp, 1024);
if (!$force && strcmp ($res, "INVALID") == 0)
{
# Log for manual investigation:
$C_debug->error('PAYPAL_RECURRING.php', 'postback()', "Postback for Invoice {$ret['invoice_id']} is INVALID, PayPal subscription id {$ret['subscription_id']}");
header("HTTP/1.0 404 Not Found");
return false;
}
else if ($force || strcmp ($res, "VERIFIED") == 0)
{
# get the payment status
$ret['status'] = true;
switch($_POST['txn_type']) {
case "subscr_cancel": $ret['status'] = false; break;
case "subscr_failed": $ret['status'] = false; break;
case "subscr_eot": $ret['status'] = false; break;
}
if($ret['status'] != false) {
switch($_POST['payment_status']) {
case "Canceled_Reversal": $ret['status'] = true; break;
case "Completed": $ret['status'] = true; break;
case "Denied": $ret['status'] = false; break;
case "Failed": $ret['status'] = false; break;
case "Pending": $ret['status'] = false; break;
case "Refunded": $ret['status'] = false; break;
case "Reversed": $ret['status'] = false; break;
}
}
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($_POST['business'] == $this->cfg['email'])
{
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
header("HTTP/1.1 200 OK");
header("Status: 200 OK");
fclose ($fp);
return;
}
$rs->MoveNext();
}
}
}
fclose ($fp);
}
header("HTTP/1.0 404 Not Found");
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do'])) {
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
$C_debug = new CORE_debugger;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYPAL_RECURRING;
$plg->postback();
}
?>

View File

@@ -0,0 +1,91 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
# Main Class
class plg_chout_PAYSWISS extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYSWISS($checkout_id=false) {
$this->name = 'PAYSWISS';
$this->type = 'redirect';
$this->recurr_only = false;
$this->support_cur = Array ('USD');
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
/*
<09> action - use "subscription" if this product is subscription
use "payment" if this is simple payment transaction
<09> period - subscription rebilling period, days
<09> trial - trial period, days
<09> setup - setup fee, $
*/
$url = "https://www.payswiss.com/process.php";
$vals = Array (
Array ('username', $this->cfg['email']),
Array ('action', 'payment'),
Array ('product', SITE_NAME. ' - Invoice # '.$invoice),
Array ('price', $amount),
Array ('action', 'payment'),
Array ('quantity', '1'),
Array ('ucancel', $this->decline_url.$invoice),
Array ('unotify', $this->return_url),
Array ('ureturn', $this->success_url.$invoice)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,115 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PAYSWISS_RECURRING extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYSWISS_RECURRING($checkout_id=false) {
$this->name = 'PAYSWISS_RECURRING';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
# PaySwiss cannot handle pro-rated subscriptions:
if($recurr_bill_arr[0]["recurr_type"] != "0") {
global $C_translate;
$msg = $C_translate->translate('prorated_not_supported','checkout','');
echo '<script language=Javascript> alert(\''.$msg.'\'); </script>';
return false;
}
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if($sched == 0) {
$period = '7';
} elseif ($sched == 1) {
$period = '31';
} elseif ($sched == 2) {
$period = '91';
} elseif ($sched == 3) {
$period = '182';
} elseif ($sched == 4) {
$period = '365';
} elseif ($sched == 5) {
$period = '730';
}
$setup = "0.00";
if($amount > $total_recurring)
$setup = number_format($amount - $total_recurring,2);
$url = "https://www.payswiss.com/process.php";
$vals = Array (
Array ('username', $this->cfg['email']),
Array ('action', 'subscription'),
Array ('product', SITE_NAME. ' - Invoice # '.$invoice),
Array ('price', $total_recurring),
Array ('action', 'payment'),
Array ('quantity', '1'),
Array ('ucancel', $this->decline_url.$invoice),
Array ('unotify', $this->return_url),
Array ('ureturn', $this->success_url.$invoice),
Array ('period', $period),
Array ('setup', $setup)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,148 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYSYSTEMS_CHECK extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYSYSTEMS_CHECK($checkout_id=false) {
$this->name = 'PAYSYSTEMS_CHECK';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://secure.paysystems1.com/cgi-v310/payment/onlinesale-tpppro_check.asp";
$vals = Array (
Array ('companyid', $this->cfg['id']),
Array ('product1', "Payment For Invoice No. ". $invoice),
Array ('total', $amount),
Array ('redirect', $this->return_url),
Array ('redirectfail', $this->decline_url.$invoice),
Array ('currency_code', $currency_iso),
Array ('option1', $invoice),
Array ('b_firstname', $acct_fields['first_name']),
Array ('b_middlename', $acct_fields['middle_name']),
Array ('b_lastname', $acct_fields['last_name']),
Array ('b_address', $acct_fields['address1']),
Array ('b_city', $acct_fields['city']),
Array ('b_state', $acct_fields['state']),
Array ('b_zip', $acct_fields['zip']),
Array ('b_country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('delivery', 'N')
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['option1'];
$ret['transaction_id'] = $VAR['order_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYSYSTEMS_CHECK;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,187 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYSYSTEMS_CHECK_RECUR extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYSYSTEMS_CHECK_RECUR($checkout_id=false) {
$this->name = 'PAYSYSTEMS_CHECK_RECUR';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
# PaySystems cannot handle pro-rated subscriptions:
if($recurr_bill_arr[0]["recurr_type"] != "0") {
global $C_translate;
$msg = $C_translate->translate('prorated_not_supported','checkout','');
echo '<script language=Javascript> alert(\''.$msg.'\'); </script>';
return false;
}
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if($sched == 0) {
$cycle = '7';
} elseif ($sched == 1) {
$cycle = '30';
} elseif ($sched == 2) {
$cycle = '91';
} elseif ($sched == 3) {
$cycle = '182';
} elseif ($sched == 4) {
$cycle = '365';
} elseif ($sched == 5) {
$cycle = '730';
}
if($amount < $total_recurring) {
$setup_fee = '0';
} else {
$setup_fee = $amount-$total_recurring;
}
$url = "https://secure.paysystems1.com/cgi-v310/payment/onlinesale-tpppro_check.asp";
$vals = Array (
Array ('companyid', $this->cfg['id']),
Array ('product1', "Payment For Invoice No. ". $invoice),
Array ('total', $amount),
Array ('redirect', $this->return_url),
Array ('redirectfail', $this->decline_url.$invoice),
Array ('currency_code', $currency_iso),
Array ('option1', $invoice),
Array ('b_firstname', $acct_fields['first_name']),
Array ('b_middlename', $acct_fields['middle_name']),
Array ('b_lastname', $acct_fields['last_name']),
Array ('b_address', $acct_fields['address1']),
Array ('b_city', $acct_fields['city']),
Array ('b_state', $acct_fields['state']),
Array ('b_zip', $acct_fields['zip']),
Array ('b_country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('delivery', 'N'),
Array ('reoccur', "Y"),
Array ('cycle', $cycle),
Array ('totalperiod', '0'),
Array ('repeatamount', $total_recurring)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['option1'];
$ret['transaction_id'] = $VAR['order_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
$ret['status'] = true;
$ret['subscription_id'] = $VAR['option1'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYSYSTEMS_CHECK_RECUR;
//$plg->postback($VAR);
$plg->bill_checkout('','','','','','');
}
?>

View File

@@ -0,0 +1,150 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYSYSTEMS_PRO extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYSYSTEMS_PRO($checkout_id=false) {
$this->name = 'PAYSYSTEMS_PRO';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://secure.paysystems1.com/cgi-v310/payment/onlinesale-tpppro.asp";
$vals = Array (
Array ('companyid', $this->cfg['id']),
Array ('product1', "Payment For Invoice No. ". $invoice),
Array ('total', $amount),
Array ('redirect', $this->return_url),
Array ('redirectfail', $this->decline_url.$invoice),
Array ('currency_code', $currency_iso),
Array ('option1', $invoice),
Array ('b_firstname', $acct_fields['first_name']),
Array ('b_middlename', $acct_fields['middle_name']),
Array ('b_lastname', $acct_fields['last_name']),
Array ('b_address', $acct_fields['address1']),
Array ('b_city', $acct_fields['city']),
Array ('b_state', $acct_fields['state']),
Array ('b_zip', $acct_fields['zip']),
Array ('b_country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('delivery', 'N')
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['option1'];
$ret['transaction_id'] = $VAR['order_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYSYSTEMS_PRO;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,184 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_PAYSYSTEMS_RECURRING extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PAYSYSTEMS_RECURRING($checkout_id=false) {
$this->name = 'PAYSYSTEMS_RECURRING';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
# PaySystems cannot handle pro-rated subscriptions:
if($recurr_bill_arr[0]["recurr_type"] != "0") {
global $C_translate;
$msg = $C_translate->translate('prorated_not_supported','checkout','');
echo '<script language=Javascript> alert(\''.$msg.'\'); </script>';
return false;
}
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if($sched == 0) {
$cycle = '7';
} elseif ($sched == 1) {
$cycle = '30';
} elseif ($sched == 2) {
$cycle = '91';
} elseif ($sched == 3) {
$cycle = '182';
} elseif ($sched == 4) {
$cycle = '365';
} elseif ($sched == 5) {
$cycle = '730';
}
if($amount < $total_recurring) {
$setup_fee = '0';
} else {
$setup_fee = $amount-$total_recurring;
}
$url = "https://secure.paysystems1.com/cgi-v310/payment/onlinesale-tpppro.asp";
$vals = Array (
Array ('companyid', $this->cfg['id']),
Array ('product1', "Payment For Invoice No. ". $invoice),
Array ('total', $amount),
Array ('redirect', $this->return_url.$invoice),
Array ('redirectfail', $this->decline_url.$invoice),
Array ('currency_code', $currency_iso),
Array ('option1', $invoice),
Array ('b_firstname', $acct_fields['first_name']),
Array ('b_middlename', $acct_fields['middle_name']),
Array ('b_lastname', $acct_fields['last_name']),
Array ('b_address', $acct_fields['address1']),
Array ('b_city', $acct_fields['city']),
Array ('b_state', $acct_fields['state']),
Array ('b_zip', $acct_fields['zip']),
Array ('b_country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('delivery', 'N'),
Array ('reoccur', "Y"),
Array ('cycle', $cycle),
Array ('totalperiod', '0'),
Array ('repeatamount', $total_recurring)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['option1'];
$ret['transaction_id'] = $VAR['order_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
$ret['status'] = true;
$ret['subscription_id'] = $VAR['option1'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_PAYSYSTEMS_RECURRING;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,182 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PLANETPAYMENT extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PLANETPAYMENT($checkout_id=false) {
$this->name = 'PLANETPAYMENT';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'secure.planetpayment.com';
$this->url = '/gateway/transact.dll';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$test = "FALSE";
else
$test = "TRUE";
# Set the post vars:
$vars = Array (
Array ('x_ADC_URL', "FALSE"),
Array ('x_ADC_Delim_Data', "TRUE"),
Array ('x_Version', "3.0"),
Array ('x_Version', "3.0"),
Array ('x_Currency_Code', $currency_iso),
Array ('x_Method', "CC"),
Array ('x_Transaction_Type', $this->cfg['x_Transaction_Type']),
Array ('x_Test_Request', $test),
Array ('x_Password', $this->cfg['x_Password']),
Array ('x_Login', $this->cfg['x_Login']),
Array ('x_Amount', $amount),
Array ('x_Invoice_Num', $invoice),
Array ('x_Description', "Payment for Invoice No. ".$invoice),
Array ('x_Card_Code', $this->billing["ccv"]),
Array ('x_Card_Num', $this->billing["cc_no"]),
Array ('x_Exp_Date', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('x_Cust_ID', $acct_fields["id"]),
Array ('x_First_Name', $this->account["first_name"]),
Array ('x_Last_Name', $this->account["last_name"]),
Array ('x_Company', $this->account["company"]),
Array ('x_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_City', $this->account["city"]),
Array ('x_State', $this->account["state"]),
Array ('x_Zip', $this->account["zip"]),
Array ('x_Email', $acct_fields["email"]),
Array ('x_Country', $country),
Array ('x_Ship_To_First_Name', $this->account["first_name"]),
Array ('x_Ship_To_Last_Name', $this->account["last_name"]),
Array ('x_Ship_To_Company', $this->account["company"]),
Array ('x_Ship_To_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_Ship_To_City', $this->account["city"]),
Array ('x_Ship_To_State', $this->account["state"]),
Array ('x_Ship_To_Zip', $this->account["zip"]),
Array ('x_Ship_To_Country', $country),
Array ('x_Customer_IP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$response = explode(',', $response);
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['avs'] = $response[4];
# Message:
$ret['msg'] = $response[3];
# AVS Details:
if ( $response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( $response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( $response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( $response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( $response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( $response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( $response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( $response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( $response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( $response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( $response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,142 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PLUGNPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PLUGNPAY($checkout_id=false) {
$this->name = 'PLUGNPAY';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'pay1.plugnpay.com';
$this->url = '/payment/pnpremote.cgi';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Set the post vars:
$vars = Array (
Array ('publisher-name', $this->cfg['account']),
Array ('publisher-email', $this->cfg['email']),
Array ('authtype', "authpostauth"),
Array ('dontsndmail', "yes"),
Array ('tax', "0.00"),
Array ('shipping', "0.00"),
Array ('currency', $currency_iso),
Array ('card-amount', $amount),
Array ('orderID', $invoice),
Array ('card-cvv', $this->billing["ccv"]),
Array ('card-number', $this->billing["cc_no"]),
Array ('card_exp', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('card-name', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('card-address1', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('card-city', $this->account["city"]),
Array ('card-state', $this->account["state"]),
Array ('card-zip', $this->account["zip"]),
Array ('email', $acct_fields["email"]),
Array ('card-country', $country),
Array ('ipaddress', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$response = explode('&', $response);
for ($i=0; $i<count($response); $i++) {
$arr1 = explode('=', $response[$i]);
$response[urldecode($arr1[0])] = urldecode($arr1[1]);
}
# Transaction Status:
if ($response['FinalStatus'] == 'success')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['transaction_id'] = $response["auth-code"];
# Message:
$ret['msg'] = $response["auth-msg"];
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

150
plugins/checkout/PROTX.php Normal file
View File

@@ -0,0 +1,150 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PROTX extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PROTX($checkout_id=false) {
$this->name = 'PROTX';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD','GBP');
$this->host = 'ukvps.protx.com';
$this->url = '/VPSDirectAuth/PaymentGateway.asp';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Get the submitted billing details:
global $VAR;
@$billing = $VAR['checkout_plugin_data'];
# Validate the currency:
if(!$this->validate_currency($currency_iso)) return false;
# validate the card type and number, and exp date:
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country name:
$country = $this->getCountry('name', $this->account["country_id"]);
# Get the data submitted from the customer:
$billing = @$VAR['checkout_plugin_data'];
# Set the post vars:
$vars = Array (
Array ('Vendor', $this->cfg['account']),
Array ('VPSProtocol', "2.20"),
Array ('TxType', "PAYMENT"),
Array ('Description', "Payment For Invoice ".$invoice),
Array ('Currency', $currency_iso),
Array ('Amount', $amount),
Array ('VendorTxCode', $invoice),
Array ('CardType', $this->billing["card_type"]),
Array ('CV2', $this->billing["ccv"]),
Array ('CardNumber', $this->billing["cc_no"]),
Array ('ExpiryDate', $this->billing["exp_month"] . '' . $this->billing["exp_year"]),
Array ('CardHolder', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('ClientNumber', $acct_fields["id"] ),
Array ('Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('PostCode', $this->account["zip"])
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
$retval="\r\n";
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$respond = explode($retval, $response);
}
for ($i=0; $i<count($respond); $i++) {
@$arr1 = explode('=', $respond[$i]);
@$response1[urldecode($arr1[0])] = urldecode($arr1[1]);
}
/*
echo $response1['StatusDetail'];
print_r($response1);
exit;
*/
# Transaction Status:
if (trim($response1['Status']) == 'OK')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['transaction_id'] = $response1["TxAuthNo"];
# Message:
$ret['msg'] = $response1['StatusDetail'];
# AVS Details:
$ret['avs'] = $response1["AVSCV2"];
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,124 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_PSIGATE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_PSIGATE ($checkout_id=false) {
$this->name = 'PSIGATE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'order.psigate.com';
$this->url = '/psigate.asp';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Set the post vars:
$vars = Array (
Array ('MerchantID', $this->cfg['account']),
Array ('ChargeType', "1"),
Array ('ThanksURL', $this->success_url),
Array ('ItemID1', "Payment for Invoice No. ".$invoice),
Array ('Description1', "Payment for Invoice No. ".$invoice),
Array ('Userid', "HTML Posting"),
Array ('Price1', $amount),
Array ('Quantity1', "1"),
Array ('CardNumber', $this->billing["cc_no"]),
Array ('ExpMonth', $this->billing["exp_month"]),
Array ('ExpYear', $this->billing["exp_year"]),
Array ('Bname', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('Baddr1', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('Bcity', $this->account["city"]),
Array ('Bstate', $this->account["state"]),
Array ('Bzip', $this->account["zip"]),
Array ('Email', $acct_fields["email"]),
Array ('Bcountry', $country)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Transaction Status:
if (!eregi('ErrMsg=', $response) && eregi('TranID=', $response))
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['avs'] = 'avs_na';
# Message:
$ret['msg'] = 'Sorry, the information entered is invalid or declined.';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_REMIT_BANK_WIRE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_REMIT_BANK_WIRE($checkout_id=false) {
$this->name = 'REMIT_BANK_WIRE';
$this->type = 'redirect';
$this->recurr_only = false;
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
$this->redirect = '<script language=Javascript>
parent.document.location = "'.SSL_URL.'?_page=checkout_plugin:plugin_ord_REMIT_BANK_WIRE_ALERT&id='.$invoice.'";
</script>';
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_REMIT_CHECK extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_REMIT_CHECK($checkout_id=false) {
$this->name = 'REMIT_CHECK';
$this->type = 'redirect';
$this->recurr_only = false;
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
$this->redirect = '<script language=Javascript>
parent.document.location = "'.SSL_URL.'?_page=checkout_plugin:plugin_ord_REMIT_CHECK_ALERT&id='.$invoice.'";
</script>';
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

180
plugins/checkout/RTWARE.php Normal file
View File

@@ -0,0 +1,180 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_RTWARE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_RTWARE($checkout_id=false) {
$this->name = 'RTWARE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'secure.rtware.net';
$this->url = '/gateway/transact.dll';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$test = "FALSE";
else
$test = "TRUE";
# Set the post vars:
$vars = Array (
Array ('x_ADC_URL', "FALSE"),
Array ('x_ADC_Delim_Data', "TRUE"),
Array ('x_Version', "3.0"),
Array ('x_Version', "3.0"),
Array ('x_Currency_Code', $currency_iso),
Array ('x_Method', "CC"),
Array ('x_Transaction_Type', $this->cfg['x_Transaction_Type']),
Array ('x_Test_Request', $test),
Array ('x_Password', $this->cfg['x_Password']),
Array ('x_Login', $this->cfg['x_Login']),
Array ('x_Amount', $amount),
Array ('x_Invoice_Num', $invoice),
Array ('x_Description', "Payment for Invoice No. ".$invoice),
Array ('x_Card_Code', $this->billing["ccv"]),
Array ('x_Card_Num', $this->billing["cc_no"]),
Array ('x_Exp_Date', $this->billing["exp_month"] . '/' . $this->billing["exp_year"]),
Array ('x_Cust_ID', $acct_fields["id"]),
Array ('x_First_Name', $this->account["first_name"]),
Array ('x_Last_Name', $this->account["last_name"]),
Array ('x_Company', $this->account["company"]),
Array ('x_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_City', $this->account["city"]),
Array ('x_State', $this->account["state"]),
Array ('x_Zip', $this->account["zip"]),
Array ('x_Email', $acct_fields["email"]),
Array ('x_Country', $country),
Array ('x_Ship_To_First_Name', $this->account["first_name"]),
Array ('x_Ship_To_Last_Name', $this->account["last_name"]),
Array ('x_Ship_To_Company', $this->account["company"]),
Array ('x_Ship_To_Address', $this->account["address1"] . ' ' . $this->account["address2"]),
Array ('x_Ship_To_City', $this->account["city"]),
Array ('x_Ship_To_State', $this->account["state"]),
Array ('x_Ship_To_Zip', $this->account["zip"]),
Array ('x_Ship_To_Country', $country),
Array ('x_Customer_IP', USER_IP)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$response = explode(',', $response);
# Transaction Status:
if ($response[0] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['avs'] = $response[4];
# Message:
$ret['msg'] = $response[3];
# AVS Details:
if ( $response[5] == 'A' )
$ret['avs'] = 'avs_address_only';
elseif ( $response[5] == 'E' )
$ret['avs'] = 'avs_error';
elseif ( $response[5] == 'N' )
$ret['avs'] = 'avs_no_match';
elseif ( $response[5] == 'P' )
$ret['avs'] = 'avs_na';
elseif ( $response[5] == 'R' )
$ret['avs'] = 'avs_retry';
elseif ( $response[5] == 'S' )
$ret['avs'] = 'avs_not_supported';
elseif ( $response[5] == 'U' )
$ret['avs'] = 'avs_address_unavail';
elseif ( $response[5] == 'W' )
$ret['avs'] = 'avs_fullzip_only';
elseif ( $response[5] == 'X' )
$ret['avs'] = 'avs_exact';
elseif ( $response[5] == 'Y' )
$ret['avs'] = 'avs_address_zip';
elseif ( $response[5] == 'Z' )
$ret['avs'] = 'avs_partzip_only';
else
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

149
plugins/checkout/SECPAY.php Normal file
View File

@@ -0,0 +1,149 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_SECPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_SECPAY ($checkout_id=false) {
$this->name = 'SECPAY';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'www.secpay.com';
$this->url = '/java-bin/ValCard';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Get the data submitted from the customer:
$billing = @$VAR['checkout_plugin_data'];
# Test mode:
if ( $this->cfg['mode'] )
$test = 'false';
else
$test = 'true';
# Set the post vars:
$vars = Array (
Array ('merchant', $this->cfg['account']),
Array ('options', "dups=false,test_status=".$test),
Array ('currency', $currency_iso),
Array ('amount', $amount),
Array ('trans_id', $invoice),
Array ('cardtype', $this->billing["card_type"]),
Array ('card_no', $this->billing["cc_no"]),
Array ('expiry', $this->billing["exp_month"] . '/'.$this->billing["exp_year"]),
Array ('customer', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('shipping', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('bill_name', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('bill_addr_1', $this->account["address1"] . ' '.$this->account["address2"]),
Array ('bill_post_code', $this->account["city"]),
Array ('bill_city', $this->account["state"]),
Array ('bill_state', $this->account["zip"]),
Array ('bill_email', $acct_fields["email"]),
Array ('bill_country', $country)
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$respond = explode('&', $response);
for ($i=0; $i<count($respond); $i++) {
@$arr1 = explode('=', $respond[$i]);
@$response1[urldecode($arr1[0])] = urldecode($arr1[1]);
}
# Transaction Status:
if (trim($response1['?valid']) == 'true')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['transaction_id'] = $response1["trans_id"];
$ret['authorization_id'] = $response1["auth_code"];
# Message:
$ret['msg'] = $response1['message'];
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,141 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_SKIPJACK extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_SKIPJACK($checkout_id=false) {
$this->name = 'SKIPJACK';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->url = '/scripts/evolvcc.dll';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('three_code', $acct_fields["country_id"]);
# Get the data submitted from the customer:
$billing = @$VAR['checkout_plugin_data'];
if($this->cfg['mode'] != '100') {
define("SJPHPAPI_ROOT_URL", "https://developer.skipjackic.com"); // test
} else {
define("SJPHPAPI_ROOT_URL", "https://www.skipjackic.com"); // production
}
require_once (PATH_PLUGINS . 'checkout/CLASS_SKIPJACK/skipjack.php');
$request = array(
"sjname" => $this->account["first_name"],
"Email" => $acct_fields["email"],
"Streetaddress" => $this->account["address1"],
"City" => $this->account["city"],
"State" => $this->account["state"],
"Zipcode" => $this->account["zip"],
"Country" => $country,
"Ordernumber" => $invoice,
"Accountnumber" => $this->billing["cc_no"],
"Month" => $this->billing["exp_month"],
"Year" => "20".$this->billing["exp_year"],
"Serialnumber" => $this->cfg['account'], // html Vital, NBova or production
"Transactionamount" => round($amount,2),
"Orderstring" => "1~NotDefined~NotDefined~1~N||",
"Shiptophone" => "888-555-1212");
$response = SkipJack_Authorize($request);
/*
echo "<pre>";
var_dump($request);
var_dump($response);
echo "</pre>";
exit;
*/
# Transaction Status:
if ($response['szIsApproved'] == '1')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['transaction_id'] = $response['szAuthorizationResponseCode'];
$ret['authorization_id'] = $response['szAuthorizationResponseCode'];
# Message:
$ret['msg'] = $response['textReturnCode'];
# AVS Details:
$ret['avs'] = $response['szAVSResponseCode'];
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,160 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
Be sure to specify your Secret Code and IPN URL in the Profile/Setup page in StormPay.
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_STORMPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_STORMPAY($checkout_id=false) {
$this->name = 'STORMPAY';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://www.stormpay.com/stormpay/handle_gen.php";
$vals = Array (
Array ('generic', '1'),
Array ('vendor_email', $this->cfg['email']),
Array ('product_name', "Payment For Invoice No: ". $invoice),
Array ('amount', $amount),
Array ('return_URL', $this->success_url.$invoice),
Array ('cancel_URL', $this->decline_url.$invoice),
Array ('notify_URL', $this->return_url),
Array ('require_IPN', '1'),
Array ('transaction_ref', $invoice),
Array ('payee_email', $this->cfg['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['transaction_ref'];
$ret['transaction_id'] = $VAR['transaction_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# If the secret word is set, validate it against what is posted
if(!empty($this->cfg['secret']))
if($this->cfg['secret'] != $VAR['secret_code'])
$do = false;
# Validate agains the posted payee:
if($VAR['vendor_email'] != $this->cfg['email'])
$do = false;
# Set the status // SUCCESS, CANCEL, REFUND, CHARGEBACK, or ERROR
if ($VAR['status'] == 'SUCCESS')
$ret['status'] = true;
else
$ret['status'] = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_STORMPAY;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,194 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
Be sure to specify your Secret Code and IPN URL in the Profile/Setup page in StormPay.
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_STORMPAY_RECURRING extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_STORMPAY_RECURRING($checkout_id=false) {
$this->name = 'STORMPAY_RECURRING';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'includes/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
# Stormpay cannot handle pro-rated subscriptions:
if($recurr_bill_arr[0]["recurr_type"] != "0") {
global $C_translate;
$msg = $C_translate->translate('prorated_not_supported','checkout','');
echo '<script language=Javascript> alert(\''.$msg.'\'); </script>';
return false;
}
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if($sched == 0) {
$rec_period = '7';
} elseif ($sched == 1) {
$rec_period = '30';
} elseif ($sched == 2) {
$rec_period = '91';
} elseif ($sched == 3) {
$rec_period = '182';
} elseif ($sched == 4) {
$rec_period = '365';
} elseif ($sched == 5) {
$rec_period = '730';
}
if($amount < $total_recurring)
{
$setup_fee = '0';
} else {
$setup_fee = $amount-$total_recurring;
}
$url = "https://www.stormpay.com/stormpay/handle_gen.php";
$vals = Array (
Array ('generic', '1'),
Array ('vendor_email', $this->cfg['email']),
Array ('product_name', "Payment For Invoice No: ". $invoice),
Array ('setup_fee', $amount),
Array ('subscription', "YES"),
Array ('recurrent_charge', $total_recurring),
Array ('duration', $rec_period),
Array ('setup_fee', $setup_fee),
Array ('return_URL', $this->success_url.$invoice),
Array ('cancel_URL', $this->decline_url.$invoice),
Array ('notify_URL', $this->return_url),
Array ('require_IPN', '1'),
Array ('transaction_ref', $invoice),
Array ('payee_email', $this->cfg['email'])
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['transaction_ref'];
$ret['transaction_id'] = $VAR['transaction_id'];
$ret['amount'] = $VAR['amount'];
$ret['currency'] = DEFAULT_CURRENCY;
$ret['subscription_id'] = $VAR['subscription_ref'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
# If the secret word is set, validate it against what is posted
if(!empty($this->cfg['secret']))
if($this->cfg['secret'] != $VAR['secret_code'])
$do = false;
# Validate agains the posted payee:
if($VAR['vendor_email'] != $this->cfg['email'])
$do = false;
# Set the status // SUCCESS, CANCEL, REFUND, CHARGEBACK, or ERROR
if ($VAR['status'] == 'SUCCESS')
$ret['status'] = true;
else
$ret['status'] = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do'])) {
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_STORMPAY_RECURRING;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,144 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_SUREPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_SUREPAY ($checkout_id=false) {
$this->name = 'SUREPAY';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host_test = 'xml.test.surepay.com';
$this->host_live = 'xml.surepay.com';
$this->url = '/';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Get the data submitted from the customer:
$billing = @$VAR['checkout_plugin_data'];
# Test mode:
if ( $this->cfg['mode'] )
$this->host = $this->host_live;
else
$this->host = $this->host_test;
# Assemble the XML request
$xml_request = '<!DOCTYPE pp.request PUBLIC "-//IMALL//DTD PUREPAYMENTS 1.0//EN" "http://www.purepayments.com/dtd/purepayments.dtd">';
$xml_request.='
<pp.request merchant="' . $this->cfg['account'] . '" password="' . $this->cfg['password'] . '">
<pp.auth ordernumber="' . $invoice .'" ecommerce="true" ecommercecode="07" ponumber="' . $this->account["first_name"].' '.$this->account["last_name"] .'" ipaddress="' . USER_IP .'" shippingcost="0.00USD" taxamount="0.00USD" referringurl="NA" browsertype="NA">
<pp.lineitem quantity="1" sku="NA" description="Invoice ' . $invoice .'" unitprice="' . $amount .'USD" taxrate="0.00" />
<pp.creditcard number="' . $this->billing["cc_no"] .'" expiration="' . $this->billing["exp_month"] . '/'.$this->billing["exp_year"] .'" cvv2="'.$this->billing["ccv"].'" cvv2status="1">
<pp.address type="billing" fullname="' . $this->account["first_name"].' '.$this->account["last_name"] .'" address1="' . $this->account["address1"] .'" address2="'.$this->account["address2"].'" city="' . $this->account["city"] .'" state="' . $this->account["state"] .'" zip="' . $this->account["zip"] .'" country="' . $country .'" phone="" email="' . $acct_fields["email"] .'" />
</pp.creditcard>
<pp.ordertext type="instructions">Payment for order ' . $invoice .'</pp.ordertext>
<pp.address type="shipping" fullname="' . $this->account["first_name"].' '.$this->account["last_name"] .'" address1="' . $this->account["address1"] .'" address2="'.$this->account["address2"].'" city="' . $this->account["city"] .'" state="' . $this->account["state"] .'" zip="' . $this->account["zip"] .'" country="' . $country .'" phone="" email="' . $acct_fields["email"] .'" />
</pp.auth>
</pp.request>';
# Set the post vars:
$vars = Array ( Array ('xml', $xml_request) );
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$response)
return false;
else
$respond = explode('&', $response);
for ($i=0; $i<count($respond); $i++) {
@$arr1 = explode('=', $respond[$i]);
@$response1[urldecode($arr1[0])] = urldecode($arr1[1]);
}
# Transaction Status:
if (trim($response1['?valid']) == 'true')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
$ret['transaction_id'] = $response1["trans_id"];
$ret['authorization_id'] = $response1["auth_code"];
# Message:
$ret['msg'] = $response;
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,208 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_SWREG_ADVANCED extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_SWREG_ADVANCED($checkout_id=false) {
$this->name = 'SWREG_ADVANCED';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'www.swreg.org';
$this->url = '/cgi-bin/c.cgi';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$test = "FALSE";
else
$test = "TRUE";
# Set the post vars:
$vars = Array (
Array ('s', $this->cfg['store']),
Array ('p', $this->cfg['store'].'agile'),
Array ('vp', $amount),
Array ('vt', $invoice),
Array ('d', '0'),
Array ('q', '1'),
Array ('t', '(null)'),
Array ('a', ''),
Array ('pt', '1'),
Array ('cn', $this->billing["cc_no"]),
Array ('in', @$this->billing["ccv"]),
Array ('mm', $this->billing["exp_month"]),
Array ('yy', $this->billing["exp_year"]),
Array ('pn', $this->billing["phone_number"]),
Array ('fn', $this->account["first_name"]),
Array ('sn', $this->account["last_name"]),
Array ('co', $this->account["company"]),
Array ('a1', $this->account["address1"]),
Array ('a2', $this->account["address2"]),
Array ('a3', $this->account["city"]),
Array ('st', $this->account["state"]),
Array ('zp', $this->account["zip"]),
Array ('em', $acct_fields["email"]),
Array ('ct', $country),
Array ('ip', USER_IP),
Array ('dfn', ''),
Array ('dsn', ''),
Array ('dco', ''),
Array ('da1', ''),
Array ('da2', ''),
Array ('da3', ''),
Array ('dst', ''),
Array ('dzp', ''),
Array ('dct', ''),
Array ('ins', ''),
Array ('ra', '')
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$response = $n->connect($this->host, $this->url, $vars, true, 1);
# Test Mode
if($this->cfg['mode'] = "1")
echo '<script language=Javascript>alert(\'Gateway response: '.$response.'\') </script>';
# Get return response
if(!$response) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
foreach(split("&",$response) as $pair) {
list($key,$val)=split("=",$pair);
$swreg[$key]=$val;
}
}
# IF SWREG RETURNED ERROR CODE OR WE HAVE NO ORDER NUMBER DISPLAY ERROR
if($swreg["result"]!=0 || $swreg["ordernumber"]=="")
{
$ret['status'] = 0;
} else {
$ret['status'] = 1;
}
# Transaction ID:
@$ret['transaction_id'] = @$swreg["ordernumber"];
# DEFINE ERROR CODES
$messages=array("",
"You must supply an ip address",
"You must supply a contact phone number",
"You must supply an email address",
"You must supply a first name",
"You must supply a surname",
"You must supply an address",
"You must supply a country",
"You must supply a country for the delivery address",
"You must supply your shop id",
"You must supply a product code ",
"Attempt to purchase a non existent item",
"Del_id/Product_id count wrong",
"Var_id/Product_id count wrong",
"Qty/Product_id count wrong",
"Email address used by fraudsters in the past unable to accept this order",
"IP address used by fraudsters in the past unable to accept this order",
"Invalid card details",
"Declined Card",
"You must supply a payment method",
"Payment method must be in the range 1 - 5",
"Call Authorisation Centre",
"Comms failure - Thankyou for the order, do NOT re-order as we will keep trying every 15 minutes to get an authorisation.",
"Incorrect expiry date",
"Value enterted into Switch /Solo issue number field despite not being a Switch or Solo card. (We have also had this result code when the expiry date is way too far in the future).",
"Affiliate account is closed. <A HREF=\"a.php?affil=\">Click here</a> and try again.",
"SWREG down for maintenance (probably only for 15 minutes)",
"Discover card will be processed manually same or following business day. Please do not reorder.",
"Store closed for sales - get this one and it shows we no longer wish to sell your products!",
"Problem with the card data - the bank doesn't like it.",
"Failed country check - On the banned country list",
"Problem with bin range - we do not (yet) know how to deal with the card (Bin range is first 6 numbers of the card so we do not know who owns it to route the payment request).",
"Duplicate order trap (if you sent us a value in variable &vt=)",
"Country name not valid - use our list of country names to avoid this error. A list of country names we accept is available by going to https://usd.swreg.org/cgi-bin/b.cgi?s=2034&p=2034get1&v=0&d=0&q=1&t= and grabbing the list from our html code. ");
$ret['msg'] = $messages[$swreg["result"]];
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,84 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_SWREG_INTERMEDIATE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_SWREG_INTERMEDIATE($checkout_id=false) {
$this->name = 'SWREG_INTERMEDIATE';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD','GBP', 'EUR', 'CAD', 'JPY');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://usd.swreg.org/cgi-bin/s.cgi";
$vals = Array (
Array ('s', $this->cfg['store']),
Array ('p', $this->cfg['store'].'agile'),
Array ('vp', $amount),
Array ('vt', $invoice),
Array ('d', '0'),
Array ('q', '1'),
Array ('t', 'Invoice Id. '.$invoice),
Array ('a', ''),
Array ('pt', '1'),
Array ('c', $currency_iso)
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,151 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_TRUSTCOMMERCE extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_TRUSTCOMMERCE($checkout_id=false) {
$this->name = 'TRUSTCOMMERCE';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->host = 'vault.trustcommerce.com';
$this->url = '/trans/';
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if(ereg('100', $this->cfg['mode']))
$demo = "n";
else
$demo = "y";
# Set the post vars:
$vars = Array (
Array ('custid', $this->cfg['x_Login']),
Array ('password', $this->cfg['x_Password']),
Array ('action', $this->cfg['x_Transaction_Type']),
Array ('avs', $this->cfg['x_AVS']),
Array ('demo', $demo),
Array ('ticket', $invoice),
Array ('media', 'cc'),
Array ('cc', $this->billing["cc_no"]),
Array ('exp', $this->billing["exp_month"].$this->billing["exp_year"]),
Array ('cvv', $this->billing["ccv"]),
Array ('amount', $amount*100),
Array ('name', $this->account["first_name"].' '.$this->account["last_name"]),
Array ('address1', $this->account["address1"] .' '.$this->account["address2"]),
Array ('city', $this->account["city"]),
Array ('state', $this->account["state"]),
Array ('zip', $this->account["zip"])
);
# Create the SSL connection & get response from the gateway:
include_once (PATH_CORE . 'ssl.inc.php');
$n = new CORE_ssl;
$return = $n->connect($this->host, $this->url, $vars, true, 1);
# Get return response
if(!$return) {
echo '<script language=Javascript>alert(\'SSL Failed!\') </script>';
return false;
} else {
$response = split("\n", trim($return));
for($i=0; $i<count($response); $i++)
{
if(!empty($response[$i]))
{
unset($thisone);
$thisone = split("=", $response[$i]);
$varr[$thisone[0]] = $thisone[1];
}
}
}
# Message:
@$ret['msg'] = $varr["transid"];
# AVS:
@$ret['avs'] = $varr["avs"];
# Transaction Status:
if ($varr["status"] == 'approved' || $varr["status"] == 'accepted')
{
$ret['status'] = 1;
}
else
{
$ret['status'] = 0;
@$ret['msg'] = 'Charge declined, please double check your card details.';
}
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,609 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_USA_EPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_USA_EPAY($checkout_id=false) {
$this->name = 'USA_EPAY';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
$tran=new umTransaction;
$tran->key = $this->cfg['key'];
$tran->testmode = $this->cfg['mode'];
$tran->ip = USER_IP;
$tran->card = $this->billing["cc_no"];
$tran->exp = $this->billing["exp_month"] . $this->billing["exp_year"];
$tran->amount = $amount;
$tran->invoice = $invoice;
$tran->cardholder = $this->account["first_name"] . ' ' . $this->account["last_name"];
$tran->street = $this->account["address1"] . ' ' . $this->account["address2"];
$tran->zip = $this->account["zip"];
$tran->description = "Invoice $invoice";
$tran->cvv2 = $this->billing["ccv"];
if($tran->Process()) {
$ret['status'] = 1;
$ret['avs'] = $tran->avs;
$ret['msg'] = $tran->authcode . ' '. $tran->cvv2;
} else {
$ret['status'] = 0;
$ret['msg'] = "Card Declined (" . $tran->result . ")";
$ret['msg'] .= " ". $tran->error;
if($tran->curlerror) {
echo "<b>Curl Error:</b> " . $tran->curlerror . "<br>";
exit;
}
}
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
// USA ePay PHP Library.
// v1.4.1 - December 27th, 2004
//
// Copyright (c) 2001-2004 USAePay
// Written by Tim McEwen (tim@usaepay.com)
//
/**
* USAePay Transaction Class
*
*/
class umTransaction {
// Required for all transactions
var $key; // Source key
var $pin; // Source pin (optional)
var $amount; // the entire amount that will be charged to the customers card
// (including tax, shipping, etc)
var $invoice; // invoice number. must be unique. limited to 10 digits. use orderid if you need longer.
// Required for Commercial Card support
var $ponum; // Purchase Order Number
var $tax; // Tax
// Amount details (optional)
var $tip; // Tip
var $shipping; // Shipping charge
var $discount; // Discount amount (ie gift certificate or coupon code)
var $subtotal; // if subtotal is set, then
// subtotal + tip + shipping - discount + tax must equal amount
// or the transaction will be declined. If subtotal is left blank
// then it will be ignored
// Required Fields for Card Not Present transacitons (Ecommerce)
var $card; // card number, no dashes, no spaces
var $exp; // expiration date 4 digits no /
var $cardholder; // name of card holder
var $street; // street address
var $zip; // zip code
// Fields for Card Present (POS)
var $magstripe; // mag stripe data. can be either Track 1, Track2 or Both (Required if card,exp,cardholder,street and zip aren't filled in)
var $cardpresent; // Must be set to true if processing a card present transaction (Default is false)
var $termtype; // The type of terminal being used: Optons are POS - cash register, StandAlone - self service terminal, Unattended - ie gas pump, Unkown (Default: Unknown)
var $magsupport; // Support for mag stripe reader: yes, no, unknown (default is unknown unless magstripe has been sent)
// fields required for check transactions
var $account; // bank account number
var $routing; // bank routing number
var $ssn; // social security number
var $dlnum; // drivers license number (required if not using ssn)
var $dlstate; // drivers license issuing state
// Option parameters
var $origauthcode; // required if running postauth transaction.
var $command; // type of command to run; Possible values are:
// sale, credit, void, preauth, postauth, check and checkcredit.
// Default is sale.
var $orderid; // Unique order identifier. This field can be used to reference
// the order for which this transaction corresponds to. This field
// can contain up to 64 characters and should be used instead of
// UMinvoice when orderids longer that 10 digits are needed.
var $custid; // Alpha-numeric id that uniquely identifies the customer.
var $description; // description of charge
var $cvv2; // cvv2 code
var $custemail; // customers email address
var $custreceipt; // send customer a receipt
var $ip; // ip address of remote host
var $testmode; // test transaction but don't process it
var $timeout; // transaction timeout. defaults to 45 seconds
var $gatewayurl; // url for the gateway
var $ignoresslcerterrors; // Bypasses ssl certificate errors. It is highly recommended that you do not use this option. Fix your openssl installation instead!
// Card Authorization - Verified By Visa and Mastercard SecureCode
var $cardauth; // enable card authentication
var $pares; //
// Third Party Card Authorization
var $xid;
var $cavv;
var $eci;
// Recurring Billing
var $recurring; // Save transaction as a recurring transaction: yes/no
var $schedule; // How often to run transaction: daily, weekly, biweekly, monthly, bimonthly, quarterly, annually. Default is monthly.
var $numleft; // The number of times to run. Either a number or * for unlimited. Default is unlimited.
var $start; // When to start the schedule. Default is tomorrow. Must be in YYYYMMDD format.
var $end; // When to stop running transactions. Default is to run forever. If both end and numleft are specified, transaction will stop when the ealiest condition is met.
var $billamount; // Optional recurring billing amount. If not specified, the amount field will be used for future recurring billing payments
// Billing Fields
var $billfname;
var $billlname;
var $billcompany;
var $billstreet;
var $billstreet2;
var $billcity;
var $billstate;
var $billzip;
var $billcountry;
var $billphone;
var $email;
var $fax;
var $website;
// Shipping Fields
var $shipfname;
var $shiplname;
var $shipcompany;
var $shipstreet;
var $shipstreet2;
var $shipcity;
var $shipstate;
var $shipzip;
var $shipcountry;
var $shipphone;
var $software; // Allows developers to identify their application to the gateway (for troubleshooting purposes)
// response fields
var $rawresult; // raw result from gateway
var $result; // full result: Approved, Declined, Error
var $resultcode; // abreviated result code: A D E
var $authcode; // authorization code
var $refnum; // reference number
var $batch; // batch number
var $avs_result; // avs result
var $avs_result_code; // avs result
var $avs; // obsolete avs result
var $cvv2_result; // cvv2 result
var $cvv2_result_code; // cvv2 result
// Cardinal Response Fields
var $acsurl; // card auth url
var $pareq; // card auth request
var $cctransid; // cardinal transid
// Errors Response Feilds
var $error; // error message if result is an error
var $errorcode; // numerical error code
var $blank; // blank response
var $curlerror; // curl error
// Constructor
function umTransaction()
{
// Set default values.
$this->command="sale";
$this->result="Error";
$this->resultcode="E";
$this->error="Transaction not processed yet.";
$this->timeout=45;
$this->cardpresent=false;
if(isset($_SERVER['REMOTE_ADDR'])) $this->ip=$_SERVER['REMOTE_ADDR'];
$this->software="USAePay PHP API v1.4.0";
}
/**
* Verify that all required data has been set
*
* @return string
*/
function CheckData()
{
if(!$this->key) return "Source Key is required";
if($this->command=="capture")
{
if(!$this->refnum) return "Reference Number is required";
} else {
if($this->command=="check" || $this->command=="checkcredit") {
if(!$this->account) return "Account Number is required";
if(!$this->routing) return "Routing Number is required";
} else {
if(!$this->magstripe) {
if(!$this->card) return "Credit Card Number is required";
if(!$this->exp) return "Expiration Date is required";
}
}
$this->amount=ereg_replace("[^[:digit:].]","",$this->amount);
if(!$this->amount) return "Amount is required";
if(!$this->invoice && !$this->orderid) return "Invoice number or Order ID is required";
if(!$this->magstripe) {
if(!$this->cardholder) return "Cardholder Name is required";
if(!$this->street) return "Street Address is required";
if(!$this->zip) return "Zipcode is required";
}
}
return 0;
}
/**
* Send transaction to the USAePay Gateway and parse response
*
* @return boolean
*/
function Process()
{
// check that we have the needed data
$tmp=$this->CheckData();
if($tmp)
{
$this->result="Error";
$this->resultcode="E";
$this->error=$tmp;
$this->errorcode=10129;
return false;
}
// check to make sure we have curl
if(!function_exists("curl_version"))
{
$this->result="Error";
$this->resultcode="E";
$this->error="Libary Error: CURL support not found";
$this->errorcode=10130;
return false;
}
//init the connection
$ch = curl_init(($this->gatewayurl?$this->gatewayurl:"https://www.usaepay.com/secure/gate.php"));
if(!is_resource($ch))
{
$this->result="Error";
$this->resultcode="E";
$this->error="Libary Error: Unable to initialize CURL ($ch)";
$this->errorcode=10131;
return false;
}
// set some options for the connection
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_TIMEOUT, ($this->timeout>0?$this->timeout:45));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
# // Bypass ssl errors - A VERY BAD IDEA
# if($this->ignoresslcerterrors)
# {
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
# }
// format the data
$data = "UMkey=" . rawurlencode($this->key) . "&" .
"UMcommand=" . rawurlencode($this->command) . "&" .
"UMauthCode=" . rawurlencode($this->origauthcode) . "&" .
"UMcard=" . rawurlencode($this->card) . "&" .
"UMexpir=" . rawurlencode($this->exp) . "&" .
"UMbillamount=" . rawurlencode($this->billamount) . "&" .
"UMamount=" . rawurlencode($this->amount) . "&" .
"UMinvoice=" . rawurlencode($this->invoice) . "&" .
"UMorderid=" . rawurlencode($this->orderid) . "&" .
"UMponum=" . rawurlencode($this->ponum) . "&" .
"UMtax=" . rawurlencode($this->tax) . "&" .
"UMtip=" . rawurlencode($this->tip) . "&" .
"UMshipping=" . rawurlencode($this->shipping) . "&" .
"UMdiscount=" . rawurlencode($this->discount) . "&" .
"UMsubtotal=" . rawurlencode($this->subtotal) . "&" .
"UMname=" . rawurlencode($this->cardholder) . "&" .
"UMstreet=" . rawurlencode($this->street) . "&" .
"UMzip=" . rawurlencode($this->zip) . "&" .
"UMdescription=" . rawurlencode($this->description) . "&" .
"UMcvv2=" . rawurlencode($this->cvv2) . "&" .
"UMip=" . rawurlencode($this->ip) . "&" .
"UMtestmode=" . rawurlencode($this->testmode) . "&" .
"UMcustemail=" . rawurlencode($this->custemail) . "&" .
"UMcustreceipt=" . rawurlencode($this->custreceipt) . "&" .
"UMrouting=" . rawurlencode($this->routing) . "&" .
"UMaccount=" . rawurlencode($this->account) . "&" .
"UMssn=" . rawurlencode($this->ssn) . "&" .
"UMdlstate=" . rawurlencode($this->dlstate) . "&" .
"UMdlnum=" . rawurlencode($this->dlnum) . "&" .
"UMrecurring=" . rawurlencode($this->recurring) . "&" .
"UMbillamount=" . rawurlencode($this->billamount) . "&" .
"UMschedule=" . rawurlencode($this->schedule) . "&" .
"UMnumleft=" . rawurlencode($this->numleft) . "&" .
"UMstart=" . rawurlencode($this->start) . "&" .
"UMexpire=" . rawurlencode($this->end) . "&" .
"UMbillfname=" . rawurlencode($this->billfname) . "&" .
"UMbilllname=" . rawurlencode($this->billlname) . "&" .
"UMbillcompany=" . rawurlencode($this->billcompany) . "&" .
"UMbillstreet=" . rawurlencode($this->billstreet) . "&" .
"UMbillstreet2=" . rawurlencode($this->billstreet2) . "&" .
"UMbillcity=" . rawurlencode($this->billcity) . "&" .
"UMbillstate=" . rawurlencode($this->billstate) . "&" .
"UMbillzip=" . rawurlencode($this->billzip) . "&" .
"UMbillcountry=" . rawurlencode($this->billcountry) . "&" .
"UMbillphone=" . rawurlencode($this->billphone) . "&" .
"UMemail=" . rawurlencode($this->email) . "&" .
"UMfax=" . rawurlencode($this->fax) . "&" .
"UMwebsite=" . rawurlencode($this->website) . "&" .
"UMshipfname=" . rawurlencode($this->shipfname) . "&" .
"UMshiplname=" . rawurlencode($this->shiplname) . "&" .
"UMshipcompany=" . rawurlencode($this->shipcompany) . "&" .
"UMshipstreet=" . rawurlencode($this->shipstreet) . "&" .
"UMshipstreet2=" . rawurlencode($this->shipstreet2) . "&" .
"UMshipcity=" . rawurlencode($this->shipcity) . "&" .
"UMshipstate=" . rawurlencode($this->shipstate) . "&" .
"UMshipzip=" . rawurlencode($this->shipzip) . "&" .
"UMshipcountry=" . rawurlencode($this->shipcountry) . "&" .
"UMshipphone=" . rawurlencode($this->shipphone) . "&" .
"UMcardauth=" . rawurlencode($this->cardauth) . "&" .
"UMpares=" . rawurlencode($this->pares) . "&" .
"UMxid=" . rawurlencode($this->xid) . "&" .
"UMcavv=" . rawurlencode($this->cavv) . "&" .
"UMeci=" . rawurlencode($this->eci) . "&" .
"UMcustid=" . rawurlencode($this->custid) . "&" .
"UMcardpresent=" . ($this->cardpresent?"1":"0") . "&" .
"UMmagstripe=" . rawurlencode($this->magstripe) . "&" .
"UMtermtype=" . rawurlencode($this->termtype) . "&" .
"UMmagsupport=" . rawurlencode($this->magsupport) . "&" .
"UMrefNum=" . rawurlencode($this->refnum);
// Append md5hash if pin has been set.
if($this->pin)
{
$key=mktime();
$data.="&UMmd5hash=" . rawurlencode(md5($this->command . ":" . $this->pin . ":" . $this->amount . ":" . $this->invoice . ":" . $key)) . "&UMmd5key=" . $key;
}
// attach the data
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
// run the transfer
$result=curl_exec ($ch);
//get the result and parse it for the response line.
if(!strlen($result))
{
$this->result="Error";
$this->resultcode="E";
$this->error="Error reading from card processing gateway.";
$this->errorcode=10132;
$this->blank=1;
$this->curlerror=curl_error($ch);
curl_close ($ch);
return false;
}
curl_close ($ch);
$this->rawresult=$result;
if(!$result) {
$this->result="Error";
$this->resultcode="E";
$this->error="Blank response from card processing gateway.";
$this->errorcode=10132;
return false;
}
// result will be on the last line of the return
$tmp=split("\n",$result);
$result=$tmp[count($tmp)-1];
// result is in urlencoded format, parse into an array
parse_str($result,$tmp);
// check to make sure we received the correct fields
if(!isset($tmp["UMversion"]) || !isset($tmp["UMstatus"]))
{
$this->result="Error";
$this->resultcode="E";
$this->error="Error parsing data from card processing gateway.";
$this->errorcode=10132;
return false;
}
// Store results
$this->result=(isset($tmp["UMstatus"])?$tmp["UMstatus"]:"Error");
$this->resultcode=(isset($tmp["UMresult"])?$tmp["UMresult"]:"E");
$this->authcode=(isset($tmp["UMauthCode"])?$tmp["UMauthCode"]:"");
$this->refnum=(isset($tmp["UMrefNum"])?$tmp["UMrefNum"]:"");
$this->batch=(isset($tmp["UMbatch"])?$tmp["UMbatch"]:"");
$this->avs_result=(isset($tmp["UMavsResult"])?$tmp["UMavsResult"]:"");
$this->avs_result_code=(isset($tmp["UMavsResultCode"])?$tmp["UMavsResultCode"]:"");
$this->cvv2_result=(isset($tmp["UMcvv2Result"])?$tmp["UMcvv2Result"]:"");
$this->cvv2_result_code=(isset($tmp["UMcvv2ResultCode"])?$tmp["UMcvv2ResultCode"]:"");
$this->error=(isset($tmp["UMerror"])?$tmp["UMerror"]:"");
$this->errorcode=(isset($tmp["UMerrorcode"])?$tmp["UMerrorcode"]:"10132");
// Obsolete variable (for backward compatibility) At some point they will no longer be set.
$this->avs=(isset($tmp["UMavsResult"])?$tmp["UMavsResult"]:"");
$this->cvv2=(isset($tmp["UMcvv2Result"])?$tmp["UMcvv2Result"]:"");
if(isset($tmp["UMcctransid"])) $this->cctransid=$tmp["UMcctransid"];
if(isset($tmp["UMacsurl"])) $this->acsurl=$tmp["UMacsurl"];
if(isset($tmp["UMpayload"])) $this->pareq=$tmp["UMpayload"];
if($this->resultcode == "A") return true;
return false;
}
}
// umVerifyCreditCardNumber
// Validates a credit card and returns the type of card.
//
// Card Types:
// 1 Mastercard
// 2 Visa
// 3 American Express
// 4 Diners Club/Carte Blanche
// 10 Discover
// 20 enRoute
// 28 JCB
/**
* Evaluates a creditcard number and if valid, returns the card type code
*
* @param ccnum string
* @return int
*/
function umVerifyCreditCardNumber($ccnum)
{
global $umErrStr;
//okay lets do the stupid
$ccnum=str_replace("-","",$ccnum);
$ccnum=str_replace(" ","",$ccnum);
$ccnum=str_replace("/","",$ccnum);
if(!ereg("^[[:digit:]]{1,200}$", $ccnum)) {$umErrStr="Cardnumber contains characters that are not numbers"; return 0;}
if(!ereg("^[[:digit:]]{13,16}$", $ccnum)) {$umErrStr="Cardnumber is not between 13 and 16 digits long"; return 0;}
// Run Luhn Mod-10 to ensure proper check digit
$total=0;
$y=0;
for($i=strlen($ccnum)-1; $i >= 0; $i--)
{
if($y==1) $y=2; else $y=1; //multiply every other digit by 2
$tmp=substr($ccnum,$i,1)*$y;
if($tmp >9) $tmp=substr($tmp,0,1) + substr($tmp,1,1);
$total+=$tmp;
}
if($total%10) {$umErrStr="Cardnumber fails Luhn Mod-10 check digit"; return 0;}
switch(substr($ccnum,0,1))
{
case 2: //enRoute - First four digits must be 2014 or 2149. Only valid length is 15 digits
if((substr($ccnum,0,4) == "2014" || substr($ccnum,0,4) == "2149") && strlen($ccnum) == 15) return 20;
break;
case 3: //JCB - Um yuck, read the if statement below, and oh by the way 300 through 309 overlaps with diners club. bummer.
if((substr($ccnum,0,4) == "3088" || substr($ccnum,0,4) == "3096" || substr($ccnum,0,4) == "3112" || substr($ccnum,0,4) == "3158" || substr($ccnum,0,4) == "3337" ||
(substr($ccnum,0,8) >= "35280000" ||substr($ccnum,0,8) <= "358999999")) && strlen($ccnum)==16)
{
return 28;
} else {
switch(substr($ccnum,1,1))
{
case 4:
case 7: // American Express - First digit must be 3 and second digit 4 or 7. Only Valid length is 15
if(strlen($ccnum) == 15) return 3;
break;
case 0:
case 6:
case 8: //Diners Club/Carte Blanche - First digit must be 3 and second digit 0, 6 or 8. Only valid length is 14
if(strlen($ccnum) == 14) return 4;
break;
}
}
break;
case 4: // Visa - First digit must be a 4 and length must be either 13 or 16 digits.
if(strlen($ccnum) == 13 || strlen($ccnum) == 16)
{
return 2;
}
break;
case 5: // Mastercard - First digit must be a 5 and second digit must be int the range 1 to 5 inclusive. Only valid length is 16
if((substr($ccnum,1,1) >=1 && substr($ccnum,1,1) <=5) && strlen($ccnum) == 16)
{
return 1;
}
break;
case 6: // Discover - First four digits must be 6011. Only valid length is 16 digits.
if(substr($ccnum,0,4) == "6011" && strlen($ccnum) == 16) return 10;
}
// couldn't match a card profile. time to call it quits and go home. this goose is cooked.
$umErrStr="Cardnumber did not match any known creditcard profiles";
return 0;
}
?>

View File

@@ -0,0 +1,137 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
class plg_chout_VERISIGN_PFPRO extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_VERISIGN_PFPRO($checkout_id=false) {
$this->name = 'VERISIGN_PFPRO';
$this->type = 'gateway'; // redirect, gateway, or other
$this->recurr_only = false;
$this->checkout_id = $checkout_id;
$this->support_cur = Array ('USD');
//putenv("PFPRO_CERT_PATH=/path/to/certs/"); // set if you get "Verisign response code was -31
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
# Validate currency
if(!$this->validate_currency($currency_iso)) return false;
$ret=false;
if(!$this->validate_card_details($ret)) return false;
# Get the country
$country = $this->getCountry('name', $this->account["country_id"]);
# Test Transaction
if($this->cfg['mode'] = "0")
$host = 'test-payflow.verisign.com';
else
$host = 'payflow.verisign.com';
# Set the post vars:
$vars = Array (
'TENDER' => "C",
'TRXTYPE' => $this->cfg['type'],
'USER' => $this->cfg['user'],
'PWD' => $this->cfg['password'],
'PARTNER' => $this->cfg['partner'],
'AMT' => $amount,
'ACCT' => $this->billing["cc_no"],
'EXPDATE' => $this->billing["exp_month"] . '' . $this->billing["exp_year"],
'CCV2' => $this->billing["ccv"],
'STREET' => ereg_replace("'", "", $this->account["address1"] . ' ' . $this->account["address2"]),
'CITY' => $this->account["city"],
'STATE' => $this->account["state"],
'ZIP' => $this->account["zip"],
'INVNUM' => $invoice,
'COMMENT1' => "AB Invoice # $invoice for {$this->account["first_name"]} {$this->account["last_name"]}",
'FIRSTNAME' => $this->account["first_name"],
'LASTNAME' => $this->account["last_name"],
'NAME' => $this->account["first_name"] . ' ' . $this->account["last_name"],
'EMAIL' => $acct_fields["email"]
);
# Create the SSL connection & get response from the gateway:
pfpro_init();
$response = pfpro_process($vars, $host );
pfpro_cleanup();
# Transaction Status:
if ($response['RESULT'] == '0')
$ret['status'] = 1;
else
$ret['status'] = 0;
# Transaction ID:
@$ret['transaction_id'] = $response['PNREF'];
@$ret['authorization_id'] = $response['AUTHCODE'];
# Message:
$ret['msg'] = $response['RESPMSG'];
# AVS Details:
$ret['avs'] = 'avs_na';
if($ret['status'] == 1) {
return $ret;
} else {
global $VAR;
@$VAR['msg']=$ret["msg"];
return false;
}
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR, $account=SESS_ACCOUNT) {
return $this->saveCreditCardDetails($VAR);
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
}
?>

View File

@@ -0,0 +1,164 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
IMPORTANT: Be sure to enter the following into your WorldPay Administration Server account under the
"configuration options" for your installation:
Callback URL: <20> <20><WPDISPLAY ITEM=MC_callback>
Callback Enabled?: <20>Ticked
FuturePay Callback Enabled?: Ticked
Use callback response?: Ticked
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_WORLDPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_WORLDPAY($checkout_id=false) {
$this->name = 'WORLDPAY';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = false;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD', 'GBP', 'EUR', 'CAD', 'JPY');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
$url = "https://select.worldpay.com/wcc/purchase";
$vals = Array (
Array ('instId', $this->cfg['instId']),
Array ('testMode', $this->cfg['testMode']),
Array ('desc', "Invoice No:". $invoice),
Array ('amount', $amount),
Array ('currency', $currency_iso),
Array ('cartId', $invoice),
Array ('name', $acct_fields['first_name'] . ' ' . $acct_fields['last_name']),
Array ('address', $acct_fields['address1']),
Array ('city', $acct_fields['city']),
Array ('state', $acct_fields['state']),
Array ('postcode', $acct_fields['zip']),
Array ('country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('MC_callback', $this->return_url),
Array ('MC_invoice', $invoice),
Array ('MC_gw', "B"),
Array ('MC_post_type', 3),
);
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['MC_invoice'];
$ret['transaction_id'] = $VAR['transId'];
$ret['amount'] = $VAR['authAmount'];
$ret['currency'] = DEFAULT_CURRENCY;
$ret['status'] = true;
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($VAR['transStatus'] != "Y")
$do = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_WORLDPAY;
$plg->postback($VAR);
}
?>

View File

@@ -0,0 +1,241 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
*/
/*
IMPORTANT: Be sure to enter the following into your WorldPay Administration Server account under the
"configuration options" for your installation:
Callback URL: <20> <20><WPDISPLAY ITEM=MC_callback>
Callback Enabled?: <20>Ticked
FuturePay Callback Enabled?: Ticked
Use callback response?: Ticked
*/
if(defined('PATH_MODULES')) include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php'); else include_once('../../modules/checkout/base_checkout_plugin.class.php');
class plg_chout_WORLDPAY_FUTUREPAY extends base_checkout_plugin
{
# Get the config values for this checkout plugin:
function plg_chout_WORLDPAY_FUTUREPAY($checkout_id=false) {
$this->name = 'WORLDPAY_FUTUREPAY';
$this->type = 'redirect'; // redirect, gateway, or other
$this->recurr_only = true;
$this->return_url = SSL_URL . 'plugins/checkout/'. $this->name .'.php';
$this->success_url = URL . '?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
$this->decline_url = URL . '?_page=invoice:user_view&id=';
$this->support_cur = Array ('USD', 'GBP', 'EUR', 'CAD', 'JPY');
$this->getDetails($checkout_id);
}
# Validate the user submitted billing details at checkout:
function validate($VAR) {
return true;
}
# Perform the checkout transaction (new purchase):
function bill_checkout( $amount, $invoice, $currency_iso, $acct_fields, $total_recurring=false, $recurr_bill_arr=false) {
if(!$this->validate_currency($currency_iso)) return false;
# Get the regular period for this subscription:
$sched = @$recurr_bill_arr[0]["recurr_schedule"];
if($sched <= 0) {
echo '<script language=Javascript> alert(\'Sorry, weekly subscriptions are not supported by this payment option!\'); </script>';
return false;
} elseif ($sched == 1) {
$intervalUnit = 3;
$intervalMult = 1;
$start_date = date("Y-m-d", time()+(86400*31));
} elseif ($sched == 2) {
$intervalUnit = 3;
$intervalMult = 3;
$start_date = date("Y-m-d", time()+(86400*90));
} elseif ($sched == 3) {
$intervalUnit = 3;
$intervalMult = 6;
$start_date = date("Y-m-d", time()+(86400*181));
} elseif ($sched == 4) {
$intervalUnit = 4;
$intervalMult = 1;
$start_date = date("Y-m-d", time()+(86400*365));
} elseif ($sched == 5) {
$intervalUnit = 4;
$intervalMult = 2;
$start_date = date("Y-m-d", time()+(86400*730));
}
$url = "https://select.worldpay.com/wcc/purchase";
# Pro-rated subscriptions:
if($recurr_bill_arr[0]["recurr_type"] == "1")
{
# Pro-rate billing:
include_once ( PATH_MODULES . 'checkout/checkout.inc.php' );
$checkout = new checkout;
$arr = $checkout->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$remain_time = $arr['end'] - time();
$period1 = round($remain_time/86400);
$start_date = date("Y-m-d", $arr["end"]);
$vals = Array (
Array ('instId', $this->cfg['instId']),
Array ('testMode', $this->cfg['testMode']),
Array ('desc', "Invoice No:". $invoice),
Array ('currency', $currency_iso),
Array ('cartId', $invoice),
Array ('cardname', $acct_fields['first_name'] . ' ' . $acct_fields['last_name']),
Array ('address', $acct_fields['address1'] . ' ' . $acct_fields['address2']),
Array ('city', $acct_fields['city']),
Array ('state', $acct_fields['state']),
Array ('postcode', $acct_fields['zip']),
Array ('country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('MC_callback', $this->return_url),
Array ('MC_invoice', $invoice),
Array ('MC_gw', "B"),
Array ('MC_post_type', 3),
Array ('subst', 'yes'),
Array ('option', 1),
Array ('futurePayType', 'regular'),
Array ('startDate', $start_date),
Array ('intervalMult', $intervalMult),
Array ('intervalUnit', $intervalUnit),
Array ('amount', $amount),
Array ('normalAmount', $total_recurring)
);
}
else
{
$vals = Array (
Array ('instId', $this->cfg['instId']),
Array ('testMode', $this->cfg['testMode']),
Array ('desc', "Invoice No:". $invoice),
Array ('currency', $currency_iso),
Array ('cartId', $invoice),
Array ('cardname', $acct_fields['first_name'] . ' ' . $acct_fields['last_name']),
Array ('address', $acct_fields['address1'] . ' ' . $acct_fields['address2']),
Array ('city', $acct_fields['city']),
Array ('state', $acct_fields['state']),
Array ('postcode', $acct_fields['zip']),
Array ('country', $acct_fields['country_id']),
Array ('email', $acct_fields['email']),
Array ('MC_callback', $this->return_url),
Array ('MC_invoice', $invoice),
Array ('MC_gw', "B"),
Array ('MC_post_type', 3),
Array ('subst', 'yes'),
Array ('option', 1),
Array ('futurePayType', 'regular'),
Array ('startDate', $start_date),
Array ('intervalMult', $intervalMult),
Array ('intervalUnit', $intervalUnit),
Array ('amount', $amount),
Array ('normalAmount', $total_recurring)
);
}
$this->post_vars($url, $vals);
return true;
}
# Stores new billing details, & return account_billing_id (gateway only)
function store_billing($VAR) {
return 0;
}
# Perform a transaction for an (new invoice):
function bill_invoice($VAR) {
return true;
}
# Issue a refund for a paid invoice (captured charges w/gateway)
function refund($VAR) {
return true;
}
# Void a authorized charge (gateways only)
function void($VAR) {
return true;
}
# Postback Validation
function postback($VAR)
{
# needed for return
$ret['invoice_id'] = $VAR['MC_invoice'];
$ret['transaction_id'] = $VAR['transId'];
$ret['amount'] = $VAR['authAmount'];
$ret['currency'] = DEFAULT_CURRENCY;
$ret['status'] = true;
$ret['subscription_id'] = $VAR['orig_orderno'];
# get the processor details:
$db = &DB();
$q = "SELECT id,active,plugin_data FROM ".AGILE_DB_PREFIX."checkout WHERE
site_id = ".$db->qstr(DEFAULT_SITE)." AND
checkout_plugin = ".$db->qstr($this->name);
$rs = $db->Execute($q);
while(!$rs->EOF)
{
$ret['checkout_id'] = $rs->fields["id"];
$do = true;
$this->cfg = unserialize($rs->fields["plugin_data"]);
if($VAR['transStatus'] != "Y")
$do = false;
if($do) {
include_once(PATH_MODULES.'checkout/checkout.inc.php');
$checkout = new checkout;
$checkout->postback($ret);
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->success_url.$ret['invoice_id'].'";
</script>';
return true;
}
$rs->MoveNext();
}
echo '<SCRIPT LANGUAGE="JavaScript">
window.location="'.$this->decline_url.$ret['invoice_id'].'";
</script>';
}
}
# Postback Function
if(empty($VAR) && empty($VAR['do']))
{
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
$plg = new plg_chout_WORLDPAY_FUTUREPAY;
$plg->postback($VAR);
}
?>