diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..56b2f51 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# First Data Hosted Checkout Payment Pages, for Zen Cart + +## Integrations + +This supports Global Gateway e4 merchants who wish to use Payment Pages to do Hosted Checkout, which collects payment offsite temporarily before redirecting the customer back to the store to complete the order. + +## Installation + +### PHP Files +Currently no core files are changed, so you can just upload the files in `/includes/` into the relevant `/includes/` directories and subdirectories within your store. + +**Note: You should not copy the README.md, LICENSE or changelog.txt files to your live server.** + +### Admin module configuration +When installing the payment module from your admin > modules > payment, copy the Page ID, Transaction Key, and Response Key from your GGe4 Payment Page "security" settings tab. + diff --git a/includes/languages/english/modules/payment/firstdata_hco.php b/includes/languages/english/modules/payment/firstdata_hco.php new file mode 100644 index 0000000..dd0196c --- /dev/null +++ b/includes/languages/english/modules/payment/firstdata_hco.php @@ -0,0 +1,34 @@ +First Data GGe4 Merchant Login' . + (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE != 'Production' ? '

For TEST CARDS refer to Using Test Credit Cards' : '') . + '

SETTINGS
Your "Receipt Link URL" setting in your First Data Payment Page configuration needs to point to ' . zen_catalog_href_link('checkout_process', '', 'SSL') . '
' . + 'Then obtain the Payment Page ID, Transaction Key and Response Key from First Data and enter them here. They can be found by logging into your First Data account, choosing Payment Pages, and clicking on the desired Page ID and navigating to the Security section.' + ); + } else { + define('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_DESCRIPTION', 'Hosted Checkout Payment Pages are available to all First Data, Global Gateway e4, and Linkpont merchants.

+ Your First Data account representative can assist with any account changes necessary to enable Hosted Checkout (HCO) in your account.

+ Click Here to Sign Up for a First Data Hosted Checkout Account

+ Click to Login to the First Data GGe4 Merchant Area'); + } + } + define('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_DECLINED_MESSAGE', 'The transaction could not be completed. Please try another card or contact your bank for more info. '); + define('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_ERROR_MESSAGE', 'There has been an error processing the transaction. Please try again. '); diff --git a/includes/modules/payment/firstdata_hco.php b/includes/modules/payment/firstdata_hco.php new file mode 100644 index 0000000..147b554 --- /dev/null +++ b/includes/modules/payment/firstdata_hco.php @@ -0,0 +1,553 @@ +code = 'firstdata_hco'; + + $this->title = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_CATALOG_TITLE; // Payment module title in Catalog + if (IS_ADMIN_FLAG === true) { + $this->description = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_DESCRIPTION; + $this->title = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_ADMIN_TITLE; // Payment module title in Admin + if (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_STATUS == 'True' && (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_LOGIN == 'testing' || MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TXNKEY == 'Test' || MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_RESPONSEKEY == '*Enter the Response Key here*')) { + $this->title .= ' (Not Configured)'; + } elseif (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE == 'Test') { + $this->title .= ' (in Testing mode)'; + } elseif (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE == 'Sandbox') { + $this->title .= ' (in Sandbox Developer mode)'; + } + + $new_version_details = plugin_version_check_for_updates(2051, $this->moduleVersion); + if ($new_version_details !== false) { + $this->title .= '' . ' - NOTE: A NEW VERSION OF THIS PLUGIN IS AVAILABLE. [Details]' . ''; + } + } + + $this->enabled = (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_STATUS == 'True'); + $this->sort_order = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_SORT_ORDER; + + if ((int)MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ORDER_STATUS_ID; + } + // Reset order status to pending if capture pending: + if (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_AUTHORIZATION_TYPE == 'Authorize') $this->order_status = 1; + + if (is_object($order)) $this->update_status(); + + $this->form_action_url = 'https://checkout.globalgatewaye4.firstdata.com/payment'; + if (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE == 'Sandbox') $this->form_action_url = 'https://demo.globalgatewaye4.firstdata.com/payment'; + + $this->_logDir = defined('DIR_FS_LOGS') ? DIR_FS_LOGS : DIR_FS_SQL_CACHE; + + // set the currency for the gateway (others will be converted to this one before submission) + $this->gateway_currency = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_CURRENCY; + } + + /** + * Calculate zone matches and flag settings to determine whether this module should display to customers or not + */ + function update_status() { + global $order, $db; + + if ($this->enabled && (int)MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ZONE > 0 && isset($order->billing['country']['id'])) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ZONE . "' and zone_country_id = '" . (int)$order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + + // other status checks? + if ($this->enabled) { + // other checks here + } + } + /** + * JS validation which does error-checking of data-entry if this module is selected for use + * (Number, Owner Lengths) + * + * @return string + */ + function javascript_validation() { + return ''; + } + /** + * Display Credit Card Information Submission Fields on the Checkout Payment Page + * + * @return array + */ + function selection() { + return array('id' => $this->code, + 'module' => $this->title); + } + /** + * Evaluates the Credit Card Type for acceptance and the validity of the Credit Card Number & Expiration Date + * + */ + function pre_confirmation_check() { + // no validation required since all the payment processing is hosted externally + return true; + } + /** + * Display Credit Card Information on the Checkout Confirmation Page + * + * @return array + */ + function confirmation() { + return array(); + } + /** + * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. + * This sends the data to the payment gateway for processing. + * (These are hidden fields on the checkout confirmation page) + * + * @return string + */ + function process_button() { + global $db, $order, $order_totals; + + // Calculate the next expected order id + $result = $db->Execute("select max(orders_id)+1 as orders_id from " . TABLE_ORDERS . " order by orders_id"); + $next_order_id = $result->fields['orders_id']; + // add randomized suffix to order id to produce uniqueness ... since it's unwise to submit the same order-number twice to the gateway, and this order is not yet committed + $next_order_id = (string)$next_order_id . '-' . zen_create_random_value(6, 'chars'); + + $submit_data_core = array( + 'x_login' => html_entity_decode(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_PAGEID), + 'TPP-ID' => 'EZN001', // hosted checkout payment pages mode + 'x_amount' => number_format($order->info['total'], 2), + 'x_currency_code' => $_SESSION['currency'], + 'x_type' => MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_AUTHORIZATION_TYPE == 'Authorize' ? 'AUTH_ONLY': 'AUTH_CAPTURE', + 'x_email_customer' => ((MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_EMAIL_CUSTOMER == 'True') ? 'TRUE': 'FALSE'), + 'enable_level3_processing' => 'TRUE', + 'x_cust_id' => $_SESSION['customer_id'], + 'x_company' => $order->billing['company'], + 'x_first_name' => $order->billing['firstname'], + 'x_last_name' => $order->billing['lastname'], + 'x_address' => $order->billing['street_address'], + 'x_city' => $order->billing['city'], + 'x_state' => $order->billing['state'], + 'x_zip' => $order->billing['postcode'], + 'x_country' => $order->billing['country']['title'], + 'x_phone' => $order->customer['telephone'], + 'x_fax' => $order->customer['fax'], + 'x_email' => $order->customer['email_address'], + 'x_ship_to_company' => $order->delivery['company'], + 'x_ship_to_first_name' => $order->delivery['firstname'], + 'x_ship_to_last_name' => $order->delivery['lastname'], + 'x_ship_to_address' => $order->delivery['street_address'], + 'x_ship_to_city' => $order->delivery['city'], + 'x_ship_to_state' => $order->delivery['state'], + 'x_ship_to_zip' => $order->delivery['postcode'], + 'x_ship_to_country' => $order->delivery['country']['title'], + 'x_customer_ip' => zen_get_ip_address(), + 'x_description' => 'Website Purchase from ' . str_replace('"',"'", STORE_NAME), + 'x_invoice_num' => $next_order_id, +// 'x_method' => 'CC', // if not passed, then the payment types can be configured in the PaymentPage including enabling PayPal and other features. + ); + + // lookup shipping and discount amounts + if (sizeof($order_totals)) { + for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { + if ($order_totals[$i]['code'] == '') continue; + if (in_array($order_totals[$i]['code'], array('ot_total','ot_subtotal','ot_tax','ot_shipping', 'insurance'))) { + if ($order_totals[$i]['code'] == 'ot_shipping') $submit_data_core['x_freight'] = round($order_totals[$i]['value'],2); + if ($order_totals[$i]['code'] == 'ot_tax') $submit_data_core['x_tax'] = round($order_totals[$i]['value'],2); + } else { + // handle credits + global ${$order_totals[$i]['code']}; + if ((substr($order_totals[$i]['text'], 0, 1) == '-') || (isset(${$order_totals[$i]['code']}->credit_class) && ${$order_totals[$i]['code']}->credit_class == true)) { + $submit_data_core['discount_amount'] += round($order_totals[$i]['value'], 2); + } + } + } + } + + // force conversion to supported currencies + $exchange_factor = 1; + if ($order->info['currency'] != $this->gateway_currency) { + global $currencies; + $exchange_factor = $currencies->get_value($this->gateway_currency); + $submit_data_core['x_amount'] = number_format($order->info['total'] * $exchange_factor, 2); + if (isset($submit_data_core['x_freight'])) $submit_data_core['x_freight'] = number_format($submit_data_core['x_freight'] * $exchange_factor, 2); + if (isset($submit_data_core['x_tax'])) $submit_data_core['x_tax'] = number_format($submit_data_core['x_tax'] * $exchange_factor, 2); + if (isset($submit_data_core['discount_amount'])) $submit_data_core['discount_amount'] = number_format($submit_data_core['discount_amount'] * $exchange_factor, 2); + $submit_data_core['x_currency_code'] = $this->gateway_currency; + $submit_data_core['x_description'] .= ' (Converted from: ' . number_format($order->info['total'] * $order->info['currency_value'], 2) . ' ' . $order->info['currency'] . ')'; + } + + +// to test a decline +//$submit_data_core['x_amount'] = 5234; // 5201=bad card, 5234=duplicate + + + // Add line-item data to transaction + if (sizeof($order->products) < 100) { + $items = ''; + $delim = '<|>'; + $product_code = $commodity_code = ''; // not submitted + $item_log = array(); + for ($i=0; $iproducts); $i++) { + $p = $order->products[$i]; + // Item ID<|>Item Title<|>Item Description<|>Quantity<|>Unit Price<|>Taxable (Y or N)<|>Product Code<|>Commodity Code<|>Unit of Measure<|>Tax Rate<|>Tax Type<|>Tax Amount<|>Discount Indicator<|>Discount Amount<|>Line Item Total + $line = $p['model'] . $delim . $p['name'] . $delim . $p['name'] . $delim . $p['qty'] . $delim . number_format($p['final_price'] * $exchange_factor,2) . $delim; + $line .= (is_array($p['tax_groups']) && sizeof($p['tax_groups']) ? 'Y' : 'N') . $delim; + $line .= $product_code . $delim . $commodity_code . $delim . '' . $delim; + $line .= $p['tax'] . $delim . '' . number_format(zen_calculate_tax($p['final_price'] * $exchange_factor, $p['tax']),2) . $delim; + $line .= '' . $delim . '' . $delim; + $line .= number_format(zen_add_tax($p['final_price'] * $exchange_factor, $p['tax']) * $p['qty'],2); + + $items .= zen_draw_hidden_field('x_line_item', $line); + $item_log[] = $line; + } + } + + $this->submit_extras = array(); + $this->notify('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_PRESUBMIT_HOOK'); + unset($this->submit_extras['x_login']); + if (sizeof($this->submit_extras)) $submit_data_core = array_merge($submit_data_core, $this->submit_extras); + + $submit_data_security = $this->hmacAuthorizationToken($submit_data_core['x_amount'], $submit_data_core['x_currency_code']); + + $submit_data_offline = array( + 'x_show_form' => 'PAYMENT_FORM', + 'x_receipt_link_method' => 'AUTO-POST', + 'x_receipt_link_text' => 'Click here to complete your order.', + 'x_receipt_link_url' => zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false), + +// By using AUTO-POST, relay isn't needed, and therefore requires less configuration in the merchant account settings +// 'x_relay_response' => 'TRUE', +// 'x_relay_URL' => zen_href_link(FILENAME_CHECKOUT_PROCESS, 'action=confirm', 'SSL', true, false), + ); + + $submit_data_extras = array(); + // The following can (and SHOULD) be set in the merchant account admin area instead of here + if (defined('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_LOGO_URL')) { + $submit_data_extras['x_logo_url'] = MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_LOGO_URL; + } + + $submit_data = array_merge($submit_data_core, $submit_data_security, $submit_data_offline, $submit_data_extras); + + if (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE == 'Test') $submit_data['x_test_request'] = 'TRUE'; + + $submit_data[zen_session_name()] = zen_session_id(); + + $process_button_string = "\n"; + foreach($submit_data as $key => $value) { + $process_button_string .= zen_draw_hidden_field($key, $value) . "\n"; + } + $process_button_string .= $items . "\n"; + + // prepare a copy of submitted data for error-reporting purposes + $this->reportable_submit_data = $submit_data; + $this->reportable_submit_data['items'] = $item_log; + + $this->_debugActions($this->reportable_submit_data, 'Submit-Data', '', zen_session_id()); + + return $process_button_string; + } + /** + * Store the CC info to the order and process any results that come back from the payment gateway + * + */ + function before_process() { + global $messageStack, $order; + $this->authorize = $_POST; + $this->authorize['HashValidationValue'] = $this->calc_md5_response($this->authorize['x_trans_id'], $this->authorize['x_amount']); + $this->authorize['HashMatchStatus'] = ($this->authorize['x_MD5_Hash'] == $this->authorize['HashValidationValue']) ? 'PASS' : 'FAIL'; + + $this->notify('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_POSTSUBMIT_HOOK', $this->authorize); + $this->_debugActions($this->authorize, 'Response-Data', '', zen_session_id()); + + // if in 'echo' mode, dump the returned data to the browser and stop execution + if (MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING == 'echo') { + echo 'Returned Response Codes:
' . print_r($_POST, true) . '

'; + die('Press the BACK button in your browser to return to the previous page.'); + } + + if ($this->authorize['x_response_code'] == '1' && $this->authorize['x_MD5_Hash'] == $this->authorize['HashValidationValue']) { + $order->info['cc_type'] = $this->authorize['TransactionCardType']; + $order->info['cc_number'] = $this->authorize['Card_Number']; + $order->info['cc_owner'] = $this->authorize['x_first_name'] . ' ' . $this->authorize['x_last_name']; + $this->auth_code = $this->authorize['x_auth_code']; + $this->transaction_id = $this->authorize['x_trans_id']; +// $_SESSION['payment_method_messages'] = nl2br($this->authorize['exact_ctr']); // added to order-comments in after_process() + return true; + } + if ($this->authorize['x_response_code'] == '2') { + $messageStack->add_session('checkout_payment', $this->authorize['x_response_reason_text'] . ' ... ' . MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_DECLINED_MESSAGE . '
' .  $this->authorize['exact_ctr'] . '
' . $this->authorize['Bank_Message'], 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false)); + } + // Code 3 or anything else is an error + $messageStack->add_session('checkout_payment', MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TEXT_ERROR_MESSAGE . ' ' . $this->authorize['x_response_reason_text'] . ' ' . $this->authorize['Bank_Message'], 'error'); + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false)); + } + + /** + * Add receipt and transaction id to order-status-history (order comments) + * + * @return boolean + */ + function after_process() { + global $insert_id, $db, $order, $currencies; + $this->notify('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_POSTPROCESS_HOOK'); + $sql = "insert into " . TABLE_ORDERS_STATUS_HISTORY . " (comments, orders_id, orders_status_id, customer_notified, date_added) values (:orderComments, :orderID, :orderStatus, 1, now() )"; + $sql = $db->bindVars($sql, ':orderComments', $this->authorize['exact_ctr'], 'string'); + $sql = $db->bindVars($sql, ':orderID', $insert_id, 'integer'); + $sql = $db->bindVars($sql, ':orderStatus', $this->order_status, 'integer'); + $db->Execute($sql); + $sql = "insert into " . TABLE_ORDERS_STATUS_HISTORY . " (comments, orders_id, orders_status_id, customer_notified, date_added) values (:orderComments, :orderID, :orderStatus, -1, now() )"; + $currency_comment = ''; + if ($order->info['currency'] != $this->gateway_currency) { + $currency_comment = ' (' . number_format($order->info['total'] * $currencies->get_value($this->gateway_currency), 2) . ' ' . $this->gateway_currency . ')'; + } + $sql = $db->bindVars($sql, ':orderComments', 'Credit Card payment. AUTH: ' . $this->auth_code . ' TransID: ' . $this->transaction_id . ' ' . $currency_comment, 'string'); + $sql = $db->bindVars($sql, ':orderID', $insert_id, 'integer'); + $sql = $db->bindVars($sql, ':orderStatus', $this->order_status, 'integer'); + $db->Execute($sql); + return false; + } + /** + * Check to see whether module is installed + * + * @return boolean + */ + function check() { + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + /** + * Install the payment module and its configuration settings + * + */ + function install() { + global $db, $messageStack; + if (defined('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_STATUS')) { + $messageStack->add_session('First Data Payment Pages module already installed.', 'error'); + zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=firstdata')); + return 'failed'; + } + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable First Data Hosted Payment Pages Module', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_STATUS', 'True', 'Do you want to accept Hosted Checkout payments via First Data Payment Pages?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_SORT_ORDER', '0', 'Sort order of displaying payment options to the customer. Lowest is displayed first.', '6', '0', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ORDER_STATUS_ID', '2', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Payment Page ID', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_PAGEID', 'testing', 'The Payment Page ID assigned in your First Data Hosted Payment Pages Console.
NOTE: If any & symbols are used here, then anytime you make edits you may need to change them from &amp; to just &', '6', '0', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function) values ('Transaction Key', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TXNKEY', 'Test', 'Transaction Key (from Payment Page Settings, under 9:Security)', '6', '0', now(), 'zen_cfg_password_display')"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function) values ('Response Key', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_RESPONSEKEY', '*Enter the Response Key here*', 'Response Key is used to verify responses from processed payments to ensure they are authentic. (From Payment Page Settings, under 9:Security)', '6', '0', now(), 'zen_cfg_password_display')"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE', 'Test', 'Transaction mode used for processing orders.
Production=Live processing with real account credentials
Test=Simulations with real account credentials
Sandbox=use special sandbox transaction key to do special testing of success/fail transaction responses (obtain sandbox credentials via First Data Provisioning)', '6', '0', 'zen_cfg_select_option(array(\'Test\', \'Production\', \'Sandbox\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Authorization Type', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_AUTHORIZATION_TYPE', 'Capture', 'Do you want submitted credit card transactions to be authorized only, or captured immediately?', '6', '0', 'zen_cfg_select_option(array(\'Authorize\', \'Capture\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Customer Notifications', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_EMAIL_CUSTOMER', 'False', 'Should First Data email a payment receipt to the customer?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Debug Mode', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING', 'Alerts Only', 'Would you like to enable debug mode? A detailed log of failed transactions may be emailed to the store owner.', '6', '0', 'zen_cfg_select_option(array(\'Off\', \'Alerts Only\', \'Log File\', \'Log and Email\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Currency Supported', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_CURRENCY', 'USD', 'Which currency is your First Data Payment Page Account configured to accept?
(Purchases in any other currency will be pre-converted to this currency before submission using the exchange rates in your store admin.)', '6', '0', 'zen_cfg_select_option(array(\'USD\', \'CAD\', \'GBP\', \'EUR\', \'AUD\', \'NZD\'), ', now())"); + $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('HMAC Calculation', 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_HMAC_MODE', 'MD5', 'The HMAC Encryption Type (from Payment Page Settings, under 9:Security)', '6', '0', 'zen_cfg_select_option(array(\'MD5\'), ', now())"); + } + /** + * Remove the module and all its settings + * + */ + function remove() { + global $db; + $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + /** + * Internal list of configuration keys used for configuration of the module + * + * @return array + */ + function keys() { + return array('MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_STATUS', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_SORT_ORDER', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ORDER_STATUS_ID', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_ZONE', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_PAGEID', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TXNKEY', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_RESPONSEKEY', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TESTMODE', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_CURRENCY', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_AUTHORIZATION_TYPE', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_EMAIL_CUSTOMER', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_HMAC_MODE', + 'MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING'); + } + + public function hmacAuthorizationToken($amount, $currency) + { + $nonce = strval(hexdec(bin2hex(openssl_random_pseudo_bytes(4, $cstrong)))); + $timestamp = strval(time()); //time stamp as a string + $data = html_entity_decode(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_PAGEID) . "^" . $nonce . "^" . $timestamp . "^" . $amount . "^" . $currency; + $hashAlgorithm = "md5"; // According to First Data they recommend MD5 here + $hmac = hash_hmac($hashAlgorithm, $data, MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_TXNKEY, false); // HMAC Hash in hex + return array( + 'x_fp_hash' => $hmac, + 'x_fp_sequence' => $nonce, + 'x_fp_timestamp' => $timestamp, + ); + } + + /** + * Calculate validity of relay response + */ + function calc_md5_response($trans_id = '', $amount = '') { + if ($amount == '' || $amount == '0') $amount = '0.00'; + return md5(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_RESPONSEKEY . html_entity_decode(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_PAGEID) . $trans_id . $amount); + } + + /** + * Used to do any debug logging / tracking / storage as required. + */ + function _debugActions($response, $mode, $order_time= '', $sessID = '') { + global $db, $messageStack, $insert_id; + + if ($order_time == '') $order_time = date("F j, Y, g:i a"); + $response['url'] = $this->form_action_url; + $this->reportable_submit_data['url'] = $this->form_action_url; + if (isset($response['x_login'])) $response['x_login'] = '*******' . substr($response['x_login'], -8); + if (isset($this->reportable_submit_data['x_login'])) $this->reportable_submit_data['x_login'] = '*******' . substr($response['x_login'], -8); + + $errorMessage = date('M-d-Y h:i:s') . + "\n=================================\n\n"; + if ($mode == 'Submit-Data') $errorMessage .= + 'Sent to First Data Hosted Payments Page: ' . print_r($this->reportable_submit_data, true) . "\n\n"; + if ($mode == 'Response-Data') $errorMessage .= + 'Response Code: ' . $response['x_response_code'] . ".\nResponse Text: " . $response['x_response_reason_text'] . "\n\n" . + ($response['x_response_code'] == 2 && $response['x_response_reason_code'] == 4 ? ' NOTICE: Card should be picked up - possibly stolen ' : '') . + ($response['x_response_code'] == 3 && $response['x_response_reason_code'] == 11 ? ' DUPLICATE TRANSACTION ATTEMPT ' : '') . + 'Results Received back from First Data: ' . print_r($response, true) . "\n\n"; + // store log file if log mode enabled + if (stristr(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING, 'Log') || strstr(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING, 'All')) { + $key = ($response['x_trans_id'] != '' ? $response['x_trans_id'] . '_' : '') . time() . '_' . zen_create_random_value(4); + $file = $this->_logDir . '/' . 'FirstData_Debug_' . $key . '.log'; + $fp = @fopen($file, 'a'); + @fwrite($fp, $errorMessage); + @fclose($fp); + } + // send email alerts only if in alert mode or if email specifically requested as logging mode + if ((isset($response['x_response_code']) && $response['x_response_code'] != '1' && stristr(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING, 'Alerts')) || stristr(MODULE_PAYMENT_FIRSTDATA_PAYMENTPAGES_DEBUGGING, 'Email')) { + zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'First Data HostedPayments Alert ' . $response['x_invoice_num'] . ' ' . date('M-d-Y h:i:s') . ' ' . $response['x_trans_id'], $errorMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML'=>nl2br($errorMessage)), 'debug'); + } + } +} + +// for backward compatibility with older ZC versions before v152 which didn't have this function: +if (!function_exists('plugin_version_check_for_updates')) { + function plugin_version_check_for_updates($plugin_file_id = 0, $version_string_to_compare = '') + { + if ($plugin_file_id == 0) return FALSE; + $new_version_available = FALSE; + $lookup_index = 0; + $url = 'https://www.zen-cart.com/downloads.php?do=versioncheck' . '&id='.(int)$plugin_file_id; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL,$url); + curl_setopt($ch, CURLOPT_VERBOSE, 0); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_USERAGENT, 'Plugin Version Check [' . (int)$plugin_file_id . '] ' . HTTP_SERVER); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($ch); + $error = curl_error($ch); + + if ($error > 0) { + curl_setopt($ch, CURLOPT_URL, str_replace('tps:', 'tp:', $url)); + $response = curl_exec($ch); + $error = curl_error($ch); + } + curl_close($ch); + if ($error > 0 || $response == '') { + $response = file_get_contents($url); + } + if ($response === false) { + $response = file_get_contents(str_replace('tps:', 'tp:', $url)); + } + if ($response === false) return false; + + $data = json_decode($response, true); + if (!$data || !is_array($data)) return false; + // compare versions + if (strcmp($data[$lookup_index]['latest_plugin_version'], $version_string_to_compare) > 0) $new_version_available = TRUE; + // check whether present ZC version is compatible with the latest available plugin version + if (!in_array('v'. PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR, $data[$lookup_index]['zcversions'])) $new_version_available = FALSE; + return ($new_version_available) ? $data[$lookup_index] : FALSE; + } +}