Version Notes
Initial release.
Download this release
Release Info
| Developer | Popular Payments |
| Extension | Popular_Payments_Snap_HostedPayments |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/local/Evo/HostedPayments/Block/Form.php +47 -0
- app/code/local/Evo/HostedPayments/Block/Iframe.php +40 -0
- app/code/local/Evo/HostedPayments/Block/Iframevalidation.php +39 -0
- app/code/local/Evo/HostedPayments/Block/Info.php +59 -0
- app/code/local/Evo/HostedPayments/Helper/Data.php +40 -0
- app/code/local/Evo/HostedPayments/Model/Hostedpayment.php +43 -0
- app/code/local/Evo/HostedPayments/Model/Payment.php +860 -0
- app/code/local/Evo/HostedPayments/Model/Resource/Hostedpayment.php +43 -0
- app/code/local/Evo/HostedPayments/Model/Resource/Hostedpayment/Collection.php +43 -0
- app/code/local/Evo/HostedPayments/Model/Resource/Setup.php +39 -0
- app/code/local/Evo/HostedPayments/controllers/ProcessingController.php +308 -0
- app/code/local/Evo/HostedPayments/etc/config.xml +146 -0
- app/code/local/Evo/HostedPayments/etc/system.xml +128 -0
- app/code/local/Evo/HostedPayments/sql/hostedpayments_setup/install-0.1.0.php +59 -0
- app/design/adminhtml/default/default/template/evo/info.phtml +38 -0
- app/design/frontend/base/default/layout/evohostedpayments.xml +59 -0
- app/design/frontend/base/default/template/evo/form.phtml +39 -0
- app/design/frontend/base/default/template/evo/iframe.phtml +40 -0
- app/design/frontend/base/default/template/evo/iframevalidation.phtml +42 -0
- app/design/frontend/base/default/template/evo/info.phtml +47 -0
- app/etc/modules/Evo_HostedPayments.xml +41 -0
- app/locale/en_US/Evo_HostedPayments.csv +19 -0
- app/locale/es_ES/Evo_HostedPayments.csv +19 -0
- lib/hostedpayments/evosnap_api.php +297 -0
- lib/hostedpayments/evosnap_constants.php +41 -0
- lib/hostedpayments/evosnap_tools.php +192 -0
- lib/hostedpayments/exceptions/hostepayments_exception.php +38 -0
- lib/hostedpayments/index.php +53 -0
- lib/hostedpayments/model/address.php +104 -0
- lib/hostedpayments/model/checkout.php +87 -0
- lib/hostedpayments/model/combo_checkout.php +56 -0
- lib/hostedpayments/model/customer.php +68 -0
- lib/hostedpayments/model/hostedpayments.php +74 -0
- lib/hostedpayments/model/order.php +110 -0
- lib/hostedpayments/model/order_checkout.php +50 -0
- lib/hostedpayments/model/order_line.php +80 -0
- lib/hostedpayments/model/subscription.php +81 -0
- lib/hostedpayments/model/subscription_checkout.php +50 -0
- lib/hostedpayments/model/token.php +63 -0
- package.xml +19 -0
- skin/adminhtml/default/default/images/evo/logo.png +0 -0
- skin/frontend/base/default/images/evo/brand-logos.png +0 -0
- skin/frontend/base/default/images/evo/cc-logo.png +0 -0
- skin/frontend/base/default/images/evo/logo.png +0 -0
app/code/local/Evo/HostedPayments/Block/Form.php
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Info Block.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Block_Form extends Mage_Payment_Block_Form
|
| 38 |
+
{
|
| 39 |
+
/**
|
| 40 |
+
* Varien constructor
|
| 41 |
+
*/
|
| 42 |
+
protected function _construct()
|
| 43 |
+
{
|
| 44 |
+
$this->setTemplate('evo/form.phtml');
|
| 45 |
+
parent::_construct();
|
| 46 |
+
}
|
| 47 |
+
}
|
app/code/local/Evo/HostedPayments/Block/Iframe.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Info Block.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Block_Iframe extends Mage_Core_Block_Template
|
| 38 |
+
{
|
| 39 |
+
|
| 40 |
+
}
|
app/code/local/Evo/HostedPayments/Block/Iframevalidation.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Info Block.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Block_IframeValidation extends Mage_Core_Block_Template
|
| 38 |
+
{
|
| 39 |
+
}
|
app/code/local/Evo/HostedPayments/Block/Info.php
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Info Block.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Block_Info extends Mage_Payment_Block_Info
|
| 38 |
+
{
|
| 39 |
+
/**
|
| 40 |
+
* Varien constructor
|
| 41 |
+
*/
|
| 42 |
+
protected function _construct()
|
| 43 |
+
{
|
| 44 |
+
parent::_construct();
|
| 45 |
+
$this->setTemplate('evo/info.phtml');
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
protected function _getPaymentLink(){
|
| 49 |
+
$result = null;
|
| 50 |
+
$paymentInst = $this->getInfo()->getMethodInstance();
|
| 51 |
+
$snapUrl = $paymentInst->getSnapOrderUrl();
|
| 52 |
+
if($snapUrl !== null){
|
| 53 |
+
$result = $snapUrl;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return $result;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
}
|
app/code/local/Evo/HostedPayments/Helper/Data.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Helper class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Helper_Data extends Mage_Payment_Helper_Data
|
| 38 |
+
{
|
| 39 |
+
|
| 40 |
+
}
|
app/code/local/Evo/HostedPayments/Model/Hostedpayment.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments Hosted Payment Resource model class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Model_Hostedpayment extends Mage_Core_Model_Abstract
|
| 38 |
+
{
|
| 39 |
+
protected function _construct()
|
| 40 |
+
{
|
| 41 |
+
$this->_init("hostedpayments/hostedpayment");
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/local/Evo/HostedPayments/Model/Payment.php
ADDED
|
@@ -0,0 +1,860 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments Payment model class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
|
| 38 |
+
require_once(Mage::getBaseDir('lib') . '/hostedpayments/index.php');
|
| 39 |
+
|
| 40 |
+
class Evo_HostedPayments_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
| 41 |
+
{
|
| 42 |
+
|
| 43 |
+
const MERCHANT_CHECKOUT_URL_TEST = 'https://cert-hp.evosnap.com';
|
| 44 |
+
const MERCHANT_CHECKOUT_URL = 'https://hp.evosnap.com';
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Availability options
|
| 48 |
+
*/
|
| 49 |
+
protected $_isGateway = false;
|
| 50 |
+
protected $_canAuthorize = false;
|
| 51 |
+
protected $_canCapture = true;
|
| 52 |
+
protected $_canCapturePartial = false;
|
| 53 |
+
protected $_canRefund = false;
|
| 54 |
+
protected $_canVoid = false;
|
| 55 |
+
protected $_canUseInternal = true;
|
| 56 |
+
protected $_canUseCheckout = true;
|
| 57 |
+
protected $_canUseForMultishipping = false;
|
| 58 |
+
protected $_canSaveCc = false;
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Module identifiers
|
| 62 |
+
*/
|
| 63 |
+
protected $_code = 'hostedpayments';
|
| 64 |
+
protected $_formBlockType = 'hostedpayments/form';
|
| 65 |
+
protected $_infoBlockType = 'hostedpayments/info';
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Retrieve model helper
|
| 69 |
+
*
|
| 70 |
+
* @return Mage_Payment_Helper_Data
|
| 71 |
+
*/
|
| 72 |
+
protected function _getHelper()
|
| 73 |
+
{
|
| 74 |
+
Mage::log(" --- Snap* Hosted Payments API : getHelper --- ");
|
| 75 |
+
return Mage::helper('hostedpayments');
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Get checkout session namespace
|
| 80 |
+
*
|
| 81 |
+
* @return Mage_Checkout_Model_Session
|
| 82 |
+
*/
|
| 83 |
+
public function getCheckout()
|
| 84 |
+
{
|
| 85 |
+
Mage::log(" --- Snap* Hosted Payments API : getCheckout --- ");
|
| 86 |
+
return Mage::getSingleton('checkout/session');
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Get current quote
|
| 91 |
+
*
|
| 92 |
+
* @return Mage_Sales_Model_Quote
|
| 93 |
+
*/
|
| 94 |
+
public function getQuote()
|
| 95 |
+
{
|
| 96 |
+
Mage::log(" --- Snap* Hosted Payments API : getQuote --- ");
|
| 97 |
+
return $this->getCheckout()->getQuote();
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Get order model
|
| 103 |
+
*
|
| 104 |
+
* @return Mage_Sales_Model_Order
|
| 105 |
+
*/
|
| 106 |
+
public function getOrder()
|
| 107 |
+
{
|
| 108 |
+
|
| 109 |
+
Mage::log(" --- Snap* Hosted Payments API : getOrder --- ");
|
| 110 |
+
|
| 111 |
+
if (!$this->_order && (null !== $this->getInfoInstance()->getOrder()))
|
| 112 |
+
{
|
| 113 |
+
$this->_order = Mage::getModel('sales/order')
|
| 114 |
+
->loadByIncrementId($this->getInfoInstance()->getOrder()->getRealOrderId());
|
| 115 |
+
}
|
| 116 |
+
return $this->_order;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/**
|
| 120 |
+
* Get Customer Id
|
| 121 |
+
*
|
| 122 |
+
* @return string
|
| 123 |
+
*/
|
| 124 |
+
public function getCustomerId()
|
| 125 |
+
{
|
| 126 |
+
Mage::log(" --- Snap* Hosted Payments API : getCustomerId --- ");
|
| 127 |
+
$customer = Mage::getSingleton('customer/session');
|
| 128 |
+
if ($customer->isLoggedIn())
|
| 129 |
+
{
|
| 130 |
+
return $customer->getCustomerId();
|
| 131 |
+
}
|
| 132 |
+
else
|
| 133 |
+
{
|
| 134 |
+
return null;
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
* Retrieves the URL to process the payment within the module.
|
| 140 |
+
* @return string
|
| 141 |
+
*/
|
| 142 |
+
public function getOrderPlaceRedirectUrl()
|
| 143 |
+
{
|
| 144 |
+
return Mage::getUrl('hostedpayments/processing/pay');
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
/**
|
| 148 |
+
* Gets 3D Secure Trigger value.
|
| 149 |
+
* @return float
|
| 150 |
+
*/
|
| 151 |
+
public function getTrigger3ds(){
|
| 152 |
+
$trigger3ds = $this->getConfigData('trigger3ds');
|
| 153 |
+
|
| 154 |
+
if(trim($trigger3ds) == ''){
|
| 155 |
+
$trigger3ds = null;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
return $trigger3ds;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/**
|
| 162 |
+
* Gets Checkout Layout.
|
| 163 |
+
* @return float
|
| 164 |
+
*/
|
| 165 |
+
public function getCheckoutLayout(){
|
| 166 |
+
$useIframe = $this->getConfigData('checkout_iframe');
|
| 167 |
+
return $useIframe? 'iframe' : null;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/**
|
| 171 |
+
* Gets Hosted Payments configuration bean.
|
| 172 |
+
* @return HostedPayments
|
| 173 |
+
*/
|
| 174 |
+
public function getHostedPaymentsConfiguration(){
|
| 175 |
+
$result = new HostedPayments();
|
| 176 |
+
$result->code = $this->getConfigData('merchant_code');
|
| 177 |
+
$result->key = $this->getConfigData('merchant_authkey');
|
| 178 |
+
$test = $this->getConfigData('test_mode');
|
| 179 |
+
$result->environment = isset($test)? !$test : true;
|
| 180 |
+
|
| 181 |
+
return $result;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/**
|
| 185 |
+
* Gets the payment URL.
|
| 186 |
+
*/
|
| 187 |
+
public function getPaymentUrl(){
|
| 188 |
+
$order = $this->getOrder();
|
| 189 |
+
$hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
|
| 190 |
+
$hostedpayment->load($order->getRealOrderId(), 'order_id');
|
| 191 |
+
|
| 192 |
+
$paymentUrl = $hostedpayment->getUrl();
|
| 193 |
+
|
| 194 |
+
if(!isset($paymentUrl) || trim($paymentUrl) == '' ){
|
| 195 |
+
$paymentUrl = EvoSnapApi::getOrderCheckoutUrl($this->_getOrderCheckout(),
|
| 196 |
+
$this->getTrigger3ds(), $this->getHostedPaymentsConfiguration());
|
| 197 |
+
|
| 198 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('hostedpayments')->__('Customer was redirected to the Snap* Hosted Payments Checkout for payment.'));
|
| 199 |
+
$order->save();
|
| 200 |
+
|
| 201 |
+
$hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
|
| 202 |
+
$hostedpayment->setOrderId($order->getRealOrderId());
|
| 203 |
+
$hostedpayment->setUrl($paymentUrl);
|
| 204 |
+
$hostedpayment->setPrefix($this->getConfigData('order_prefix'));
|
| 205 |
+
$hostedpayment->setDataChanges(true);
|
| 206 |
+
$hostedpayment->save();
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
return $paymentUrl;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
/**
|
| 213 |
+
* Retrieves Snap* order.
|
| 214 |
+
* @return SnapOrder
|
| 215 |
+
*/
|
| 216 |
+
public function getSnapOrder(){
|
| 217 |
+
$order = $this->getOrder();
|
| 218 |
+
$hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
|
| 219 |
+
$hostedpayment->load($order->getRealOrderId(), 'order_id');
|
| 220 |
+
|
| 221 |
+
return EvoSnapApi::getOrder($this->_getOrderId(((null !== $hostedpayment->getId()) && ($hostedpayment->getId() != 0))? $hostedpayment->getPrefix() : $this->getConfigData('order_prefix'), $this->getOrder()->getRealOrderId()), $this->getHostedPaymentsConfiguration());
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* Retrieves Snap* order URL.
|
| 226 |
+
* @return String
|
| 227 |
+
*/
|
| 228 |
+
public function getSnapOrderUrl(){
|
| 229 |
+
$result = null;
|
| 230 |
+
|
| 231 |
+
$order = $this->getOrder();
|
| 232 |
+
|
| 233 |
+
if(isset($order) && ($order->getStatus() == 'pending') && (null !== $order->getRealOrderId())){
|
| 234 |
+
$hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
|
| 235 |
+
$hostedpayment->load($order->getRealOrderId(), 'order_id');
|
| 236 |
+
|
| 237 |
+
if((null !== $hostedpayment->getId()) && ($hostedpayment->getId() != 0) &&
|
| 238 |
+
(trim($hostedpayment->getUrl()) != '')){
|
| 239 |
+
$result = Mage::getUrl('hostedpayments/processing/return', array('id' => $order->getRealOrderId(), '_secure' => true));
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
return $result;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/**
|
| 247 |
+
* Cancels order.
|
| 248 |
+
*/
|
| 249 |
+
public function cancelOrder(){
|
| 250 |
+
$order = $this->getOrder();
|
| 251 |
+
|
| 252 |
+
if ($order->canCancel()){
|
| 253 |
+
$order->cancel();
|
| 254 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('hostedpayments')->__('Customer cancelled this order via Snap* Hosted Payments Checkout.'));
|
| 255 |
+
$order->save();
|
| 256 |
+
$this->_clearHostedpaymentUrl($order->getRealOrderId());
|
| 257 |
+
}
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/**
|
| 261 |
+
* Cancels order.
|
| 262 |
+
*/
|
| 263 |
+
public function payOrder($snapOrder){
|
| 264 |
+
$order = $this->getOrder();
|
| 265 |
+
|
| 266 |
+
$order->getPayment()->setTransactionId($this->_getTransactionId($snapOrder));
|
| 267 |
+
$order->getPayment()->capture(null);
|
| 268 |
+
$order->save();
|
| 269 |
+
$this->_clearHostedpaymentUrl($order->getRealOrderId());
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
private function _clearHostedpaymentUrl($order_id){
|
| 273 |
+
$hostedpayment = Mage::getModel('hostedpayments/hostedpayment');
|
| 274 |
+
$hostedpayment->load($order_id, 'order_id');
|
| 275 |
+
$hostedpayment->setUrl('');
|
| 276 |
+
$hostedpayment->setDataChanges(true);
|
| 277 |
+
$hostedpayment->save();
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
private function _getTransactionId($snapOrder){
|
| 281 |
+
$result = null;
|
| 282 |
+
if(is_array($snapOrder->transactions)){
|
| 283 |
+
for($i = count($snapOrder->transactions) - 1; $i >= 0; $i--){
|
| 284 |
+
$txn = $snapOrder->transactions[$i];
|
| 285 |
+
if($txn->txn_action == 'sale'){
|
| 286 |
+
$result = $txn->txn_id;
|
| 287 |
+
$i = -1;
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
return $result;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
/**
|
| 296 |
+
* Gets order checkout object.
|
| 297 |
+
* @return SnapCheckoutAbstract
|
| 298 |
+
*/
|
| 299 |
+
private function _getOrderCheckout(){
|
| 300 |
+
$layout = $this->getCheckoutLayout();
|
| 301 |
+
|
| 302 |
+
$mOrder = $this->getOrder();
|
| 303 |
+
|
| 304 |
+
$checkout = new SnapOrder_Checkout();
|
| 305 |
+
$checkout->return_url = Mage::getUrl('hostedpayments/processing/return', array('id' => $mOrder->getRealOrderId(), '_secure' => true));
|
| 306 |
+
$checkout->cancel_url = $checkout->return_url;
|
| 307 |
+
$checkout->auto_return = true;
|
| 308 |
+
$checkout->checkout_layout = $layout;
|
| 309 |
+
$checkout->create_token = false;
|
| 310 |
+
$checkout->language = EvoSnapTools::getLanguage(Mage::app()->getLocale()->getLocale()->getLanguage());
|
| 311 |
+
|
| 312 |
+
$billing = $mOrder->getBillingAddress();
|
| 313 |
+
$shipping = $mOrder->getShippingAddress();
|
| 314 |
+
|
| 315 |
+
$customer = new SnapCustomer();
|
| 316 |
+
|
| 317 |
+
$customer->first_name = $mOrder->getCustomerFirstname();
|
| 318 |
+
$customer->last_name = $mOrder->getCustomerLastname();
|
| 319 |
+
$customer->email = $mOrder->getCustomerEmail();
|
| 320 |
+
$customer->phone = $billing->getTelephone();
|
| 321 |
+
|
| 322 |
+
$checkout->customer = $customer;
|
| 323 |
+
|
| 324 |
+
$order = new SnapOrder();
|
| 325 |
+
$checkout->order = $order;
|
| 326 |
+
|
| 327 |
+
$order->id = $this->_getOrderId($this->getConfigData('order_prefix'), $mOrder->getRealOrderId());
|
| 328 |
+
$order->total_subtotal = $mOrder->getSubtotal();
|
| 329 |
+
$order->total_discount = abs($mOrder->getDiscountAmount());
|
| 330 |
+
$order->total_shipping = $mOrder->getShippingAmount();
|
| 331 |
+
$order->total_tax = $mOrder->getTaxAmount();
|
| 332 |
+
$order->total = $mOrder->getBaseGrandTotal();
|
| 333 |
+
$order->currency_code = $mOrder->getOrderCurrencyCode();
|
| 334 |
+
|
| 335 |
+
$products = $mOrder->getAllItems();
|
| 336 |
+
for($i = 0; $i < count($products); $i++) {
|
| 337 |
+
$order_lines[$i] = $this->_getOrderItem($products[$i]);
|
| 338 |
+
}
|
| 339 |
+
$order->lines = $order_lines;
|
| 340 |
+
|
| 341 |
+
$order->billto_address = $this->_getAddress($billing);
|
| 342 |
+
if(!empty($shipping)){
|
| 343 |
+
$order->shipto_address = $this->_getAddress($billing);
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
return $checkout;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
private function _getOrderItem($orderItem){
|
| 350 |
+
$order_line = new SnapOrderLine();
|
| 351 |
+
|
| 352 |
+
$order_line->sku = $orderItem->getSku();
|
| 353 |
+
$order_line->name = $orderItem->getName();
|
| 354 |
+
$order_line->description = $orderItem->getDescription();
|
| 355 |
+
$order_line->qty = $orderItem->getQtyOrdered();
|
| 356 |
+
$order_line->price = $orderItem->getPrice();
|
| 357 |
+
$order_line->tax = $orderItem->getTaxAmount();
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
return $order_line;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
/**
|
| 364 |
+
*
|
| 365 |
+
* @param Mage_Sales_Model_Order_Address $mAddress
|
| 366 |
+
* @return SnapAddress
|
| 367 |
+
*/
|
| 368 |
+
private function _getAddress($mAddress){
|
| 369 |
+
$address = new SnapAddress();
|
| 370 |
+
$address->company = $mAddress->getCompany();
|
| 371 |
+
$address->first_name = $mAddress->getFirstname();
|
| 372 |
+
$address->last_name = $mAddress->getLastname();
|
| 373 |
+
$address->address1 = $mAddress->getStreet1();
|
| 374 |
+
$address->address2 = $mAddress->getStreet2();
|
| 375 |
+
$address->house_number = $mAddress->getStreet1();
|
| 376 |
+
$address->city = $mAddress->getCity();
|
| 377 |
+
$address->zipcode = $mAddress->getPostcode();
|
| 378 |
+
|
| 379 |
+
$address->country = $mAddress->getCountry();
|
| 380 |
+
$address->state = $mAddress->getRegionCode();
|
| 381 |
+
|
| 382 |
+
return $address;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
private function _getOrderId($order_prefix, $id_order){
|
| 386 |
+
if(isset($order_prefix)){
|
| 387 |
+
$result = $order_prefix.$id_order;
|
| 388 |
+
}else{
|
| 389 |
+
$result = $id_order;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
return $result;
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
/**
|
| 397 |
+
* prepare params array to send it to gateway page via POST
|
| 398 |
+
*
|
| 399 |
+
* @return array
|
| 400 |
+
*/
|
| 401 |
+
public function getFormFields()
|
| 402 |
+
{
|
| 403 |
+
Mage::log(" --- Snap* Hosted Payments API : getFormFields --- ");
|
| 404 |
+
|
| 405 |
+
$aOBFields = array();
|
| 406 |
+
$billing = $this->getOrder()->getBillingAddress();
|
| 407 |
+
$shipping = $this->getOrder()->getShippingAddress();
|
| 408 |
+
$items = $this->getOrder()->getAllItems();
|
| 409 |
+
|
| 410 |
+
// customer info
|
| 411 |
+
$aOBFields['customer[merchant_customer_id]'] = $this->getOrder()->getCustomerId();
|
| 412 |
+
$aOBFields['customer[email]'] = $this->getOrder()->getCustomerEmail();
|
| 413 |
+
$aOBFields['customer[first_name]'] = $billing->getFirstname();
|
| 414 |
+
$aOBFields['customer[last_name]'] = $billing->getLastname();
|
| 415 |
+
$aOBFields['customer[phone]'] = $billing->getTelephone();
|
| 416 |
+
|
| 417 |
+
// order header
|
| 418 |
+
$aOBFields['order[merchant_order_id]'] = $this->getOrder()->getRealOrderId();
|
| 419 |
+
$aOBFields['order[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());
|
| 420 |
+
$aOBFields['order[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));
|
| 421 |
+
$aOBFields['order[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());
|
| 422 |
+
$aOBFields['order[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());
|
| 423 |
+
$aOBFields['order[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());
|
| 424 |
+
//$aOBFields['order[ship_method]'] = '';
|
| 425 |
+
|
| 426 |
+
// billing fields
|
| 427 |
+
$aOBFields['order[billto_company]'] = $billing->getCompany();
|
| 428 |
+
$aOBFields['order[billto_first_name]'] = $billing->getFirstname();
|
| 429 |
+
$aOBFields['order[billto_last_name]'] = $billing->getLastname();
|
| 430 |
+
$aOBFields['order[billto_address1]'] = $billing->getStreet1();
|
| 431 |
+
$aOBFields['order[billto_address2]'] = $billing->getStreet2();
|
| 432 |
+
$aOBFields['order[billto_city]'] = $billing->getCity();
|
| 433 |
+
$aOBFields['order[billto_state]'] = $billing->getRegionCode();
|
| 434 |
+
$aOBFields['order[billto_country]'] = $billing->getCountry();
|
| 435 |
+
$aOBFields['order[billto_zipcode]'] = $billing->getPostcode();
|
| 436 |
+
|
| 437 |
+
// shipping fields
|
| 438 |
+
if(!empty($shipping))
|
| 439 |
+
{
|
| 440 |
+
$aOBFields['order[shipto_company]'] = $shipping->getCompany();
|
| 441 |
+
$aOBFields['order[shipto_first_name]'] = $shipping->getFirstname();
|
| 442 |
+
$aOBFields['order[shipto_last_name]'] = $shipping->getLastname();
|
| 443 |
+
$aOBFields['order[shipto_address1]'] = $shipping->getStreet1();
|
| 444 |
+
$aOBFields['order[shipto_address2]'] = $shipping->getStreet2();
|
| 445 |
+
$aOBFields['order[shipto_city]'] = $shipping->getCity();
|
| 446 |
+
$aOBFields['order[shipto_state]'] = $shipping->getRegionCode();
|
| 447 |
+
$aOBFields['order[shipto_country]'] = $shipping->getCountry();
|
| 448 |
+
$aOBFields['order[shipto_zipcode]'] = $shipping->getPostcode();
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
// items
|
| 452 |
+
if (!empty($items))
|
| 453 |
+
{
|
| 454 |
+
for($nCount=0; $nCount<count($items); $nCount++)
|
| 455 |
+
{
|
| 456 |
+
$aOBFields['order_item['.$nCount.'][sku]'] = $items[$nCount]->getSku();
|
| 457 |
+
$aOBFields['order_item['.$nCount.'][name]'] = $items[$nCount]->getName();
|
| 458 |
+
$aOBFields['order_item['.$nCount.'][price]'] = self::_currencyAmount($items[$nCount]->getPrice());
|
| 459 |
+
$aOBFields['order_item['.$nCount.'][qty]'] = $items[$nCount]->getQtyOrdered();
|
| 460 |
+
$aOBFields['order_item['.$nCount.'][description]'] = $items[$nCount]->getDescription();
|
| 461 |
+
$aOBFields['order_item['.$nCount.'][tax]'] = self::_currencyAmount($items[$nCount]->getTaxAmount());
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// return URLs
|
| 466 |
+
$aOBFields['return_url'] = Mage::getUrl('hostedpayments/standard/success', array('_secure' => true));
|
| 467 |
+
$aOBFields['cancel_url'] = Mage::getUrl('hostedpayments/standard/cancel', array('_secure' => true));
|
| 468 |
+
|
| 469 |
+
// check to see if the aheadWorks SARP module is being used and is enabled. if it is then we need to
|
| 470 |
+
// add additional fields to the post fields array
|
| 471 |
+
if($this->_isUsingSARP() === true)
|
| 472 |
+
{
|
| 473 |
+
Mage::log("is using SARP ");
|
| 474 |
+
|
| 475 |
+
$aSubscriptionIDs = array();
|
| 476 |
+
$aSubscriptionIDs = $this->_getSubscriptionByOrderID($this->getOrder()->getId());
|
| 477 |
+
|
| 478 |
+
/*
|
| 479 |
+
foreach($aSubscriptionIDs as $nID)
|
| 480 |
+
{
|
| 481 |
+
$oSubscription = Mage::getSingleton('sarp/subscription')->load($nID);
|
| 482 |
+
}
|
| 483 |
+
*/
|
| 484 |
+
|
| 485 |
+
if(!empty($aSubscriptionIDs))
|
| 486 |
+
{
|
| 487 |
+
$oSubscription = Mage::getSingleton('sarp/subscription')->load($aSubscriptionIDs[0]);
|
| 488 |
+
$dStartDate = new Zend_Date($oSubscription->getNextSubscriptionEventDate($oSubscription->getDateStart()), Zend_Date::DATE_LONG);
|
| 489 |
+
$nTotalOccurrences = 0;
|
| 490 |
+
|
| 491 |
+
if($oSubscription->isInfinite())
|
| 492 |
+
$nTotalOccurrences = 9999;
|
| 493 |
+
else
|
| 494 |
+
$nTotalOccurrences = Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($oSubscription)->count();
|
| 495 |
+
|
| 496 |
+
//Mage::log("Subscription ID: " . $aSubscriptionIDs[0]);
|
| 497 |
+
//Mage::log("Subscription Inerval: " . $oSubscription->getPeriod()->getPeriodType()."s");
|
| 498 |
+
//Mage::log("Subscription Occurences: " . $nTotalOccurrences);
|
| 499 |
+
|
| 500 |
+
$aOBFields['sub[auto_process]'] = 0;
|
| 501 |
+
$aOBFields['sub[start_date]'] = $dStartDate;
|
| 502 |
+
$aOBFields['sub[interval_length]'] = $oSubscription->getPeriod()->getPeriodValue();
|
| 503 |
+
$aOBFields['sub[interval_unit]'] = $oSubscription->getPeriod()->getPeriodType()."s";
|
| 504 |
+
$aOBFields['sub[total_occurrences]'] = $nTotalOccurrences;
|
| 505 |
+
|
| 506 |
+
$aOBFields['sub[trial_occurrences]'] = '';
|
| 507 |
+
$aOBFields['sub[trial_amount]'] = 0.00;
|
| 508 |
+
|
| 509 |
+
// order header
|
| 510 |
+
$aOBFields['sub[merchant_subscription_id]'] = $this->getOrder()->getRealOrderId();
|
| 511 |
+
//$aOBFields['sub[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());
|
| 512 |
+
|
| 513 |
+
// grand total should be the normal price not the first period price
|
| 514 |
+
|
| 515 |
+
$aOBFields['sub[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));
|
| 516 |
+
$aOBFields['sub[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());
|
| 517 |
+
$aOBFields['sub[ship_method]'] = '';
|
| 518 |
+
$aOBFields['sub[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());
|
| 519 |
+
|
| 520 |
+
// billing fields
|
| 521 |
+
$aOBFields['sub[billto_company]'] = $billing->getCompany();
|
| 522 |
+
$aOBFields['sub[billto_first_name]'] = $billing->getFirstname();
|
| 523 |
+
$aOBFields['sub[billto_last_name]'] = $billing->getLastname();
|
| 524 |
+
$aOBFields['sub[billto_address1]'] = $billing->getStreet1();
|
| 525 |
+
$aOBFields['sub[billto_address2]'] = $billing->getStreet2();
|
| 526 |
+
$aOBFields['sub[billto_city]'] = $billing->getCity();
|
| 527 |
+
$aOBFields['sub[billto_state]'] = $billing->getRegionCode();
|
| 528 |
+
$aOBFields['sub[billto_country]'] = $billing->getCountry();
|
| 529 |
+
$aOBFields['sub[billto_zipcode]'] = $billing->getPostcode();
|
| 530 |
+
|
| 531 |
+
// shipping fields
|
| 532 |
+
if(!empty($shipping))
|
| 533 |
+
{
|
| 534 |
+
$aOBFields['sub[shipto_company]'] = $shipping->getCompany();
|
| 535 |
+
$aOBFields['sub[shipto_first_name]'] = $shipping->getFirstname();
|
| 536 |
+
$aOBFields['sub[shipto_last_name]'] = $shipping->getLastname();
|
| 537 |
+
$aOBFields['sub[shipto_address1]'] = $shipping->getStreet1();
|
| 538 |
+
$aOBFields['sub[shipto_address2]'] = $shipping->getStreet2();
|
| 539 |
+
$aOBFields['sub[shipto_city]'] = $shipping->getCity();
|
| 540 |
+
$aOBFields['sub[shipto_state]'] = $shipping->getRegionCode();
|
| 541 |
+
$aOBFields['sub[shipto_country]'] = $shipping->getCountry();
|
| 542 |
+
$aOBFields['sub[shipto_zipcode]'] = $shipping->getPostcode();
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
$items = $this->getOrder()->getAllItems();
|
| 546 |
+
$nCount = 0;
|
| 547 |
+
$nSubCount = 0;
|
| 548 |
+
$aOBFields['sub[total_subtotal]'] = 0;
|
| 549 |
+
$aOBFields['sub[total]'] = 0;
|
| 550 |
+
|
| 551 |
+
// items
|
| 552 |
+
if (!empty($items))
|
| 553 |
+
{
|
| 554 |
+
for($nCount=0; $nCount<count($items); $nCount++)
|
| 555 |
+
{
|
| 556 |
+
$oItem = $items[$nCount];
|
| 557 |
+
|
| 558 |
+
if(Mage::helper('sarp')->isSubscriptionType($items[$nCount]) == 1)
|
| 559 |
+
{
|
| 560 |
+
$productId = $oItem->getProductId();
|
| 561 |
+
$oProduct = Mage::getModel('catalog/product')->load($productId);
|
| 562 |
+
$nFirstPeriodPrice = self::_currencyAmount($oProduct->getAwSarpFirstPeriodPrice());
|
| 563 |
+
$nNormalPrice = self::_currencyAmount((!empty($nFirstPeriodPrice) ? $oProduct->getAwSarpSubscriptionPrice() : $items[$nCount]->getPrice()));
|
| 564 |
+
|
| 565 |
+
Mage::log("Normal Price:" . $nNormalPrice);
|
| 566 |
+
Mage::log("First Period Price:" . $nFirstPeriodPrice);
|
| 567 |
+
|
| 568 |
+
if ($oItem->canInvoice()) $qtys[$oItem->getId()] = $oItem->getQtyToInvoice();
|
| 569 |
+
|
| 570 |
+
$aOBFields['sub_item[' . $nSubCount . '][sku]'] = $items[$nCount]->getSku();
|
| 571 |
+
$aOBFields['sub_item[' . $nSubCount . '][name]'] = $items[$nCount]->getName();
|
| 572 |
+
$aOBFields['sub_item[' . $nSubCount . '][price]'] = $nNormalPrice;
|
| 573 |
+
$aOBFields['sub_item[' . $nSubCount . '][qty]'] = $items[$nCount]->getQtyOrdered();
|
| 574 |
+
$aOBFields['sub_item[' . $nSubCount . '][description]'] = $items[$nCount]->getDescription();
|
| 575 |
+
//$aOBFields['sub_item[' . $nSubCount . '][details]'] = '';
|
| 576 |
+
|
| 577 |
+
if ($oItem->getIsVirtual())
|
| 578 |
+
{
|
| 579 |
+
$aOBFields['sub[total_shipping]'] = 0.00;
|
| 580 |
+
}
|
| 581 |
+
else
|
| 582 |
+
{
|
| 583 |
+
$aOBFields['sub[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
/*
|
| 587 |
+
$aOBFields['sub[trial_amount]'] = $nFirstPeriodPrice;
|
| 588 |
+
*/
|
| 589 |
+
|
| 590 |
+
$aOBFields['sub[total_subtotal]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];
|
| 591 |
+
$aOBFields['sub[total]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];
|
| 592 |
+
|
| 593 |
+
$nSubCount++;
|
| 594 |
+
}
|
| 595 |
+
else
|
| 596 |
+
Mage::log("Not a subscription item: " . $items[$nCount]->getName());
|
| 597 |
+
}
|
| 598 |
+
Mage::log("Sub. Sub Total: " . $aOBFields['sub[total_subtotal]']);
|
| 599 |
+
Mage::log("Sub. Total: " . $aOBFields['sub[total]']);
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
$aOBFields['sub[total]'] = $aOBFields['sub[total]'] + $aOBFields['sub[total_shipping]'];
|
| 603 |
+
}
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
// generate the MAC and add it as the final param
|
| 607 |
+
$aOBFields['mac'] = $this->getFormFieldsMAC($aOBFields);
|
| 608 |
+
|
| 609 |
+
Mage::log(print_r($aOBFields, true));
|
| 610 |
+
|
| 611 |
+
return $aOBFields;
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
/**
|
| 615 |
+
* prepare the mac param based on the params array
|
| 616 |
+
*
|
| 617 |
+
* @return string
|
| 618 |
+
*/
|
| 619 |
+
public function getFormFieldsMAC($aOBFields)
|
| 620 |
+
{
|
| 621 |
+
Mage::log(" --- Snap* Hosted Payments API : getFormFieldsMAC --- ");
|
| 622 |
+
return $this->_getMAC(array(
|
| 623 |
+
'code' => $this->getConfigData('merchant_code'),
|
| 624 |
+
'email' => (isset($aOBFields['customer[email]']) ? $aOBFields['customer[email]'] : ''),
|
| 625 |
+
'merchant_order_id' => (isset($aOBFields['order[merchant_order_id]']) ? $aOBFields['order[merchant_order_id]'] : ''),
|
| 626 |
+
'order_total_subtotal' => (isset($aOBFields['order[total_subtotal]']) ? $aOBFields['order[total_subtotal]'] : ''),
|
| 627 |
+
'order_total' => (isset($aOBFields['order[total]']) ? $aOBFields['order[total]'] : ''),
|
| 628 |
+
'merchant_subscription_id' => (isset($aOBFields['sub[merchant_subscription_id]']) ? $aOBFields['sub[merchant_subscription_id]'] : ''),
|
| 629 |
+
'sub_total_occurrences' => (isset($aOBFields['sub[total_occurrences]']) ? $aOBFields['sub[total_occurrences]'] : ''),
|
| 630 |
+
'sub_trial_occurrences' => (isset($aOBFields['sub[trial_occurrences]']) ? $aOBFields['sub[trial_occurrences]'] : ''),
|
| 631 |
+
'sub_trial_amount' => (isset($aOBFields['sub[trial_amount]']) ? $aOBFields['sub[trial_amount]'] : ''),
|
| 632 |
+
'sub_total_subtotal' => (isset($aOBFields['sub[total_subtotal]']) ? $aOBFields['sub[total_subtotal]'] : ''),
|
| 633 |
+
'sub_total' => (isset($aOBFields['sub[total]']) ? $aOBFields['sub[total]'] : '')
|
| 634 |
+
));
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
/**
|
| 638 |
+
* Get base url of EVO Snap* Hosted Payments API
|
| 639 |
+
*
|
| 640 |
+
* @return string
|
| 641 |
+
*/
|
| 642 |
+
public function getEvoBaseUrl()
|
| 643 |
+
{
|
| 644 |
+
Mage::log(" --- Snap* Hosted Payments API : getEvoBaseUrl --- ");
|
| 645 |
+
$bTestMode = $this->getConfigData('test_mode');
|
| 646 |
+
return ($bTestMode ? $this->_merchantCheckoutURLTest : $this->_merchantCheckoutURL);
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
// /**
|
| 650 |
+
// * capture an order payment
|
| 651 |
+
// *
|
| 652 |
+
// * @param Varien_Object $payment
|
| 653 |
+
// * @return Mage_Payment_Model_Abstract
|
| 654 |
+
// */
|
| 655 |
+
// public function capture(Varien_Object $payment, $amount)
|
| 656 |
+
// {
|
| 657 |
+
// Mage::log(" --- Snap* Hosted Payments API : capture --- ");
|
| 658 |
+
// $payment->setStatus(self::STATUS_APPROVED)
|
| 659 |
+
// ->setLastTransId($this->getTransactionId());
|
| 660 |
+
|
| 661 |
+
// return $this;
|
| 662 |
+
// }
|
| 663 |
+
|
| 664 |
+
/**
|
| 665 |
+
* cancel an order and refund the capture OR reverse the authorization which has not yet been captured,
|
| 666 |
+
* depending on how the module is configured
|
| 667 |
+
*
|
| 668 |
+
* @param Varien_Object $payment
|
| 669 |
+
* @return Mage_Payment_Model_Abstract
|
| 670 |
+
*/
|
| 671 |
+
public function cancel(Varien_Object $payment)
|
| 672 |
+
{
|
| 673 |
+
Mage::log(" --- Snap* Hosted Payments API : cancel --- ");
|
| 674 |
+
return $this->refund($payment);
|
| 675 |
+
}
|
| 676 |
+
|
| 677 |
+
/**
|
| 678 |
+
* refund the amount with transaction id
|
| 679 |
+
*
|
| 680 |
+
* @access public
|
| 681 |
+
* @param string $payment Varien_Object object
|
| 682 |
+
* @return Mage_Payment_Model_Abstract
|
| 683 |
+
*/
|
| 684 |
+
public function refund(Varien_Object $oPayment, $nAmount)
|
| 685 |
+
{
|
| 686 |
+
Mage::log(" --- Snap* Hosted Payments API : refund --- ");
|
| 687 |
+
|
| 688 |
+
if(empty($nAmount))
|
| 689 |
+
$nAmount=null;
|
| 690 |
+
|
| 691 |
+
if ($oPayment->getLastTransId())
|
| 692 |
+
{
|
| 693 |
+
// build the request
|
| 694 |
+
$oOrder = $oPayment->getOrder();
|
| 695 |
+
$aMACParamKeys = array('code','action','merchant_order_id','txn_id');
|
| 696 |
+
$aRequest = $this->_buildAPIRequest(array(
|
| 697 |
+
'action' => 'credit',
|
| 698 |
+
'merchant_order_id' => $oOrder->getRealOrderId(),
|
| 699 |
+
'txn_id' => $oPayment->getLastTransId(),
|
| 700 |
+
'amount' => (!is_null($nAmount) ? self::_currencyAmount($nAmount) : $nAmount),
|
| 701 |
+
), $aMACParamKeys);
|
| 702 |
+
Mage::log($aRequest);
|
| 703 |
+
|
| 704 |
+
// post the request
|
| 705 |
+
$aResult = $this->_postAPIRequest($aRequest);
|
| 706 |
+
Mage::log($aResult);
|
| 707 |
+
|
| 708 |
+
// parse the response
|
| 709 |
+
if ($aResult['success'] === true && isset($aResult['status']) && strtolower($aResult['status']) == 'approved') // approved
|
| 710 |
+
{
|
| 711 |
+
Mage::log('approved');
|
| 712 |
+
if($aResult['txn_id'] != null)
|
| 713 |
+
$oPayment->setLastTransId($aResult['txn_id']);
|
| 714 |
+
$oPayment->setStatus(self::STATUS_SUCCESS);
|
| 715 |
+
$oPayment->getOrder()->addStatusToHistory($oPayment->getOrder()->getStatus(), $this->_getHelper()->__('Payment has been refunded via Snap* Hosted Payments Checkout (transid # '.$aResult['txn_id'].').'));
|
| 716 |
+
}
|
| 717 |
+
else
|
| 718 |
+
{
|
| 719 |
+
$oPayment->setStatus(self::STATUS_ERROR);
|
| 720 |
+
if ($aResult['success'] === true && isset($aResult['status']) && strtolower($aResult['status']) == 'declined') // declined
|
| 721 |
+
{
|
| 722 |
+
Mage::log('declined');
|
| 723 |
+
$sError = 'Payment refund request was declined by Snap* Hosted Payments Checkout.'.(!empty($aResult['message']) ? ' '.$aResult['message'] : '');
|
| 724 |
+
}
|
| 725 |
+
else
|
| 726 |
+
{
|
| 727 |
+
Mage::log('failure');
|
| 728 |
+
$sError = 'Payment refund request failed.'.(!empty($aResult['message']) ? ' '.$aResult['message'] : '');
|
| 729 |
+
}
|
| 730 |
+
Mage::getSingleton('adminhtml/session')->addError($this->_getHelper()->__($sError));
|
| 731 |
+
$oPayment->getOrder()->addStatusToHistory($oPayment->getOrder()->getStatus(), $this->_getHelper()->__($sError));
|
| 732 |
+
Mage::throwException($sError);
|
| 733 |
+
}
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
+
return $this;
|
| 737 |
+
}
|
| 738 |
+
|
| 739 |
+
/**
|
| 740 |
+
*
|
| 741 |
+
*/
|
| 742 |
+
protected function _buildAPIRequest($aParams=array(), $aMACParamKeys=array())
|
| 743 |
+
{
|
| 744 |
+
Mage::log('_buildAPIRequest()');
|
| 745 |
+
Mage::log('$aParams:');
|
| 746 |
+
Mage::log($aParams);
|
| 747 |
+
|
| 748 |
+
// build the request
|
| 749 |
+
$aRequest = array_merge(array('code' => $this->getConfigData('merchant_code'), 'return' => 'serialize'), $aParams);
|
| 750 |
+
foreach ($aRequest as $key => $value)
|
| 751 |
+
{
|
| 752 |
+
if (empty($value)) unset($aRequest[$key]);
|
| 753 |
+
}
|
| 754 |
+
|
| 755 |
+
// add the MAC
|
| 756 |
+
$aRequest['mac'] = $this->_getMAC($aRequest, $aMACParamKeys);
|
| 757 |
+
|
| 758 |
+
return $aRequest;
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
/**
|
| 762 |
+
*
|
| 763 |
+
*/
|
| 764 |
+
protected function _postAPIRequest($aRequest)
|
| 765 |
+
{
|
| 766 |
+
$mError = false;
|
| 767 |
+
Mage::log('_postAPIRequest');
|
| 768 |
+
|
| 769 |
+
if (!extension_loaded('curl'))
|
| 770 |
+
{
|
| 771 |
+
$mError = 'The curl extension was requested and is not loaded; unable to proceed.';
|
| 772 |
+
}
|
| 773 |
+
else
|
| 774 |
+
{
|
| 775 |
+
Mage::log('json_encode($aRequest)');
|
| 776 |
+
Mage::log(json_encode($aRequest));
|
| 777 |
+
|
| 778 |
+
// do the request
|
| 779 |
+
$hCURL = curl_init();
|
| 780 |
+
curl_setopt($hCURL, CURLOPT_RETURNTRANSFER, true);
|
| 781 |
+
curl_setopt($hCURL, CURLOPT_POST, 1);
|
| 782 |
+
curl_setopt($hCURL, CURLOPT_FAILONERROR, 1);
|
| 783 |
+
curl_setopt($hCURL, CURLOPT_FOLLOWLOCATION, 1);
|
| 784 |
+
curl_setopt($hCURL, CURLOPT_TIMEOUT, 10);
|
| 785 |
+
curl_setopt($hCURL, CURLOPT_URL, $this->getEvoAPIUrl());
|
| 786 |
+
curl_setopt($hCURL, CURLOPT_POSTFIELDS, $aRequest);
|
| 787 |
+
curl_setopt($hCURL, CURLOPT_SSL_VERIFYPEER, false);
|
| 788 |
+
$sResult = curl_exec($hCURL);
|
| 789 |
+
|
| 790 |
+
Mage::log('$sResult');
|
| 791 |
+
Mage::log($sResult);
|
| 792 |
+
Mage::log(curl_error($hCURL));
|
| 793 |
+
|
| 794 |
+
curl_close($hCURL);
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
if ($mError !== false)
|
| 798 |
+
{
|
| 799 |
+
Mage::throwException($mError);
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
return $this->_parseAPIResponse($sResult);
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
/**
|
| 806 |
+
*
|
| 807 |
+
*/
|
| 808 |
+
public function _parseAPIResponse($sResult)
|
| 809 |
+
{
|
| 810 |
+
Mage::log(" --- Snap* Hosted Payments API : _parseAPIResponse --- ");
|
| 811 |
+
Mage::log('_parseAPIResponse');
|
| 812 |
+
Mage::log($sResult);
|
| 813 |
+
|
| 814 |
+
// parse the response
|
| 815 |
+
if ($sResult !== false) {
|
| 816 |
+
return unserialize($sResult);
|
| 817 |
+
} else {
|
| 818 |
+
return false;
|
| 819 |
+
}
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
protected static function _currencyAmount($amount)
|
| 823 |
+
{
|
| 824 |
+
return number_format($amount, 2, '.', '');
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
|
| 828 |
+
/*
|
| 829 |
+
Determine whether or not the SARP module is being used
|
| 830 |
+
*/
|
| 831 |
+
protected function _isUsingSARP()
|
| 832 |
+
{
|
| 833 |
+
Mage::log(" --- Snap* Hosted Payments API : _isUsingSARP --- ");
|
| 834 |
+
$bReturn = false;
|
| 835 |
+
|
| 836 |
+
$oModules = Mage::getConfig()->getNode();
|
| 837 |
+
if(array_key_exists($this->_sSARPName, $oModules->global->resources))
|
| 838 |
+
$bReturn = true;
|
| 839 |
+
|
| 840 |
+
return $bReturn;
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
protected function _getSubscriptionByOrderID($nOrderID)
|
| 844 |
+
{
|
| 845 |
+
Mage::log(" --- Snap* Hosted Payments API : _getSubscriptionByOrderID --- ");
|
| 846 |
+
|
| 847 |
+
$aSubscriptionIDs = array();
|
| 848 |
+
$oWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 849 |
+
|
| 850 |
+
$result = $oWrite->query("SELECT id FROM aw_sarp_subscriptions WHERE real_id = " . $nOrderID . ";");
|
| 851 |
+
|
| 852 |
+
while ($aRows = $result->fetch(PDO::FETCH_ASSOC))
|
| 853 |
+
{
|
| 854 |
+
$aSubscriptionIDs[] = $aRows['id'];
|
| 855 |
+
}
|
| 856 |
+
|
| 857 |
+
return $aSubscriptionIDs;
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
}
|
app/code/local/Evo/HostedPayments/Model/Resource/Hostedpayment.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments Hosted Payment Resource model collection class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Model_Resource_Hostedpayment extends Mage_Core_Model_Resource_Db_Abstract
|
| 38 |
+
{
|
| 39 |
+
protected function _construct()
|
| 40 |
+
{
|
| 41 |
+
$this->_init("hostedpayments/hostedpayment", "id");
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/local/Evo/HostedPayments/Model/Resource/Hostedpayment/Collection.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments Payment model class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Model_Resource_Hostedpayment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
| 38 |
+
{
|
| 39 |
+
protected function _construct()
|
| 40 |
+
{
|
| 41 |
+
$this->_init("hostedpayments/hostedpayment");
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/local/Evo/HostedPayments/Model/Resource/Setup.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments Setup class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
|
| 38 |
+
{
|
| 39 |
+
}
|
app/code/local/Evo/HostedPayments/controllers/ProcessingController.php
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments processing class.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
class Evo_HostedPayments_ProcessingController extends Mage_Core_Controller_Front_Action
|
| 38 |
+
{
|
| 39 |
+
const STATUS_APPROVED = 'APPROVED';
|
| 40 |
+
|
| 41 |
+
const EVO_CALLBACK_STATUS_CHECKOUT_CANCELLED = 'CHECKOUT_CANCELLED';
|
| 42 |
+
const EVO_CALLBACK_STATUS_CHECKOUT_COMPLETED = 'CHECKOUT_COMPLETED';
|
| 43 |
+
const EVO_CALLBACK_STATUS_CHECKOUT_HELD_FOR_ADMIN = 'CHECKOUT_HELD_FOR_ADMIN';
|
| 44 |
+
const EVO_CALLBACK_STATUS_SUB_NOTIFIED = 'SUB_NOTIFIED';
|
| 45 |
+
const EVO_CALLBACK_STATUS_SUB_PROCESSED = 'SUB_PROCESSED';
|
| 46 |
+
const EVO_CALLBACK_STATUS_SUB_COMPLETED = 'SUB_COMPLETED';
|
| 47 |
+
const EVO_CALLBACK_STATUS_SUB_DECLINED = 'SUB_DECLINED';
|
| 48 |
+
const EVO_CALLBACK_STATUS_SUB_FAILED = 'SUB_FAILED';
|
| 49 |
+
const EVO_CALLBACK_STATUS_SUB_CANCELLED = 'SUB_CANCELLED';
|
| 50 |
+
const EVO_CALLBACK_STATUS_ORDER_CREDIT = 'ORDER_CREDIT';
|
| 51 |
+
const EVO_CALLBACK_STATUS_ORDER_CHARGEBACK = 'ORDER_CHARGEBACK';
|
| 52 |
+
|
| 53 |
+
const EVO_ORDER_STATUS_CANCELED = 'Canceled';
|
| 54 |
+
const EVO_ORDER_STATUS_PENDING = 'Pending';
|
| 55 |
+
const EVO_ORDER_STATUS_PAID = 'Paid';
|
| 56 |
+
const EVO_ORDER_STATUS_REFUNDED = 'Refunded';
|
| 57 |
+
const EVO_ORDER_STATUS_DENIED = 'Denied';
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Get singleton of Checkout Session Model
|
| 61 |
+
*
|
| 62 |
+
* @return Mage_Checkout_Model_Session
|
| 63 |
+
*/
|
| 64 |
+
private function _getCheckout()
|
| 65 |
+
{
|
| 66 |
+
return Mage::getSingleton('checkout/session');
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Payment action.
|
| 71 |
+
*/
|
| 72 |
+
public function payAction()
|
| 73 |
+
{
|
| 74 |
+
try {
|
| 75 |
+
$session = $this->_getCheckout();
|
| 76 |
+
|
| 77 |
+
$orderId = $this->getRequest()->getParam('id');
|
| 78 |
+
|
| 79 |
+
if(isset($orderId)){
|
| 80 |
+
$session->setEvoRealOrderId($orderId);
|
| 81 |
+
$session->unsEvoPaymentUrl();
|
| 82 |
+
}else{
|
| 83 |
+
$session->setEvoRealOrderId($session->getLastRealOrderId());
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
$paymentUrl = $session->getEvoPaymentUrl();
|
| 87 |
+
$useIframe = $session->getEvoUseIframe();
|
| 88 |
+
|
| 89 |
+
if(!isset($paymentUrl)){
|
| 90 |
+
$order = Mage::getModel('sales/order');
|
| 91 |
+
|
| 92 |
+
$order->loadByIncrementId($session->getEvoRealOrderId());
|
| 93 |
+
|
| 94 |
+
$paymentInst = $order->getPayment()->getMethodInstance();
|
| 95 |
+
|
| 96 |
+
$paymentUrl = $paymentInst->getPaymentUrl();
|
| 97 |
+
$session->setEvoPaymentUrl($paymentUrl);
|
| 98 |
+
$useIframe = $paymentInst->getCheckoutLayout() === 'iframe';
|
| 99 |
+
$session->setEvoUseIframe($useIframe);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
if($useIframe){
|
| 103 |
+
$this->loadLayout();
|
| 104 |
+
$this->getLayout()->getBlock('hostedpayments.iframe')->setPaymentUrl($paymentUrl);
|
| 105 |
+
$this->renderLayout();
|
| 106 |
+
}else{
|
| 107 |
+
$this->_redirectUrl($paymentUrl);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
$session->unsQuoteId();
|
| 111 |
+
$session->unsLastRealOrderId();
|
| 112 |
+
} catch (HostedPayments_Exception $e) {
|
| 113 |
+
Mage::log('Hosted Payments Error: '.$e->getMessage(), Zend_Log::ERR);
|
| 114 |
+
$this->_redirect('customer/account');
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Return action.
|
| 120 |
+
*/
|
| 121 |
+
public function returnAction()
|
| 122 |
+
{
|
| 123 |
+
$this->_getCheckout()->unsEvoPaymentUrl();
|
| 124 |
+
try {
|
| 125 |
+
$order = Mage::getModel('sales/order');
|
| 126 |
+
|
| 127 |
+
$order->loadByIncrementId($this->getRequest()->getParam('id'));
|
| 128 |
+
$noiframe = $this->getRequest()->getParam('noiframe');
|
| 129 |
+
|
| 130 |
+
$paymentInst = $order->getPayment()->getMethodInstance();
|
| 131 |
+
|
| 132 |
+
if(!isset($noiframe) && ($paymentInst->getCheckoutLayout() === 'iframe')){
|
| 133 |
+
$validationUrl = Mage::getUrl('hostedpayments/processing/return', array('id' => $this->getRequest()->getParam('id'), 'noiframe' => 1, '_secure' => true));
|
| 134 |
+
$this->loadLayout();
|
| 135 |
+
$this->getLayout()->getBlock('hostedpayments.iframevalidation')->setValidationUrl($validationUrl);
|
| 136 |
+
$this->renderLayout();
|
| 137 |
+
}else{
|
| 138 |
+
$snapOrder = $paymentInst->getSnapOrder();
|
| 139 |
+
|
| 140 |
+
switch ($snapOrder->status){
|
| 141 |
+
case self::EVO_ORDER_STATUS_CANCELED:
|
| 142 |
+
$paymentInst->cancelOrder();
|
| 143 |
+
$this->_redirect('customer/account');
|
| 144 |
+
break;
|
| 145 |
+
case self::EVO_ORDER_STATUS_PAID:
|
| 146 |
+
$paymentInst->payOrder($snapOrder);
|
| 147 |
+
$this->_successAction($paymentInst->getOrder());
|
| 148 |
+
break;
|
| 149 |
+
case self::EVO_ORDER_STATUS_PENDING:
|
| 150 |
+
case self::EVO_ORDER_STATUS_DENIED:
|
| 151 |
+
$this->_redirect('hostedpayments/processing/pay', array('id' => $this->getRequest()->getParam('id'), '_secure' => true));
|
| 152 |
+
break;
|
| 153 |
+
default:
|
| 154 |
+
$this->_redirect('customer/account');
|
| 155 |
+
break;
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
} catch (HostedPayments_Exception $e) {
|
| 159 |
+
Mage::log('Hosted Payments Error: '.$e->getMessage(), Zend_Log::ERR);
|
| 160 |
+
$this->_redirect('customer/account');
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
public function callbackAction()
|
| 165 |
+
{
|
| 166 |
+
$aResponse = $this->_verifyCallback();
|
| 167 |
+
if($aResponse['success'] === true)
|
| 168 |
+
{
|
| 169 |
+
$aResponse = $this->_processCallback();
|
| 170 |
+
}
|
| 171 |
+
echo json_encode($aResponse);
|
| 172 |
+
Mage::log($aResponse);
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/**
|
| 176 |
+
* Evo returns POST variables to this action
|
| 177 |
+
*/
|
| 178 |
+
private function _successAction(Mage_Sales_Model_Order $order)
|
| 179 |
+
{
|
| 180 |
+
$session = $this->_getCheckout();
|
| 181 |
+
|
| 182 |
+
$session->unsEvoRealOrderId();
|
| 183 |
+
$session->setQuoteId($order->getQuoteId());
|
| 184 |
+
$session->getQuote()->setIsActive(false)->save();
|
| 185 |
+
|
| 186 |
+
if($order->getId())
|
| 187 |
+
{
|
| 188 |
+
$order->sendNewOrderEmail();
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
$this->_redirect('checkout/onepage/success');
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
private function _verifyCallback()
|
| 195 |
+
{
|
| 196 |
+
try
|
| 197 |
+
{
|
| 198 |
+
$aMessageTypes = array(
|
| 199 |
+
self::EVO_CALLBACK_STATUS_CHECKOUT_CANCELLED,
|
| 200 |
+
self::EVO_CALLBACK_STATUS_CHECKOUT_COMPLETED,
|
| 201 |
+
self::EVO_CALLBACK_STATUS_CHECKOUT_HELD_FOR_ADMIN,
|
| 202 |
+
self::EVO_CALLBACK_STATUS_SUB_NOTIFIED,
|
| 203 |
+
self::EVO_CALLBACK_STATUS_SUB_PROCESSED,
|
| 204 |
+
self::EVO_CALLBACK_STATUS_SUB_COMPLETED,
|
| 205 |
+
self::EVO_CALLBACK_STATUS_SUB_DECLINED,
|
| 206 |
+
self::EVO_CALLBACK_STATUS_SUB_FAILED,
|
| 207 |
+
self::EVO_CALLBACK_STATUS_SUB_CANCELLED,
|
| 208 |
+
self::EVO_CALLBACK_STATUS_ORDER_CREDIT,
|
| 209 |
+
self::EVO_CALLBACK_STATUS_ORDER_CHARGEBACK
|
| 210 |
+
);
|
| 211 |
+
|
| 212 |
+
// check to make sure we have a post to check
|
| 213 |
+
if($this->getRequest()->isPost() !== true)
|
| 214 |
+
throw new Exception('Invalid request type');
|
| 215 |
+
|
| 216 |
+
// check response
|
| 217 |
+
$response = $this->getRequest()->getPost();
|
| 218 |
+
if(empty($response))
|
| 219 |
+
throw new Exception('Response doesn\'t contain POST elements');
|
| 220 |
+
|
| 221 |
+
// check message type
|
| 222 |
+
if(!in_array($response['message_type'], $aMessageTypes))
|
| 223 |
+
throw new Exception('Invalid message type '.$response['message_type']);
|
| 224 |
+
|
| 225 |
+
// check to make sure we have an order with the corresponding passed
|
| 226 |
+
if (empty($response['merchant_order_id']) || strlen($response['merchant_order_id']) > 50)
|
| 227 |
+
throw new Exception('Missing or invalid order ID # '.$response['merchant_order_id']);
|
| 228 |
+
|
| 229 |
+
// load the order, make sure it's valid
|
| 230 |
+
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($response['merchant_order_id']);
|
| 231 |
+
if (!$this->_order->getId())
|
| 232 |
+
throw new Exception('Non-existent order # '.$response['merchant_order_id']);
|
| 233 |
+
|
| 234 |
+
// load the payment instance and verify the MAC
|
| 235 |
+
$this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
|
| 236 |
+
$response['code'] = $this->_paymentInst->getConfigData('merchant_code');
|
| 237 |
+
if ($this->_paymentInst->_verifyMAC($response['mac'], $response, array('code','message_type','merchant_order_id','merchant_subscription_id','txn_id')) !== true)
|
| 238 |
+
throw new Exception('Invalid mac signature');
|
| 239 |
+
|
| 240 |
+
return array('success' => true);
|
| 241 |
+
}
|
| 242 |
+
catch (Exception $e)
|
| 243 |
+
{
|
| 244 |
+
return array('success' => false, 'message' => $e->getMessage());
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
private function _processCallback()
|
| 249 |
+
{
|
| 250 |
+
$response = $this->getRequest()->getPost();
|
| 251 |
+
$aStatus = array('success' => false);
|
| 252 |
+
$order = Mage::getModel('sales/order');
|
| 253 |
+
$order->loadByIncrementId($response['merchant_order_id']);
|
| 254 |
+
$paymentInst = $order->getPayment()->getMethodInstance();
|
| 255 |
+
$paymentInst->setResponse($response);
|
| 256 |
+
|
| 257 |
+
switch($response['message_type'])
|
| 258 |
+
{
|
| 259 |
+
case self::EVO_CALLBACK_STATUS_CHECKOUT_COMPLETED:
|
| 260 |
+
$order->getPayment()->setTransactionId($response['txn_id']);
|
| 261 |
+
$invoice = $order->prepareInvoice();
|
| 262 |
+
$invoice->register()->capture();
|
| 263 |
+
Mage::getModel('core/resource_transaction')
|
| 264 |
+
->addObject($invoice)
|
| 265 |
+
->addObject($invoice->getOrder())
|
| 266 |
+
->save();
|
| 267 |
+
$aStatus = array('success' => true);
|
| 268 |
+
break;
|
| 269 |
+
|
| 270 |
+
case self::EVO_CALLBACK_STATUS_CHECKOUT_CANCELLED:
|
| 271 |
+
if ($order->canCancel())
|
| 272 |
+
$order->cancel();
|
| 273 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('hostedpayments')->__('Customer cancelled this order via Snap* Hosted Payments Checkout.'));
|
| 274 |
+
$aStatus = array('success' => true);
|
| 275 |
+
break;
|
| 276 |
+
|
| 277 |
+
case self::EVO_CALLBACK_STATUS_ORDER_CREDIT:
|
| 278 |
+
|
| 279 |
+
$order->getPayment()
|
| 280 |
+
->setPreparedMessage($response["message_description"])
|
| 281 |
+
->setTransactionId($response['txn_id'])
|
| 282 |
+
->setIsTransactionClosed(true)
|
| 283 |
+
->registerRefundNotification(-1*$order->base_grand_total);
|
| 284 |
+
$order->save();
|
| 285 |
+
//$order->getPayment()->refund();
|
| 286 |
+
logToFile($order->getStatus());
|
| 287 |
+
$order->addStatusToHistory($order->getStatus(), Mage::helper('hostedpayments')->__('Payment for this refunded via Snap* Hosted Payments API™.'));
|
| 288 |
+
|
| 289 |
+
if ($creditmemo = $paymentInst->getCreatedCreditmemo()) {
|
| 290 |
+
$creditmemo->sendEmail();
|
| 291 |
+
$comment = $order->addStatusHistoryComment(
|
| 292 |
+
Mage::helper('paypal')->__('Notified customer about creditmemo #%s.', $creditmemo->getIncrementId())
|
| 293 |
+
)
|
| 294 |
+
->setIsCustomerNotified(true)
|
| 295 |
+
->save();
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
$aStatus = array('success' => true);
|
| 300 |
+
break;
|
| 301 |
+
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
$order->save();
|
| 305 |
+
return $aStatus;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
}
|
app/code/local/Evo/HostedPayments/etc/config.xml
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
|
| 4 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* This software and documentation is subject to and made
|
| 7 |
+
* available only pursuant to the terms of an executed license
|
| 8 |
+
* agreement, and may be used only in accordance with the terms
|
| 9 |
+
* of said agreement. This software may not, in whole or in part,
|
| 10 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 11 |
+
* any electronic medium or machine-readable form without
|
| 12 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 13 |
+
*
|
| 14 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 15 |
+
* to restrictions set forth in an executed license agreement
|
| 16 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 17 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 18 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 19 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 20 |
+
* Computer Software-Licensing clause at NASA FAR supplement
|
| 21 |
+
* 16-52.227-86; or their equivalent.
|
| 22 |
+
*
|
| 23 |
+
* Information in this software is subject to change without notice
|
| 24 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 25 |
+
*
|
| 26 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 27 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
-->
|
| 31 |
+
<config>
|
| 32 |
+
<modules>
|
| 33 |
+
<Evo_HostedPayments>
|
| 34 |
+
<version>1.0.0</version>
|
| 35 |
+
</Evo_HostedPayments>
|
| 36 |
+
</modules>
|
| 37 |
+
<global>
|
| 38 |
+
<models>
|
| 39 |
+
<hostedpayments>
|
| 40 |
+
<class>Evo_HostedPayments_Model</class>
|
| 41 |
+
<resourceModel>hostedpayments_resource</resourceModel>
|
| 42 |
+
</hostedpayments>
|
| 43 |
+
<hostedpayments_resource>
|
| 44 |
+
<class>Evo_HostedPayments_Model_Resource</class>
|
| 45 |
+
<entities>
|
| 46 |
+
<hostedpayment>
|
| 47 |
+
<table>evo_hostedpayments</table>
|
| 48 |
+
</hostedpayment>
|
| 49 |
+
</entities>
|
| 50 |
+
</hostedpayments_resource>
|
| 51 |
+
</models>
|
| 52 |
+
<helpers>
|
| 53 |
+
<hostedpayments>
|
| 54 |
+
<class>Evo_HostedPayments_Helper</class>
|
| 55 |
+
</hostedpayments>
|
| 56 |
+
</helpers>
|
| 57 |
+
<payment>
|
| 58 |
+
<groups>
|
| 59 |
+
<hostedpayments>Hosted Payments</hostedpayments>
|
| 60 |
+
</groups>
|
| 61 |
+
</payment>
|
| 62 |
+
<resources>
|
| 63 |
+
<hostedpayments_setup>
|
| 64 |
+
<setup>
|
| 65 |
+
<module>Evo_HostedPayments</module>
|
| 66 |
+
</setup>
|
| 67 |
+
<connection>
|
| 68 |
+
<use>core_setup</use>
|
| 69 |
+
</connection>
|
| 70 |
+
</hostedpayments_setup>
|
| 71 |
+
<hostedpayments_write>
|
| 72 |
+
<connection>
|
| 73 |
+
<use>core_write</use>
|
| 74 |
+
</connection>
|
| 75 |
+
</hostedpayments_write>
|
| 76 |
+
<hostedpayments_read>
|
| 77 |
+
<connection>
|
| 78 |
+
<use>core_read</use>
|
| 79 |
+
</connection>
|
| 80 |
+
</hostedpayments_read>
|
| 81 |
+
</resources>
|
| 82 |
+
<blocks>
|
| 83 |
+
<hostedpayments>
|
| 84 |
+
<class>Evo_HostedPayments_Block</class>
|
| 85 |
+
</hostedpayments>
|
| 86 |
+
<payment>
|
| 87 |
+
<rewrite>
|
| 88 |
+
<payment_form>Evo_Payment_Block_Form</payment_form>
|
| 89 |
+
</rewrite>
|
| 90 |
+
</payment>
|
| 91 |
+
</blocks>
|
| 92 |
+
</global>
|
| 93 |
+
<frontend>
|
| 94 |
+
<secure_url>
|
| 95 |
+
<hostedpayments_processing>/hostedpayments/processing</hostedpayments_processing>
|
| 96 |
+
</secure_url>
|
| 97 |
+
<routers>
|
| 98 |
+
<hostedpayments>
|
| 99 |
+
<use>standard</use>
|
| 100 |
+
<args>
|
| 101 |
+
<module>Evo_HostedPayments</module>
|
| 102 |
+
<frontName>hostedpayments</frontName>
|
| 103 |
+
</args>
|
| 104 |
+
</hostedpayments>
|
| 105 |
+
</routers>
|
| 106 |
+
<layout>
|
| 107 |
+
<updates>
|
| 108 |
+
<evohostedpayments>
|
| 109 |
+
<file>evohostedpayments.xml</file>
|
| 110 |
+
</evohostedpayments>
|
| 111 |
+
</updates>
|
| 112 |
+
</layout>
|
| 113 |
+
<translate>
|
| 114 |
+
<modules>
|
| 115 |
+
<Mage_Checkout>
|
| 116 |
+
<files>
|
| 117 |
+
<default>Evo_HostedPayments.csv</default>
|
| 118 |
+
</files>
|
| 119 |
+
</Mage_Checkout>
|
| 120 |
+
</modules>
|
| 121 |
+
</translate>
|
| 122 |
+
</frontend>
|
| 123 |
+
<adminhtml>
|
| 124 |
+
<translate>
|
| 125 |
+
<modules>
|
| 126 |
+
<Mage_Checkout>
|
| 127 |
+
<files>
|
| 128 |
+
<default>Evo_HostedPayments.csv</default>
|
| 129 |
+
</files>
|
| 130 |
+
</Mage_Checkout>
|
| 131 |
+
</modules>
|
| 132 |
+
</translate>
|
| 133 |
+
</adminhtml>
|
| 134 |
+
<default>
|
| 135 |
+
<payment>
|
| 136 |
+
<hostedpayments>
|
| 137 |
+
<active>1</active>
|
| 138 |
+
<model>hostedpayments/payment</model>
|
| 139 |
+
<order_status>pending</order_status>
|
| 140 |
+
<title>Pay by Credit or Debit Card</title>
|
| 141 |
+
<allowspecific>0</allowspecific>
|
| 142 |
+
<group>online</group>
|
| 143 |
+
</hostedpayments>
|
| 144 |
+
</payment>
|
| 145 |
+
</default>
|
| 146 |
+
</config>
|
app/code/local/Evo/HostedPayments/etc/system.xml
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
|
| 4 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* This software and documentation is subject to and made
|
| 7 |
+
* available only pursuant to the terms of an executed license
|
| 8 |
+
* agreement, and may be used only in accordance with the terms
|
| 9 |
+
* of said agreement. This software may not, in whole or in part,
|
| 10 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 11 |
+
* any electronic medium or machine-readable form without
|
| 12 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 13 |
+
*
|
| 14 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 15 |
+
* to restrictions set forth in an executed license agreement
|
| 16 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 17 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 18 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 19 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 20 |
+
* Computer Software-Licensing clause at NASA FAR supplement
|
| 21 |
+
* 16-52.227-86; or their equivalent.
|
| 22 |
+
*
|
| 23 |
+
* Information in this software is subject to change without notice
|
| 24 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 25 |
+
*
|
| 26 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 27 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
-->
|
| 31 |
+
<config>
|
| 32 |
+
<sections>
|
| 33 |
+
<payment>
|
| 34 |
+
<groups>
|
| 35 |
+
<hostedpayments translate="label" module="hostedpayments">
|
| 36 |
+
<label>Snap* Hosted Payments by Popular Payments</label>
|
| 37 |
+
<frontend_type>text</frontend_type>
|
| 38 |
+
<sort_order>10</sort_order>
|
| 39 |
+
<show_in_default>1</show_in_default>
|
| 40 |
+
<show_in_website>1</show_in_website>
|
| 41 |
+
<show_in_store>1</show_in_store>
|
| 42 |
+
<comment><![CDATA[
|
| 43 |
+
<div><img src="http://www.snapspain.es/wp-content/uploads/poppay-snap-banner.png" alt="Snap* logo" /></div>
|
| 44 |
+
<p>¿No tienes una cuenta en <strong>Snap*</strong>? Contacta con nosotros haciendo clic
|
| 45 |
+
<a href="http://www.snapspain.es/contacto/">aquí</a> o en el <strong>900 907 222</strong>.</p>
|
| 46 |
+
<p>Visita <a href="http://www.snapspain.es" title="Ir al sitio Web de Snap*">www.snapspain.es</a> para más información.</p>
|
| 47 |
+
<hr />
|
| 48 |
+
]]></comment>
|
| 49 |
+
<fields>
|
| 50 |
+
<active translate="label">
|
| 51 |
+
<label>Enabled</label>
|
| 52 |
+
<frontend_type>select</frontend_type>
|
| 53 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 54 |
+
<sort_order>1</sort_order>
|
| 55 |
+
<show_in_default>1</show_in_default>
|
| 56 |
+
<show_in_website>1</show_in_website>
|
| 57 |
+
<show_in_store>0</show_in_store>
|
| 58 |
+
</active>
|
| 59 |
+
<title translate="label">
|
| 60 |
+
<label>Title</label>
|
| 61 |
+
<frontend_type>text</frontend_type>
|
| 62 |
+
<sort_order>2</sort_order>
|
| 63 |
+
<show_in_default>1</show_in_default>
|
| 64 |
+
<show_in_website>1</show_in_website>
|
| 65 |
+
<show_in_store>1</show_in_store>
|
| 66 |
+
</title>
|
| 67 |
+
<test_mode translate="label comment">
|
| 68 |
+
<label>Test mode</label>
|
| 69 |
+
<comment>Select your Snap* environment.</comment>
|
| 70 |
+
<frontend_type>select</frontend_type>
|
| 71 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 72 |
+
<sort_order>3</sort_order>
|
| 73 |
+
<show_in_default>1</show_in_default>
|
| 74 |
+
<show_in_website>1</show_in_website>
|
| 75 |
+
<show_in_store>0</show_in_store>
|
| 76 |
+
</test_mode>
|
| 77 |
+
<merchant_code translate="label comment">
|
| 78 |
+
<label>Merchant Code</label>
|
| 79 |
+
<comment>Your Snap* Hosted Payments code.</comment>
|
| 80 |
+
<frontend_type>text</frontend_type>
|
| 81 |
+
<sort_order>4</sort_order>
|
| 82 |
+
<show_in_default>1</show_in_default>
|
| 83 |
+
<show_in_website>1</show_in_website>
|
| 84 |
+
<show_in_store>1</show_in_store>
|
| 85 |
+
</merchant_code>
|
| 86 |
+
<merchant_authkey translate="label comment">
|
| 87 |
+
<label>Merchant Authkey</label>
|
| 88 |
+
<comment>The key corresponding to the Snap* Hosted Payments code.</comment>
|
| 89 |
+
<frontend_type>text</frontend_type>
|
| 90 |
+
<sort_order>5</sort_order>
|
| 91 |
+
<show_in_default>1</show_in_default>
|
| 92 |
+
<show_in_website>1</show_in_website>
|
| 93 |
+
<show_in_store>1</show_in_store>
|
| 94 |
+
</merchant_authkey>
|
| 95 |
+
<checkout_iframe translate="label comment">
|
| 96 |
+
<label>Use iframe layout</label>
|
| 97 |
+
<comment>Select whether Snap* is integrated in your shop using an iframe.</comment>
|
| 98 |
+
<frontend_type>select</frontend_type>
|
| 99 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 100 |
+
<sort_order>6</sort_order>
|
| 101 |
+
<show_in_default>1</show_in_default>
|
| 102 |
+
<show_in_website>1</show_in_website>
|
| 103 |
+
<show_in_store>1</show_in_store>
|
| 104 |
+
</checkout_iframe>
|
| 105 |
+
<trigger3ds translate="label comment">
|
| 106 |
+
<label>3D Secure Trigger</label>
|
| 107 |
+
<comment>Value that triggers 3D Secure. Empty -> Never, 0 -> Always.</comment>
|
| 108 |
+
<frontend_type>text</frontend_type>
|
| 109 |
+
<sort_order>7</sort_order>
|
| 110 |
+
<show_in_default>1</show_in_default>
|
| 111 |
+
<show_in_website>1</show_in_website>
|
| 112 |
+
<show_in_store>1</show_in_store>
|
| 113 |
+
</trigger3ds>
|
| 114 |
+
<order_prefix translate="label comment">
|
| 115 |
+
<label>Order Prefix</label>
|
| 116 |
+
<comment>Order Prefix sent to Snap* Hosted Payments.</comment>
|
| 117 |
+
<frontend_type>text</frontend_type>
|
| 118 |
+
<sort_order>8</sort_order>
|
| 119 |
+
<show_in_default>1</show_in_default>
|
| 120 |
+
<show_in_website>1</show_in_website>
|
| 121 |
+
<show_in_store>1</show_in_store>
|
| 122 |
+
</order_prefix>
|
| 123 |
+
</fields>
|
| 124 |
+
</hostedpayments>
|
| 125 |
+
</groups>
|
| 126 |
+
</payment>
|
| 127 |
+
</sections>
|
| 128 |
+
</config>
|
app/code/local/Evo/HostedPayments/sql/hostedpayments_setup/install-0.1.0.php
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Payments Setup script.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
|
| 38 |
+
$installer = $this;
|
| 39 |
+
$installer->startSetup();
|
| 40 |
+
$table = $installer->getConnection()->newTable($installer->getTable('hostedpayments/hostedpayment'))
|
| 41 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 42 |
+
'unsigned' => true,
|
| 43 |
+
'nullable' => false,
|
| 44 |
+
'primary' => true,
|
| 45 |
+
'identity' => true,
|
| 46 |
+
), 'Entity ID')
|
| 47 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
|
| 48 |
+
'nullable' => false,
|
| 49 |
+
'unique' => true,
|
| 50 |
+
), 'Order ID')
|
| 51 |
+
->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
| 52 |
+
'nullable' => false,
|
| 53 |
+
), 'Payment URL')
|
| 54 |
+
->addColumn('prefix', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
|
| 55 |
+
'nullable' => true
|
| 56 |
+
), 'Order ID Prefix')
|
| 57 |
+
->setComment('Snap* Hosted Payments URLs table');
|
| 58 |
+
$installer->getConnection()->createTable($table);
|
| 59 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/evo/info.phtml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Info Block View.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
?>
|
| 38 |
+
<div><img class="evo-snap-logo" src="<?php echo $this->getSkinUrl('images/evo/logo.png')?>" alt="Snap*" style="float: left; margin: 5px;" /><strong><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></div>
|
app/design/frontend/base/default/layout/evohostedpayments.xml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
|
| 4 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* This software and documentation is subject to and made
|
| 7 |
+
* available only pursuant to the terms of an executed license
|
| 8 |
+
* agreement, and may be used only in accordance with the terms
|
| 9 |
+
* of said agreement. This software may not, in whole or in part,
|
| 10 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 11 |
+
* any electronic medium or machine-readable form without
|
| 12 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 13 |
+
*
|
| 14 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 15 |
+
* to restrictions set forth in an executed license agreement
|
| 16 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 17 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 18 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 19 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 20 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 21 |
+
* 16-52.227-86; or their equivalent.
|
| 22 |
+
*
|
| 23 |
+
* Information in this software is subject to change without notice
|
| 24 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 25 |
+
*
|
| 26 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 27 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
-->
|
| 31 |
+
<layout version="0.1.0">
|
| 32 |
+
<hostedpayments_processing_pay translate="label">
|
| 33 |
+
<label>Snap* Hosted Payments Checkout</label>
|
| 34 |
+
<!-- Mage_Checkout -->
|
| 35 |
+
<remove name="left"/>
|
| 36 |
+
<remove name="right"/>
|
| 37 |
+
|
| 38 |
+
<reference name="root">
|
| 39 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
| 40 |
+
</reference>
|
| 41 |
+
<reference name="content">
|
| 42 |
+
<block type="hostedpayments/iframe" name="hostedpayments.iframe" template="evo/iframe.phtml" />
|
| 43 |
+
</reference>
|
| 44 |
+
</hostedpayments_processing_pay>
|
| 45 |
+
|
| 46 |
+
<hostedpayments_processing_return translate="label">
|
| 47 |
+
<label>Snap* Hosted Payments Checkout</label>
|
| 48 |
+
<!-- Mage_Checkout -->
|
| 49 |
+
<remove name="left"/>
|
| 50 |
+
<remove name="right"/>
|
| 51 |
+
|
| 52 |
+
<reference name="root">
|
| 53 |
+
<action method="setTemplate"><template>page/empty.phtml</template></action>
|
| 54 |
+
</reference>
|
| 55 |
+
<reference name="content">
|
| 56 |
+
<block type="hostedpayments/iframevalidation" name="hostedpayments.iframevalidation" template="evo/iframevalidation.phtml" />
|
| 57 |
+
</reference>
|
| 58 |
+
</hostedpayments_processing_return>
|
| 59 |
+
</layout>
|
app/design/frontend/base/default/template/evo/form.phtml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Form Block View.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
?>
|
| 38 |
+
<?php $_code=$this->getMethodCode() ?>
|
| 39 |
+
<p style="vertical-align: middle;"><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/brand-logos.png')?>" alt="<?php echo $this->__('Credit Card Logos') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><strong style="display: inline-block; vertical-align: middle;"><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></p>
|
app/design/frontend/base/default/template/evo/iframe.phtml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Iframe Block View.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
?>
|
| 38 |
+
<div class="block block-evosnap">
|
| 39 |
+
<iframe id="evosnapif" src="<?php echo $this->getPaymentUrl() ?>" style="width: 100%; height: 70vh; border: none;"></iframe>
|
| 40 |
+
</div>
|
app/design/frontend/base/default/template/evo/iframevalidation.phtml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Iframe Validation Block View.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
?>
|
| 38 |
+
<script type="text/javascript">
|
| 39 |
+
<!--
|
| 40 |
+
window.parent.location.href= "<?php echo $this->getValidationUrl() ?>";
|
| 41 |
+
-->
|
| 42 |
+
</script>
|
app/design/frontend/base/default/template/evo/info.phtml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* EVO Snap* Hosted Info Block View.
|
| 31 |
+
*
|
| 32 |
+
* @category EVO
|
| 33 |
+
* @package Evo
|
| 34 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 35 |
+
* @license EVO Payments International EULA
|
| 36 |
+
*/
|
| 37 |
+
?>
|
| 38 |
+
<p style="vertical-align: middle;"><img class="credit-card-logo" src="<?php echo $this->getSkinUrl('images/evo/brand-logos.png')?>" alt="<?php echo $this->__('Credit Card Logos') ?>" style="display: inline-block; margin: 5px; vertical-align: middle;" /><strong style="display: inline-block; vertical-align: middle;"><?php echo $this->__('Pay by VISA, MasterCard or Maestro') ?></strong></p>
|
| 39 |
+
<?php
|
| 40 |
+
$paymentLink = $this->_getPaymentLink();
|
| 41 |
+
|
| 42 |
+
if($paymentLink !== null){
|
| 43 |
+
?>
|
| 44 |
+
<p><a class="hostedpayments-resume-link" href="<?php echo $paymentLink ?>"><strong><?php echo $this->__('Resume Payment')?></strong></a></p>
|
| 45 |
+
<?php
|
| 46 |
+
}
|
| 47 |
+
?>
|
app/etc/modules/Evo_HostedPayments.xml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
|
| 4 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 5 |
+
*
|
| 6 |
+
* This software and documentation is subject to and made
|
| 7 |
+
* available only pursuant to the terms of an executed license
|
| 8 |
+
* agreement, and may be used only in accordance with the terms
|
| 9 |
+
* of said agreement. This software may not, in whole or in part,
|
| 10 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 11 |
+
* any electronic medium or machine-readable form without
|
| 12 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 13 |
+
*
|
| 14 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 15 |
+
* to restrictions set forth in an executed license agreement
|
| 16 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 17 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 18 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 19 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 20 |
+
* Computer Software-Licensing clause at NASA FAR supplement
|
| 21 |
+
* 16-52.227-86; or their equivalent.
|
| 22 |
+
*
|
| 23 |
+
* Information in this software is subject to change without notice
|
| 24 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 25 |
+
*
|
| 26 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 27 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
-->
|
| 31 |
+
<config>
|
| 32 |
+
<modules>
|
| 33 |
+
<Evo_HostedPayments>
|
| 34 |
+
<active>true</active>
|
| 35 |
+
<codePool>local</codePool>
|
| 36 |
+
<depends>
|
| 37 |
+
<Mage_Payment />
|
| 38 |
+
</depends>
|
| 39 |
+
</Evo_HostedPayments>
|
| 40 |
+
</modules>
|
| 41 |
+
</config>
|
app/locale/en_US/Evo_HostedPayments.csv
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"Snap* Hosted Payments by Popular Payments","Snap* Hosted Payments by Popular Payments"
|
| 2 |
+
"Customer was redirected to the Snap* Hosted Payments Checkout for payment.","Customer was redirected to the Snap* Hosted Payments Checkout for payment."
|
| 3 |
+
"Customer cancelled this order via Snap* Hosted Payments Checkout.","Customer cancelled this order via Snap* Hosted Payments Checkout."
|
| 4 |
+
"Pay by VISA, MasterCard or Maestro","Pay by VISA, MasterCard or Maestro"
|
| 5 |
+
"Pay by Credit Card at Snap*","Pay by Credit Card at Snap*"
|
| 6 |
+
"Snap* Hosted Payments is a flexible, web based payment processing service that offers multiple payment options.","Snap* Hosted Payments is a flexible, web based payment processing service that offers multiple payment options."
|
| 7 |
+
"Select your Snap* environment.","Select your Snap* environment."
|
| 8 |
+
"Merchant Code","Merchant Code"
|
| 9 |
+
"Your Snap* Hosted Payments code.","Your Snap* Hosted Payments code."
|
| 10 |
+
"Merchant Authkey","Merchant Authkey"
|
| 11 |
+
"The key corresponding to the Snap* Hosted Payments code.","The key corresponding to the Snap* Hosted Payments code."
|
| 12 |
+
"Use iframe layout","Use iframe layout"
|
| 13 |
+
"Select whether Snap* is integrated in your shop using an iframe.","Select whether Snap* is integrated in your shop using an iframe."
|
| 14 |
+
"3D Secure Trigger","3D Secure Trigger"
|
| 15 |
+
"Value that triggers 3D Secure. Empty -> Never, 0 -> Always.","Value that triggers 3D Secure. Empty -> Never, 0 -> Always."
|
| 16 |
+
"Order Prefix","Order Prefix"
|
| 17 |
+
"Order Prefix sent to Snap* Hosted Payments.","Order Prefix sent to Snap* Hosted Payments."
|
| 18 |
+
"Resume Payment","Resume Payment"
|
| 19 |
+
"Credit Card Logos","Credit Card Logos"
|
app/locale/es_ES/Evo_HostedPayments.csv
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"Snap* Hosted Payments by Popular Payments","Snap* Hosted Payments by Popular Payments"
|
| 2 |
+
"Customer was redirected to the Snap* Hosted Payments Checkout for payment.","El cliente ha sido redirigido hacia la página de Proceso de Compra de Snap* Hosted Payments para realizar el pago."
|
| 3 |
+
"Customer cancelled this order via Snap* Hosted Payments Checkout.","El cliente canceló el pedido en la página de Proceso de Compra de Snap* Hosted Payments API™"
|
| 4 |
+
"Pay by VISA, MasterCard or Maestro","Pagar con VISA, MasterCard o Maestro"
|
| 5 |
+
"Pay by Credit Card at Snap*","Pagar con Tarjeta de Crédito en Snap*"
|
| 6 |
+
"Snap* Hosted Payments is a flexible, web based payment processing service that offers multiple payment options.","Snap* Hosted Payments es un servicio Web flexible de procesamiento de pagos que ofrece múltiples opciones de pago."
|
| 7 |
+
"Select your Snap* environment.","Seleccione su entorno Snap*."
|
| 8 |
+
"Merchant Code","Código de Comercio"
|
| 9 |
+
"Your Snap* Hosted Payments code.","Su código de Snap* Hosted Payments."
|
| 10 |
+
"Merchant Authkey","Clave de Comercio"
|
| 11 |
+
"The key corresponding to the Snap* Hosted Payments code.","La clave correspondiente a su código de Snap* Hosted Payments."
|
| 12 |
+
"Use iframe layout","Utilizar diseño iframe"
|
| 13 |
+
"Select whether Snap* is integrated in your shop using an iframe.","Seleccione si Snap* se integra en su tienda mediante un iframe."
|
| 14 |
+
"3D Secure Trigger","Nivel 3D Secure"
|
| 15 |
+
"Value that triggers 3D Secure. Empty -> Never, 0 -> Always.","Valor a partir del cual se activa 3D Secure. Vacío -> Nunca, 0 -> Siempre."
|
| 16 |
+
"Order Prefix","Prefijo del Pedido"
|
| 17 |
+
"Order Prefix sent to Snap* Hosted Payments.","Prefijo del Pedido enviado a Snap* Hosted Payments."
|
| 18 |
+
"Resume Payment","Completar Pago"
|
| 19 |
+
"Credit Card Logos","Marcas de las Tarjetas de Crédito"
|
lib/hostedpayments/evosnap_api.php
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*
|
| 28 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 29 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 30 |
+
* @license EVO Payments International EULA
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
class EvoSnapApi
|
| 34 |
+
{
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Retrieves orders.
|
| 38 |
+
* @param array $params request parameters.
|
| 39 |
+
* @param HostedPayments $cfg Hosted Payments Configuration.
|
| 40 |
+
* @return the order status.
|
| 41 |
+
*/
|
| 42 |
+
public static function getOrders($params, $cfg){
|
| 43 |
+
$aPost = EvoSnapApi::getEvoSnapOrdersPost($params, $cfg->code, $cfg->key);
|
| 44 |
+
$orders = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
|
| 45 |
+
if ($orders ['success'] != false) {
|
| 46 |
+
return $orders['orders'];
|
| 47 |
+
} else {
|
| 48 |
+
throw new HostedPayments_Exception($orders['message']);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
private static function getEvoSnapOrdersPost($params, $code, $key){
|
| 53 |
+
$aPost = array(
|
| 54 |
+
'action' => 'get_orders',
|
| 55 |
+
'code' => $code,
|
| 56 |
+
'return' => 'json',
|
| 57 |
+
);
|
| 58 |
+
$aPost['mac'] = EvoSnapApi::getOrdersMac($aPost, $key);
|
| 59 |
+
$aPost = array_merge($aPost, $params);
|
| 60 |
+
return $aPost;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
private static function getOrdersMac($aPost, $key){
|
| 64 |
+
$aMACParams = array(
|
| 65 |
+
'code' => $aPost['code'],
|
| 66 |
+
'action' => $aPost['action'],
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
return EvoSnapTools::getMac($aMACParams, $key);
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Retrieves an order.
|
| 74 |
+
* @param string $id the order ID.
|
| 75 |
+
* @param HostedPayments $cfg Hosted Payments Configuration.
|
| 76 |
+
* @return the order status.
|
| 77 |
+
*/
|
| 78 |
+
public static function getOrder($id, $cfg){
|
| 79 |
+
$aPost = EvoSnapApi::getEvoSnapOrderPost($id, $cfg->code, $cfg->key);
|
| 80 |
+
$order = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
|
| 81 |
+
if ($order ['success'] != false) {
|
| 82 |
+
$raw_order = $order['order'];
|
| 83 |
+
EvoSnapApi::setOrderTransactionData($raw_order);
|
| 84 |
+
return $raw_order;
|
| 85 |
+
} else {
|
| 86 |
+
throw new HostedPayments_Exception($order['message']);
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
private static function setOrderTransactionData($raw_order){
|
| 91 |
+
$total_refunded = 0;
|
| 92 |
+
if(isset($raw_order->transactions) && is_array($raw_order->transactions)){
|
| 93 |
+
foreach($raw_order->transactions as $txn){
|
| 94 |
+
if($txn->txn_action === 'sale'){
|
| 95 |
+
$raw_order->payment_transaction = $txn;
|
| 96 |
+
}elseif($txn->txn_action === 'credit'){
|
| 97 |
+
$total_refunded += $txn->txn_amount;
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
$raw_order->total_refunded = $total_refunded;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Gets order status.
|
| 107 |
+
* @param string $id the order ID.
|
| 108 |
+
* @param HostedPayments $cfg Hosted Payments Configuration.
|
| 109 |
+
* @return the order status.
|
| 110 |
+
*/
|
| 111 |
+
public static function getOrderStatus($id, $cfg){
|
| 112 |
+
$order = EvoSnapApi::getOrder($id, $cfg);
|
| 113 |
+
|
| 114 |
+
if ($order != null) {
|
| 115 |
+
$result = $order->status;
|
| 116 |
+
} else {
|
| 117 |
+
$result = null;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
return $result;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
private static function getEvoSnapOrderPost($id, $code, $key){
|
| 124 |
+
$aPost = array(
|
| 125 |
+
'action' => 'get_order',
|
| 126 |
+
'code' => $code,
|
| 127 |
+
'merchant_order_id' => $id,
|
| 128 |
+
'return' => 'json',
|
| 129 |
+
);
|
| 130 |
+
$aPost['mac'] = EvoSnapApi::getOrderMac($aPost, $key);
|
| 131 |
+
|
| 132 |
+
return $aPost;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
private static function getOrderMac($aPost, $key){
|
| 136 |
+
$aMACParams = array(
|
| 137 |
+
'code' => $aPost['code'],
|
| 138 |
+
'action' => $aPost['action'],
|
| 139 |
+
'merchant_order_id' => $aPost['merchant_order_id']
|
| 140 |
+
);
|
| 141 |
+
|
| 142 |
+
return EvoSnapTools::getMac($aMACParams, $key);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
* Gets checkout order
|
| 147 |
+
* @param SnapOrder_Checkout $order the order checkout.
|
| 148 |
+
* @param float $trigger3ds value that triggers 3D secure.
|
| 149 |
+
* @param HostedPayments $cfg Hosted Payments Configuration.
|
| 150 |
+
*/
|
| 151 |
+
public static function getOrderCheckoutUrl($order, $trigger3ds, $cfg) {
|
| 152 |
+
$aPost = EvoSnapApi::getEvoSnapCehckoutPost($order, $trigger3ds, $cfg->code, $cfg->key);
|
| 153 |
+
$result = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(true), $cfg->environment);
|
| 154 |
+
if ($result ['success'] != false) {
|
| 155 |
+
return $result ['url'];
|
| 156 |
+
} else {
|
| 157 |
+
throw new HostedPayments_Exception($result['message']);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/**
|
| 162 |
+
*
|
| 163 |
+
* @param SnapOrder_Checkout $checkout
|
| 164 |
+
* @param float $trigger3ds
|
| 165 |
+
* @param string $code
|
| 166 |
+
* @param string $key
|
| 167 |
+
* @return array
|
| 168 |
+
*/
|
| 169 |
+
private static function getEvoSnapCehckoutPost($checkout, $trigger3ds, $code, $key){
|
| 170 |
+
$returnUrl = $checkout->return_url;
|
| 171 |
+
$cancelUrl = $checkout->cancel_url;
|
| 172 |
+
|
| 173 |
+
$customer = $checkout->customer;
|
| 174 |
+
$aCustomer = array(
|
| 175 |
+
'merchant_customer_id' => $customer->id,
|
| 176 |
+
'first_name' =>EvoSnapTools::getString($customer->first_name),
|
| 177 |
+
'last_name' => EvoSnapTools::getString($customer->last_name),
|
| 178 |
+
'phone' => EvoSnapTools::getString($customer->phone, 15),
|
| 179 |
+
'email' => EvoSnapTools::getString($customer->email, 50)
|
| 180 |
+
);
|
| 181 |
+
|
| 182 |
+
$order = $checkout->order;
|
| 183 |
+
$aOrder = array(
|
| 184 |
+
'merchant_order_id' => EvoSnapTools::getString($order->id, 255),
|
| 185 |
+
'total_subtotal' => EvoSnapTools::getNumber($order->total_subtotal),
|
| 186 |
+
'total_tax' => EvoSnapTools::getNumber($order->total_tax),
|
| 187 |
+
'total_shipping' => EvoSnapTools::getNumber($order->total_shipping),
|
| 188 |
+
'total_discount' => EvoSnapTools::getNumber($order->total_discount),
|
| 189 |
+
'total' => EvoSnapTools::getNumber($order->total),
|
| 190 |
+
'ship_method' => EvoSnapTools::getString($order->ship_method),
|
| 191 |
+
'currency_code' => EvoSnapTools::getString($order->currency_code),
|
| 192 |
+
'enable_3d' => EvoSnapTools::getBoolean(isset($trigger3ds) && ($checkout->order->total >= $trigger3ds))
|
| 193 |
+
);
|
| 194 |
+
|
| 195 |
+
$aOrderLines = array();
|
| 196 |
+
$products = $order->lines;
|
| 197 |
+
for($i = 0; $i < count($products); $i++) {
|
| 198 |
+
$aOrderLines[$i] = EvoSnapApi::getOrderItem($products[$i]);
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
$aOrder = array_merge($aOrder, EvoSnapTools::getAddress('billto', $order->billto_address));
|
| 202 |
+
if(isset($order->shipto_address)){
|
| 203 |
+
$aOrder = array_merge($aOrder, EvoSnapTools::getAddress('shipto', $order->shipto_address));
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
$aPost = array(
|
| 207 |
+
'action' => $checkout->getAction(),
|
| 208 |
+
'code' => $code,
|
| 209 |
+
'customer' => $aCustomer,
|
| 210 |
+
'order' => $aOrder,
|
| 211 |
+
'order_item' => $aOrderLines,
|
| 212 |
+
'return_url' => $returnUrl,
|
| 213 |
+
'cancel_url' => $cancelUrl,
|
| 214 |
+
'auto_return' => '1',
|
| 215 |
+
'checkout_layout' => $checkout->checkout_layout,
|
| 216 |
+
'language' => $checkout->language
|
| 217 |
+
);
|
| 218 |
+
$aPost['mac'] = EvoSnapApi::getOrderCheckoutMac($aPost, $key);
|
| 219 |
+
|
| 220 |
+
return $aPost;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
/**
|
| 224 |
+
*
|
| 225 |
+
* @param OrderLine $orderItem
|
| 226 |
+
* @return array
|
| 227 |
+
*/
|
| 228 |
+
private static function getOrderItem($orderItem){
|
| 229 |
+
return array(
|
| 230 |
+
'sku' => EvoSnapTools::getString($orderItem->sku, 25),
|
| 231 |
+
'name' => EvoSnapTools::getString($orderItem->name, 30),
|
| 232 |
+
'description' => EvoSnapTools::getString($orderItem->description, 300),
|
| 233 |
+
'qty' => EvoSnapTools::getNumber($orderItem->qty),
|
| 234 |
+
'price' => EvoSnapTools::getNumber($orderItem->price),
|
| 235 |
+
'tax' => EvoSnapTools::getNumber($orderItem->tax)
|
| 236 |
+
);
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
private static function getOrderCheckoutMac($aPost, $key){
|
| 240 |
+
$aMACParams = array(
|
| 241 |
+
'code' => $aPost['code'],
|
| 242 |
+
'email' => $aPost['customer']['email'],
|
| 243 |
+
'order_total_subtotal' => $aPost['order']['total_subtotal'],
|
| 244 |
+
'order_total' => $aPost['order']['total'],
|
| 245 |
+
'merchant_order_id' => $aPost['order']['merchant_order_id']
|
| 246 |
+
);
|
| 247 |
+
|
| 248 |
+
return EvoSnapTools::getMac($aMACParams, $key);
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/**
|
| 252 |
+
* Credits an order.
|
| 253 |
+
* @param string $id the order ID.
|
| 254 |
+
* @param string $txnId the transaction ID.
|
| 255 |
+
* @param float $amount the amount to credit, null value defaults to original transaction amount.
|
| 256 |
+
* @param HostedPayments $cfg Hosted Payments Configuration.
|
| 257 |
+
* @return the order status.
|
| 258 |
+
*/
|
| 259 |
+
public static function creditOrder($id, $txnId, $amount, $cfg){
|
| 260 |
+
$aPost = EvoSnapApi::getEvoSnapCreditOrderPost($id, $txnId, $amount,
|
| 261 |
+
$cfg->code, $cfg->key);
|
| 262 |
+
$credit = EvoSnapTools::callEvoSnap($aPost, $cfg->getUrl(false), $cfg->environment);
|
| 263 |
+
if ($credit ['success'] != false) {
|
| 264 |
+
return $credit['txn_id'];
|
| 265 |
+
} else {
|
| 266 |
+
throw new HostedPayments_Exception($credit['message']);
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
private static function getEvoSnapCreditOrderPost($id, $txnId, $amount, $code, $key){
|
| 271 |
+
$aPost = array(
|
| 272 |
+
'action' => 'credit',
|
| 273 |
+
'code' => $code,
|
| 274 |
+
'merchant_order_id' => $id,
|
| 275 |
+
'txn_id' => $txnId,
|
| 276 |
+
'return' => 'json'
|
| 277 |
+
);
|
| 278 |
+
$aPost['mac'] = EvoSnapApi::getCreditOrderMac($aPost, $key);
|
| 279 |
+
|
| 280 |
+
if($amount != null){
|
| 281 |
+
$aPost['amount'] = $amount;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
return $aPost;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
private static function getCreditOrderMac($aPost, $key){
|
| 288 |
+
$aMACParams = array(
|
| 289 |
+
'code' => $aPost['code'],
|
| 290 |
+
'action' => $aPost['action'],
|
| 291 |
+
'merchant_order_id' => $aPost['merchant_order_id'],
|
| 292 |
+
'txn_id' => $aPost['txn_id']
|
| 293 |
+
);
|
| 294 |
+
|
| 295 |
+
return EvoSnapTools::getMac($aMACParams, $key);
|
| 296 |
+
}
|
| 297 |
+
}
|
lib/hostedpayments/evosnap_constants.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*
|
| 28 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 29 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 30 |
+
* @license EVO Payments International EULA
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
final class EvoSnapConstants {
|
| 35 |
+
const ORDER_STATUS_NAME = 'EVOSNAP_OS_PENDING';
|
| 36 |
+
const LIVE_CHECKOUT_URL = 'https://hp.evosnap.com/srv/checkout/';
|
| 37 |
+
const CERT_CHECKOUT_URL = 'https://cert-hp.evosnap.com/srv/checkout/';
|
| 38 |
+
const LIVE_TXN_URL = 'https://hp.evosnap.com/srv/txn.php';
|
| 39 |
+
const CERT_TXN_URL = 'https://cert-hp.evosnap.com/srv/txn.php';
|
| 40 |
+
public static $VALID_PAYMENT_STATUSES = array('Pedning', 'Declined');
|
| 41 |
+
}
|
lib/hostedpayments/evosnap_tools.php
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*
|
| 28 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 29 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 30 |
+
* @license EVO Payments International EULA
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
class EvoSnapTools
|
| 34 |
+
{
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Calls EVO Snap* Hosted Payments Service
|
| 38 |
+
* @param array $params the CURL params to send to the service.
|
| 39 |
+
* @param string $url the URL to call.
|
| 40 |
+
* @param boolean $verifySsl flag to determine if the SSL cert must be validated. Default to true.
|
| 41 |
+
* @return array the resulting call.
|
| 42 |
+
*/
|
| 43 |
+
public static function callEvoSnap($params, $url, $verifySsl = true){
|
| 44 |
+
$rCurl = curl_init ();
|
| 45 |
+
curl_setopt ( $rCurl, CURLOPT_URL, $url );
|
| 46 |
+
curl_setopt ( $rCurl, CURLOPT_SSL_VERIFYPEER, $verifySsl );
|
| 47 |
+
curl_setopt ( $rCurl, CURLOPT_RETURNTRANSFER, 1 );
|
| 48 |
+
curl_setopt ( $rCurl, CURLOPT_POST, true );
|
| 49 |
+
curl_setopt ( $rCurl, CURLOPT_POSTFIELDS, EvoSnapTools::encodeRequest ( $params ) );
|
| 50 |
+
|
| 51 |
+
$result = ( array ) json_decode ( curl_exec ( $rCurl ) );
|
| 52 |
+
|
| 53 |
+
curl_close ( $rCurl );
|
| 54 |
+
|
| 55 |
+
return $result;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Creates the MAC signature.
|
| 60 |
+
* @param array $aParams the params.
|
| 61 |
+
* @param string $sPrivateKey the private key.
|
| 62 |
+
* @return string the MAC signature.
|
| 63 |
+
*/
|
| 64 |
+
public static function getMac($aParams, $sPrivateKey){
|
| 65 |
+
$sUnencoded = '';
|
| 66 |
+
if (!empty($aParams)){
|
| 67 |
+
$aTemp = array();
|
| 68 |
+
foreach ($aParams as $key => $val){
|
| 69 |
+
$aTemp[$key] = $val;
|
| 70 |
+
}
|
| 71 |
+
ksort($aTemp);
|
| 72 |
+
$sUnencoded.= implode('', $aTemp);
|
| 73 |
+
}
|
| 74 |
+
if (!empty($sPrivateKey))
|
| 75 |
+
$sUnencoded.= $sPrivateKey;
|
| 76 |
+
|
| 77 |
+
return md5($sUnencoded);
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Encodes request data.
|
| 82 |
+
* @param array $aRequest the request to encode.
|
| 83 |
+
* @return string the encoded request.
|
| 84 |
+
*/
|
| 85 |
+
public static function encodeRequest($aRequest){
|
| 86 |
+
$aFields = array();
|
| 87 |
+
if(is_array($aRequest) && !empty($aRequest)){
|
| 88 |
+
foreach ($aRequest as $key => $val){
|
| 89 |
+
if (is_array($val) || is_object($val))
|
| 90 |
+
$aFields[] = $key.'='.urlencode(json_encode($val));
|
| 91 |
+
else
|
| 92 |
+
$aFields[] = $key.'='.urlencode($val);
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
return implode('&', $aFields);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Gets a valid String to send to EVO Snap*.
|
| 101 |
+
* @param string $s the String to format.
|
| 102 |
+
* @param int $l the lenght of the string. Default = 20.
|
| 103 |
+
* @return string
|
| 104 |
+
*/
|
| 105 |
+
public static function getString($s, $l = 20){
|
| 106 |
+
return substr(trim($s), 0, $l);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* Gets a valid Number to send to EVO Snap*.
|
| 111 |
+
* @param float $n the number to format.
|
| 112 |
+
* @return string
|
| 113 |
+
*/
|
| 114 |
+
public static function getNumber($n){
|
| 115 |
+
return number_format($n, 2);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Gets a valid Boolean to send to EVO Snap*.
|
| 120 |
+
* @param boolean $n the boolean to format.
|
| 121 |
+
* @return string
|
| 122 |
+
*/
|
| 123 |
+
public static function getBoolean($b){
|
| 124 |
+
return $b? 1 : 0;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Formtas a ZIP code in a valid form for EVO Snap*.
|
| 129 |
+
* @param string $zip the ZIP code to format.
|
| 130 |
+
* @return string Zip Code in a valid format.
|
| 131 |
+
*/
|
| 132 |
+
public static function getZipCode($zip){
|
| 133 |
+
return EvoSnapTools::getString(strtoupper(preg_replace("/[^a-zA-Z0-9]+/", "", $zip)), 9);
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* Gets an address formatted in a form ready to send to EVO Snap*.
|
| 138 |
+
* @param string $prefix the form variables prefix.
|
| 139 |
+
* @param SnapAddress $address the address.
|
| 140 |
+
* @return the address in an array.
|
| 141 |
+
*/
|
| 142 |
+
public static function getAddress($prefix, $address){
|
| 143 |
+
$aAddress = array();
|
| 144 |
+
$aAddress[$prefix.'_company'] = EvoSnapTools::getString($address->company);
|
| 145 |
+
$aAddress[$prefix.'_first_name'] = EvoSnapTools::getString($address->first_name);
|
| 146 |
+
$aAddress[$prefix.'_last_name'] = EvoSnapTools::getString($address->last_name);
|
| 147 |
+
$aAddress[$prefix.'_po_box_number'] = EvoSnapTools::getString($address->po_box_number);
|
| 148 |
+
$aAddress[$prefix.'_address1'] = EvoSnapTools::getString($address->address1);
|
| 149 |
+
$aAddress[$prefix.'_address2'] = EvoSnapTools::getString($address->address2);
|
| 150 |
+
$aAddress[$prefix.'_house_number'] = EvoSnapTools::getString($address->house_number);
|
| 151 |
+
$aAddress[$prefix.'_city'] = EvoSnapTools::getString($address->city);
|
| 152 |
+
$aAddress[$prefix.'_zipcode'] = EvoSnapTools::getZipCode($address->zipcode);
|
| 153 |
+
$aAddress[$prefix.'_country'] = $address->country;
|
| 154 |
+
$aAddress[$prefix.'_state'] = $address->state;
|
| 155 |
+
|
| 156 |
+
return $aAddress;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Gets the languange code used by Snap* from ISO value.
|
| 161 |
+
* @param string $iso_language the language ID.
|
| 162 |
+
* @return string EVO Snap* language code.
|
| 163 |
+
*/
|
| 164 |
+
public static function getLanguage($iso_language){
|
| 165 |
+
$result = 'ENG'; //Default English
|
| 166 |
+
|
| 167 |
+
//By now, only Spanish supported.
|
| 168 |
+
// TODO Change the way the language is selected as the number
|
| 169 |
+
// of languages increases
|
| 170 |
+
if(isset($iso_language) && $iso_language == 'es'){
|
| 171 |
+
$result = 'SPA';
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
return $result;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Retrieves a value from the request.
|
| 179 |
+
* @param array $request the HTTP request.
|
| 180 |
+
* @param string $param parameter name.
|
| 181 |
+
* @return Ambigous <NULL, string>
|
| 182 |
+
*/
|
| 183 |
+
public static function getParam($request, $param){
|
| 184 |
+
if(isset($request[$param])){
|
| 185 |
+
$result = $request[$param];
|
| 186 |
+
}else{
|
| 187 |
+
$result = null;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
return $result;
|
| 191 |
+
}
|
| 192 |
+
}
|
lib/hostedpayments/exceptions/hostepayments_exception.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Hosted Payments Exception class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class HostedPayments_Exception extends Exception {
|
| 37 |
+
|
| 38 |
+
}
|
lib/hostedpayments/index.php
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*
|
| 28 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 29 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 30 |
+
* @license EVO Payments International EULA
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
define('_EVO_HP_ROOT_', __DIR__);
|
| 34 |
+
|
| 35 |
+
include_once(_EVO_HP_ROOT_.'/model/hostedpayments.php');
|
| 36 |
+
|
| 37 |
+
include_once(_EVO_HP_ROOT_.'/model/address.php');
|
| 38 |
+
include_once(_EVO_HP_ROOT_.'/model/customer.php');
|
| 39 |
+
include_once(_EVO_HP_ROOT_.'/model/order_line.php');
|
| 40 |
+
include_once(_EVO_HP_ROOT_.'/model/order.php');
|
| 41 |
+
include_once(_EVO_HP_ROOT_.'/model/subscription.php');
|
| 42 |
+
include_once(_EVO_HP_ROOT_.'/model/token.php');
|
| 43 |
+
|
| 44 |
+
include_once(_EVO_HP_ROOT_.'/model/checkout.php');
|
| 45 |
+
include_once(_EVO_HP_ROOT_.'/model/order_checkout.php');
|
| 46 |
+
include_once(_EVO_HP_ROOT_.'/model/subscription_checkout.php');
|
| 47 |
+
include_once(_EVO_HP_ROOT_.'/model/combo_checkout.php');
|
| 48 |
+
|
| 49 |
+
include_once(_EVO_HP_ROOT_.'/exceptions/hostepayments_exception.php');
|
| 50 |
+
|
| 51 |
+
include_once(_EVO_HP_ROOT_.'/evosnap_constants.php');
|
| 52 |
+
include_once(_EVO_HP_ROOT_.'/evosnap_api.php');
|
| 53 |
+
include_once(_EVO_HP_ROOT_.'/evosnap_tools.php');
|
lib/hostedpayments/model/address.php
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Address class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapAddress {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Company name.
|
| 40 |
+
* @var string
|
| 41 |
+
*/
|
| 42 |
+
public $company;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* First name.
|
| 46 |
+
* @var string
|
| 47 |
+
*/
|
| 48 |
+
public $first_name;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Last name.
|
| 52 |
+
* @var string
|
| 53 |
+
*/
|
| 54 |
+
public $last_name;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* House number.
|
| 58 |
+
* @var string
|
| 59 |
+
*/
|
| 60 |
+
public $house_number;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* PO Box Number.
|
| 64 |
+
* @var string
|
| 65 |
+
*/
|
| 66 |
+
public $po_box_number;
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Address first line.
|
| 70 |
+
* @var string
|
| 71 |
+
*/
|
| 72 |
+
public $address1;
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Address second line.
|
| 76 |
+
* @var string
|
| 77 |
+
*/
|
| 78 |
+
public $address2;
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* City.
|
| 82 |
+
* @var string
|
| 83 |
+
*/
|
| 84 |
+
public $city;
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* State. 2 char state code. Only used in US.
|
| 88 |
+
* @var string
|
| 89 |
+
*/
|
| 90 |
+
public $state;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Country. 2 chas ISO code.
|
| 94 |
+
* @var string
|
| 95 |
+
*/
|
| 96 |
+
public $country;
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* ZIP code. 1 to 9 digits, uppercase chars or spaces.
|
| 100 |
+
* @var string
|
| 101 |
+
*/
|
| 102 |
+
public $zipcode;
|
| 103 |
+
|
| 104 |
+
}
|
lib/hostedpayments/model/checkout.php
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Checkout abstract class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
abstract class SnapCheckoutAbstract {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Customer.
|
| 40 |
+
* @var SnapCustomer
|
| 41 |
+
*/
|
| 42 |
+
public $customer;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Return URL.
|
| 46 |
+
* @var string
|
| 47 |
+
*/
|
| 48 |
+
public $return_url;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Cancel URL.
|
| 52 |
+
* @var string
|
| 53 |
+
*/
|
| 54 |
+
public $cancel_url;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Auto return flag. Indicates if the customer is return directly to the return URL
|
| 58 |
+
* or redirected to the EVO Snap* Success page.
|
| 59 |
+
* @var boolean
|
| 60 |
+
*/
|
| 61 |
+
public $auto_return;
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Checkout page layout. "iframe" value if the checkout is going to be displayed
|
| 65 |
+
* embedded on an iframe.
|
| 66 |
+
* @var string
|
| 67 |
+
*/
|
| 68 |
+
public $checkout_layout;
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Flag to indicate if EVO Snap* should create a token to reuse the credit card
|
| 72 |
+
* typed by the user in the future. Only used in orders or subscriptions.
|
| 73 |
+
* @var boolean
|
| 74 |
+
*/
|
| 75 |
+
public $create_token;
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Language code.
|
| 79 |
+
* @var string
|
| 80 |
+
*/
|
| 81 |
+
public $language;
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Retrieves the action to execute.
|
| 85 |
+
*/
|
| 86 |
+
public abstract function getAction();
|
| 87 |
+
}
|
lib/hostedpayments/model/combo_checkout.php
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Order and Subscription abstract class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapCombo_Checkout extends SnapCheckoutAbstract {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Order.
|
| 40 |
+
* @var SnapOrder
|
| 41 |
+
*/
|
| 42 |
+
public $order;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Subscription.
|
| 46 |
+
* @var SnapSubscription
|
| 47 |
+
*/
|
| 48 |
+
public $subscription;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Retrieves the action to execute.
|
| 52 |
+
*/
|
| 53 |
+
public function getAction(){
|
| 54 |
+
return 'combo';
|
| 55 |
+
}
|
| 56 |
+
}
|
lib/hostedpayments/model/customer.php
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Customer class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapCustomer {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Customer ID.
|
| 40 |
+
* @var string
|
| 41 |
+
*/
|
| 42 |
+
public $id;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* First name.
|
| 46 |
+
* @var string
|
| 47 |
+
*/
|
| 48 |
+
public $first_name;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Last name.
|
| 52 |
+
* @var string
|
| 53 |
+
*/
|
| 54 |
+
public $last_name;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Phone.
|
| 58 |
+
* @var string
|
| 59 |
+
*/
|
| 60 |
+
public $phone;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Email.
|
| 64 |
+
* @var string
|
| 65 |
+
*/
|
| 66 |
+
public $email;
|
| 67 |
+
|
| 68 |
+
}
|
lib/hostedpayments/model/hostedpayments.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Hosted Payments configuration.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class HostedPayments {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Environment. True for Live, False for certification.
|
| 40 |
+
* @var boolean
|
| 41 |
+
*/
|
| 42 |
+
public $environment;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Hosted Payments Merchant Profile Code.
|
| 46 |
+
* @var string
|
| 47 |
+
*/
|
| 48 |
+
public $code;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Hosted Payments Merchant Profile Key.
|
| 52 |
+
* @var string
|
| 53 |
+
*/
|
| 54 |
+
public $key;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Retrieves the URL.
|
| 58 |
+
* @param boolean $checkout flag to indicate if the URL is for the checkout system.
|
| 59 |
+
* @return string
|
| 60 |
+
*/
|
| 61 |
+
public function getUrl($checkout){
|
| 62 |
+
if($checkout){
|
| 63 |
+
$result = $this->environment?
|
| 64 |
+
EvoSnapConstants::LIVE_CHECKOUT_URL :
|
| 65 |
+
EvoSnapConstants::CERT_CHECKOUT_URL;
|
| 66 |
+
}else{
|
| 67 |
+
$result = $this->environment?
|
| 68 |
+
EvoSnapConstants::LIVE_TXN_URL :
|
| 69 |
+
EvoSnapConstants::CERT_TXN_URL;
|
| 70 |
+
}
|
| 71 |
+
return $result;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
}
|
lib/hostedpayments/model/order.php
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Order class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapOrder {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Order ID.
|
| 40 |
+
* @var string
|
| 41 |
+
*/
|
| 42 |
+
public $id;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Bill to address.
|
| 46 |
+
* @var SnapAddress
|
| 47 |
+
*/
|
| 48 |
+
public $billto_address;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Ship to address.
|
| 52 |
+
* @var SnapSnapAddress
|
| 53 |
+
*/
|
| 54 |
+
public $shipto_address;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Array of order lines.
|
| 58 |
+
* @var array(OrderLine)
|
| 59 |
+
*/
|
| 60 |
+
public $lines;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Subtotal amount.
|
| 64 |
+
* @var float
|
| 65 |
+
*/
|
| 66 |
+
public $total_subtotal;
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Total discounts amount.
|
| 70 |
+
* @var float
|
| 71 |
+
*/
|
| 72 |
+
public $total_discount;
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Tax amount.
|
| 76 |
+
* @var float
|
| 77 |
+
*/
|
| 78 |
+
public $total_tax;
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Shipping amount. Any wrapping amount should be included here.
|
| 82 |
+
* @var float
|
| 83 |
+
*/
|
| 84 |
+
public $total_shipping;
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Total amount.
|
| 88 |
+
* @var float
|
| 89 |
+
*/
|
| 90 |
+
public $total;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Ship method.
|
| 94 |
+
* @var string
|
| 95 |
+
*/
|
| 96 |
+
public $ship_method;
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* ISO currency code.
|
| 100 |
+
* @var string
|
| 101 |
+
*/
|
| 102 |
+
public $currency_code;
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* Metadata.
|
| 106 |
+
* @var array
|
| 107 |
+
*/
|
| 108 |
+
public $metadata;
|
| 109 |
+
|
| 110 |
+
}
|
lib/hostedpayments/model/order_checkout.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Order Checkout class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapOrder_Checkout extends SnapCheckoutAbstract {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Order.
|
| 40 |
+
* @var SnapOrder
|
| 41 |
+
*/
|
| 42 |
+
public $order;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Retrieves the action to execute.
|
| 46 |
+
*/
|
| 47 |
+
public function getAction(){
|
| 48 |
+
return 'order';
|
| 49 |
+
}
|
| 50 |
+
}
|
lib/hostedpayments/model/order_line.php
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Order Line class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapOrderLine {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* SKU
|
| 40 |
+
* @var string
|
| 41 |
+
*/
|
| 42 |
+
public $sku;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Item name.
|
| 46 |
+
* @var string
|
| 47 |
+
*/
|
| 48 |
+
public $name;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Description.
|
| 52 |
+
* @var string
|
| 53 |
+
*/
|
| 54 |
+
public $description;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Item price (each).
|
| 58 |
+
* @var float
|
| 59 |
+
*/
|
| 60 |
+
public $price;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Item tax (each).
|
| 64 |
+
* @var float
|
| 65 |
+
*/
|
| 66 |
+
public $tax;
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Item quantity.
|
| 70 |
+
* @var float
|
| 71 |
+
*/
|
| 72 |
+
public $qty;
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Item description. Array of strings.
|
| 76 |
+
* @var array
|
| 77 |
+
*/
|
| 78 |
+
public $details;
|
| 79 |
+
|
| 80 |
+
}
|
lib/hostedpayments/model/subscription.php
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Subscription class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapSubscription extends SnapOrder {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Number of time between Subscription Payments.
|
| 40 |
+
* @var integer
|
| 41 |
+
*/
|
| 42 |
+
public $interval_length;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Frequency of Subscription Payments: �days�, �weeks�,�months�, �years�
|
| 46 |
+
* @var string
|
| 47 |
+
*/
|
| 48 |
+
public $interval_unit;
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Date to process first Subscription Payment. Format 'mm/dd/yyyy'.
|
| 52 |
+
* Must be at least 1 day in the future.
|
| 53 |
+
* @var string
|
| 54 |
+
*/
|
| 55 |
+
public $start_date;
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Total number of Subscription Payments. Specify �9999� for unlimited.
|
| 59 |
+
* @var integer
|
| 60 |
+
*/
|
| 61 |
+
public $total_occurrences;
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Trial number of Subscription Payments.
|
| 65 |
+
* @var integer
|
| 66 |
+
*/
|
| 67 |
+
public $trial_occurrences;
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Total amount to bill during the Trial Period (if any).
|
| 71 |
+
* @var float
|
| 72 |
+
*/
|
| 73 |
+
public $trial_amount;
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Flag to enable Automatic Payment processing on Snap* Hosted Payment.
|
| 77 |
+
* @var boolean
|
| 78 |
+
*/
|
| 79 |
+
public $auto_process;
|
| 80 |
+
|
| 81 |
+
}
|
lib/hostedpayments/model/subscription_checkout.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Subscription Checkout class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapSubscription_Checkout extends SnapCheckoutAbstract {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Subscription.
|
| 40 |
+
* @var SnapSubscription
|
| 41 |
+
*/
|
| 42 |
+
public $subscription;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Retrieves the action to execute.
|
| 46 |
+
*/
|
| 47 |
+
public function getAction(){
|
| 48 |
+
return 'sub';
|
| 49 |
+
}
|
| 50 |
+
}
|
lib/hostedpayments/model/token.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/* Copyright (c) 2015 EVO Payments International - All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* This software and documentation is subject to and made
|
| 6 |
+
* available only pursuant to the terms of an executed license
|
| 7 |
+
* agreement, and may be used only in accordance with the terms
|
| 8 |
+
* of said agreement. This software may not, in whole or in part,
|
| 9 |
+
* be copied, photocopied, reproduced, translated, or reduced to
|
| 10 |
+
* any electronic medium or machine-readable form without
|
| 11 |
+
* prior consent, in writing, from EVO Payments International, INC.
|
| 12 |
+
*
|
| 13 |
+
* Use, duplication or disclosure by the U.S. Government is subject
|
| 14 |
+
* to restrictions set forth in an executed license agreement
|
| 15 |
+
* and in subparagraph (c)(1) of the Commercial Computer
|
| 16 |
+
* Software-Restricted Rights Clause at FAR 52.227-19; subparagraph
|
| 17 |
+
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
| 18 |
+
* clause at DFARS 252.227-7013, subparagraph (d) of the Commercial
|
| 19 |
+
* Computer Software--Licensing clause at NASA FAR supplement
|
| 20 |
+
* 16-52.227-86; or their equivalent.
|
| 21 |
+
*
|
| 22 |
+
* Information in this software is subject to change without notice
|
| 23 |
+
* and does not represent a commitment on the part of EVO Payments International.
|
| 24 |
+
*
|
| 25 |
+
* Sample Code is for reference Only and is intended to be used for educational purposes. It's the responsibility of
|
| 26 |
+
* the software company to properly integrate into thier solution code that best meets thier production needs.
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Token class.
|
| 31 |
+
*
|
| 32 |
+
* @author Antonio Molinero <antonio.molinero@evopayments.com>
|
| 33 |
+
* @copyright Copyright (c) 2015 EVO Snap* (http://www.evosnap.com)
|
| 34 |
+
* @license EVO Payments International EULA
|
| 35 |
+
*/
|
| 36 |
+
class SnapToken {
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Order ID.
|
| 40 |
+
* @var string
|
| 41 |
+
*/
|
| 42 |
+
public $id;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Bill to address.
|
| 46 |
+
* @var SnapAddress
|
| 47 |
+
*/
|
| 48 |
+
public $billto_address;
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Authorization Amount.
|
| 53 |
+
* @var float
|
| 54 |
+
*/
|
| 55 |
+
public $auth_amount;
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Metadata.
|
| 59 |
+
* @var array
|
| 60 |
+
*/
|
| 61 |
+
public $metadata;
|
| 62 |
+
|
| 63 |
+
}
|
package.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Popular_Payments_Snap_HostedPayments</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>EVO Payments International EULA</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Popular Payments - Snap* Hosted Payments</summary>
|
| 10 |
+
<description>Hosted Payments is perfect for merchants who want to streamline payments and reduce PCI compliance burden.
|
| 11 |
+
Offering the fastest way to securely accept payment within your shopping cart, donations website, or online billing application.</description>
|
| 12 |
+
<notes>Initial release.</notes>
|
| 13 |
+
<authors><author><name>Popular Payments</name><user>popularpayments</user><email>partners@popularpayments.es</email></author></authors>
|
| 14 |
+
<date>2015-12-17</date>
|
| 15 |
+
<time>09:30:55</time>
|
| 16 |
+
<contents><target name="magelocale"><dir name="en_US"><file name="Evo_HostedPayments.csv" hash="258ae48ace276313fbd327c09718d5c6"/></dir><dir name="es_ES"><file name="Evo_HostedPayments.csv" hash="03b8a0cf0a10599a8858ebd52939526f"/></dir></target><target name="magelib"><dir name="hostedpayments"><file name="evosnap_api.php" hash="6b6d6e5747a9b7876e66fef0a206eff6"/><file name="evosnap_constants.php" hash="e4da0c5944f13fd87f5fa8db4aef9c26"/><file name="evosnap_tools.php" hash="91d9978a774582839d8bc524985d1ba3"/><dir name="exceptions"><file name="hostepayments_exception.php" hash="2ab976b824a27fbcf3f1cdc7dea607d8"/></dir><file name="index.php" hash="11af8d661d96429f0d2288a483e7f225"/><dir name="model"><file name="address.php" hash="acbecd3223d913b6c822d83a2bc5fde7"/><file name="checkout.php" hash="fe5f107c6df599665635a4b8feeebd7a"/><file name="combo_checkout.php" hash="48c59f828f1d5d903d4067a29208b2df"/><file name="customer.php" hash="5d193104124d98f81533fefb83ef18e8"/><file name="hostedpayments.php" hash="d2916bc74976532e2f5f05ab244764ba"/><file name="order.php" hash="4ab2632b843187391e602fa7ea01cdeb"/><file name="order_checkout.php" hash="88eed40487ce2a9b24ec50bbfd6238f5"/><file name="order_line.php" hash="27c3701ea5461e63230e1ccda575a2eb"/><file name="subscription.php" hash="ab8199fc8852d271a4160978b0ef7ada"/><file name="subscription_checkout.php" hash="b3f89fd6336f5c57adc39fd0d1bd452b"/><file name="token.php" hash="87cca899cafc5caa5c9a37b31a2fee95"/></dir></dir></target><target name="magelocal"><dir name="Evo"><dir name="HostedPayments"><dir name="Block"><file name="Form.php" hash="413d0f7ecc48334458a6677f634a4fc0"/><file name="Iframe.php" hash="7912a95f2d0536eff4741aa1d4d13de4"/><file name="Iframevalidation.php" hash="111d9833f030fabcb7baa18f926cf9f0"/><file name="Info.php" hash="086ca3365fe27b818900ce805bbcb45c"/></dir><dir name="Helper"><file name="Data.php" hash="c3b73cb701fea4bc08ca4ebe02741fd8"/></dir><dir name="Model"><file name="Hostedpayment.php" hash="807c952986c2461ad7fd9dba45d66dba"/><file name="Payment.php" hash="72f947fbeaaaae429a83239e5658882d"/><dir name="Resource"><dir name="Hostedpayment"><file name="Collection.php" hash="b51a062a9bbfc5a69b1a3b6575991e1a"/></dir><file name="Hostedpayment.php" hash="cc3c32dcebabf4c5b0abd7a2dcbbe924"/><file name="Setup.php" hash="96a49aea7e98d3470f2fb2abe23a53dc"/></dir></dir><dir name="controllers"><file name="ProcessingController.php" hash="143330b3ff1af64194288711c62cb82f"/></dir><dir name="etc"><file name="config.xml" hash="69ba6b12e8726fc7537d61c45f955185"/><file name="system.xml" hash="b42994adda2b2564ca6396bfca114e04"/></dir><dir name="sql"><dir name="hostedpayments_setup"><file name="install-0.1.0.php" hash="08d8b35784c3c8b1a2355022cb4da566"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="evo"><file name="info.phtml" hash="2b3a1b10beabe5c667956ccb85fd1e6e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="evohostedpayments.xml" hash="ff3f05c4e91e1495cf8cc53632d6279d"/></dir><dir name="template"><dir name="evo"><file name="form.phtml" hash="47af0cbfdfb7b2066f3e6d0238b22ef7"/><file name="iframe.phtml" hash="3dc536079f66dae2cc80fd5dd3e5a207"/><file name="iframevalidation.phtml" hash="5060a6563cdeebad96430165b66e44c8"/><file name="info.phtml" hash="63231065d6a007ebfec47a20ae20986b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="evo"><file name="logo.png" hash="a108e448a1066ac4ee0152302998182c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="evo"><file name="brand-logos.png" hash="489b1ad5d5952d60787add247219e2e7"/><file name="cc-logo.png" hash="702b7d0ce2f4748684d79ae2ab7bb33b"/><file name="logo.png" hash="a108e448a1066ac4ee0152302998182c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Evo_HostedPayments.xml" hash="1c8ee1cde5bd6360dfe14e3ee91252ad"/></dir></target></contents>
|
| 17 |
+
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.3.0</min><max>5.9.0</max></php></required></dependencies>
|
| 19 |
+
</package>
|
skin/adminhtml/default/default/images/evo/logo.png
ADDED
|
Binary file
|
skin/frontend/base/default/images/evo/brand-logos.png
ADDED
|
Binary file
|
skin/frontend/base/default/images/evo/cc-logo.png
ADDED
|
Binary file
|
skin/frontend/base/default/images/evo/logo.png
ADDED
|
Binary file
|
