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,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
?>