Version Notes
* Rewrote from scratch
Download this release
Release Info
| Developer | PayIntelligent |
| Extension | Paymill_Paymill |
| Version | 3.0.0 |
| Comparing to | |
| See all releases | |
Version 3.0.0
- app/code/community/Paymill/Paymill/Block/Adminhtml/Log.php +32 -0
- app/code/community/Paymill/Paymill/Block/Adminhtml/Log/Grid.php +136 -0
- app/code/community/Paymill/Paymill/Block/Payment/Form/PaymentFormCreditcard.php +30 -0
- app/code/community/Paymill/Paymill/Block/Payment/Form/PaymentFormDirectdebit.php +31 -0
- app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormCreditcard.php +50 -0
- app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormDirectdebit.php +50 -0
- app/code/community/Paymill/Paymill/Helper/CustomerHelper.php +63 -0
- app/code/community/Paymill/Paymill/Helper/Data.php +99 -0
- app/code/community/Paymill/Paymill/Helper/FastCheckoutHelper.php +88 -0
- app/code/community/Paymill/Paymill/Helper/LoggingHelper.php +45 -0
- app/code/community/Paymill/Paymill/Helper/OptionHelper.php +141 -0
- app/code/community/Paymill/Paymill/Helper/PaymentHelper.php +268 -0
- app/code/community/Paymill/Paymill/Helper/RefundHelper.php +82 -0
- app/code/community/Paymill/Paymill/Helper/TransactionHelper.php +95 -0
- app/code/community/Paymill/Paymill/Model/Fastcheckout.php +136 -0
- app/code/community/Paymill/Paymill/Model/Log.php +51 -0
- app/code/community/Paymill/Paymill/Model/Method/MethodModelAbstract.php +237 -0
- app/code/community/Paymill/Paymill/Model/Method/MethodModelCreditcard.php +146 -0
- app/code/community/Paymill/Paymill/Model/Method/MethodModelDirectdebit.php +43 -0
- app/code/community/Paymill/Paymill/Model/Mysql4/Fastcheckout.php +30 -0
- app/code/community/Paymill/Paymill/Model/Mysql4/Fastcheckout/Collection.php +30 -0
- app/code/community/Paymill/Paymill/Model/Mysql4/Log.php +30 -0
- app/code/community/Paymill/Paymill/Model/Mysql4/Log/Collection.php +30 -0
- app/code/community/Paymill/Paymill/Model/Observer.php +70 -0
- app/code/community/Paymill/Paymill/Model/TransactionData.php +62 -0
- app/code/community/Paymill/Paymill/controllers/Adminhtml/LogController.php +65 -0
- app/code/community/Paymill/Paymill/etc/adminhtml.xml +16 -0
- app/code/community/Paymill/Paymill/etc/config.xml +162 -0
- app/code/community/Paymill/Paymill/etc/system.xml +228 -0
- app/code/community/Paymill/Paymill/sql/paymill_setup/mysql4-install-3.0.0.php +46 -0
- app/design/adminhtml/base/default/layout/paymill.xml +12 -0
- app/design/adminhtml/base/default/template/paymill/payment/info/creditcard.phtml +14 -0
- app/design/adminhtml/base/default/template/paymill/payment/info/directdebit.phtml +14 -0
- app/design/frontend/base/default/layout/paymill.xml +19 -0
- app/design/frontend/base/default/template/paymill/payment/form/creditcard.phtml +63 -0
- app/design/frontend/base/default/template/paymill/payment/form/directdebit.phtml +47 -0
- app/design/frontend/base/default/template/paymill/payment/info/creditcard.phtml +6 -0
- app/design/frontend/base/default/template/paymill/payment/info/directdebit.phtml +6 -0
- app/etc/modules/Paymill_Paymill.xml +16 -0
- app/locale/de_DE/Paymill_Paymill.csv +54 -0
- app/locale/en_GB/Paymill_Paymill.csv +54 -0
- app/locale/en_US/Paymill_Paymill.csv +54 -0
- js/paymill/paymentForm.js +201 -0
- lib/Services/Paymill/Apiclient/Curl.php +158 -0
- lib/Services/Paymill/Apiclient/Interface.php +20 -0
- lib/Services/Paymill/Apiclient/paymill.crt +25 -0
- lib/Services/Paymill/Base.php +145 -0
- lib/Services/Paymill/Clients.php +14 -0
- lib/Services/Paymill/Exception.php +17 -0
- lib/Services/Paymill/LoggingInterface.php +14 -0
- lib/Services/Paymill/Offers.php +14 -0
- lib/Services/Paymill/PaymentProcessor.php +463 -0
- lib/Services/Paymill/Payments.php +27 -0
- lib/Services/Paymill/Preauthorizations.php +27 -0
- lib/Services/Paymill/Refunds.php +55 -0
- lib/Services/Paymill/Subscriptions.php +14 -0
- lib/Services/Paymill/Transactions.php +40 -0
- lib/Services/Paymill/Webhooks.php +14 -0
- package.xml +23 -0
- skin/frontend/base/default/css/paymill/logo.css +17 -0
- skin/frontend/base/default/images/paymill/icon_mastercard.png +0 -0
- skin/frontend/base/default/images/paymill/icon_paymill.png +0 -0
- skin/frontend/base/default/images/paymill/icon_visa.png +0 -0
app/code/community/Paymill/Paymill/Block/Adminhtml/Log.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
$this->_blockGroup = 'paymill';
|
| 28 |
+
$this->_controller = 'adminhtml_log';
|
| 29 |
+
$this->_headerText = Mage::helper('paymill')->__('paymill_log');
|
| 30 |
+
parent::__construct();
|
| 31 |
+
}
|
| 32 |
+
}
|
app/code/community/Paymill/Paymill/Block/Adminhtml/Log/Grid.php
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Is filter allowed
|
| 24 |
+
*
|
| 25 |
+
* @var boolean
|
| 26 |
+
*/
|
| 27 |
+
protected $_isFilterAllowed = true;
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Is sortable
|
| 31 |
+
*
|
| 32 |
+
* @var boolean
|
| 33 |
+
*/
|
| 34 |
+
protected $_isSortable = true;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Construct
|
| 38 |
+
*/
|
| 39 |
+
public function __construct()
|
| 40 |
+
{
|
| 41 |
+
parent::__construct();
|
| 42 |
+
$this->setId('log_grid');
|
| 43 |
+
$this->setDefaultSort('id');
|
| 44 |
+
$this->setDefaultDir('DESC');
|
| 45 |
+
$this->setSaveParametersInSession(true);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Is filter allowed
|
| 50 |
+
*/
|
| 51 |
+
protected function _isFilterAllowed()
|
| 52 |
+
{
|
| 53 |
+
return $this->_isFilterAllowed;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Is sortable
|
| 58 |
+
*/
|
| 59 |
+
protected function _isSortable()
|
| 60 |
+
{
|
| 61 |
+
return $this->_isSortable;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Retrive massaction block
|
| 66 |
+
*
|
| 67 |
+
* @return Mage_Adminhtml_Block_Widget_Grid_Massaction
|
| 68 |
+
*/
|
| 69 |
+
public function getMassactionBlock()
|
| 70 |
+
{
|
| 71 |
+
return $this->getChild('massaction')->setErrorText(Mage::helper('paymill')->__('paymill_error_text_no_entry_selected'));
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Prepare Collection
|
| 76 |
+
*
|
| 77 |
+
* @return Paymill_Paymill_Block_Adminhtml_Log_Grid
|
| 78 |
+
*/
|
| 79 |
+
protected function _prepareCollection()
|
| 80 |
+
{
|
| 81 |
+
$collection = Mage::getModel('paymill/log')->getCollection();
|
| 82 |
+
$this->setCollection($collection);
|
| 83 |
+
return parent::_prepareCollection();
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Prepare Columns
|
| 88 |
+
*
|
| 89 |
+
* @return Paymill_Paymill_Block_Adminhtml_Log_Grid
|
| 90 |
+
*/
|
| 91 |
+
protected function _prepareColumns()
|
| 92 |
+
{
|
| 93 |
+
$this->addColumn('entry_date', array(
|
| 94 |
+
'header' => Mage::helper('paymill')->__('paymill_backend_log_entry_date'),
|
| 95 |
+
'index' => 'entry_date',
|
| 96 |
+
));
|
| 97 |
+
$this->addColumn('version', array(
|
| 98 |
+
'header' => Mage::helper('paymill')->__('paymill_backend_log_version'),
|
| 99 |
+
'index' => 'version',
|
| 100 |
+
));
|
| 101 |
+
$this->addColumn('merchant_info', array(
|
| 102 |
+
'header' => Mage::helper('paymill')->__('paymill_backend_log_merchant_info'),
|
| 103 |
+
'index' => 'merchant_info',
|
| 104 |
+
));
|
| 105 |
+
$this->addColumn('dev_info', array(
|
| 106 |
+
'header' => Mage::helper('paymill')->__('paymill_backend_log_dev_info'),
|
| 107 |
+
'index' => 'dev_info',
|
| 108 |
+
));
|
| 109 |
+
$this->addColumn('dev_info_additional', array(
|
| 110 |
+
'header' => Mage::helper('paymill')->__('paymill_backend_log_dev_info_additional'),
|
| 111 |
+
'index' => 'dev_info_additional',
|
| 112 |
+
));
|
| 113 |
+
|
| 114 |
+
return parent::_prepareColumns();
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Prepares Massaction for deletion of Logentries
|
| 119 |
+
*
|
| 120 |
+
* @return Paymill_Paymill_Block_Adminhtml_Log_Grid
|
| 121 |
+
*/
|
| 122 |
+
protected function _prepareMassaction()
|
| 123 |
+
{
|
| 124 |
+
$this->setMassactionIdField('id');
|
| 125 |
+
$this->getMassactionBlock()->setFormFieldName('log_id');
|
| 126 |
+
|
| 127 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 128 |
+
'label' => Mage::helper('paymill')->__('paymill_action_delete'),
|
| 129 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 130 |
+
'confirm' => Mage::helper('paymill')->__('paymill_dialog_confirm'),
|
| 131 |
+
));
|
| 132 |
+
|
| 133 |
+
return $this;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
}
|
app/code/community/Paymill/Paymill/Block/Payment/Form/PaymentFormCreditcard.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Block_Payment_Form_PaymentFormCreditcard extends Mage_Payment_Block_Form
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
protected function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->setTemplate('paymill/payment/form/creditcard.phtml');
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/community/Paymill/Paymill/Block/Payment/Form/PaymentFormDirectdebit.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Block_Payment_Form_PaymentFormDirectdebit extends Mage_Payment_Block_Form
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
protected function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->setTemplate('paymill/payment/form/directdebit.phtml');
|
| 29 |
+
|
| 30 |
+
}
|
| 31 |
+
}
|
app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormCreditcard.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Block_Payment_Info_PaymentFormCreditcard extends Mage_Payment_Block_Info
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
protected function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->setTemplate('paymill/payment/info/creditcard.phtml');
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Add custom information to payment method information
|
| 33 |
+
*
|
| 34 |
+
* @param Varien_Object|array $transport
|
| 35 |
+
*/
|
| 36 |
+
protected function _prepareSpecificInformation($transport = null)
|
| 37 |
+
{
|
| 38 |
+
if (null !== $this->_paymentSpecificInformation) {
|
| 39 |
+
return $this->_paymentSpecificInformation;
|
| 40 |
+
}
|
| 41 |
+
$transport = parent::_prepareSpecificInformation($transport);
|
| 42 |
+
|
| 43 |
+
$data = array();
|
| 44 |
+
$data['paymillTransactionId'] = $this->getInfo()->getAdditionalInformation('paymillTransactionId');
|
| 45 |
+
$data['imgUrl'] = Mage::helper('paymill')->getImagePath() . "icon_paymill.png";
|
| 46 |
+
|
| 47 |
+
return $transport->setData(array_merge($data, $transport->getData()));
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
}
|
app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormDirectdebit.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Block_Payment_Info_PaymentFormDirectdebit extends Mage_Payment_Block_Info
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
protected function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->setTemplate('paymill/payment/info/directdebit.phtml');
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Add custom information to payment method information
|
| 33 |
+
*
|
| 34 |
+
* @param Varien_Object|array $transport
|
| 35 |
+
*/
|
| 36 |
+
protected function _prepareSpecificInformation($transport = null)
|
| 37 |
+
{
|
| 38 |
+
if (null !== $this->_paymentSpecificInformation) {
|
| 39 |
+
return $this->_paymentSpecificInformation;
|
| 40 |
+
}
|
| 41 |
+
$transport = parent::_prepareSpecificInformation($transport);
|
| 42 |
+
|
| 43 |
+
$data = array();
|
| 44 |
+
$data['paymillTransactionId'] = $this->getInfo()->getAdditionalInformation('paymillTransactionId');
|
| 45 |
+
$data['imgUrl'] = Mage::helper('paymill')->getImagePath() . "icon_paymill.png";
|
| 46 |
+
|
| 47 |
+
return $transport->setData(array_merge($data, $transport->getData()));
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
}
|
app/code/community/Paymill/Paymill/Helper/CustomerHelper.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Customer Helper contains methods dealing customer information.
|
| 22 |
+
*/
|
| 23 |
+
class Paymill_Paymill_Helper_CustomerHelper extends Mage_Core_Helper_Abstract
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* Returns the current customers full name
|
| 27 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 28 |
+
* @return string the customers full name
|
| 29 |
+
*/
|
| 30 |
+
public function getCustomerName($object)
|
| 31 |
+
{
|
| 32 |
+
$custFirstName = $object->getBillingAddress()->getFirstname();
|
| 33 |
+
$custLastName = $object->getBillingAddress()->getLastname();;
|
| 34 |
+
$custFullName = $custFirstName . " " . $custLastName;
|
| 35 |
+
return $custFullName;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Returns the current customers email adress.
|
| 40 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 41 |
+
* @return string the customers email adress
|
| 42 |
+
*/
|
| 43 |
+
public function getCustomerEmail($object)
|
| 44 |
+
{
|
| 45 |
+
return $object->getCustomerEmail();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Returns the Id of the user currently logged in.
|
| 50 |
+
* Returns null if there is no logged in user.
|
| 51 |
+
* @return String userId
|
| 52 |
+
*/
|
| 53 |
+
public function getUserId()
|
| 54 |
+
{
|
| 55 |
+
$result = null;
|
| 56 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()){
|
| 57 |
+
$result = Mage::getSingleton('customer/session')->getId();
|
| 58 |
+
}else {
|
| 59 |
+
|
| 60 |
+
}
|
| 61 |
+
return $result;
|
| 62 |
+
}
|
| 63 |
+
}
|
app/code/community/Paymill/Paymill/Helper/Data.php
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Data Helper contains methods dealing with shopiformation.
|
| 22 |
+
* Examples for this might be f.Ex backend option states or pathes.
|
| 23 |
+
*/
|
| 24 |
+
class Paymill_Paymill_Helper_Data extends Mage_Core_Helper_Abstract
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Returns the path to the image directory as a string
|
| 28 |
+
* @return string Path
|
| 29 |
+
*/
|
| 30 |
+
public function getImagePath()
|
| 31 |
+
{
|
| 32 |
+
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'skin/frontend/base/default/images/paymill/';
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Returns the path to the js directory as a string
|
| 37 |
+
* @return string Path
|
| 38 |
+
*/
|
| 39 |
+
public function getJscriptPath()
|
| 40 |
+
{
|
| 41 |
+
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'js/paymill/';
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Returns the API Url
|
| 46 |
+
* @return string
|
| 47 |
+
*/
|
| 48 |
+
public function getApiUrl()
|
| 49 |
+
{
|
| 50 |
+
return "https://api.paymill.com/v2/";
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Returns the version of the plugin as a string
|
| 56 |
+
* @return String Version
|
| 57 |
+
*/
|
| 58 |
+
public function getVersion()
|
| 59 |
+
{
|
| 60 |
+
return "v3.0.0";
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Returns a boolean deciding if the template is going to be displayed of not
|
| 65 |
+
* @param String $code payment code
|
| 66 |
+
* @return boolean
|
| 67 |
+
*/
|
| 68 |
+
public function showTemplateForm($code){
|
| 69 |
+
$optionHelper = Mage::helper('paymill/optionHelper');
|
| 70 |
+
$fcHelper = Mage::helper('paymill/fastCheckoutHelper');
|
| 71 |
+
|
| 72 |
+
return !($optionHelper->isFastCheckoutEnabled() && $fcHelper->hasData($code));
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Returns the div tag opening defining the visibility of the payment form
|
| 77 |
+
* @param String $code
|
| 78 |
+
* @return string
|
| 79 |
+
*/
|
| 80 |
+
public function getFormTypeForDisplay($code)
|
| 81 |
+
{
|
| 82 |
+
if($this->showTemplateForm($code)){
|
| 83 |
+
return "<div>";
|
| 84 |
+
} else {
|
| 85 |
+
return "<div style='display:none;'>";
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Returns the Source string passt to every transaction
|
| 91 |
+
* @return String Source
|
| 92 |
+
*/
|
| 93 |
+
public function getSourceString()
|
| 94 |
+
{
|
| 95 |
+
$version = $this->getVersion();
|
| 96 |
+
$shopversion = Mage::getVersion();
|
| 97 |
+
return $version . "_Magento_" . $shopversion;
|
| 98 |
+
}
|
| 99 |
+
}
|
app/code/community/Paymill/Paymill/Helper/FastCheckoutHelper.php
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The FastCheckout Helper contains methods dealing with the fast checkout process.
|
| 22 |
+
* Examples for this might be f.Ex a customers userId used for matching client data or methods to grant easier access the db information.
|
| 23 |
+
*/
|
| 24 |
+
class Paymill_Paymill_Helper_FastCheckoutHelper extends Mage_Core_Helper_Abstract
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Calls the Data helper to get the state of the Fast Checkout option
|
| 28 |
+
*/
|
| 29 |
+
public function isFastCheckoutEnabled()
|
| 30 |
+
{
|
| 31 |
+
return Mage::helper("paymill/optionHelper")->isFastCheckoutEnabled();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Returns the clientId matched with the userId passed as an argument.
|
| 36 |
+
* If no match is found, the return value will be null.
|
| 37 |
+
* @param String $userId Unique identifier of the customer
|
| 38 |
+
* @return String clientId matched with the userId <b>can be null if no match is found</b>
|
| 39 |
+
*/
|
| 40 |
+
public function getClientId()
|
| 41 |
+
{
|
| 42 |
+
$userId = Mage::helper("paymill/customerHelper")->getUserId();
|
| 43 |
+
$collection = Mage::getModel('paymill/fastcheckout')->getCollection();
|
| 44 |
+
$collection->addFilter('user_id', $userId);
|
| 45 |
+
$obj = $collection->getFirstItem();
|
| 46 |
+
return $obj->getClientId();
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Returns the PaymentId associated with the current user
|
| 51 |
+
* @param String $code PaymentMethodCode
|
| 52 |
+
* @return String paymentId
|
| 53 |
+
*/
|
| 54 |
+
public function getPaymentId($code)
|
| 55 |
+
{
|
| 56 |
+
$userId = Mage::helper("paymill/customerHelper")->getUserId();
|
| 57 |
+
return Mage::getModel("paymill/fastcheckout")->getPaymentId($userId, $code);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Returns a boolean describing whether there is saved fc data for the current user
|
| 62 |
+
* @param String $code PaymentMethodCode
|
| 63 |
+
* @return boolean
|
| 64 |
+
*/
|
| 65 |
+
public function hasData($code){
|
| 66 |
+
$userId = Mage::helper("paymill/customerHelper")->getUserId();
|
| 67 |
+
if(Mage::getModel("paymill/fastcheckout")->hasFcData($userId, $code)){
|
| 68 |
+
return true;
|
| 69 |
+
}
|
| 70 |
+
return false;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Saves the dataset into the database
|
| 75 |
+
* @param String $code paymentCode
|
| 76 |
+
* @param String $clientId Description
|
| 77 |
+
* @param String $name Description
|
| 78 |
+
*/
|
| 79 |
+
public function saveData($code, $clientId, $paymentId)
|
| 80 |
+
{
|
| 81 |
+
$userId = Mage::helper("paymill/customerHelper")->getUserId();
|
| 82 |
+
if(isset($userId)){
|
| 83 |
+
Mage::getModel("paymill/fastcheckout")->saveFcData($code, $userId, $clientId, $paymentId);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
}
|
app/code/community/Paymill/Paymill/Helper/LoggingHelper.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Logging Helper contains methods dealing with Log entries.
|
| 22 |
+
* Examples for this might be f.Ex logging data or reading from the log.
|
| 23 |
+
*/
|
| 24 |
+
class Paymill_Paymill_Helper_LoggingHelper extends Mage_Core_Helper_Abstract implements Services_Paymill_LoggingInterface
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Inserts the arguments into the db log
|
| 28 |
+
* @param String $merchantInfo
|
| 29 |
+
* @param String $devInfo
|
| 30 |
+
* @param String $devInfoAdditional
|
| 31 |
+
*/
|
| 32 |
+
public function log($merchantInfo, $devInfo = null, $devInfoAdditional = null)
|
| 33 |
+
{
|
| 34 |
+
Mage::getModel('paymill/log')->log($merchantInfo, $devInfo, $devInfoAdditional);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Returns a collection of all log-entries
|
| 39 |
+
* @return Collection Description
|
| 40 |
+
*/
|
| 41 |
+
public function getEntries(){
|
| 42 |
+
$collection = Mage::getModel('paymill/log')->getCollection();
|
| 43 |
+
return $collection;
|
| 44 |
+
}
|
| 45 |
+
}
|
app/code/community/Paymill/Paymill/Helper/OptionHelper.php
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Option Helper contains methods dealing with reading out backend options.
|
| 22 |
+
*/
|
| 23 |
+
class Paymill_Paymill_Helper_OptionHelper extends Mage_Core_Helper_Abstract
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* Returns the Public Key from the Backend as a string
|
| 27 |
+
* @return String
|
| 28 |
+
*/
|
| 29 |
+
public function getPublicKey()
|
| 30 |
+
{
|
| 31 |
+
return trim($this->_getGeneralOption("public_key"));
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Returns the Private Key from the Backend as a string
|
| 36 |
+
* @return String
|
| 37 |
+
*/
|
| 38 |
+
public function getPrivateKey()
|
| 39 |
+
{
|
| 40 |
+
return trim($this->_getGeneralOption("private_key"));
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Returns the state of the "Logging" Switch from the Backend as a Boolean
|
| 45 |
+
* @return Boolean
|
| 46 |
+
*/
|
| 47 |
+
public function isLogging()
|
| 48 |
+
{
|
| 49 |
+
return $this->_getGeneralOption("logging_active");
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Returns the state of the "FastCheckout" Switch from the Backend as a Boolean
|
| 54 |
+
* @return Boolean
|
| 55 |
+
*/
|
| 56 |
+
public function isFastCheckoutEnabled()
|
| 57 |
+
{
|
| 58 |
+
return $this->_getGeneralOption("fc_active");
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Returns the state of the "Debug" Switch from the Backend as a Boolean
|
| 63 |
+
* @return Boolean
|
| 64 |
+
*/
|
| 65 |
+
public function isInDebugMode()
|
| 66 |
+
{
|
| 67 |
+
return $this->_getGeneralOption("debugging_active");
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Returns the state of the "Show Labels" Switch from the Backend as a Boolean
|
| 72 |
+
* @return Boolean
|
| 73 |
+
*/
|
| 74 |
+
public function isShowingLabels()
|
| 75 |
+
{
|
| 76 |
+
return $this->_getGeneralOption("show_label");
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Returns the value of the given backend option.
|
| 81 |
+
* <p align = "center">Needs the $_storeId to be set to work properly</p>
|
| 82 |
+
* @param String $choice Name of the desired category as a string
|
| 83 |
+
* @param String $optionName Name of the desired option as a string
|
| 84 |
+
* @return mixed Value of the Backend Option
|
| 85 |
+
* @throws Exception "No Store Id has been set."
|
| 86 |
+
*/
|
| 87 |
+
private function _getBackendOption($choice, $optionName)
|
| 88 |
+
{
|
| 89 |
+
try{
|
| 90 |
+
$value = Mage::getStoreConfig('payment/'.$choice.'/'.$optionName, Mage::app()->getStore()->getStoreId());
|
| 91 |
+
}catch(Exception $ex){
|
| 92 |
+
$value = "An Error has occoured getting the config element";
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return $value;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Returns the Value of the general Option with the given name.
|
| 100 |
+
* <p align = "center">Needs the $_storeId to be set to work properly</p>
|
| 101 |
+
* @param String $optionName
|
| 102 |
+
* @return mixed Value
|
| 103 |
+
*/
|
| 104 |
+
private function _getGeneralOption($optionName)
|
| 105 |
+
{
|
| 106 |
+
return $this->_getBackendOption("paymill", $optionName);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* Returns the state of the "preAuth" Switch from the Backend as a Boolean
|
| 111 |
+
* @return boolean
|
| 112 |
+
*/
|
| 113 |
+
public function isPreAuthorizing()
|
| 114 |
+
{
|
| 115 |
+
return $this->_getGeneralOption("preAuth_active");
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Returns the Token Tolerance Value for the given payment
|
| 120 |
+
* @param String $paymentType Paymentcode
|
| 121 |
+
* @return int Token Tolerance Value (in multiplied format eg 10.00 to 1000)
|
| 122 |
+
*/
|
| 123 |
+
public function getTokenTolerance($paymentType)
|
| 124 |
+
{
|
| 125 |
+
if($paymentType === 'paymill_creditcard'){
|
| 126 |
+
$value = $this->_getBackendOption("paymill_creditcard", 'tokenTolerance');
|
| 127 |
+
$value = str_replace ( ',' , '.' , $value );
|
| 128 |
+
$value = (int)($value*100);
|
| 129 |
+
return $value;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
if($paymentType === 'paymill_directdebit'){
|
| 133 |
+
$value = $this->_getBackendOption("paymill_directdebit", 'tokenTolerance');
|
| 134 |
+
$value = str_replace ( ',' , '.' , $value );
|
| 135 |
+
$value = (int)($value*100);
|
| 136 |
+
return $value;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
return 0;
|
| 140 |
+
}
|
| 141 |
+
}
|
app/code/community/Paymill/Paymill/Helper/PaymentHelper.php
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Payment Helper contains methods dealing with payment relevant information.
|
| 22 |
+
* Examples for this might be f.Ex customer data, formating of basket amounts or similar.
|
| 23 |
+
*/
|
| 24 |
+
class Paymill_Paymill_Helper_PaymentHelper extends Mage_Core_Helper_Abstract
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Returns the order amount in the smallest possible unit (f.Ex. cent for the EUR currency)
|
| 28 |
+
* <p align = "center" color = "red">At the moment, only currencies with a 1:100 conversion are supported. Special cases need to be added if necessary</p>
|
| 29 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 30 |
+
* @return int Amount in the smallest possible unit
|
| 31 |
+
*/
|
| 32 |
+
public function getAmount($object = null)
|
| 33 |
+
{
|
| 34 |
+
if($object == null){
|
| 35 |
+
$object = Mage::getSingleton('checkout/session')->getQuote();
|
| 36 |
+
}
|
| 37 |
+
$decimalTotal = $object->getGrandTotal();
|
| 38 |
+
$amountTotal = $decimalTotal * 100;
|
| 39 |
+
return $amountTotal;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Returns the currency compliant to ISO 4217 (3 char code)
|
| 44 |
+
* @return string 3 Character long currency code
|
| 45 |
+
*/
|
| 46 |
+
public function getCurrency()
|
| 47 |
+
{
|
| 48 |
+
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
|
| 49 |
+
return $currency_code;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Returns the description you want to display in the Paymill Backend.
|
| 54 |
+
* The current format is [OrderId] [Email adress of the customer]
|
| 55 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 56 |
+
* @return string
|
| 57 |
+
*/
|
| 58 |
+
public function getDescription($object)
|
| 59 |
+
{
|
| 60 |
+
$orderId = $this->getOrderId($object);
|
| 61 |
+
$customerEmail = Mage::helper("paymill/customerHelper")->getCustomerEmail($object);
|
| 62 |
+
$description = $orderId. ", " . $customerEmail;
|
| 63 |
+
|
| 64 |
+
return $description;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Returns the short tag of the Payment
|
| 69 |
+
* @param String $code
|
| 70 |
+
* @return string
|
| 71 |
+
*/
|
| 72 |
+
public function getPaymentType($code)
|
| 73 |
+
{
|
| 74 |
+
//Creditcard
|
| 75 |
+
if($code === "paymill_creditcard"){
|
| 76 |
+
$type = "cc";
|
| 77 |
+
}
|
| 78 |
+
//Directdebit
|
| 79 |
+
if($code === "paymill_directdebit"){
|
| 80 |
+
$type = "elv";
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
return $type;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Returns the reserved order id
|
| 88 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 89 |
+
* @return String OrderId
|
| 90 |
+
*/
|
| 91 |
+
public function getOrderId($object)
|
| 92 |
+
{
|
| 93 |
+
$orderId = null;
|
| 94 |
+
|
| 95 |
+
if($object instanceof Mage_Sales_Model_Order){
|
| 96 |
+
$orderId = $object->getIncrementId();
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
if($object instanceof Mage_Sales_Model_Quote){
|
| 100 |
+
$orderId = $object->getReservedOrderId();
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
return $orderId;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Returns an instance of the paymentProcessor class.
|
| 110 |
+
* @param String $paymentCode name of the payment
|
| 111 |
+
* @param String $token Token generated by the Javascript
|
| 112 |
+
* @param Integer $authorizedAmount Amount used for the Token generation
|
| 113 |
+
* @return Services_Paymill_PaymentProcessor
|
| 114 |
+
*/
|
| 115 |
+
public function createPaymentProcessor($paymentCode, $token)
|
| 116 |
+
{
|
| 117 |
+
$privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
|
| 118 |
+
$apiUrl = Mage::helper('paymill')->getApiUrl();
|
| 119 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 120 |
+
$libBase = null;
|
| 121 |
+
|
| 122 |
+
$params = array();
|
| 123 |
+
$params['token'] = $token;
|
| 124 |
+
$params['amount'] = (int)$this->getAmount();
|
| 125 |
+
$params['currency'] = $this->getCurrency();
|
| 126 |
+
$params['payment'] = $this->getPaymentType($paymentCode); // The chosen payment (cc | elv)
|
| 127 |
+
$params['name'] = Mage::helper("paymill/customerHelper")->getCustomerName($quote);
|
| 128 |
+
$params['email'] = Mage::helper("paymill/customerHelper")->getCustomerEmail($quote);
|
| 129 |
+
$params['description'] = $this->getDescription($quote);
|
| 130 |
+
$params['source'] = Mage::helper('paymill')->getSourceString();
|
| 131 |
+
|
| 132 |
+
return new Services_Paymill_PaymentProcessor($privateKey, $apiUrl, $libBase, $params, Mage::helper('paymill/loggingHelper'));
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* Creates a client object from the given data and returns the Id
|
| 137 |
+
* @param String $email
|
| 138 |
+
* @param String $description
|
| 139 |
+
* @return String ClientId
|
| 140 |
+
* @throws Exception "Invalid Result Exception: Invalid ResponseCode for Client"
|
| 141 |
+
*/
|
| 142 |
+
public function createClient($email, $description)
|
| 143 |
+
{
|
| 144 |
+
$privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
|
| 145 |
+
$apiUrl = Mage::helper('paymill')->getApiUrl();
|
| 146 |
+
|
| 147 |
+
if(empty($privateKey)){
|
| 148 |
+
Mage::helper('paymill/loggingHelper')->log("No private Key was set.");
|
| 149 |
+
Mage::throwException("No private Key was set.");
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
$clientsObject = new Services_Paymill_Clients($privateKey, $apiUrl);
|
| 153 |
+
|
| 154 |
+
$client = $clientsObject->create(
|
| 155 |
+
array(
|
| 156 |
+
'email' => $email,
|
| 157 |
+
'description' => $description
|
| 158 |
+
)
|
| 159 |
+
);
|
| 160 |
+
|
| 161 |
+
if (isset($client['data']['response_code']) && $client['data']['response_code'] !== 20000) {
|
| 162 |
+
$this->_log("An Error occured: " . $client['data']['response_code'], var_export($client, true));
|
| 163 |
+
throw new Exception("Invalid Result Exception: Invalid ResponseCode for Client");
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
$clientId = $client['id'];
|
| 167 |
+
Mage::helper('paymill/loggingHelper')->log("Client created.", $clientId);
|
| 168 |
+
return $clientId;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
/**
|
| 172 |
+
* Creates a payment object from the given data and returns the Id
|
| 173 |
+
* @param String $token
|
| 174 |
+
* @param String $clientId
|
| 175 |
+
* @return String PaymentId
|
| 176 |
+
* @throws Exception "Invalid Result Exception: Invalid ResponseCode for Payment"
|
| 177 |
+
*/
|
| 178 |
+
public function createPayment($token, $clientId)
|
| 179 |
+
{
|
| 180 |
+
$privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
|
| 181 |
+
$apiUrl = Mage::helper('paymill')->getApiUrl();
|
| 182 |
+
|
| 183 |
+
if(empty($privateKey)){
|
| 184 |
+
Mage::helper('paymill/loggingHelper')->log("No private Key was set.");
|
| 185 |
+
Mage::throwException("No private Key was set.");
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
$paymentsObject = new Services_Paymill_Payments($privateKey, $apiUrl);
|
| 189 |
+
|
| 190 |
+
$payment = $paymentsObject->create(
|
| 191 |
+
array(
|
| 192 |
+
'token' => $token,
|
| 193 |
+
'client' => $clientId
|
| 194 |
+
)
|
| 195 |
+
);
|
| 196 |
+
|
| 197 |
+
if (isset($payment['data']['response_code']) && $payment['data']['response_code'] !== 20000) {
|
| 198 |
+
$this->_log("An Error occured: " . $payment['data']['response_code'], var_export($payment, true));
|
| 199 |
+
throw new Exception("Invalid Result Exception: Invalid ResponseCode for Payment");
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
$paymentId = $payment['id'];
|
| 203 |
+
Mage::helper('paymill/loggingHelper')->log("Payment created.", $paymentId);
|
| 204 |
+
return $paymentId;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Creates a preAuthorization with the given arguments
|
| 209 |
+
* @param String $token
|
| 210 |
+
* @param String $paymentId if given, this replaces the token to use fast checkout
|
| 211 |
+
* @return mixed Response
|
| 212 |
+
*/
|
| 213 |
+
public function createPreAuthorization($paymentId)
|
| 214 |
+
{
|
| 215 |
+
$privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
|
| 216 |
+
$apiUrl = Mage::helper('paymill')->getApiUrl();
|
| 217 |
+
|
| 218 |
+
if(empty($privateKey)){
|
| 219 |
+
Mage::helper('paymill/loggingHelper')->log("No private Key was set.");
|
| 220 |
+
Mage::throwException("No private Key was set.");
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
$preAuthObject = new Services_Paymill_Preauthorizations($privateKey, $apiUrl);
|
| 224 |
+
|
| 225 |
+
$amount = (int)$this->getAmount();
|
| 226 |
+
$currency = $this->getCurrency();
|
| 227 |
+
|
| 228 |
+
$params = array( 'payment' => $paymentId, 'source' => Mage::helper('paymill')->getSourceString(), 'amount' => $amount, 'currency' => $currency );
|
| 229 |
+
$preAuth = $preAuthObject->create($params);
|
| 230 |
+
|
| 231 |
+
Mage::helper('paymill/loggingHelper')->log("PreAuthorization created from Payment", $preAuth['preauthorization']['id'], print_r($params, true));
|
| 232 |
+
|
| 233 |
+
return $preAuth['preauthorization'];
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
/**
|
| 239 |
+
* Generates a transaction from the given arguments
|
| 240 |
+
* @param Mage_Sales_Model_Order $order
|
| 241 |
+
* @param String $preAuthorizationId
|
| 242 |
+
* @param float|double $amount
|
| 243 |
+
* @return Boolean Indicator of success
|
| 244 |
+
*/
|
| 245 |
+
public function createTransactionFromPreAuth($order, $preAuthorizationId, $amount)
|
| 246 |
+
{
|
| 247 |
+
$privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
|
| 248 |
+
$apiUrl = Mage::helper('paymill')->getApiUrl();
|
| 249 |
+
if(empty($privateKey)){
|
| 250 |
+
Mage::helper('paymill/loggingHelper')->log("No private Key was set.");
|
| 251 |
+
Mage::throwException("No private Key was set.");
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
$transactionsObject = new Services_Paymill_Transactions($privateKey, $apiUrl);
|
| 255 |
+
$params = array(
|
| 256 |
+
'amount' => (int)($amount*100),
|
| 257 |
+
'currency' => $this->getCurrency(),
|
| 258 |
+
'description' => $this->getDescription($order),
|
| 259 |
+
'source' => Mage::helper('paymill')->getSourceString(),
|
| 260 |
+
'preauthorization'=> $preAuthorizationId
|
| 261 |
+
);
|
| 262 |
+
|
| 263 |
+
$transaction = $transactionsObject->create($params);
|
| 264 |
+
Mage::helper('paymill/loggingHelper')->log("Creating Transaction from PreAuthorization", print_r($params, true), var_export($transaction,true));
|
| 265 |
+
|
| 266 |
+
return $transaction;
|
| 267 |
+
}
|
| 268 |
+
}
|
app/code/community/Paymill/Paymill/Helper/RefundHelper.php
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Refund Helper contains methods dealing with refund processes.
|
| 22 |
+
*/
|
| 23 |
+
class Paymill_Paymill_Helper_RefundHelper extends Mage_Core_Helper_Abstract
|
| 24 |
+
{
|
| 25 |
+
/**
|
| 26 |
+
* Validates the result of the refund
|
| 27 |
+
* @param mixed $refund
|
| 28 |
+
* @return boolean
|
| 29 |
+
*/
|
| 30 |
+
private function validateRefund($refund)
|
| 31 |
+
{
|
| 32 |
+
//Logs errorfeedback in case of any other response than ok
|
| 33 |
+
if (isset($refund['data']['response_code']) && $refund['data']['response_code'] !== 20000) {
|
| 34 |
+
Mage::helper('paymill/loggingHelper')->log("An Error occured: " . $refund['data']['response_code'], var_export($refund, true));
|
| 35 |
+
return false;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
//Logs feedback in case of an unset id
|
| 39 |
+
if (!isset($refund['id']) && !isset($refund['data']['id'])) {
|
| 40 |
+
Mage::helper('paymill/loggingHelper')->log("No Refund created.", var_export($refund, true));
|
| 41 |
+
return false;
|
| 42 |
+
} else { //Logs success feedback for debugging purposes
|
| 43 |
+
Mage::helper('paymill/loggingHelper')->log("Refund created.", $refund['id'], var_export($refund, true));
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
return true;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Creates a refund from the ordernumber passed as an argument
|
| 51 |
+
* @param Mage_Sales_Model_Order $order
|
| 52 |
+
* @return boolean Indicator of success
|
| 53 |
+
*/
|
| 54 |
+
public function createRefund($order, $amount)
|
| 55 |
+
{
|
| 56 |
+
//Gather Data
|
| 57 |
+
try{
|
| 58 |
+
$privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
|
| 59 |
+
$apiUrl = Mage::helper('paymill')->getApiUrl();
|
| 60 |
+
$refundsObject = new Services_Paymill_Refunds( $privateKey, $apiUrl );
|
| 61 |
+
$transactionId = Mage::helper('paymill/transactionHelper')->getTransactionId($order);
|
| 62 |
+
} catch (Exception $ex){
|
| 63 |
+
Mage::helper('paymill/loggingHelper')->log("No Refund created due to illegal parameters.", $ex->getMessage());
|
| 64 |
+
return false;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
//Create Refund
|
| 68 |
+
$params = array(
|
| 69 |
+
'transactionId' => $transactionId,
|
| 70 |
+
'source' => Mage::helper('paymill')->getSourceString(),
|
| 71 |
+
'params' => array( 'amount' => $amount )
|
| 72 |
+
);
|
| 73 |
+
try{
|
| 74 |
+
$refund = $refundsObject->create($params);
|
| 75 |
+
} catch (Exception $ex){
|
| 76 |
+
Mage::helper('paymill/loggingHelper')->log("No Refund created.", $ex->getMessage(), var_export($params, true));
|
| 77 |
+
return false;
|
| 78 |
+
}
|
| 79 |
+
//Validate Refund and return feedback
|
| 80 |
+
return $this->validateRefund($refund);
|
| 81 |
+
}
|
| 82 |
+
}
|
app/code/community/Paymill/Paymill/Helper/TransactionHelper.php
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* The Transaction Helper contains methods dealing saving and loading additional transaction data into and from order objects.
|
| 22 |
+
*/
|
| 23 |
+
class Paymill_Paymill_Helper_TransactionHelper extends Mage_Core_Helper_Abstract
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Reads the additional data string from the argumented order object and returns it as an instance of Paymill_Paymill_Model_Transaction
|
| 28 |
+
* @param Mage_Sales_Model_Order_Payment $object
|
| 29 |
+
* @return Paymill_Paymill_Model_TransactionData Transaction Model
|
| 30 |
+
*/
|
| 31 |
+
public function getAdditionalInformation(Mage_Sales_Model_Order_Payment $object)
|
| 32 |
+
{
|
| 33 |
+
$transactionId = $object->getAdditionalInformation('paymillTransactionId');
|
| 34 |
+
$preAuthflag = $object->getAdditionalInformation('paymillPreAuthFlag');
|
| 35 |
+
$model = $this->createTransactionModel($transactionId, $preAuthflag);
|
| 36 |
+
return $model;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Sets the additional Data string of the argumented object to the valueS of the argumented instance of the Paymill_Paymill_Model_Transaction
|
| 41 |
+
* @param Mage_Sales_Model_Order_Payment $object
|
| 42 |
+
* @param Paymill_Paymill_Model_Transaction $transactionModel Instance of the Transaction Model class
|
| 43 |
+
* @return boolean Indicator of success
|
| 44 |
+
*/
|
| 45 |
+
public function setAdditionalInformation(Mage_Sales_Model_Order_Payment $object, Paymill_Paymill_Model_TransactionData $transactionModel)
|
| 46 |
+
{
|
| 47 |
+
$object->setAdditionalInformation('paymillTransactionId', $transactionModel->getTransactionId());
|
| 48 |
+
$object->setAdditionalInformation('paymillPreAuthFlag', $transactionModel->getPreAuthorizationFlag());
|
| 49 |
+
Mage::helper('paymill/loggingHelper')->log("Saved Transaction Data.", "Order " . $object->getIncrementId() .
|
| 50 |
+
$object->getReservedOrderId(), var_export($object->getAdditionalInformation(), true));
|
| 51 |
+
|
| 52 |
+
return true;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Returns the state of the isPreAuthorization Flag as a boolean
|
| 57 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 58 |
+
* @return booelean PreAuthorizationFlag
|
| 59 |
+
*/
|
| 60 |
+
public function getPreAuthenticatedFlagState($object)
|
| 61 |
+
{
|
| 62 |
+
$payment = $object->getPayment();
|
| 63 |
+
$transactionObject = $this->getAdditionalInformation($payment);
|
| 64 |
+
Mage::helper('paymill/loggingHelper')->log("Read Model from object to return Flag.", var_export($transactionObject, true));
|
| 65 |
+
return $transactionObject->getPreAuthorizationFlag();
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Returns the transactionId as a string
|
| 70 |
+
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
|
| 71 |
+
* @return String transactionId
|
| 72 |
+
*/
|
| 73 |
+
public function getTransactionId($object)
|
| 74 |
+
{
|
| 75 |
+
$payment = $object->getPayment();
|
| 76 |
+
$transactionObject = $this->getAdditionalInformation($payment);
|
| 77 |
+
Mage::helper('paymill/loggingHelper')->log("Read Model from object to return Transaction Id.", var_export($transactionObject, true));
|
| 78 |
+
return $transactionObject->getTransactionId();
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
* Creates a Transaction Model from the given Data
|
| 83 |
+
* @param String $transactionId
|
| 84 |
+
* @param Boolean $isPreAuthenticated
|
| 85 |
+
* @return Paymill_Paymill_Model_TransactionData Model with the desired attributes
|
| 86 |
+
*/
|
| 87 |
+
public function createTransactionModel($transactionId, $isPreAuthenticated = false)
|
| 88 |
+
{
|
| 89 |
+
$transactionModel = new Paymill_Paymill_Model_TransactionData();
|
| 90 |
+
$transactionModel->setTransactionId($transactionId);
|
| 91 |
+
$transactionModel->setPreAuthorizationFlag($isPreAuthenticated);
|
| 92 |
+
return $transactionModel;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
}
|
app/code/community/Paymill/Paymill/Model/Fastcheckout.php
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Fastcheckout extends Mage_Core_Model_Abstract
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Construct
|
| 25 |
+
*/
|
| 26 |
+
function _construct()
|
| 27 |
+
{
|
| 28 |
+
parent::_construct();
|
| 29 |
+
$this->_init('paymill/fastcheckout');
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Returns the paymentId matched with the userId passed as an argument.
|
| 35 |
+
* If no match is found, the return value will be null.
|
| 36 |
+
* @param String $userId Unique identifier of the customer
|
| 37 |
+
* @param String $code PaymentMethodCode
|
| 38 |
+
* @return String paymentId matched with the userId <b>can be null if no match is found</b>
|
| 39 |
+
*/
|
| 40 |
+
public function getPaymentId($userId, $code)
|
| 41 |
+
{
|
| 42 |
+
$collection = Mage::getModel('paymill/fastcheckout')->getCollection();
|
| 43 |
+
$collection->addFilter('user_id', $userId);
|
| 44 |
+
$obj = $collection->getFirstItem();
|
| 45 |
+
if($code === "paymill_creditcard"){
|
| 46 |
+
return $obj->getCcPaymentId();
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
if($code === "paymill_directdebit"){
|
| 50 |
+
return $obj->getElvPaymentId();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Saves a set of arguments (paymentMethodCode, clientId and paymentId) as a match to the Id of the current user.
|
| 57 |
+
* The paymentMethodCode is used to bind the Data to the correct payment type.
|
| 58 |
+
* @param String $paymentMethodCode $_code from the payment model
|
| 59 |
+
* @param String $clientId Code returned from the PaymentProcessor used to recreate the current client object
|
| 60 |
+
* @param String $paymentId Code returned from the PaymentProcessor used to recreate the current payment object
|
| 61 |
+
* @return boolean Indicator of Success
|
| 62 |
+
*/
|
| 63 |
+
public function saveFcData($paymentMethodCode, $userId, $clientId, $paymentId)
|
| 64 |
+
{
|
| 65 |
+
$logger = Mage::helper("paymill/loggingHelper");
|
| 66 |
+
$collection = Mage::getModel('paymill/fastcheckout')->getCollection();
|
| 67 |
+
$collection->addFilter('user_id', $userId);
|
| 68 |
+
$customerExists = $collection->count();
|
| 69 |
+
|
| 70 |
+
if($customerExists == 1){
|
| 71 |
+
$obj = $collection->getFirstItem();
|
| 72 |
+
|
| 73 |
+
if($paymentMethodCode === 'paymill_creditcard'){
|
| 74 |
+
$logger->log("Saving Fast Checkout Data", "Customer data already exists. Saving CC only Data.");
|
| 75 |
+
$obj->setCcPaymentId($paymentId)
|
| 76 |
+
->save();
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
if($paymentMethodCode === 'paymill_directdebit'){
|
| 80 |
+
$logger->log("Saving Fast Checkout Data", "Customer data already exists. Saving ELV only Data.");
|
| 81 |
+
$obj->setElvPaymentId($paymentId)
|
| 82 |
+
->save();
|
| 83 |
+
}
|
| 84 |
+
return true;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
//Insert into db
|
| 88 |
+
if($paymentMethodCode === 'paymill_creditcard'){
|
| 89 |
+
$logger->log("Saving Fast Checkout Data", "Customer data saved with CC data");
|
| 90 |
+
$this->setId(null)
|
| 91 |
+
->setUserId($userId)
|
| 92 |
+
->setClientId($clientId)
|
| 93 |
+
->setCcPaymentId($paymentId)
|
| 94 |
+
->save();
|
| 95 |
+
return true;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if($paymentMethodCode === 'paymill_directdebit'){
|
| 99 |
+
$logger->log("Saving Fast Checkout Data", "Customer data saved with ELV data");
|
| 100 |
+
$this->setId(null)
|
| 101 |
+
->setUserId($userId)
|
| 102 |
+
->setClientId($clientId)
|
| 103 |
+
->setElvPaymentId($paymentId)
|
| 104 |
+
->save();
|
| 105 |
+
return true;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
return false;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Returns a boolean describing if there is FC Data registered for the given userId
|
| 113 |
+
* @param String $userId
|
| 114 |
+
* @param String $code PaymentMethodCode
|
| 115 |
+
* @return boolean
|
| 116 |
+
*/
|
| 117 |
+
public function hasFcData($userId, $code){
|
| 118 |
+
$collection = Mage::getModel('paymill/fastcheckout')->getCollection();
|
| 119 |
+
$collection->addFilter('user_id', $userId);
|
| 120 |
+
|
| 121 |
+
if($code === "paymill_creditcard"){
|
| 122 |
+
$obj = $collection->getFirstItem();
|
| 123 |
+
if($obj->getCcPaymentId() != null){
|
| 124 |
+
return true;
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
if($code === "paymill_directdebit"){
|
| 129 |
+
$obj = $collection->getFirstItem();
|
| 130 |
+
if($obj->getElvPaymentId() != null){
|
| 131 |
+
return true;
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
return false;
|
| 135 |
+
}
|
| 136 |
+
}
|
app/code/community/Paymill/Paymill/Model/Log.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Log extends Mage_Core_Model_Abstract
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Construct
|
| 25 |
+
*/
|
| 26 |
+
function _construct()
|
| 27 |
+
{
|
| 28 |
+
parent::_construct();
|
| 29 |
+
$this->_init('paymill/log');
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Inserts the arguments into the db log
|
| 34 |
+
* @param String $merchantInfo
|
| 35 |
+
* @param String $devInfo
|
| 36 |
+
* @param String $devInfoAdditional
|
| 37 |
+
*/
|
| 38 |
+
public function log($merchantInfo, $devInfo, $devInfoAdditional = null)
|
| 39 |
+
{
|
| 40 |
+
if(Mage::helper("paymill/optionHelper")->isLogging()){
|
| 41 |
+
$this->setId(null)
|
| 42 |
+
->setEntryDate(null)
|
| 43 |
+
->setVersion(Mage::helper("paymill")->getVersion())
|
| 44 |
+
->setMerchantInfo($merchantInfo)
|
| 45 |
+
->setDevInfo($devInfo)
|
| 46 |
+
->setDevInfoAdditional($devInfoAdditional)
|
| 47 |
+
->save();
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
}
|
app/code/community/Paymill/Paymill/Model/Method/MethodModelAbstract.php
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Payment_Model_Method_Abstract
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Is method a gateaway
|
| 25 |
+
*
|
| 26 |
+
* @var boolean
|
| 27 |
+
*/
|
| 28 |
+
protected $_isGateway = false;
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Can use the Authorize method
|
| 32 |
+
*
|
| 33 |
+
* @var boolean
|
| 34 |
+
*/
|
| 35 |
+
protected $_canAuthorize = true;
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Can use the Refund method
|
| 39 |
+
*
|
| 40 |
+
* @var boolean
|
| 41 |
+
*/
|
| 42 |
+
protected $_canRefund = true;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Can use the Refund method to refund less than the full amount
|
| 46 |
+
*
|
| 47 |
+
* @var boolean
|
| 48 |
+
*/
|
| 49 |
+
protected $_canRefundInvoicePartial = true;
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Can use the Capture method
|
| 53 |
+
*
|
| 54 |
+
* @var boolean
|
| 55 |
+
*/
|
| 56 |
+
protected $_canCapture = true;
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Can this method use for checkout
|
| 60 |
+
*
|
| 61 |
+
* @var boolean
|
| 62 |
+
*/
|
| 63 |
+
protected $_canUseCheckout = true;
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Can this method use for multishipping
|
| 67 |
+
*
|
| 68 |
+
* @var boolean
|
| 69 |
+
*/
|
| 70 |
+
protected $_canUseForMultishipping = false;
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Is a initalize needed
|
| 74 |
+
*
|
| 75 |
+
* @var boolean
|
| 76 |
+
*/
|
| 77 |
+
protected $_isInitializeNeeded = false;
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Payment Title
|
| 81 |
+
*
|
| 82 |
+
* @var type
|
| 83 |
+
*/
|
| 84 |
+
protected $_methodTitle = '';
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Magento method code
|
| 88 |
+
*
|
| 89 |
+
* @var string
|
| 90 |
+
*/
|
| 91 |
+
protected $_code = 'paymill_abstract';
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* Check if currency is avaible for this payment
|
| 95 |
+
*
|
| 96 |
+
* @param string $currencyCode
|
| 97 |
+
* @return boolean
|
| 98 |
+
*/
|
| 99 |
+
public function canUseForCurrency($currencyCode)
|
| 100 |
+
{
|
| 101 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 102 |
+
$storeId = $quote ? $quote->getStoreId() : null;
|
| 103 |
+
|
| 104 |
+
$availableCurrencies = explode(',', $this->getConfigData('currency', $storeId));
|
| 105 |
+
if (!in_array($currencyCode, $availableCurrencies)) {
|
| 106 |
+
return false;
|
| 107 |
+
}
|
| 108 |
+
return true;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Return Quote or Order Object depending on the type of the payment info
|
| 113 |
+
*
|
| 114 |
+
* @return Mage_Sales_Model_Order
|
| 115 |
+
*/
|
| 116 |
+
public function getOrder()
|
| 117 |
+
{
|
| 118 |
+
$paymentInfo = $this->getInfoInstance();
|
| 119 |
+
|
| 120 |
+
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
|
| 121 |
+
return $paymentInfo->getOrder();
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
return $paymentInfo->getQuote();
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Get the title of every payment option with payment fee if available
|
| 129 |
+
*
|
| 130 |
+
* @return string
|
| 131 |
+
*/
|
| 132 |
+
public function getTitle()
|
| 133 |
+
{
|
| 134 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 135 |
+
$storeId = $quote ? $quote->getStoreId() : null;
|
| 136 |
+
|
| 137 |
+
return $this->_getHelper()->__($this->getConfigData('title', $storeId));
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/**
|
| 141 |
+
* Assing data to information model object for fast checkout
|
| 142 |
+
* Saves Session Variables.
|
| 143 |
+
* @param mixed $data
|
| 144 |
+
*/
|
| 145 |
+
public function assignData($data)
|
| 146 |
+
{
|
| 147 |
+
//Recieve Data
|
| 148 |
+
$postData = Mage::app()->getRequest()->getPost();
|
| 149 |
+
$token = $postData['payment']['paymill-payment-token'];
|
| 150 |
+
|
| 151 |
+
//Save Data into session
|
| 152 |
+
Mage::getSingleton('core/session')->setToken($token);
|
| 153 |
+
Mage::getSingleton('core/session')->setPaymentCode($this->getCode());
|
| 154 |
+
|
| 155 |
+
//Finish as usual
|
| 156 |
+
return parent::assignData($data);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Gets Excecuted when the checkout button is pressed.
|
| 161 |
+
* @param Varien_Object $payment
|
| 162 |
+
* @param float $amount
|
| 163 |
+
* @throws Exception
|
| 164 |
+
*/
|
| 165 |
+
public function authorize(Varien_Object $payment, $amount)
|
| 166 |
+
{
|
| 167 |
+
$success = false;
|
| 168 |
+
if(Mage::helper('paymill/optionHelper')->isPreAuthorizing() && $this->_code === "paymill_creditcard"){
|
| 169 |
+
Mage::helper('paymill/loggingHelper')->log("Starting payment process as preAuth");
|
| 170 |
+
$success = $this->preAuth($payment, $amount);
|
| 171 |
+
} else{
|
| 172 |
+
Mage::helper('paymill/loggingHelper')->log("Starting payment process as debit");
|
| 173 |
+
$success = $this->debit($payment, $amount);
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
if(!$success){
|
| 177 |
+
Mage::helper('paymill/loggingHelper')->log("There was an error processing the payment.");
|
| 178 |
+
Mage::getSingleton('checkout/session')->setGotoSection('payment');
|
| 179 |
+
Mage::throwException("There was an error processing your payment.");
|
| 180 |
+
}
|
| 181 |
+
//Finish as usual
|
| 182 |
+
return parent::authorize($payment, $amount);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
/**
|
| 186 |
+
* Deals with payment processing when debit mode is active
|
| 187 |
+
* @return booelan Indicator of success
|
| 188 |
+
*/
|
| 189 |
+
public function debit(Varien_Object $payment, $amount)
|
| 190 |
+
{
|
| 191 |
+
//Gathering data from session
|
| 192 |
+
$token = Mage::getSingleton('core/session')->getToken();
|
| 193 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 194 |
+
|
| 195 |
+
//Create Payment Processor
|
| 196 |
+
$paymentHelper = Mage::helper("paymill/paymentHelper");
|
| 197 |
+
$fcHelper = Mage::helper("paymill/fastCheckoutHelper");
|
| 198 |
+
$paymentProcessor = $paymentHelper->createPaymentProcessor($this->getCode(), $token);
|
| 199 |
+
|
| 200 |
+
//Loading Fast Checkout Data (if enabled and given)
|
| 201 |
+
if($fcHelper->isFastCheckoutEnabled()){
|
| 202 |
+
$clientId = $fcHelper->getClientId();
|
| 203 |
+
if(isset($clientId)){
|
| 204 |
+
$paymentProcessor->setClientId($clientId);
|
| 205 |
+
$paymentId = $fcHelper->getPaymentId($this->_code);
|
| 206 |
+
if(isset($paymentId)){
|
| 207 |
+
$paymentProcessor->setPaymentId($paymentId);
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
//Process Payment
|
| 213 |
+
$success = $paymentProcessor->processPayment();
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
If($success){
|
| 217 |
+
//Save Transaction Data
|
| 218 |
+
$transactionHelper = Mage::helper("paymill/transactionHelper");
|
| 219 |
+
$transactionModel = $transactionHelper->createTransactionModel($paymentProcessor->getTransactionId(), false);
|
| 220 |
+
$transactionHelper->setAdditionalInformation($payment, $transactionModel);
|
| 221 |
+
|
| 222 |
+
//Save Data for Fast Checkout (if enabled)
|
| 223 |
+
if($fcHelper->isFastCheckoutEnabled()){ //Fast checkout enabled
|
| 224 |
+
if(!$fcHelper->hasData($this->_code)){
|
| 225 |
+
$clientId = $paymentProcessor->getClientId();
|
| 226 |
+
$paymentId = $paymentProcessor->getPaymentId();
|
| 227 |
+
$fcHelper->saveData($this->_code, $clientId, $paymentId);
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
return true;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
return false;
|
| 235 |
+
|
| 236 |
+
}
|
| 237 |
+
}
|
app/code/community/Paymill/Paymill/Model/Method/MethodModelCreditcard.php
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Method_MethodModelCreditcard extends Paymill_Paymill_Model_Method_MethodModelAbstract
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Magento method code
|
| 24 |
+
*
|
| 25 |
+
* @var string
|
| 26 |
+
*/
|
| 27 |
+
protected $_code = "paymill_creditcard";
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Form block identifier
|
| 31 |
+
*
|
| 32 |
+
* @var string
|
| 33 |
+
*/
|
| 34 |
+
protected $_formBlockType = 'paymill/payment_form_paymentFormCreditcard';
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Info block identifier
|
| 38 |
+
*
|
| 39 |
+
* @var string
|
| 40 |
+
*/
|
| 41 |
+
protected $_infoBlockType = 'paymill/payment_info_paymentFormCreditcard';
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Deals with payment processing when preAuth mode is active
|
| 45 |
+
*/
|
| 46 |
+
public function preAuth(Varien_Object $payment, $amount)
|
| 47 |
+
{
|
| 48 |
+
//Initalizing variables and helpers
|
| 49 |
+
$paymill_flag_client_set = false;
|
| 50 |
+
$paymill_flag_payment_set = false;
|
| 51 |
+
$quote = $quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 52 |
+
$paymentHelper = Mage::helper("paymill/paymentHelper");
|
| 53 |
+
$customerHelper = Mage::helper("paymill/customerHelper");
|
| 54 |
+
$fcHelper = Mage::helper("paymill/fastCheckoutHelper");
|
| 55 |
+
|
| 56 |
+
//Gathering data
|
| 57 |
+
$token = Mage::getSingleton('core/session')->getToken();
|
| 58 |
+
$email = $customerHelper->getCustomerEmail($quote);
|
| 59 |
+
$description = $paymentHelper->getDescription($quote);
|
| 60 |
+
|
| 61 |
+
//Loading Fast Checkout Data (if enabled and given)
|
| 62 |
+
if($fcHelper->isFastCheckoutEnabled()){
|
| 63 |
+
$clientId = $fcHelper->getClientId();
|
| 64 |
+
Mage::helper('paymill/loggingHelper')->log("preAuthorization found an existing Client.", $clientId);
|
| 65 |
+
if(isset($clientId)){
|
| 66 |
+
$paymill_flag_client_set = true;
|
| 67 |
+
$paymentId = $fcHelper->getPaymentId($this->_code);
|
| 68 |
+
Mage::helper('paymill/loggingHelper')->log("preAuthorization found an existing Payment.", $paymentId);
|
| 69 |
+
if(isset($paymentId)){
|
| 70 |
+
$paymill_flag_payment_set = true;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
if(!$paymill_flag_client_set){
|
| 76 |
+
try{
|
| 77 |
+
$clientId = $paymentHelper->createClient($email, $description);
|
| 78 |
+
} catch (Exception $ex){
|
| 79 |
+
Mage::helper('paymill/loggingHelper')->log("There was an error creating the client.", $ex->getMessage());
|
| 80 |
+
return false;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
if(!$paymill_flag_payment_set){
|
| 86 |
+
try{
|
| 87 |
+
$paymentId = $paymentHelper->createPayment($token, $clientId);
|
| 88 |
+
} catch (Exception $ex){
|
| 89 |
+
Mage::helper('paymill/loggingHelper')->log("There was an error creating the payment.", $ex->getMessage());
|
| 90 |
+
return false;
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
//Authorize payment
|
| 95 |
+
try{
|
| 96 |
+
$transaction = $paymentHelper->createPreAuthorization($paymentId);
|
| 97 |
+
} catch (Exception $ex){
|
| 98 |
+
Mage::helper('paymill/loggingHelper')->log("There was an error creating the Pre-Authorization.", $ex->getMessage());
|
| 99 |
+
return false;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
//Save Transaction Data
|
| 103 |
+
$transactionHelper = Mage::helper("paymill/transactionHelper");
|
| 104 |
+
$transactionModel = $transactionHelper->createTransactionModel($transaction['id'], true);
|
| 105 |
+
$transactionHelper->setAdditionalInformation($payment, $transactionModel);
|
| 106 |
+
|
| 107 |
+
//Save Data for Fast Checkout (if enabled)
|
| 108 |
+
if($fcHelper->isFastCheckoutEnabled()){ //Fast checkout enabled
|
| 109 |
+
if(!$fcHelper->hasData($this->_code)){
|
| 110 |
+
$clientId = $clientId;
|
| 111 |
+
$paymentId = $paymentId;
|
| 112 |
+
$fcHelper->saveData($this->_code, $clientId, $paymentId);
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
return true;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/**
|
| 120 |
+
* Gets called when a capture gets triggered (default on invoice generation)
|
| 121 |
+
*/
|
| 122 |
+
public function capture(Varien_Object $payment, $amount)
|
| 123 |
+
{
|
| 124 |
+
//Initalizing variables and helpers
|
| 125 |
+
$paymentHelper = Mage::helper("paymill/paymentHelper");
|
| 126 |
+
$transactionHelper = Mage::helper("paymill/transactionHelper");
|
| 127 |
+
$order = $payment->getOrder();
|
| 128 |
+
|
| 129 |
+
if($transactionHelper->getPreAuthenticatedFlagState($order)){
|
| 130 |
+
//Capture preAuth
|
| 131 |
+
$preAuthorization = $transactionHelper->getTransactionId($order);
|
| 132 |
+
$captureTransaction = $paymentHelper->createTransactionFromPreAuth($order, $preAuthorization, $amount);
|
| 133 |
+
|
| 134 |
+
if (isset($captureTransaction['data']['response_code']) && $captureTransaction['data']['response_code'] !== 20000) {
|
| 135 |
+
$this->_log("An Error occured: " . $captureTransaction['data']['response_code'], var_export($captureTransaction, true));
|
| 136 |
+
throw new Exception("Invalid Result Exception: Invalid ResponseCode");
|
| 137 |
+
}
|
| 138 |
+
Mage::helper('paymill/loggingHelper')->log("Capture created", var_export($captureTransaction, true));
|
| 139 |
+
|
| 140 |
+
//Save Transaction Data
|
| 141 |
+
$transactionId = $captureTransaction['id'];
|
| 142 |
+
$transactionModel = $transactionHelper->createTransactionModel($transactionId, true);
|
| 143 |
+
$transactionHelper->setAdditionalInformation($payment, $transactionModel);
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
}
|
app/code/community/Paymill/Paymill/Model/Method/MethodModelDirectdebit.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Method_MethodModelDirectdebit extends Paymill_Paymill_Model_Method_MethodModelAbstract
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Magento method code
|
| 24 |
+
*
|
| 25 |
+
* @var string
|
| 26 |
+
*/
|
| 27 |
+
protected $_code = "paymill_directdebit";
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Form block identifier
|
| 31 |
+
*
|
| 32 |
+
* @var string
|
| 33 |
+
*/
|
| 34 |
+
protected $_formBlockType = 'paymill/payment_form_paymentFormDirectdebit';
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Info block identifier
|
| 38 |
+
*
|
| 39 |
+
* @var string
|
| 40 |
+
*/
|
| 41 |
+
protected $_infoBlockType = 'paymill/payment_info_paymentFormDirectdebit';
|
| 42 |
+
|
| 43 |
+
}
|
app/code/community/Paymill/Paymill/Model/Mysql4/Fastcheckout.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Mysql4_Fastcheckout extends Mage_Core_Model_Mysql4_Abstract
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Construct
|
| 25 |
+
*/
|
| 26 |
+
function _construct()
|
| 27 |
+
{
|
| 28 |
+
$this->_init('paymill/fastcheckout', 'id');
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/community/Paymill/Paymill/Model/Mysql4/Fastcheckout/Collection.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Mysql4_FastCheckout_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
public function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->_init('paymill/fastcheckout');
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/community/Paymill/Paymill/Model/Mysql4/Log.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Construct
|
| 25 |
+
*/
|
| 26 |
+
function _construct()
|
| 27 |
+
{
|
| 28 |
+
$this->_init('paymill/log', 'id');
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/community/Paymill/Paymill/Model/Mysql4/Log/Collection.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Construct
|
| 24 |
+
*/
|
| 25 |
+
public function _construct()
|
| 26 |
+
{
|
| 27 |
+
parent::_construct();
|
| 28 |
+
$this->_init('paymill/log');
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/community/Paymill/Paymill/Model/Observer.php
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_Observer{
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Registered for the checkout_onepage_controller_success_action event
|
| 24 |
+
* Generates the invoice for the current order
|
| 25 |
+
*
|
| 26 |
+
* @param Varien_Event_Observer $observer
|
| 27 |
+
*/
|
| 28 |
+
public function generateInvoice(Varien_Event_Observer $observer)
|
| 29 |
+
{
|
| 30 |
+
$orderIds = $observer->getEvent()->getOrderIds();
|
| 31 |
+
if ($orderIds) {
|
| 32 |
+
$orderId = current($orderIds);
|
| 33 |
+
if (!$orderId) {
|
| 34 |
+
return;
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
| 38 |
+
|
| 39 |
+
if($order->getPayment()->getMethod() === 'paymill_creditcard' || $order->getPayment()->getMethod() === 'paymill_directdebit'){
|
| 40 |
+
|
| 41 |
+
if( Mage::helper('paymill/transactionHelper')->getPreAuthenticatedFlagState($order)){ // If the transaction is not flagged as a debit (not a preAuth) transaction
|
| 42 |
+
Mage::helper('paymill/loggingHelper')->log("Debug", "No Invoice generated, since the transaction is flagged as preauth");
|
| 43 |
+
} else {
|
| 44 |
+
if($order->canInvoice()) {
|
| 45 |
+
//Create the Invoice
|
| 46 |
+
Mage::helper('paymill/loggingHelper')->log(Mage::helper('paymill')->__($paymentCode), Mage::helper('paymill')->__('paymill_checkout_generating_invoice'), "Order Id: ".$order->getIncrementId());
|
| 47 |
+
$invoiceId = Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), array());
|
| 48 |
+
Mage::getModel('sales/order_invoice_api')->capture($invoiceId);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Registered for the sales_order_creditmemo_refund event
|
| 56 |
+
* Creates a refund based on the created creditmemo
|
| 57 |
+
* @param Varien_Event_Observer $observer
|
| 58 |
+
*/
|
| 59 |
+
public function refundCreditmemo(Varien_Event_Observer $observer)
|
| 60 |
+
{
|
| 61 |
+
$creditmemo = $observer->getEvent()->getCreditmemo();
|
| 62 |
+
$order = $creditmemo->getOrder();
|
| 63 |
+
if($order->getPayment()->getMethod() === 'paymill_creditcard' || $order->getPayment()->getMethod() === 'paymill_directdebit'){
|
| 64 |
+
$amount = (int)((string)($creditmemo->getGrandTotal()*100));
|
| 65 |
+
Mage::helper('paymill/loggingHelper')->log("Trying to Refund.", var_export($order->getIncrementId(), true), $amount);
|
| 66 |
+
Mage::helper('paymill/refundHelper')->createRefund($order, $amount);
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
app/code/community/Paymill/Paymill/Model/TransactionData.php
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
class Paymill_Paymill_Model_TransactionData
|
| 21 |
+
{
|
| 22 |
+
|
| 23 |
+
private $_preAuthorizationFlag = null;
|
| 24 |
+
private $_transactionId = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Returns the state of the PreAuthorizationFlag
|
| 28 |
+
* @return Boolean
|
| 29 |
+
*/
|
| 30 |
+
public function getPreAuthorizationFlag()
|
| 31 |
+
{
|
| 32 |
+
return $this->_preAuthorizationFlag;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Returns the TransactionId as a string
|
| 37 |
+
* @return String
|
| 38 |
+
*/
|
| 39 |
+
public function getTransactionId()
|
| 40 |
+
{
|
| 41 |
+
return $this->_transactionId;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Sets the PreAuthorizationFlag
|
| 46 |
+
* @param Boolean $flag
|
| 47 |
+
*/
|
| 48 |
+
public function setPreAuthorizationFlag($flag)
|
| 49 |
+
{
|
| 50 |
+
$this->_preAuthorizationFlag = $flag;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Sets the transaction id
|
| 55 |
+
* @param String $id
|
| 56 |
+
*/
|
| 57 |
+
public function setTransactionId($id)
|
| 58 |
+
{
|
| 59 |
+
$this->_transactionId = $id;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
}
|
app/code/community/Paymill/Paymill/controllers/Adminhtml/LogController.php
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill * @package Paymill_Paymill
|
| 16 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 17 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 18 |
+
*/
|
| 19 |
+
class Paymill_Paymill_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
|
| 20 |
+
{
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Initialize logs view
|
| 24 |
+
*
|
| 25 |
+
* @return Paymill_Paymill_Adminhtml_LogController
|
| 26 |
+
*/
|
| 27 |
+
protected function _initAction()
|
| 28 |
+
{
|
| 29 |
+
$this->loadLayout()->_setActiveMenu('log/paymill_log');
|
| 30 |
+
return $this;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Action initially called
|
| 35 |
+
*/
|
| 36 |
+
public function indexAction()
|
| 37 |
+
{
|
| 38 |
+
// Let's call our initAction method which will set some basic params for each action
|
| 39 |
+
$this->_initAction()
|
| 40 |
+
->renderLayout();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Normal Magento delete mass action for selected entries
|
| 45 |
+
*/
|
| 46 |
+
public function massDeleteAction()
|
| 47 |
+
{
|
| 48 |
+
$logIds = $this->getRequest()->getParam('log_id');
|
| 49 |
+
|
| 50 |
+
if (!is_array($logIds)) {
|
| 51 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('paymill')->__('paymill_error_text_no_entry_selected'));
|
| 52 |
+
} else {
|
| 53 |
+
try {
|
| 54 |
+
foreach ($logIds as $logId) {
|
| 55 |
+
Mage::getModel('paymill/log')->load($logId)->delete();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('paymill')->__("paymill_log_action_success"));
|
| 59 |
+
} catch (Exception $e) {
|
| 60 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
$this->_redirect('*/*/index');
|
| 64 |
+
}
|
| 65 |
+
}
|
app/code/community/Paymill/Paymill/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<logs>
|
| 5 |
+
<title>Paymill</title>
|
| 6 |
+
<sort_order>60</sort_order>
|
| 7 |
+
<children>
|
| 8 |
+
<paymill_log translate="title" module="paymill">
|
| 9 |
+
<title>paymill_log</title>
|
| 10 |
+
<sort_order>10</sort_order>
|
| 11 |
+
<action>paymill/adminhtml_log</action>
|
| 12 |
+
</paymill_log>
|
| 13 |
+
</children>
|
| 14 |
+
</logs>
|
| 15 |
+
</menu>
|
| 16 |
+
</config>
|
app/code/community/Paymill/Paymill/etc/config.xml
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Paymill_Paymill>
|
| 5 |
+
<version>3.0.0</version>
|
| 6 |
+
</Paymill_Paymill>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
<global>
|
| 11 |
+
<blocks>
|
| 12 |
+
<paymill>
|
| 13 |
+
<class>Paymill_Paymill_Block</class>
|
| 14 |
+
</paymill>
|
| 15 |
+
</blocks>
|
| 16 |
+
|
| 17 |
+
<models>
|
| 18 |
+
<paymill>
|
| 19 |
+
<class>Paymill_Paymill_Model</class>
|
| 20 |
+
<resourceModel>paymill_mysql4</resourceModel>
|
| 21 |
+
</paymill>
|
| 22 |
+
<paymill_mysql4>
|
| 23 |
+
<class>Paymill_Paymill_Model_Mysql4</class>
|
| 24 |
+
<entities>
|
| 25 |
+
<log>
|
| 26 |
+
<table>paymill_log</table>
|
| 27 |
+
</log>
|
| 28 |
+
<fastcheckout>
|
| 29 |
+
<table>paymill_fastCheckout</table>
|
| 30 |
+
</fastcheckout>
|
| 31 |
+
</entities>
|
| 32 |
+
</paymill_mysql4>
|
| 33 |
+
</models>
|
| 34 |
+
|
| 35 |
+
<helpers>
|
| 36 |
+
<paymill>
|
| 37 |
+
<class>Paymill_Paymill_Helper</class>
|
| 38 |
+
</paymill>
|
| 39 |
+
</helpers>
|
| 40 |
+
|
| 41 |
+
<resources>
|
| 42 |
+
<paymill_setup>
|
| 43 |
+
<setup>
|
| 44 |
+
<module>Paymill_Paymill</module>
|
| 45 |
+
</setup>
|
| 46 |
+
<connection>
|
| 47 |
+
<use>core_setup</use>
|
| 48 |
+
</connection>
|
| 49 |
+
</paymill_setup>
|
| 50 |
+
|
| 51 |
+
<paymill_write>
|
| 52 |
+
<connection>
|
| 53 |
+
<use>core_write</use>
|
| 54 |
+
</connection>
|
| 55 |
+
</paymill_write>
|
| 56 |
+
|
| 57 |
+
<paymill_read>
|
| 58 |
+
<connection>
|
| 59 |
+
<use>core_read</use>
|
| 60 |
+
</connection>
|
| 61 |
+
</paymill_read>
|
| 62 |
+
</resources>
|
| 63 |
+
</global>
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
<!-- declare default configuration values for this module -->
|
| 67 |
+
<default>
|
| 68 |
+
<!-- 'payment' configuration section (tab) -->
|
| 69 |
+
<payment>
|
| 70 |
+
<paymill_creditcard>
|
| 71 |
+
<active>0</active>
|
| 72 |
+
<currency>EUR,USD</currency>
|
| 73 |
+
<model>paymill/method_methodModelCreditcard</model>
|
| 74 |
+
<order_status>pending</order_status>
|
| 75 |
+
<title>paymill_credit_card</title>
|
| 76 |
+
<payment_action>authorize</payment_action>
|
| 77 |
+
</paymill_creditcard>
|
| 78 |
+
|
| 79 |
+
<paymill_directdebit>
|
| 80 |
+
<active>0</active>
|
| 81 |
+
<currency>EUR,USD</currency>
|
| 82 |
+
<model>paymill/method_methodModelDirectdebit</model>
|
| 83 |
+
<order_status>pending_payment</order_status>
|
| 84 |
+
<title>paymill_direct_debit</title>
|
| 85 |
+
<payment_action>authorize</payment_action>
|
| 86 |
+
</paymill_directdebit>
|
| 87 |
+
</payment>
|
| 88 |
+
</default>
|
| 89 |
+
|
| 90 |
+
<frontend>
|
| 91 |
+
<layout>
|
| 92 |
+
<updates>
|
| 93 |
+
<paymill>
|
| 94 |
+
<file>paymill.xml</file>
|
| 95 |
+
</paymill>
|
| 96 |
+
</updates>
|
| 97 |
+
</layout>
|
| 98 |
+
<translate>
|
| 99 |
+
<modules>
|
| 100 |
+
<Paymill_Paymill>
|
| 101 |
+
<files>
|
| 102 |
+
<default>Paymill_Paymill.csv</default>
|
| 103 |
+
</files>
|
| 104 |
+
</Paymill_Paymill>
|
| 105 |
+
</modules>
|
| 106 |
+
</translate>
|
| 107 |
+
<events>
|
| 108 |
+
<checkout_onepage_controller_success_action>
|
| 109 |
+
<observers>
|
| 110 |
+
<paymill_paymill_model_observer>
|
| 111 |
+
<type>model</type>
|
| 112 |
+
<class>Paymill_Paymill_Model_Observer</class>
|
| 113 |
+
<method>generateInvoice</method>
|
| 114 |
+
</paymill_paymill_model_observer>
|
| 115 |
+
</observers>
|
| 116 |
+
</checkout_onepage_controller_success_action>
|
| 117 |
+
</events>
|
| 118 |
+
</frontend>
|
| 119 |
+
|
| 120 |
+
<adminhtml>
|
| 121 |
+
<translate>
|
| 122 |
+
<modules>
|
| 123 |
+
<Paymill_Paymill>
|
| 124 |
+
<files>
|
| 125 |
+
<default>Paymill_Paymill.csv</default>
|
| 126 |
+
</files>
|
| 127 |
+
</Paymill_Paymill>
|
| 128 |
+
</modules>
|
| 129 |
+
</translate>
|
| 130 |
+
<layout>
|
| 131 |
+
<updates>
|
| 132 |
+
<paymill>
|
| 133 |
+
<file>paymill.xml</file>
|
| 134 |
+
</paymill>
|
| 135 |
+
</updates>
|
| 136 |
+
</layout>
|
| 137 |
+
<events>
|
| 138 |
+
<sales_order_creditmemo_refund>
|
| 139 |
+
<observers>
|
| 140 |
+
<paymill_paymill_model_observer>
|
| 141 |
+
<type>model</type>
|
| 142 |
+
<class>Paymill_Paymill_Model_Observer</class>
|
| 143 |
+
<method>refundCreditmemo</method>
|
| 144 |
+
</paymill_paymill_model_observer>
|
| 145 |
+
</observers>
|
| 146 |
+
</sales_order_creditmemo_refund>
|
| 147 |
+
</events>
|
| 148 |
+
</adminhtml>
|
| 149 |
+
|
| 150 |
+
<admin>
|
| 151 |
+
<routers>
|
| 152 |
+
<paymill>
|
| 153 |
+
<use>admin</use>
|
| 154 |
+
<args>
|
| 155 |
+
<module>Paymill_Paymill</module>
|
| 156 |
+
<frontName>paymill</frontName>
|
| 157 |
+
</args>
|
| 158 |
+
</paymill>
|
| 159 |
+
</routers>
|
| 160 |
+
</admin>
|
| 161 |
+
|
| 162 |
+
</config>
|
app/code/community/Paymill/Paymill/etc/system.xml
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<payment>
|
| 5 |
+
<groups>
|
| 6 |
+
<paymill translate="label">
|
| 7 |
+
<label>paymill_Basic_Setting</label>
|
| 8 |
+
<show_in_default>1</show_in_default>
|
| 9 |
+
<show_in_website>1</show_in_website>
|
| 10 |
+
<show_in_store>1</show_in_store>
|
| 11 |
+
<sort_order>700</sort_order>
|
| 12 |
+
<fields>
|
| 13 |
+
<version>
|
| 14 |
+
<label>v3.0.0</label>
|
| 15 |
+
<sort_order>1</sort_order>
|
| 16 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
| 17 |
+
<frontend_type>label</frontend_type>
|
| 18 |
+
<show_in_default>1</show_in_default>
|
| 19 |
+
<show_in_website>1</show_in_website>
|
| 20 |
+
<show_in_store>1</show_in_store>
|
| 21 |
+
</version>
|
| 22 |
+
<public_key translate="label, tooltip, comment">
|
| 23 |
+
<label>paymill_Public_Key</label>
|
| 24 |
+
<sort_order>2</sort_order>
|
| 25 |
+
<tooltip>paymill_public_key_tooltip</tooltip>
|
| 26 |
+
<comment>paymill_public_key_comment</comment>
|
| 27 |
+
<frontend_type>text</frontend_type>
|
| 28 |
+
<show_in_default>1</show_in_default>
|
| 29 |
+
<show_in_website>1</show_in_website>
|
| 30 |
+
<show_in_store>1</show_in_store>
|
| 31 |
+
</public_key>
|
| 32 |
+
<private_key translate="label, tooltip, comment">
|
| 33 |
+
<label>paymill_Private_Key</label>
|
| 34 |
+
<sort_order>3</sort_order>
|
| 35 |
+
<tooltip>paymill_private_key_tooltip</tooltip>
|
| 36 |
+
<comment>paymill_private_key_comment</comment>
|
| 37 |
+
<frontend_type>text</frontend_type>
|
| 38 |
+
<show_in_default>1</show_in_default>
|
| 39 |
+
<show_in_website>1</show_in_website>
|
| 40 |
+
<show_in_store>1</show_in_store>
|
| 41 |
+
</private_key>
|
| 42 |
+
<debugging_active translate="label">
|
| 43 |
+
<label>paymill_Activate_Debugging</label>
|
| 44 |
+
<sort_order>6</sort_order>
|
| 45 |
+
<frontend_type>select</frontend_type>
|
| 46 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 47 |
+
<show_in_default>1</show_in_default>
|
| 48 |
+
<show_in_website>1</show_in_website>
|
| 49 |
+
<show_in_store>1</show_in_store>
|
| 50 |
+
</debugging_active>
|
| 51 |
+
<fc_active translate="label">
|
| 52 |
+
<label>paymill_fc_active</label>
|
| 53 |
+
<sort_order>7</sort_order>
|
| 54 |
+
<frontend_type>select</frontend_type>
|
| 55 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 56 |
+
<show_in_default>1</show_in_default>
|
| 57 |
+
<show_in_website>1</show_in_website>
|
| 58 |
+
<show_in_store>1</show_in_store>
|
| 59 |
+
</fc_active>
|
| 60 |
+
<logging_active translate="label">
|
| 61 |
+
<label>paymill_Activate_Logging</label>
|
| 62 |
+
<sort_order>8</sort_order>
|
| 63 |
+
<frontend_type>select</frontend_type>
|
| 64 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 65 |
+
<show_in_default>1</show_in_default>
|
| 66 |
+
<show_in_website>1</show_in_website>
|
| 67 |
+
<show_in_store>1</show_in_store>
|
| 68 |
+
</logging_active>
|
| 69 |
+
<show_label translate="label">
|
| 70 |
+
<label>paymill_Show_Label</label>
|
| 71 |
+
<sort_order>9</sort_order>
|
| 72 |
+
<frontend_type>select</frontend_type>
|
| 73 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 74 |
+
<show_in_default>1</show_in_default>
|
| 75 |
+
<show_in_website>1</show_in_website>
|
| 76 |
+
<show_in_store>1</show_in_store>
|
| 77 |
+
</show_label>
|
| 78 |
+
<preAuth_active translate="label">
|
| 79 |
+
<label>paymill_preAuth_active</label>
|
| 80 |
+
<sort_order>10</sort_order>
|
| 81 |
+
<frontend_type>select</frontend_type>
|
| 82 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 83 |
+
<show_in_default>1</show_in_default>
|
| 84 |
+
<show_in_website>1</show_in_website>
|
| 85 |
+
<show_in_store>1</show_in_store>
|
| 86 |
+
</preAuth_active>
|
| 87 |
+
</fields>
|
| 88 |
+
</paymill>
|
| 89 |
+
|
| 90 |
+
<paymill_creditcard module="paymill" translate="label">
|
| 91 |
+
<label>paymill_credit_card_label</label>
|
| 92 |
+
<show_in_default>1</show_in_default>
|
| 93 |
+
<show_in_website>1</show_in_website>
|
| 94 |
+
<show_in_store>1</show_in_store>
|
| 95 |
+
<sort_order>800</sort_order>
|
| 96 |
+
<fields>
|
| 97 |
+
<version>
|
| 98 |
+
<label>v3.0.0</label>
|
| 99 |
+
<sort_order>100</sort_order>
|
| 100 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
| 101 |
+
<frontend_type>label</frontend_type>
|
| 102 |
+
<show_in_default>1</show_in_default>
|
| 103 |
+
<show_in_website>1</show_in_website>
|
| 104 |
+
<show_in_store>1</show_in_store>
|
| 105 |
+
</version>
|
| 106 |
+
|
| 107 |
+
<active translate="label">
|
| 108 |
+
<label>paymill_opt_Enabled</label>
|
| 109 |
+
<sort_order>200</sort_order>
|
| 110 |
+
<frontend_type>select</frontend_type>
|
| 111 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 112 |
+
<show_in_default>1</show_in_default>
|
| 113 |
+
<show_in_website>1</show_in_website>
|
| 114 |
+
<show_in_store>1</show_in_store>
|
| 115 |
+
</active>
|
| 116 |
+
|
| 117 |
+
<tokenTolerance translate="label, tooltip, comment">
|
| 118 |
+
<label>paymill_token_tolerace</label>
|
| 119 |
+
<sort_order>210</sort_order>
|
| 120 |
+
<tooltip>paymill_token_tolerace_tooltip</tooltip>
|
| 121 |
+
<comment>paymill_token_tolerace_comment</comment>
|
| 122 |
+
<frontend_type>text</frontend_type>
|
| 123 |
+
<show_in_default>1</show_in_default>
|
| 124 |
+
<show_in_website>1</show_in_website>
|
| 125 |
+
<show_in_store>1</show_in_store>
|
| 126 |
+
</tokenTolerance>
|
| 127 |
+
|
| 128 |
+
<specificcountry translate="label">
|
| 129 |
+
<label>paymill_opt_Countries</label>
|
| 130 |
+
<sort_order>300</sort_order>
|
| 131 |
+
<frontend_type>multiselect</frontend_type>
|
| 132 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 133 |
+
<can_be_empty>1</can_be_empty>
|
| 134 |
+
<show_in_default>1</show_in_default>
|
| 135 |
+
<show_in_website>1</show_in_website>
|
| 136 |
+
<show_in_store>1</show_in_store>
|
| 137 |
+
</specificcountry>
|
| 138 |
+
<currency translate="label">
|
| 139 |
+
<label>paymill_accepted_currency</label>
|
| 140 |
+
<frontend_type>multiselect</frontend_type>
|
| 141 |
+
<source_model>adminhtml/system_config_source_currency</source_model>
|
| 142 |
+
<sort_order>350</sort_order>
|
| 143 |
+
<show_in_default>1</show_in_default>
|
| 144 |
+
<show_in_website>1</show_in_website>
|
| 145 |
+
<show_in_store>0</show_in_store>
|
| 146 |
+
</currency>
|
| 147 |
+
<sort_order translate="label">
|
| 148 |
+
<label>paymill_opt_Sort</label>
|
| 149 |
+
<frontend_type>text</frontend_type>
|
| 150 |
+
<sort_order>400</sort_order>
|
| 151 |
+
<show_in_default>1</show_in_default>
|
| 152 |
+
<show_in_website>1</show_in_website>
|
| 153 |
+
<show_in_store>1</show_in_store>
|
| 154 |
+
</sort_order>
|
| 155 |
+
</fields>
|
| 156 |
+
</paymill_creditcard>
|
| 157 |
+
|
| 158 |
+
<paymill_directdebit module="paymill" translate="label">
|
| 159 |
+
<label>paymill_direct_debit_label</label>
|
| 160 |
+
<show_in_default>1</show_in_default>
|
| 161 |
+
<show_in_website>1</show_in_website>
|
| 162 |
+
<show_in_store>1</show_in_store>
|
| 163 |
+
<sort_order>800</sort_order>
|
| 164 |
+
<fields>
|
| 165 |
+
<version>
|
| 166 |
+
<label>v3.0.0</label>
|
| 167 |
+
<sort_order>100</sort_order>
|
| 168 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
| 169 |
+
<frontend_type>label</frontend_type>
|
| 170 |
+
<show_in_default>1</show_in_default>
|
| 171 |
+
<show_in_website>1</show_in_website>
|
| 172 |
+
<show_in_store>1</show_in_store>
|
| 173 |
+
</version>
|
| 174 |
+
|
| 175 |
+
<active translate="label">
|
| 176 |
+
<label>paymill_opt_Enabled</label>
|
| 177 |
+
<sort_order>200</sort_order>
|
| 178 |
+
<frontend_type>select</frontend_type>
|
| 179 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 180 |
+
<show_in_default>1</show_in_default>
|
| 181 |
+
<show_in_website>1</show_in_website>
|
| 182 |
+
<show_in_store>1</show_in_store>
|
| 183 |
+
</active>
|
| 184 |
+
|
| 185 |
+
<tokenTolerance translate="label, tooltip, comment">
|
| 186 |
+
<label>paymill_token_tolerace</label>
|
| 187 |
+
<sort_order>210</sort_order>
|
| 188 |
+
<tooltip>paymill_token_tolerace_tooltip</tooltip>
|
| 189 |
+
<comment>paymill_token_tolerace_comment</comment>
|
| 190 |
+
<frontend_type>text</frontend_type>
|
| 191 |
+
<show_in_default>1</show_in_default>
|
| 192 |
+
<show_in_website>1</show_in_website>
|
| 193 |
+
<show_in_store>1</show_in_store>
|
| 194 |
+
</tokenTolerance>
|
| 195 |
+
|
| 196 |
+
<specificcountry translate="label">
|
| 197 |
+
<label>paymill_opt_Countries</label>
|
| 198 |
+
<sort_order>300</sort_order>
|
| 199 |
+
<frontend_type>multiselect</frontend_type>
|
| 200 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 201 |
+
<can_be_empty>1</can_be_empty>
|
| 202 |
+
<show_in_default>1</show_in_default>
|
| 203 |
+
<show_in_website>1</show_in_website>
|
| 204 |
+
<show_in_store>1</show_in_store>
|
| 205 |
+
</specificcountry>
|
| 206 |
+
<currency translate="label">
|
| 207 |
+
<label>paymill_accepted_currency</label>
|
| 208 |
+
<frontend_type>multiselect</frontend_type>
|
| 209 |
+
<source_model>adminhtml/system_config_source_currency</source_model>
|
| 210 |
+
<sort_order>350</sort_order>
|
| 211 |
+
<show_in_default>1</show_in_default>
|
| 212 |
+
<show_in_website>1</show_in_website>
|
| 213 |
+
<show_in_store>0</show_in_store>
|
| 214 |
+
</currency>
|
| 215 |
+
<sort_order translate="label">
|
| 216 |
+
<label>paymill_opt_Sort</label>
|
| 217 |
+
<frontend_type>text</frontend_type>
|
| 218 |
+
<sort_order>400</sort_order>
|
| 219 |
+
<show_in_default>1</show_in_default>
|
| 220 |
+
<show_in_website>1</show_in_website>
|
| 221 |
+
<show_in_store>1</show_in_store>
|
| 222 |
+
</sort_order>
|
| 223 |
+
</fields>
|
| 224 |
+
</paymill_directdebit>
|
| 225 |
+
</groups>
|
| 226 |
+
</payment>
|
| 227 |
+
</sections>
|
| 228 |
+
</config>
|
app/code/community/Paymill/Paymill/sql/paymill_setup/mysql4-install-3.0.0.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category Paymill
|
| 16 |
+
* @package Paymill_Paymill
|
| 17 |
+
* @copyright Copyright (c) 2013 PAYMILL GmbH (https://paymill.com/en-gb/)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
$installer = $this;
|
| 22 |
+
$installer->startSetup();
|
| 23 |
+
|
| 24 |
+
$installer->run("
|
| 25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('paymill_log')}` (
|
| 26 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 27 |
+
`entry_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 28 |
+
`version` varchar(25) NOT NULL COLLATE utf8_unicode_ci,
|
| 29 |
+
`merchant_info` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
|
| 30 |
+
`dev_info` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
| 31 |
+
`dev_info_additional` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
| 32 |
+
PRIMARY KEY (`id`)
|
| 33 |
+
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
|
| 34 |
+
|
| 35 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('paymill_fastCheckout')}` (
|
| 36 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
| 37 |
+
`user_id` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
|
| 38 |
+
`client_id` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
|
| 39 |
+
`cc_payment_id` varchar(250) COLLATE utf8_unicode_ci NULL,
|
| 40 |
+
`elv_payment_id` varchar(250) COLLATE utf8_unicode_ci NULL,
|
| 41 |
+
PRIMARY KEY (`id`),
|
| 42 |
+
UNIQUE KEY `userId` (`user_id`)
|
| 43 |
+
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
|
| 44 |
+
");
|
| 45 |
+
|
| 46 |
+
$installer->endSetup();
|
app/design/adminhtml/base/default/layout/paymill.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<paymill_adminhtml_log_index>
|
| 4 |
+
<reference name="content">
|
| 5 |
+
<block type="paymill/adminhtml_log" name="adminhtml_log.grid.container" />
|
| 6 |
+
</reference>
|
| 7 |
+
</paymill_adminhtml_log_index>
|
| 8 |
+
<paymill_adminhtml_log_grid>
|
| 9 |
+
<update handle="formkey"/>
|
| 10 |
+
<block type="paymill/adminhtml_log_grid" name="adminhtml_log.grid" output="toHtml" />
|
| 11 |
+
</paymill_adminhtml_log_grid>
|
| 12 |
+
</layout>
|
app/design/adminhtml/base/default/template/paymill/payment/info/creditcard.phtml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if ($_specificInfo = $this->getSpecificInformation()): ?>
|
| 2 |
+
<table
|
| 3 |
+
<tr>
|
| 4 |
+
<td><img src="<?php echo $_specificInfo['imgUrl'] ?>" /></td>
|
| 5 |
+
</tr>
|
| 6 |
+
<tr>
|
| 7 |
+
<td><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></td>
|
| 8 |
+
</tr>
|
| 9 |
+
<tr>
|
| 10 |
+
<td><?php echo $this->escapeHtml("Transaction Id: " . $_specificInfo['paymillTransactionId']); ?></td>
|
| 11 |
+
</tr>
|
| 12 |
+
</table>
|
| 13 |
+
<?php endif; ?>
|
| 14 |
+
<?php echo $this->getChildHtml() ?>
|
app/design/adminhtml/base/default/template/paymill/payment/info/directdebit.phtml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php if ($_specificInfo = $this->getSpecificInformation()): ?>
|
| 2 |
+
<table
|
| 3 |
+
<tr>
|
| 4 |
+
<td><img src="<?php echo $_specificInfo['imgUrl'] ?>" /></td>
|
| 5 |
+
</tr>
|
| 6 |
+
<tr>
|
| 7 |
+
<td><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></td>
|
| 8 |
+
</tr>
|
| 9 |
+
<tr>
|
| 10 |
+
<td><?php echo $this->escapeHtml("Transaction Id: " . $_specificInfo['paymillTransactionId']); ?></td>
|
| 11 |
+
</tr>
|
| 12 |
+
</table>
|
| 13 |
+
<?php endif; ?>
|
| 14 |
+
<?php echo $this->getChildHtml() ?>
|
app/design/frontend/base/default/layout/paymill.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
To change this template, choose Tools | Templates
|
| 4 |
+
and open the template in the editor.
|
| 5 |
+
-->
|
| 6 |
+
<layout version="0.1.0">
|
| 7 |
+
<checkout_onepage_index>
|
| 8 |
+
<reference name="head">
|
| 9 |
+
<action method="addCss">
|
| 10 |
+
<stylesheet>css/paymill/logo.css</stylesheet>
|
| 11 |
+
</action>
|
| 12 |
+
<block type="core/text" name="google.cdn.jquery">
|
| 13 |
+
<action method="setText">
|
| 14 |
+
<text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script type="text/javascript" src="https://bridge.paymill.com/"></script></script><script type="text/javascript">pmQuery = jQuery.noConflict();</script>]]></text>
|
| 15 |
+
</action>
|
| 16 |
+
</block>
|
| 17 |
+
</reference>
|
| 18 |
+
</checkout_onepage_index>
|
| 19 |
+
</layout>
|
app/design/frontend/base/default/template/paymill/payment/form/creditcard.phtml
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $_code=$this->getMethodCode() ?>
|
| 2 |
+
<script type="text/javascript" src="<?php echo Mage::helper('paymill')->getJscriptPath()."paymentForm.js"?>"></script>
|
| 3 |
+
<?php echo Mage::helper('paymill')->getFormTypeForDisplay($_code)?>
|
| 4 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
| 5 |
+
<li>
|
| 6 |
+
<p class="paymill-payment-errors alert-error" style="display:none;"></p>
|
| 7 |
+
</li>
|
| 8 |
+
<li>
|
| 9 |
+
<label class="card-number-label">
|
| 10 |
+
<?php echo $this->__("paymill_Number") ?>
|
| 11 |
+
</label>
|
| 12 |
+
</li>
|
| 13 |
+
<li>
|
| 14 |
+
<div class="card-icon"></div>
|
| 15 |
+
</li>
|
| 16 |
+
<li>
|
| 17 |
+
<input id ="card-number" class="card-number" type="text" size="20"/>
|
| 18 |
+
</li>
|
| 19 |
+
<li>
|
| 20 |
+
<label class="card-cvc-label">
|
| 21 |
+
<?php echo $this->__("paymill_Cvc") ?>
|
| 22 |
+
</label>
|
| 23 |
+
</li>
|
| 24 |
+
<li>
|
| 25 |
+
<input class="card-cvc" type="text" size="4"/>
|
| 26 |
+
</li>
|
| 27 |
+
<li>
|
| 28 |
+
<label class="card-holdername-label">
|
| 29 |
+
<?php echo $this->__("paymill_Holder") ?>
|
| 30 |
+
</label>
|
| 31 |
+
</li>
|
| 32 |
+
<li>
|
| 33 |
+
<input class="card-holdername" type="text" size="20"/>
|
| 34 |
+
</li>
|
| 35 |
+
<li>
|
| 36 |
+
<label class="card-expiry-label">
|
| 37 |
+
<?php echo $this->__("paymill_Date") ?>
|
| 38 |
+
</label>
|
| 39 |
+
</li>
|
| 40 |
+
<li>
|
| 41 |
+
<div>
|
| 42 |
+
<input class="card-expiry-month" type="text" size="2"/>
|
| 43 |
+
<span> / </span>
|
| 44 |
+
<input class="card-expiry-year" type="text" size="4"/>
|
| 45 |
+
</div>
|
| 46 |
+
</li>
|
| 47 |
+
<?php if(Mage::helper('paymill/optionHelper')->isShowingLabels()){ echo "<li><div class='paymill_powered'><div class='paymill_credits'>".$this->__("paymill_slogan")."<a href='http://www.paymill.de' target='_blank'>Paymill</a></div></div></li>";} ?>
|
| 48 |
+
<li>
|
| 49 |
+
<input class="paymill-payment-token" name="payment[paymill-payment-token]" id="payment[paymill-payment-token]" type="hidden" value="" />
|
| 50 |
+
<input class="paymill-payment-amount" name="payment[paymill-payment-amount]" id="payment[paymill-payment-amount]" type="hidden" value="<?php echo Mage::helper('paymill/paymentHelper')->getAmount() ?>" />
|
| 51 |
+
<input class="paymill-payment-currency" name="payment[paymill-payment-currency]" id="payment[paymill-payment-currency]" type="hidden" value="<?php echo Mage::helper('paymill/paymentHelper')->getCurrency() ?>" />
|
| 52 |
+
<input class="paymill-option-debug" name="payment[paymill-option-debug]" id="payment[paymill-option-debug]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->isInDebugMode() ?>" />
|
| 53 |
+
<input class="paymill-option-tokenTolerance-cc" name="payment[paymill-option-tokenTolerance-cc]" id="payment[paymill-option-tokenTolerance-cc]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->getTokenTolerance($_code) ?>"/>
|
| 54 |
+
<input class="paymill-info-image-path" name="payment[paymill-info-image-path]" id="payment[paymill-info-image-path]" type="hidden" value="<?php echo Mage::helper('paymill')->getImagePath() ?>" />
|
| 55 |
+
<input class="paymill-info-public_key" name="payment[paymill-info-public_key]" id="payment[paymill-info-public_key]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->getPublicKey() ?>" />
|
| 56 |
+
<input class="paymill-info-fastCheckout-cc" name="payment[paymill-info-fastCheckout-cc]" id="payment[paymill-info-fastCheckout-cc]" type="hidden" value="<?php echo Mage::helper('paymill')->showTemplateForm($_code) ?>" />
|
| 57 |
+
<input class="paymill-payment-error-number" name="payment[paymill-payment-error-number]" id="payment[paymill-payment-error-number]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_number_cc") ."<br/>\n" ?>" />
|
| 58 |
+
<input class="paymill-payment-error-holder" name="payment[paymill-payment-error-holder]" id="payment[paymill-payment-error-holder]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_holder_cc") ."<br/>\n" ?>" />
|
| 59 |
+
<input class="paymill-payment-error-expdate" name="payment[paymill-payment-error-expdate]" id="payment[paymill-payment-error-expdate]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_expdate") ."<br/>\n" ?>" />
|
| 60 |
+
<input class="paymill-payment-error-cvc" name="payment[paymill-payment-error-cvc]" id="payment[paymill-payment-error--cvc]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_cvc") ."<br/>\n" ?>" />
|
| 61 |
+
</li>
|
| 62 |
+
</ul>
|
| 63 |
+
</div>
|
app/design/frontend/base/default/template/paymill/payment/form/directdebit.phtml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $_code=$this->getMethodCode() ?>
|
| 2 |
+
<script type="text/javascript" src="<?php echo Mage::helper('paymill')->getJscriptPath()."paymentForm.js"?>"></script>
|
| 3 |
+
<?php echo Mage::helper('paymill')->getFormTypeForDisplay($_code)?>
|
| 4 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
| 5 |
+
<li>
|
| 6 |
+
<p class="paymill-payment-errors alert-error" style="display:none;"></p>
|
| 7 |
+
</li>
|
| 8 |
+
<li>
|
| 9 |
+
<label class="elv-account-label">
|
| 10 |
+
<?php echo $this->__("paymill_account") ?>
|
| 11 |
+
</label>
|
| 12 |
+
</li>
|
| 13 |
+
<li>
|
| 14 |
+
<input class="elv-account" type="text" size="20"/>
|
| 15 |
+
</li>
|
| 16 |
+
<li>
|
| 17 |
+
<label class="elv-bankcode-label">
|
| 18 |
+
<?php echo $this->__("paymill_bankcode") ?>
|
| 19 |
+
</label>
|
| 20 |
+
</li>
|
| 21 |
+
<li>
|
| 22 |
+
<input class="elv-bankcode" type="text" size="20"/>
|
| 23 |
+
</li>
|
| 24 |
+
<li>
|
| 25 |
+
<label class="elv-holdername-label">
|
| 26 |
+
<?php echo $this->__("paymill_Holder") ?>
|
| 27 |
+
</label>
|
| 28 |
+
</li>
|
| 29 |
+
<li>
|
| 30 |
+
<input class="elv-holdername" size="20"/>
|
| 31 |
+
</li>
|
| 32 |
+
<?php if(Mage::helper('paymill/optionHelper')->isShowingLabels()){ echo "<li><div class='paymill_powered'><div class='paymill_credits'>".$this->__("paymill_slogan")."<a href='http://www.paymill.de' target='_blank'>Paymill</a></div></div></li>";} ?>
|
| 33 |
+
<li>
|
| 34 |
+
<input class="paymill-payment-token" name="payment[paymill-payment-token]" id="payment[paymill-payment-token]" type="hidden" value="" />
|
| 35 |
+
<input class="paymill-payment-amount" name="payment[paymill-payment-amount]" id="payment[paymill-payment-amount]" type="hidden" value="<?php echo Mage::helper('paymill/paymentHelper')->getAmount() ?>" />
|
| 36 |
+
<input class="paymill-payment-currency" name="payment[paymill-payment-currency]" id="payment[paymill-payment-currency]" type="hidden" value="<?php echo Mage::helper('paymill/paymentHelper')->getCurrency() ?>" />
|
| 37 |
+
<input class="paymill-option-debug" name="payment[paymill-option-debug]" id="payment[paymill-option-debug]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->isInDebugMode() ?>" />
|
| 38 |
+
<input class="paymill-option-tokenTolerance-elv" name="payment[paymill-option-tokenTolerance-elv]" id="payment[paymill-option-tokenTolerance-elv]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->getTokenTolerance($_code) ?>" />
|
| 39 |
+
<input class="paymill-info-image-path" name="payment[paymill-info-image-path]" id="payment[paymill-info-image-path]" type="hidden" value="<?php echo Mage::helper('paymill')->getImagePath() ?>" />
|
| 40 |
+
<input class="paymill-info-public_key" name="payment[paymill-info-public_key]" id="payment[paymill-info-public_key]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->getPublicKey() ?>" />
|
| 41 |
+
<input class="paymill-info-fastCheckout-elv" name="payment[paymill-info-fastCheckout-elv]" id="payment[paymill-info-fastCheckout-elv]" type="hidden" value="<?php echo Mage::helper('paymill')->showTemplateForm($_code) ?>" />
|
| 42 |
+
<input class="paymill-payment-error-number-elv" name="payment[paymill-payment-error-number-elv]" id="payment[paymill-payment-error-number-elv]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_number_elv") ."<br/>\n" ?>" />
|
| 43 |
+
<input class="paymill-payment-error-holder-elv" name="payment[paymill-payment-error-holder-elv]" id="payment[paymill-payment-error-holder-elv]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_holder_elv") ."<br/>\n" ?>" />
|
| 44 |
+
<input class="paymill-payment-error-bankcode" name="payment[paymill-payment-error-bankcode]" id="payment[paymill-payment-error-bankcode]" type="hidden" value="<?php echo $this->__("paymill_error_text_invalid_bankcode") ."<br/>\n" ?>" />
|
| 45 |
+
</li>
|
| 46 |
+
</ul>
|
| 47 |
+
</div>
|
app/design/frontend/base/default/template/paymill/payment/info/creditcard.phtml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<table>
|
| 2 |
+
<tr>
|
| 3 |
+
<td><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></td>
|
| 4 |
+
</tr>
|
| 5 |
+
</table>
|
| 6 |
+
<?php echo $this->getChildHtml() ?>
|
app/design/frontend/base/default/template/paymill/payment/info/directdebit.phtml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<table>
|
| 2 |
+
<tr>
|
| 3 |
+
<td><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></td>
|
| 4 |
+
</tr>
|
| 5 |
+
</table>
|
| 6 |
+
<?php echo $this->getChildHtml() ?>
|
app/etc/modules/Paymill_Paymill.xml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<!-- declare CompanyName_NewModule module -->
|
| 5 |
+
<Paymill_Paymill>
|
| 6 |
+
<!-- this is an active module -->
|
| 7 |
+
<active>true</active>
|
| 8 |
+
<!-- this module will be located in app/code/local code pool -->
|
| 9 |
+
<codePool>community</codePool>
|
| 10 |
+
<!-- specify dependencies for correct module loading order -->
|
| 11 |
+
<depends>
|
| 12 |
+
<Mage_Payment />
|
| 13 |
+
</depends>
|
| 14 |
+
</Paymill_Paymill>
|
| 15 |
+
</modules>
|
| 16 |
+
</config>
|
app/locale/de_DE/Paymill_Paymill.csv
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"paymill_credit_card","Kreditkarte"
|
| 2 |
+
"paymill_direct_debit","Lastschrift"
|
| 3 |
+
"paymill_creditcard","Kreditkarte"
|
| 4 |
+
"paymill_directdebit","Lastschrift"
|
| 5 |
+
"paymill_Basic_Setting","Paymill Grundeinstellungen"
|
| 6 |
+
"paymill_Public_Key","Public Key"
|
| 7 |
+
"paymill_Private_Key","Private Key"
|
| 8 |
+
"paymill_Activate_Debugging","Debugging aktivieren"
|
| 9 |
+
"paymill_fc_active","One Step Checkout erlauben"
|
| 10 |
+
"paymill_Activate_Logging","Logging aktivieren"
|
| 11 |
+
"paymill_Show_Label","Paymill Label im Checkout anzeigen"
|
| 12 |
+
"paymill_credit_card_label","Kreditkarte"
|
| 13 |
+
"paymill_direct_debit_label","Lastschrift"
|
| 14 |
+
"paymill_opt_Enabled","aktivieren"
|
| 15 |
+
"paymill_opt_Countries","Länder"
|
| 16 |
+
"paymill_opt_Sort","Anzeigeposition"
|
| 17 |
+
"paymill_Number","Nummer"
|
| 18 |
+
"paymill_Cvc","CVC"
|
| 19 |
+
"paymill_Holder","Inhabername"
|
| 20 |
+
"paymill_Date","Gültig bis"
|
| 21 |
+
"paymill_Amount","Betrag"
|
| 22 |
+
"paymill_Currency","Währung"
|
| 23 |
+
"paymill_public_key_tooltip","Bitte geben Sie hier Ihren Public Key ein."
|
| 24 |
+
"paymill_public_key_comment","Ihren Public Key können Sie dem Paymill Cockpit entnehmen."
|
| 25 |
+
"paymill_private_key_tooltip","Bitte geben Sie hier Ihren Private Key ein."
|
| 26 |
+
"paymill_private_key_comment","Ihren Private Key können Sie dem Paymill Cockpit entnehmen."
|
| 27 |
+
"paymill_error_text_invalid_number_cc","Bitte geben Sie eine gültige Kreditkartennummer ein."
|
| 28 |
+
"paymill_error_text_invalid_number_elv","Bitte geben Sie eine gültige Kontonummer ein"
|
| 29 |
+
"paymill_error_text_invalid_expdate","Ungültiges Ablaufdatum"
|
| 30 |
+
"paymill_error_text_invalid_holder_cc","Bitte geben Sie einen Karteninhaber an."
|
| 31 |
+
"paymill_error_text_invalid_holder_elv","Bitte geben Sie einen Kontoinhaber an."
|
| 32 |
+
"paymill_error_text_invalid_bankcode","Ungültige Bankleitzahl"
|
| 33 |
+
"paymill_error_text_invalid_payment","Zahlart konnte nicht identifiziert werden. Bitte kontaktieren Sie den Support."
|
| 34 |
+
"paymill_account","Kontonummer"
|
| 35 |
+
"paymill_bankcode","Bankleitzahl"
|
| 36 |
+
"paymill_log","Paymill Log"
|
| 37 |
+
"paymill_error_text_no_entry_selected","Bitte wählen Sie einen Eintrag aus"
|
| 38 |
+
"paymill_action_delete", "Auswahl löschen"
|
| 39 |
+
"paymill_dialog_confirm", "Sind Sie sicher?"
|
| 40 |
+
"paymill_backend_log_id","ID"
|
| 41 |
+
"paymill_backend_log_entry_date","Eintragsdatum"
|
| 42 |
+
"paymill_backend_log_version","Version"
|
| 43 |
+
"paymill_backend_log_merchant_info","Händler Informationen"
|
| 44 |
+
"paymill_backend_log_dev_info","Entwickler Informationen"
|
| 45 |
+
"paymill_backend_log_dev_info_additional","Weitere Entwickler Informationen"
|
| 46 |
+
"paymill_checkout_generating_invoice","Rechnung wird generiert"
|
| 47 |
+
"paymill_preAuth_active","Kreditkarten transaktionen im Checkout authorisieren, Buchung bei Rechnungsgenerierung durchführen."
|
| 48 |
+
"paymill_token_tolerace","Token Toleranz Wert"
|
| 49 |
+
"paymill_token_tolerace_tooltip","Wert der bei Generierung des Paymill Tokens aufgeschlagen wird, um 3DSecure Abweichungen zu vermeiden"
|
| 50 |
+
"paymill_token_tolerace_comment", "Wert der bei Generierung des Paymill Tokens aufgeschlagen wird, um 3DSecure Abweichungen zu vermeiden"
|
| 51 |
+
"paymill_log_action_success", "Aktion erfolgreich"
|
| 52 |
+
"paymill_accepted_currency", "Aktzeptierte Währungen"
|
| 53 |
+
"paymill_slogan","Sichere Kreditkartenzahlung powered by "
|
| 54 |
+
"paymill_error_text_invalid_cvc", "Ungültige CVC"
|
app/locale/en_GB/Paymill_Paymill.csv
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"paymill_credit_card","Credit Card"
|
| 2 |
+
"paymill_direct_debit","Direct Debit"
|
| 3 |
+
"paymill_creditcard","Credit Card"
|
| 4 |
+
"paymill_directdebit","Direct Debit"
|
| 5 |
+
"paymill_Basic_Setting","Paymill Basic Settings"
|
| 6 |
+
"paymill_Public_Key","Public Key"
|
| 7 |
+
"paymill_Private_Key","Private Key"
|
| 8 |
+
"paymill_Activate_Debugging","activate Debugging"
|
| 9 |
+
"paymill_fc_active","enable fast checkout"
|
| 10 |
+
"paymill_Activate_Logging","enable logging"
|
| 11 |
+
"paymill_Show_Label","show Paymill label during checkout"
|
| 12 |
+
"paymill_credit_card_label","Credit Card"
|
| 13 |
+
"paymill_direct_debit_label","Direct Debit"
|
| 14 |
+
"paymill_opt_Enabled","enable"
|
| 15 |
+
"paymill_opt_Countries","Countries"
|
| 16 |
+
"paymill_opt_Sort","Display position"
|
| 17 |
+
"paymill_Number","Number"
|
| 18 |
+
"paymill_Cvc","CVC"
|
| 19 |
+
"paymill_Holder","Holdername"
|
| 20 |
+
"paymill_Date","Valid until (MM/YYYY)"
|
| 21 |
+
"paymill_Amount","Amount"
|
| 22 |
+
"paymill_Currency","Currency"
|
| 23 |
+
"paymill_public_key_tooltip","Please enter your Public Key."
|
| 24 |
+
"paymill_public_key_comment","You can find your public key in the paymill cockpit by clicking: MY ACCOUNT->Settings->API keys"
|
| 25 |
+
"paymill_private_key_tooltip","Please enter your Private Key."
|
| 26 |
+
"paymill_private_key_comment","You can find your private key in the paymill cockpit by clicking: MY ACCOUNT->Settings->API keys"
|
| 27 |
+
"paymill_error_text_invalid_number_cc","Please enter a valid Credit Card number."
|
| 28 |
+
"paymill_error_text_invalid_number_elv","Please enter a valid Accountnumber"
|
| 29 |
+
"paymill_error_text_invalid_expdate","Invalid Expiry Date"
|
| 30 |
+
"paymill_error_text_invalid_holder_cc","Please enter a card holder."
|
| 31 |
+
"paymill_error_text_invalid_holder_elv","Please enter an account holder."
|
| 32 |
+
"paymill_error_text_invalid_bankcode","Invalid Bankcode"
|
| 33 |
+
"paymill_error_text_invalid_payment","The payment you chose could not be identified. Please contact the support"
|
| 34 |
+
"paymill_account","Accountnumber"
|
| 35 |
+
"paymill_bankcode","Bankcode"
|
| 36 |
+
"paymill_log","Paymill Log"
|
| 37 |
+
"paymill_error_text_no_entry_selected","Please select an entry"
|
| 38 |
+
"paymill_action_delete", "Delete selection"
|
| 39 |
+
"paymill_dialog_confirm", "Are you sure?"
|
| 40 |
+
"paymill_backend_log_id","ID"
|
| 41 |
+
"paymill_backend_log_entry_date","Entry date"
|
| 42 |
+
"paymill_backend_log_version","Version"
|
| 43 |
+
"paymill_backend_log_merchant_info","Merchant Information"
|
| 44 |
+
"paymill_backend_log_dev_info","Developer Information"
|
| 45 |
+
"paymill_backend_log_dev_info_additional","Additional Developer Information"
|
| 46 |
+
"paymill_checkout_generating_invoice","Invoice is beeing generated"
|
| 47 |
+
"paymill_preAuth_active","Authorize Credit Card payments during Checkout and capture manually by generating the invoice."
|
| 48 |
+
"paymill_token_tolerace","Token Tolerance Value"
|
| 49 |
+
"paymill_token_tolerace_tooltip","Sum of all additional charges used to avoid 3D secure variations"
|
| 50 |
+
"paymill_token_tolerace_comment", "Sum of all additional charges used to avoid 3D secure variations"
|
| 51 |
+
"paymill_log_action_success", "Action successful"
|
| 52 |
+
"paymill_accepted_currency", "Accepted Currencies"
|
| 53 |
+
"paymill_slogan","Secure Payments powered by "
|
| 54 |
+
"paymill_error_text_invalid_cvc", "Invalid cvc"
|
app/locale/en_US/Paymill_Paymill.csv
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"paymill_credit_card","Credit Card"
|
| 2 |
+
"paymill_direct_debit","Direct Debit"
|
| 3 |
+
"paymill_creditcard","Credit Card"
|
| 4 |
+
"paymill_directdebit","Direct Debit"
|
| 5 |
+
"paymill_Basic_Setting","Paymill Basic Settings"
|
| 6 |
+
"paymill_Public_Key","Public Key"
|
| 7 |
+
"paymill_Private_Key","Private Key"
|
| 8 |
+
"paymill_Activate_Debugging","activate Debugging"
|
| 9 |
+
"paymill_fc_active","enable fast checkout"
|
| 10 |
+
"paymill_Activate_Logging","enable logging"
|
| 11 |
+
"paymill_Show_Label","show Paymill label during checkout"
|
| 12 |
+
"paymill_credit_card_label","Credit Card"
|
| 13 |
+
"paymill_direct_debit_label","Direct Debit"
|
| 14 |
+
"paymill_opt_Enabled","enable"
|
| 15 |
+
"paymill_opt_Countries","Countries"
|
| 16 |
+
"paymill_opt_Sort","Display position"
|
| 17 |
+
"paymill_Number","Number"
|
| 18 |
+
"paymill_Cvc","CVC"
|
| 19 |
+
"paymill_Holder","Holdername"
|
| 20 |
+
"paymill_Date","Valid until (MM/YYYY)"
|
| 21 |
+
"paymill_Amount","Amount"
|
| 22 |
+
"paymill_Currency","Currency"
|
| 23 |
+
"paymill_public_key_tooltip","Please enter your Public Key."
|
| 24 |
+
"paymill_public_key_comment","You can find your public key in the paymill cockpit by clicking: MY ACCOUNT->Settings->API keys"
|
| 25 |
+
"paymill_private_key_tooltip","Please enter your Private Key."
|
| 26 |
+
"paymill_private_key_comment","You can find your private key in the paymill cockpit by clicking: MY ACCOUNT->Settings->API keys"
|
| 27 |
+
"paymill_error_text_invalid_number_cc","Please enter a valid Credit Card number."
|
| 28 |
+
"paymill_error_text_invalid_number_elv","Please enter a valid Accountnumber"
|
| 29 |
+
"paymill_error_text_invalid_expdate","Invalid Expiry Date"
|
| 30 |
+
"paymill_error_text_invalid_holder_cc","Please enter a card holder."
|
| 31 |
+
"paymill_error_text_invalid_holder_elv","Please enter an account holder."
|
| 32 |
+
"paymill_error_text_invalid_bankcode","Invalid Bankcode"
|
| 33 |
+
"paymill_error_text_invalid_payment","The payment you chose could not be identified. Please contact the support"
|
| 34 |
+
"paymill_account","Accountnumber"
|
| 35 |
+
"paymill_bankcode","Bankcode"
|
| 36 |
+
"paymill_log","Paymill Log"
|
| 37 |
+
"paymill_error_text_no_entry_selected","Please select an entry"
|
| 38 |
+
"paymill_action_delete", "Delete selection"
|
| 39 |
+
"paymill_dialog_confirm", "Are you sure?"
|
| 40 |
+
"paymill_backend_log_id","ID"
|
| 41 |
+
"paymill_backend_log_entry_date","Entry date"
|
| 42 |
+
"paymill_backend_log_version","Version"
|
| 43 |
+
"paymill_backend_log_merchant_info","Merchant Information"
|
| 44 |
+
"paymill_backend_log_dev_info","Developer Information"
|
| 45 |
+
"paymill_backend_log_dev_info_additional","Additional Developer Information"
|
| 46 |
+
"paymill_checkout_generating_invoice","Invoice is beeing generated"
|
| 47 |
+
"paymill_preAuth_active","Authorize Credit Card payments during Checkout and capture manually by generating the invoice."
|
| 48 |
+
"paymill_token_tolerace","Token Tolerance Value"
|
| 49 |
+
"paymill_token_tolerace_tooltip","Sum of all additional charges used to avoid 3D secure variations"
|
| 50 |
+
"paymill_token_tolerace_comment", "Sum of all additional charges used to avoid 3D secure variations"
|
| 51 |
+
"paymill_log_action_success", "Action successful"
|
| 52 |
+
"paymill_accepted_currency", "Accepted Currencies"
|
| 53 |
+
"paymill_slogan","Secure Payments powered by "
|
| 54 |
+
"paymill_error_text_invalid_cvc", "Invalid cvc"
|
js/paymill/paymentForm.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//Backend Options
|
| 2 |
+
var PAYMILL_PUBLIC_KEY = null;
|
| 3 |
+
|
| 4 |
+
//State Descriptors
|
| 5 |
+
var PAYMILL_PAYMENT_NAME = "Preparing Payment";
|
| 6 |
+
var PAYMILL_IMAGE_PATH = null;
|
| 7 |
+
var PAYMILL_NO_FAST_CHECKOUT = false;
|
| 8 |
+
|
| 9 |
+
//Errortexts
|
| 10 |
+
var PAYMILL_ERROR_STRING = "";
|
| 11 |
+
var PAYMILL_ERROR_TEXT_IVALID_NUMBER = null;
|
| 12 |
+
var PAYMILL_ERROR_TEXT_IVALID_EXPDATE = null;
|
| 13 |
+
var PAYMILL_ERROR_TEXT_IVALID_HOLDER = null;
|
| 14 |
+
var PAYMILL_ERROR_TEXT_IVALID_BANKCODE = null;
|
| 15 |
+
var PAYMILL_ERROR_TEXT_IVALID_PAYMENT = null;
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* prints debug messages in the log if debug mode is active
|
| 19 |
+
* @param {String} message
|
| 20 |
+
*/
|
| 21 |
+
function debug(message)
|
| 22 |
+
{
|
| 23 |
+
debug_state = pmQuery('.paymill-option-debug').val();
|
| 24 |
+
if(debug_state == 1){
|
| 25 |
+
var displayName = "";
|
| 26 |
+
if(PAYMILL_PAYMENT_NAME === 'paymill_creditcard'){
|
| 27 |
+
displayName = 'Credit Card';
|
| 28 |
+
}
|
| 29 |
+
if(PAYMILL_PAYMENT_NAME === 'paymill_directdebit'){
|
| 30 |
+
displayName = 'Direct Debit';
|
| 31 |
+
}
|
| 32 |
+
if(PAYMILL_PAYMENT_NAME === 'Preparing Payment'){
|
| 33 |
+
displayName = 'Preparing Payment';
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
console.log("["+ displayName +"] " + message);
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Event Handler for the display of the card icons
|
| 42 |
+
*/
|
| 43 |
+
function paymillShowCardIcon()
|
| 44 |
+
{
|
| 45 |
+
switch(paymill.cardType(pmQuery('.card-number').val())){
|
| 46 |
+
case 'Visa':
|
| 47 |
+
pmQuery('.card-icon').html('<img src="'+ pmQuery('.paymill-info-image-path').val() +'icon_visa.png" >');
|
| 48 |
+
pmQuery('.card-icon').show();
|
| 49 |
+
break;
|
| 50 |
+
case 'MasterCard':
|
| 51 |
+
pmQuery('.card-icon').html('<img src="'+ pmQuery('.paymill-info-image-path').val() +'icon_mastercard.png" >');
|
| 52 |
+
pmQuery('.card-icon').show();
|
| 53 |
+
break;
|
| 54 |
+
default:
|
| 55 |
+
pmQuery('.card-icon').hide();
|
| 56 |
+
debug("Creditcard number not according to any known pattern: "+paymill.cardType(pmQuery('.card-number').val()));
|
| 57 |
+
break;
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Handles the response of the paymill bridge. saves the token in a formfield.
|
| 63 |
+
* @param {Boolean} error
|
| 64 |
+
* @param {response object} result
|
| 65 |
+
*/
|
| 66 |
+
function paymillResponseHandler(error, result)
|
| 67 |
+
{
|
| 68 |
+
if (error) {
|
| 69 |
+
// Appending error
|
| 70 |
+
PAYMILL_ERROR_STRING += error.apierror + "\n";
|
| 71 |
+
debug(error.apierror);
|
| 72 |
+
debug("Paymill Response Handler triggered: Error.");
|
| 73 |
+
} else {
|
| 74 |
+
// Appending Token to form
|
| 75 |
+
debug("Saving Token in Form: "+result.token);
|
| 76 |
+
pmQuery('.paymill-payment-token').val(result.token);
|
| 77 |
+
payment.save();
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
*
|
| 83 |
+
* @returns {Boolean}
|
| 84 |
+
*/
|
| 85 |
+
function paymillSubmitForm()
|
| 86 |
+
{
|
| 87 |
+
PAYMILL_PAYMENT_NAME = pmQuery("input[name='payment[method]']:checked").val();
|
| 88 |
+
PAYMILL_ERROR_STRING = "";
|
| 89 |
+
pmQuery('.paymill-payment-errors').hide();
|
| 90 |
+
|
| 91 |
+
if(PAYMILL_PAYMENT_NAME === "paymill_creditcard"){
|
| 92 |
+
PAYMILL_ERROR_TEXT_IVALID_NUMBER_CC = pmQuery('.paymill-payment-error-number').val();
|
| 93 |
+
PAYMILL_ERROR_TEXT_IVALID_HOLDER_CC = pmQuery('.paymill-payment-error-holder').val();
|
| 94 |
+
PAYMILL_ERROR_TEXT_IVALID_CVC = pmQuery('.paymill-payment-error-cvc').val();
|
| 95 |
+
PAYMILL_ERROR_TEXT_IVALID_EXPDATE = pmQuery('.paymill-payment-error-expdate').val();
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if(PAYMILL_PAYMENT_NAME === "paymill_directdebit"){
|
| 99 |
+
PAYMILL_ERROR_TEXT_IVALID_NUMBER_ELV = pmQuery('.paymill-payment-error-number-elv').val();
|
| 100 |
+
PAYMILL_ERROR_TEXT_IVALID_HOLDER_ELV = pmQuery('.paymill-payment-error-holder-elv').val();
|
| 101 |
+
PAYMILL_ERROR_TEXT_IVALID_BANKCODE = pmQuery('.paymill-payment-error-bankcode').val();;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
switch(PAYMILL_PAYMENT_NAME){
|
| 105 |
+
case "paymill_creditcard":
|
| 106 |
+
PAYMILL_NO_FAST_CHECKOUT = pmQuery('.paymill-info-fastCheckout-cc').val();
|
| 107 |
+
PAYMILL_TOKEN_TOLERANCE = pmQuery('.paymill-option-tokenTolerance-cc').val();
|
| 108 |
+
if(PAYMILL_NO_FAST_CHECKOUT){
|
| 109 |
+
if (false == paymill.validateCardNumber(pmQuery('.card-number').val())) {
|
| 110 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_NUMBER_CC;
|
| 111 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_NUMBER_CC);
|
| 112 |
+
}
|
| 113 |
+
if (false == paymill.validateExpiry(pmQuery('.card-expiry-month').val(), pmQuery('.card-expiry-year').val())) {
|
| 114 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_EXPDATE;
|
| 115 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_EXPDATE);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
if (pmQuery('.card-holdername').val() == '') {
|
| 119 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_HOLDER_CC;
|
| 120 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_HOLDER_CC);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
if (false == paymill.validateCvc(pmQuery('.card-cvc').val())) {
|
| 124 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_CVC;
|
| 125 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_CVC);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
var params = {
|
| 129 |
+
amount_int: (parseInt(pmQuery('.paymill-payment-amount').val()) + parseInt(PAYMILL_TOKEN_TOLERANCE)), // E.g. "15" for 0.15 Eur
|
| 130 |
+
currency: pmQuery('.paymill-payment-currency').val(), // ISO 4217 e.g. "EUR"
|
| 131 |
+
number: pmQuery('.card-number').val(),
|
| 132 |
+
exp_month: pmQuery('.card-expiry-month').val(),
|
| 133 |
+
exp_year: pmQuery('.card-expiry-year').val(),
|
| 134 |
+
cvc: pmQuery('.card-cvc').val(),
|
| 135 |
+
cardholdername: pmQuery('.card-holdername').val()
|
| 136 |
+
};
|
| 137 |
+
}
|
| 138 |
+
break;
|
| 139 |
+
|
| 140 |
+
case "paymill_directdebit":
|
| 141 |
+
PAYMILL_NO_FAST_CHECKOUT = pmQuery('.paymill-info-fastCheckout-elv').val();
|
| 142 |
+
PAYMILL_TOKEN_TOLERANCE = pmQuery('.paymill-option-tokenTolerance-elv').val();
|
| 143 |
+
if(PAYMILL_NO_FAST_CHECKOUT){
|
| 144 |
+
if (false == pmQuery('.elv-holdername').val()) {
|
| 145 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_HOLDER_ELV;
|
| 146 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_HOLDER_ELV);
|
| 147 |
+
}
|
| 148 |
+
if (false == paymill.validateAccountNumber(pmQuery('.elv-account').val())) {
|
| 149 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_NUMBER_ELV;
|
| 150 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_NUMBER_ELV);
|
| 151 |
+
}
|
| 152 |
+
if (false == paymill.validateBankCode(pmQuery('.elv-bankcode').val())) {
|
| 153 |
+
PAYMILL_ERROR_STRING += PAYMILL_ERROR_TEXT_IVALID_BANKCODE;
|
| 154 |
+
debug(PAYMILL_ERROR_TEXT_IVALID_BANKCODE);
|
| 155 |
+
}
|
| 156 |
+
var params = {
|
| 157 |
+
amount_int: pmQuery('.paymill-payment-amount').val() + PAYMILL_TOKEN_TOLERANCE, // E.g. "15" for 0.15 Eur
|
| 158 |
+
currency: pmQuery('.paymill-payment-currency').val(), // ISO 4217 e.g. "EUR"
|
| 159 |
+
number: pmQuery('.elv-account').val(),
|
| 160 |
+
bank: pmQuery('.elv-bankcode').val(),
|
| 161 |
+
accountholder: pmQuery('.elv-holdername').val()
|
| 162 |
+
};
|
| 163 |
+
}
|
| 164 |
+
break;
|
| 165 |
+
|
| 166 |
+
default:
|
| 167 |
+
payment.save();
|
| 168 |
+
return false;
|
| 169 |
+
break;
|
| 170 |
+
}
|
| 171 |
+
if(PAYMILL_ERROR_STRING !== ""){
|
| 172 |
+
debug(PAYMILL_ERROR_STRING);
|
| 173 |
+
// Append Errormessage to form
|
| 174 |
+
pmQuery('.paymill-payment-errors').html(PAYMILL_ERROR_STRING);
|
| 175 |
+
pmQuery('.paymill-payment-errors').show();
|
| 176 |
+
return false;
|
| 177 |
+
}
|
| 178 |
+
if(PAYMILL_NO_FAST_CHECKOUT){
|
| 179 |
+
debug("Generating Token");
|
| 180 |
+
paymill.createToken(params, paymillResponseHandler);
|
| 181 |
+
} else {
|
| 182 |
+
debug("FastCheckout Data found. Skipping Token generation.");
|
| 183 |
+
payment.save();
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
return false;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
pmQuery(document).ready(function()
|
| 191 |
+
{
|
| 192 |
+
//Gather Data
|
| 193 |
+
PAYMILL_PUBLIC_KEY = pmQuery('.paymill-info-public_key').val();
|
| 194 |
+
PAYMILL_ERROR_STRING = "";
|
| 195 |
+
pmQuery('.paymill-payment-errors').hide();
|
| 196 |
+
|
| 197 |
+
pmQuery('#card-number').live('input', paymillShowCardIcon);
|
| 198 |
+
pmQuery('#payment-buttons-container button:first').prop("onclick", null);
|
| 199 |
+
pmQuery('#payment-buttons-container button:first').unbind('click');
|
| 200 |
+
pmQuery('#payment-buttons-container button:first').click(paymillSubmitForm);
|
| 201 |
+
});
|
lib/Services/Paymill/Apiclient/Curl.php
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once 'Interface.php';
|
| 4 |
+
|
| 5 |
+
require_once realpath(dirname(__FILE__)) . '/../Exception.php';
|
| 6 |
+
|
| 7 |
+
if (!function_exists('json_decode')) {
|
| 8 |
+
throw new Exception("Please install the PHP JSON extension");
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
if (!function_exists('curl_init')) {
|
| 12 |
+
throw new Exception("Please install the PHP cURL extension");
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Services_Paymill cURL HTTP client
|
| 17 |
+
*/
|
| 18 |
+
class Services_Paymill_Apiclient_Curl implements Services_Paymill_Apiclient_Interface
|
| 19 |
+
{
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Paymill API merchant key
|
| 23 |
+
*
|
| 24 |
+
* @var string
|
| 25 |
+
*/
|
| 26 |
+
private $_apiKey = null;
|
| 27 |
+
|
| 28 |
+
private $_responseArray = null;
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Paymill API base url
|
| 32 |
+
*
|
| 33 |
+
* @var string
|
| 34 |
+
*/
|
| 35 |
+
private $_apiUrl = '/';
|
| 36 |
+
|
| 37 |
+
const USER_AGENT = 'Paymill-php/0.0.2';
|
| 38 |
+
|
| 39 |
+
public static $lastRawResponse;
|
| 40 |
+
public static $lastRawCurlOptions;
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* cURL HTTP client constructor
|
| 44 |
+
*
|
| 45 |
+
* @param string $apiKey
|
| 46 |
+
* @param string $apiEndpoint
|
| 47 |
+
*/
|
| 48 |
+
public function __construct($apiKey, $apiEndpoint)
|
| 49 |
+
{
|
| 50 |
+
$this->_apiKey = $apiKey;
|
| 51 |
+
$this->_apiUrl = $apiEndpoint;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Perform API and handle exceptions
|
| 56 |
+
*
|
| 57 |
+
* @param $action
|
| 58 |
+
* @param array $params
|
| 59 |
+
* @param string $method
|
| 60 |
+
* @return mixed
|
| 61 |
+
* @throws Services_Paymill_Exception
|
| 62 |
+
* @throws Exception
|
| 63 |
+
*/
|
| 64 |
+
public function request($action, $params = array(), $method = 'POST')
|
| 65 |
+
{
|
| 66 |
+
if (!is_array($params))
|
| 67 |
+
$params = array();
|
| 68 |
+
|
| 69 |
+
try {
|
| 70 |
+
$this->_responseArray = $this->_requestApi($action, $params, $method);
|
| 71 |
+
$httpStatusCode = $this->_responseArray['header']['status'];
|
| 72 |
+
if ($httpStatusCode != 200) {
|
| 73 |
+
$errorMessage = 'Client returned HTTP status code ' . $httpStatusCode;
|
| 74 |
+
if (isset($this->_responseArray['body']['error'])) {
|
| 75 |
+
$errorMessage = $this->_responseArray['body']['error'];
|
| 76 |
+
}
|
| 77 |
+
$responseCode = '';
|
| 78 |
+
if (isset($this->_responseArray['body']['response_code'])) {
|
| 79 |
+
$responseCode = $this->_responseArray['body']['response_code'];
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
return array("data" => array(
|
| 83 |
+
"error" => $errorMessage,
|
| 84 |
+
"response_code" => $responseCode
|
| 85 |
+
));
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
return $this->_responseArray['body'];
|
| 89 |
+
} catch (Exception $e) {
|
| 90 |
+
return array("data" => array("error" => $e->getMessage()));
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Perform HTTP request to REST endpoint
|
| 96 |
+
*
|
| 97 |
+
* @param string $action
|
| 98 |
+
* @param array $params
|
| 99 |
+
* @param string $method
|
| 100 |
+
* @return array
|
| 101 |
+
*/
|
| 102 |
+
protected function _requestApi($action = '', $params = array(), $method = 'POST')
|
| 103 |
+
{
|
| 104 |
+
$curlOpts = array(
|
| 105 |
+
CURLOPT_URL => $this->_apiUrl . $action,
|
| 106 |
+
CURLOPT_RETURNTRANSFER => true,
|
| 107 |
+
CURLOPT_CUSTOMREQUEST => $method,
|
| 108 |
+
CURLOPT_USERAGENT => self::USER_AGENT,
|
| 109 |
+
CURLOPT_SSL_VERIFYPEER => true,
|
| 110 |
+
CURLOPT_CAINFO => realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'paymill.crt',
|
| 111 |
+
);
|
| 112 |
+
|
| 113 |
+
if (Services_Paymill_Apiclient_Interface::HTTP_GET === $method) {
|
| 114 |
+
if (0 !== count($params)) {
|
| 115 |
+
$curlOpts[CURLOPT_URL] .= false === strpos($curlOpts[CURLOPT_URL], '?') ? '?' : '&';
|
| 116 |
+
$curlOpts[CURLOPT_URL] .= http_build_query($params, null, '&');
|
| 117 |
+
}
|
| 118 |
+
} else {
|
| 119 |
+
$curlOpts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&');
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if ($this->_apiKey) {
|
| 123 |
+
$curlOpts[CURLOPT_USERPWD] = $this->_apiKey . ':';
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
$curl = curl_init();
|
| 127 |
+
curl_setopt_array($curl, $curlOpts);
|
| 128 |
+
$responseBody = curl_exec($curl);
|
| 129 |
+
self::$lastRawCurlOptions = $curlOpts;
|
| 130 |
+
self::$lastRawResponse = $responseBody;
|
| 131 |
+
$responseInfo = curl_getinfo($curl);
|
| 132 |
+
if ($responseBody === false) {
|
| 133 |
+
$responseBody = array('error' => curl_error($curl));
|
| 134 |
+
}
|
| 135 |
+
curl_close($curl);
|
| 136 |
+
|
| 137 |
+
if ('application/json' === $responseInfo['content_type']) {
|
| 138 |
+
$responseBody = json_decode($responseBody, true);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
return array(
|
| 142 |
+
'header' => array(
|
| 143 |
+
'status' => $responseInfo['http_code'],
|
| 144 |
+
'reason' => null,
|
| 145 |
+
),
|
| 146 |
+
'body' => $responseBody
|
| 147 |
+
);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
/**
|
| 151 |
+
* Returns the response of the request as an array.
|
| 152 |
+
* @return mixed Response
|
| 153 |
+
* @todo Create Unit Test
|
| 154 |
+
*/
|
| 155 |
+
public function getResponse(){
|
| 156 |
+
return $this->_responseArray;
|
| 157 |
+
}
|
| 158 |
+
}
|
lib/Services/Paymill/Apiclient/Interface.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
interface Services_Paymill_Apiclient_Interface
|
| 4 |
+
{
|
| 5 |
+
const HTTP_POST = 'POST';
|
| 6 |
+
const HTTP_GET = 'GET';
|
| 7 |
+
const HTTP_PUT = 'PUT';
|
| 8 |
+
const HTTP_DELETE = 'DELETE';
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Perform API and handle exceptions
|
| 12 |
+
*
|
| 13 |
+
* @param $action
|
| 14 |
+
* @param array $params
|
| 15 |
+
* @param string $method
|
| 16 |
+
* @return mixed
|
| 17 |
+
*/
|
| 18 |
+
public function request($action, $params = array(), $method = 'POST');
|
| 19 |
+
|
| 20 |
+
}
|
lib/Services/Paymill/Apiclient/paymill.crt
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-----BEGIN CERTIFICATE-----
|
| 2 |
+
MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
|
| 3 |
+
MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
|
| 4 |
+
IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
|
| 5 |
+
MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
|
| 6 |
+
FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
|
| 7 |
+
bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
|
| 8 |
+
dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
|
| 9 |
+
H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
|
| 10 |
+
uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
|
| 11 |
+
mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
|
| 12 |
+
a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
|
| 13 |
+
E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
|
| 14 |
+
WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
|
| 15 |
+
VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
|
| 16 |
+
Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
|
| 17 |
+
cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
|
| 18 |
+
IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
|
| 19 |
+
AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
|
| 20 |
+
YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
|
| 21 |
+
6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
|
| 22 |
+
Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
|
| 23 |
+
c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
|
| 24 |
+
mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
|
| 25 |
+
-----END CERTIFICATE-----
|
lib/Services/Paymill/Base.php
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once 'Apiclient/Curl.php';
|
| 4 |
+
/**
|
| 5 |
+
* Paymill API wrapper super class
|
| 6 |
+
*/
|
| 7 |
+
abstract class Services_Paymill_Base
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* Resource relative url path name ending with '/', set or override in subclass
|
| 11 |
+
*
|
| 12 |
+
* @var string
|
| 13 |
+
*/
|
| 14 |
+
protected $_serviceResource = null;
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Paymill HTTP client class
|
| 18 |
+
*
|
| 19 |
+
* @var Services_Paymill_Apiclient_Interface
|
| 20 |
+
*/
|
| 21 |
+
protected $_httpClient;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Base constructor
|
| 25 |
+
* sets _httpClient property
|
| 26 |
+
*
|
| 27 |
+
* @param string $apiKey merchant api key
|
| 28 |
+
* @param string $apiEndpoint endpoint URL for the api
|
| 29 |
+
*/
|
| 30 |
+
public function __construct($apiKey, $apiEndpoint)
|
| 31 |
+
{
|
| 32 |
+
$this->_httpClient = new Services_Paymill_Apiclient_Curl($apiKey, $apiEndpoint);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* General REST GET verb
|
| 37 |
+
*
|
| 38 |
+
* @param array $filters e.g. count,offest
|
| 39 |
+
* @param string $identifier resource id
|
| 40 |
+
*
|
| 41 |
+
* @return array of resource items
|
| 42 |
+
*/
|
| 43 |
+
public function get($filters = array(), $identifier = '')
|
| 44 |
+
{
|
| 45 |
+
$response = $this->_httpClient->request(
|
| 46 |
+
$this->_serviceResource . $identifier,
|
| 47 |
+
$filters,
|
| 48 |
+
Services_Paymill_Apiclient_Interface::HTTP_GET
|
| 49 |
+
);
|
| 50 |
+
|
| 51 |
+
return $response['data'];
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* General REST GET verb
|
| 56 |
+
* returns one item or null
|
| 57 |
+
*
|
| 58 |
+
* @param string $identifier resource id
|
| 59 |
+
*
|
| 60 |
+
* @return array resource item | null
|
| 61 |
+
*/
|
| 62 |
+
public function getOne($identifier = null)
|
| 63 |
+
{
|
| 64 |
+
if (!$identifier) {
|
| 65 |
+
return null;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
$filters = array("count" => 1, 'offset' => 0);
|
| 69 |
+
|
| 70 |
+
return $this->get($filters, $identifier);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* General REST DELETE verb
|
| 75 |
+
* Delete or inactivate/cancel resource item
|
| 76 |
+
*
|
| 77 |
+
* @param string $clientId
|
| 78 |
+
*
|
| 79 |
+
* @return array item deleted
|
| 80 |
+
*/
|
| 81 |
+
public function delete($clientId = null)
|
| 82 |
+
{
|
| 83 |
+
$response = $this->_httpClient->request(
|
| 84 |
+
$this->_serviceResource . $clientId,
|
| 85 |
+
array(),
|
| 86 |
+
Services_Paymill_Apiclient_Interface::HTTP_DELETE
|
| 87 |
+
);
|
| 88 |
+
|
| 89 |
+
return $response['data'];
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* General REST POST verb
|
| 94 |
+
* create resource item
|
| 95 |
+
*
|
| 96 |
+
* @param array $itemData
|
| 97 |
+
*
|
| 98 |
+
* @return array created item
|
| 99 |
+
*/
|
| 100 |
+
public function create($itemData = array())
|
| 101 |
+
{
|
| 102 |
+
$response = $this->_httpClient->request(
|
| 103 |
+
$this->_serviceResource,
|
| 104 |
+
$itemData,
|
| 105 |
+
Services_Paymill_Apiclient_Interface::HTTP_POST
|
| 106 |
+
);
|
| 107 |
+
|
| 108 |
+
return $response['data'];
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* General REST PUT verb
|
| 113 |
+
* Update resource item
|
| 114 |
+
*
|
| 115 |
+
* @param array $itemData
|
| 116 |
+
*
|
| 117 |
+
* @return array item updated or null
|
| 118 |
+
*/
|
| 119 |
+
public function update(array $itemData = array())
|
| 120 |
+
{
|
| 121 |
+
if (!isset($itemData['id']) ) {
|
| 122 |
+
return null;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
$itemId = $itemData['id'];
|
| 126 |
+
unset ($itemData['id']);
|
| 127 |
+
|
| 128 |
+
$response = $this->_httpClient->request(
|
| 129 |
+
$this->_serviceResource . $itemId,
|
| 130 |
+
$itemData,
|
| 131 |
+
Services_Paymill_Apiclient_Interface::HTTP_PUT
|
| 132 |
+
);
|
| 133 |
+
|
| 134 |
+
return $response['data'];
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/**
|
| 138 |
+
* Returns the response of the last request as an array
|
| 139 |
+
* @return mixed Response
|
| 140 |
+
* @todo Add Unit test
|
| 141 |
+
*/
|
| 142 |
+
public function getResponse(){
|
| 143 |
+
return $this->_httpClient->getResponse();
|
| 144 |
+
}
|
| 145 |
+
}
|
lib/Services/Paymill/Clients.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for clients resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Clients extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'clients/';
|
| 14 |
+
}
|
lib/Services/Paymill/Exception.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Services_Paymill_Exception class
|
| 5 |
+
*/
|
| 6 |
+
class Services_Paymill_Exception extends Exception
|
| 7 |
+
{
|
| 8 |
+
/**
|
| 9 |
+
* Constructor for exception object
|
| 10 |
+
*
|
| 11 |
+
* @return void
|
| 12 |
+
*/
|
| 13 |
+
public function __construct($message, $code)
|
| 14 |
+
{
|
| 15 |
+
parent::__construct($message, $code);
|
| 16 |
+
}
|
| 17 |
+
}
|
lib/Services/Paymill/LoggingInterface.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
interface Services_Paymill_LoggingInterface
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Logging for PaymentProcessor
|
| 8 |
+
*
|
| 9 |
+
* @param type $message
|
| 10 |
+
* @param type $debugInfo
|
| 11 |
+
*/
|
| 12 |
+
public function log($message, $debugInfo);
|
| 13 |
+
|
| 14 |
+
}
|
lib/Services/Paymill/Offers.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for offers resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Offers extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'offers/';
|
| 14 |
+
}
|
lib/Services/Paymill/PaymentProcessor.php
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* This class acts as an easy to use gateway for the paymill phph wrapper.
|
| 5 |
+
* @version 1.0.0
|
| 6 |
+
* @category PayIntelligent
|
| 7 |
+
* @copyright Copyright (c) 2013 PayIntelligent GmbH (http://payintelligent.de)
|
| 8 |
+
*/
|
| 9 |
+
class Services_Paymill_PaymentProcessor
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
//Options: Variables needed to create Paymill Lib Components
|
| 13 |
+
private $_libBase;
|
| 14 |
+
private $_privateKey;
|
| 15 |
+
private $_apiUrl;
|
| 16 |
+
//Objects: Objects used by the methods
|
| 17 |
+
private $_clientsObject;
|
| 18 |
+
private $_transactionsObject;
|
| 19 |
+
private $_paymentsObject;
|
| 20 |
+
private $_logger; //Only this object can be set using a set function.
|
| 21 |
+
//Process Payment relevant
|
| 22 |
+
private $_token; //Token generated for the Transaction
|
| 23 |
+
private $_amount; //Current Amount
|
| 24 |
+
private $_currency; //Currency (of both amounts)
|
| 25 |
+
private $_name; //Customername
|
| 26 |
+
private $_email; //Customer Email Adress
|
| 27 |
+
private $_description;
|
| 28 |
+
private $_lastResponse;
|
| 29 |
+
private $_transactionId; //Transaction Id generated by the createTransaction function.
|
| 30 |
+
//Fast Checkout Variables
|
| 31 |
+
private $_clientId = null;
|
| 32 |
+
private $_paymentId = null;
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Creates an object of the PaymentProcessor class.
|
| 36 |
+
* @param String <b>$privateKey</b> Paymill-PrivateKey
|
| 37 |
+
* @param String <b>$apiUrl</b> Paymill-Api Url
|
| 38 |
+
* @param String <b>$libBase</b> Path to the lib Base (Can be null, Default Path will be used)
|
| 39 |
+
* @param array <b>$params</b>( <br />
|
| 40 |
+
* <b>token</b>, generated Token <br />
|
| 41 |
+
* <b>amount</b>, Basketamount <br />
|
| 42 |
+
* <b>currency</b>, Transaction currency <br />
|
| 43 |
+
* <b>name</b>, Customer name <br />
|
| 44 |
+
* <b>email</b>, Customer emailaddress <br />
|
| 45 |
+
* <b>description</b>, Description for transactions <br />
|
| 46 |
+
* ) <p color='red'><b>(If not set here, the use of setters is required for the class to work)</b></p>
|
| 47 |
+
* @param object $loggingClassInstance Instance of Object implementing the Services_Paymill_PaymentProcessorInterface. If not set, there will be no logging.
|
| 48 |
+
*/
|
| 49 |
+
public function __construct($privateKey = null, $apiUrl = null, $libBase = null, $params = null, Services_Paymill_LoggingInterface $loggingClassInstance = null)
|
| 50 |
+
{
|
| 51 |
+
$this->setPrivateKey($privateKey);
|
| 52 |
+
$this->setApiUrl($apiUrl);
|
| 53 |
+
$this->setLibBase($libBase);
|
| 54 |
+
$this->_token = $params['token'];
|
| 55 |
+
$this->_amount = $params['amount'];
|
| 56 |
+
$this->_currency = $params['currency'];
|
| 57 |
+
$this->_name = $params['name'];
|
| 58 |
+
$this->_email = $params['email'];
|
| 59 |
+
$this->_description = $params['description'];
|
| 60 |
+
$this->setLogger($loggingClassInstance);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Creates a Paymill-Client with the given Data
|
| 65 |
+
*
|
| 66 |
+
* @param array $params
|
| 67 |
+
* @return boolean
|
| 68 |
+
*/
|
| 69 |
+
private function _createClient()
|
| 70 |
+
{
|
| 71 |
+
if (isset($this->_clientId)) {
|
| 72 |
+
$this->_log("Client using: " . $this->_clientId);
|
| 73 |
+
} else {
|
| 74 |
+
$client = $this->_clientsObject->create(
|
| 75 |
+
array(
|
| 76 |
+
'email' => $this->_email,
|
| 77 |
+
'description' => $this->_description
|
| 78 |
+
)
|
| 79 |
+
);
|
| 80 |
+
|
| 81 |
+
$this->_validateResult($client, 'Client');
|
| 82 |
+
|
| 83 |
+
$this->_clientId = $client['id'];
|
| 84 |
+
}
|
| 85 |
+
return $this->_clientId;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Creates a Paymill-Payment with the given Data
|
| 90 |
+
*
|
| 91 |
+
* @param array $params
|
| 92 |
+
* @return boolean
|
| 93 |
+
*/
|
| 94 |
+
private function _createPayment()
|
| 95 |
+
{
|
| 96 |
+
if (isset($this->_paymentId)) {
|
| 97 |
+
$this->_log("Payment using: " . $this->_paymentId);
|
| 98 |
+
} else {
|
| 99 |
+
$payment = $this->_paymentsObject->create(
|
| 100 |
+
array(
|
| 101 |
+
'token' => $this->_token,
|
| 102 |
+
'client' => $this->_clientId
|
| 103 |
+
)
|
| 104 |
+
);
|
| 105 |
+
$this->_validateResult($payment, 'Payment');
|
| 106 |
+
|
| 107 |
+
$this->_paymentId = $payment['id'];
|
| 108 |
+
}
|
| 109 |
+
return true;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
* Creates a Paymill-Transaction with the given Data
|
| 114 |
+
*
|
| 115 |
+
* @param array $params
|
| 116 |
+
* @return boolean
|
| 117 |
+
*/
|
| 118 |
+
private function _createTransaction()
|
| 119 |
+
{
|
| 120 |
+
$transaction = $this->_transactionsObject->create(
|
| 121 |
+
array(
|
| 122 |
+
'amount' => $this->_amount,
|
| 123 |
+
'currency' => $this->_currency,
|
| 124 |
+
'description' => $this->_description,
|
| 125 |
+
'payment' => $this->_paymentId,
|
| 126 |
+
'client' => $this->_clientId
|
| 127 |
+
)
|
| 128 |
+
);
|
| 129 |
+
$this->_validateResult($transaction, 'Transaction');
|
| 130 |
+
|
| 131 |
+
$this->_transactionId = $transaction['id'];
|
| 132 |
+
return true;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* Load the PhpWrapper-Classes and creates an instance for each class.
|
| 137 |
+
*/
|
| 138 |
+
private function _initiatePhpWrapperClasses()
|
| 139 |
+
{
|
| 140 |
+
require_once $this->_libBase . 'Transactions.php';
|
| 141 |
+
require_once $this->_libBase . 'Clients.php';
|
| 142 |
+
require_once $this->_libBase . 'Payments.php';
|
| 143 |
+
$this->_clientsObject = new Services_Paymill_Clients($this->_privateKey, $this->_apiUrl);
|
| 144 |
+
$this->_transactionsObject = new Services_Paymill_Transactions($this->_privateKey, $this->_apiUrl);
|
| 145 |
+
$this->_paymentsObject = new Services_Paymill_Payments($this->_privateKey, $this->_apiUrl);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
/**
|
| 149 |
+
* Calls the log() function of the logger object if the object has been set.
|
| 150 |
+
*
|
| 151 |
+
* @param string $message
|
| 152 |
+
* @param string $debugInfo
|
| 153 |
+
*/
|
| 154 |
+
private function _log($message, $debugInfo = null)
|
| 155 |
+
{
|
| 156 |
+
if (isset($this->_logger)) {
|
| 157 |
+
$this->_logger->log($message, $debugInfo);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/**
|
| 162 |
+
* Validates the array passed as an argument to be processPayment() compliant
|
| 163 |
+
* @param mixed $parameter
|
| 164 |
+
* @return boolean
|
| 165 |
+
*/
|
| 166 |
+
private function _validateParameter()
|
| 167 |
+
{
|
| 168 |
+
$validation = true;
|
| 169 |
+
$parameter = array(
|
| 170 |
+
"token" => $this->_token,
|
| 171 |
+
"amount" => $this->_amount,
|
| 172 |
+
"currency" => $this->_currency,
|
| 173 |
+
"name" => $this->_name,
|
| 174 |
+
"email" => $this->_email,
|
| 175 |
+
"description" => $this->_description);
|
| 176 |
+
|
| 177 |
+
$arrayMask = array(
|
| 178 |
+
"token" => 'string',
|
| 179 |
+
"amount" => 'integer',
|
| 180 |
+
"currency" => 'string',
|
| 181 |
+
"name" => 'string',
|
| 182 |
+
"email" => 'string',
|
| 183 |
+
"description" => 'string');
|
| 184 |
+
|
| 185 |
+
foreach ($arrayMask as $mask => $type) {
|
| 186 |
+
if (is_null($parameter[$mask])) {
|
| 187 |
+
$validation = false;
|
| 188 |
+
$this->_log("The Parameter $mask is missing.", var_export($parameter, true));
|
| 189 |
+
} else {
|
| 190 |
+
switch ($type) {
|
| 191 |
+
case 'string':
|
| 192 |
+
if (!is_string($parameter[$mask])) {
|
| 193 |
+
$this->_log("The Parameter $mask is not a string.", var_export($parameter, true));
|
| 194 |
+
$validation = false;
|
| 195 |
+
}
|
| 196 |
+
break;
|
| 197 |
+
case 'integer':
|
| 198 |
+
if (!is_integer($parameter[$mask])) {
|
| 199 |
+
$this->_log("The Parameter $mask is not an integer.", var_export($parameter, true));
|
| 200 |
+
$validation = false;
|
| 201 |
+
}
|
| 202 |
+
break;
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
if (!$validation) {
|
| 207 |
+
break;
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
return $validation;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
/**
|
| 214 |
+
* Validates the created Paymill-Objects
|
| 215 |
+
*
|
| 216 |
+
* @param array $transaction
|
| 217 |
+
* @param string $type
|
| 218 |
+
* @return boolean
|
| 219 |
+
*/
|
| 220 |
+
private function _validateResult($transaction, $type)
|
| 221 |
+
{
|
| 222 |
+
$this->_lastResponse = $transaction;
|
| 223 |
+
if (isset($transaction['data']['response_code']) && $transaction['data']['response_code'] !== 20000) {
|
| 224 |
+
$this->_log("An Error occured: " . $transaction['data']['response_code'], var_export($transaction, true));
|
| 225 |
+
throw new Exception("Invalid Result Exception: Invalid ResponseCode");
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
if (!isset($transaction['id']) && !isset($transaction['data']['id'])) {
|
| 229 |
+
$this->_log("No $type created.", var_export($transaction, true));
|
| 230 |
+
throw new Exception("Invalid Result Exception: Invalid Id");
|
| 231 |
+
} else {
|
| 232 |
+
$this->_log("$type created.", isset($transaction['id']) ? $transaction['id'] : $transaction['data']['id']);
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
// check result
|
| 236 |
+
if ($type == 'Transaction') {
|
| 237 |
+
if (is_array($transaction) && array_key_exists('status', $transaction)) {
|
| 238 |
+
if ($transaction['status'] == "closed") {
|
| 239 |
+
// transaction was successfully issued
|
| 240 |
+
return true;
|
| 241 |
+
} elseif ($transaction['status'] == "open") {
|
| 242 |
+
// transaction was issued but status is open for any reason
|
| 243 |
+
$this->_log("Status is open.", var_export($transaction, true));
|
| 244 |
+
throw new Exception("Invalid Result Exception: Invalid Orderstate");
|
| 245 |
+
} else {
|
| 246 |
+
// another error occured
|
| 247 |
+
$this->_log("Unknown error." . var_export($transaction, true));
|
| 248 |
+
throw new Exception("Invalid Result Exception: Unknown Error");
|
| 249 |
+
}
|
| 250 |
+
} else {
|
| 251 |
+
// another error occured
|
| 252 |
+
$this->_log("$type could not be issued.", var_export($transaction, true));
|
| 253 |
+
throw new Exception("Invalid Result Exception: $type could not be issued.");
|
| 254 |
+
}
|
| 255 |
+
} else {
|
| 256 |
+
return true;
|
| 257 |
+
}
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/**
|
| 261 |
+
* Executes the Payment Process
|
| 262 |
+
*
|
| 263 |
+
* @return boolean
|
| 264 |
+
*/
|
| 265 |
+
final public function processPayment()
|
| 266 |
+
{
|
| 267 |
+
$this->_initiatePhpWrapperClasses();
|
| 268 |
+
if (!$this->_validateParameter()) {
|
| 269 |
+
return false;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
try {
|
| 273 |
+
$this->_createClient();
|
| 274 |
+
$this->_createPayment();
|
| 275 |
+
$this->_createTransaction();
|
| 276 |
+
return true;
|
| 277 |
+
} catch (Exception $ex) {
|
| 278 |
+
// paymill wrapper threw an exception
|
| 279 |
+
$this->_log("Exception thrown from paymill wrapper.", $ex->getMessage());
|
| 280 |
+
return false;
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
/**
|
| 284 |
+
* Returns the objects data
|
| 285 |
+
*
|
| 286 |
+
* @return array
|
| 287 |
+
*/
|
| 288 |
+
public function toArray(){
|
| 289 |
+
return array(
|
| 290 |
+
'apiurl' => $this->_apiUrl,
|
| 291 |
+
'libbase' => $this->_libBase,
|
| 292 |
+
'privatekey' => $this->_privateKey,
|
| 293 |
+
'logger' => $this->_logger,
|
| 294 |
+
'token' => $this->_token,
|
| 295 |
+
'amount' => $this->_amount,
|
| 296 |
+
'currency' => $this->_currency,
|
| 297 |
+
'description' => $this->_description,
|
| 298 |
+
'email' => $this->_email,
|
| 299 |
+
'name' => $this->_name
|
| 300 |
+
);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
/* ***************************************************************************************************************
|
| 307 |
+
* *********************************************** Getter **************************************************
|
| 308 |
+
* *************************************************************************************************************** */
|
| 309 |
+
|
| 310 |
+
/**
|
| 311 |
+
* <p align = 'center'><b>Can only be called after the call of processPayment(). Otherwise null will be returned</b></p>
|
| 312 |
+
* Returns the ClientId
|
| 313 |
+
* @return String ClientId
|
| 314 |
+
*/
|
| 315 |
+
public function getClientId()
|
| 316 |
+
{
|
| 317 |
+
return $this->_clientId;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
/**
|
| 321 |
+
* <p align = 'center'><b>Can only be called after the call of processPayment(). Otherwise null will be returned</b></p>
|
| 322 |
+
* Returns the PaymentId
|
| 323 |
+
* @return String PaymentId
|
| 324 |
+
*/
|
| 325 |
+
public function getPaymentId()
|
| 326 |
+
{
|
| 327 |
+
return $this->_paymentId;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
/**
|
| 331 |
+
* <p align = 'center'><b>Can only be called after the call of processPayment(). Otherwise null will be returned</b></p>
|
| 332 |
+
* Returns the TransactionId
|
| 333 |
+
* @return String TransactionId
|
| 334 |
+
*/
|
| 335 |
+
public function getTransactionId()
|
| 336 |
+
{
|
| 337 |
+
return $this->_transactionId;
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
/**
|
| 341 |
+
* <p align = 'center'><b>Can only be called after the call of processPayment(). Otherwise null will be returned</b></p>
|
| 342 |
+
* Returns the last response send by Paymill
|
| 343 |
+
* @return array LastResponse
|
| 344 |
+
*/
|
| 345 |
+
public function getLastResponse()
|
| 346 |
+
{
|
| 347 |
+
return $this->_lastResponse;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
/* ***************************************************************************************************************
|
| 351 |
+
* *********************************************** Setter **************************************************
|
| 352 |
+
* *************************************************************************************************************** */
|
| 353 |
+
|
| 354 |
+
/**
|
| 355 |
+
* Sets the clientId
|
| 356 |
+
* @param String $clientId
|
| 357 |
+
*/
|
| 358 |
+
public function setClientId($clientId = null)
|
| 359 |
+
{
|
| 360 |
+
$this->_clientId = $clientId;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
/**
|
| 364 |
+
* Sets the paymentId
|
| 365 |
+
* @param String $paymentId
|
| 366 |
+
*/
|
| 367 |
+
public function setPaymentId($paymentId = null)
|
| 368 |
+
{
|
| 369 |
+
$this->_paymentId = $paymentId;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
/**
|
| 373 |
+
* This method sets the token
|
| 374 |
+
* @param String $token
|
| 375 |
+
*/
|
| 376 |
+
public function setToken($token = null)
|
| 377 |
+
{
|
| 378 |
+
$this->_token = $token;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
/**
|
| 382 |
+
* This method sets the amount
|
| 383 |
+
* @param String $amount
|
| 384 |
+
*/
|
| 385 |
+
public function setAmount($amount = null)
|
| 386 |
+
{
|
| 387 |
+
$this->_amount = $amount;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
/**
|
| 391 |
+
* Sets the currency
|
| 392 |
+
* @param String $currency
|
| 393 |
+
*/
|
| 394 |
+
public function setCurrency($currency = null)
|
| 395 |
+
{
|
| 396 |
+
$this->_currency = $currency;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
/**
|
| 400 |
+
* Sets the Customer name
|
| 401 |
+
* @param String $name
|
| 402 |
+
*/
|
| 403 |
+
public function setName($name = null)
|
| 404 |
+
{
|
| 405 |
+
$this->_name = $name;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
/**
|
| 409 |
+
* Sets the Customer Email Adress
|
| 410 |
+
* @param String $email
|
| 411 |
+
*/
|
| 412 |
+
public function setEmail($email = null)
|
| 413 |
+
{
|
| 414 |
+
$this->_email = $email;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
/**
|
| 418 |
+
* Sets the Description
|
| 419 |
+
* @param String $description
|
| 420 |
+
*/
|
| 421 |
+
public function setDescription($description = null)
|
| 422 |
+
{
|
| 423 |
+
$this->_description = $description;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
/**
|
| 427 |
+
* Sets the Api URL
|
| 428 |
+
* @param String $apiUrl
|
| 429 |
+
*/
|
| 430 |
+
public function setApiUrl($apiUrl = null)
|
| 431 |
+
{
|
| 432 |
+
$this->_apiUrl = $apiUrl;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
/**
|
| 436 |
+
* Sets the Path to the libBase
|
| 437 |
+
* @param String $libBase Path to the Lib base. If not set, the default path is set.
|
| 438 |
+
*/
|
| 439 |
+
public function setLibBase($libBase = null)
|
| 440 |
+
{
|
| 441 |
+
$this->_libBase = $libBase == null ? dirname(__FILE__) . DIRECTORY_SEPARATOR : $libBase;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
/**
|
| 445 |
+
* Sets up the Logger Object.
|
| 446 |
+
* <b>The Logger object can be any class implementing the Services_Paymill_PaymentProcessorInterface.</b>
|
| 447 |
+
* @param any $logger
|
| 448 |
+
*/
|
| 449 |
+
public function setLogger(Services_Paymill_LoggingInterface $logger = null)
|
| 450 |
+
{
|
| 451 |
+
$this->_logger = $logger;
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
/**
|
| 455 |
+
* Sets the Paymill-PrivateKey
|
| 456 |
+
* @param string $privateKey
|
| 457 |
+
*/
|
| 458 |
+
public function setPrivateKey($privateKey = null)
|
| 459 |
+
{
|
| 460 |
+
$this->_privateKey = $privateKey;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
}
|
lib/Services/Paymill/Payments.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for payments resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Payments extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'payments/';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* General REST PUT verb
|
| 17 |
+
* Update resource item
|
| 18 |
+
*
|
| 19 |
+
* @param array $itemData
|
| 20 |
+
*
|
| 21 |
+
* @return array item updated or null
|
| 22 |
+
*/
|
| 23 |
+
public function update(array $itemData = array())
|
| 24 |
+
{
|
| 25 |
+
throw new Services_Paymill_Exception( __CLASS__ . " does not support " . __METHOD__, "404");
|
| 26 |
+
}
|
| 27 |
+
}
|
lib/Services/Paymill/Preauthorizations.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for transactions resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Preauthorizations extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'preauthorizations/';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* General REST PUT verb
|
| 17 |
+
* Update resource item
|
| 18 |
+
*
|
| 19 |
+
* @param array $itemData
|
| 20 |
+
*
|
| 21 |
+
* @return array item updated or null
|
| 22 |
+
*/
|
| 23 |
+
public function update(array $itemData = array())
|
| 24 |
+
{
|
| 25 |
+
throw new Services_Paymill_Exception( __CLASS__ . " does not support " . __METHOD__, "404");
|
| 26 |
+
}
|
| 27 |
+
}
|
lib/Services/Paymill/Refunds.php
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for refunds resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Refunds extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'refunds/';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* General REST POST verb
|
| 17 |
+
* create resource item
|
| 18 |
+
*
|
| 19 |
+
* @param array $itemData
|
| 20 |
+
*
|
| 21 |
+
* @return array created item
|
| 22 |
+
*/
|
| 23 |
+
public function create($itemData = array())
|
| 24 |
+
{
|
| 25 |
+
$transactionId = $itemData['transactionId'];
|
| 26 |
+
$params = $itemData['params'];
|
| 27 |
+
|
| 28 |
+
return $this->_httpClient->request(
|
| 29 |
+
$this->_serviceResource . "$transactionId",
|
| 30 |
+
$params,
|
| 31 |
+
Services_Paymill_Apiclient_Interface::HTTP_POST
|
| 32 |
+
);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* General REST DELETE verb
|
| 37 |
+
* Delete or inactivate/cancel resource item
|
| 38 |
+
*
|
| 39 |
+
* @param string $clientId
|
| 40 |
+
*
|
| 41 |
+
* @return array item deleted
|
| 42 |
+
*/
|
| 43 |
+
public function delete($identifier = null)
|
| 44 |
+
{
|
| 45 |
+
throw new Services_Paymill_Exception( __CLASS__ . " does not support " . __METHOD__, "404");
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* {@inheritDoc}
|
| 50 |
+
*/
|
| 51 |
+
public function update(array $itemData = array())
|
| 52 |
+
{
|
| 53 |
+
throw new Services_Paymill_Exception( __CLASS__ . " does not support " . __METHOD__, "404" );
|
| 54 |
+
}
|
| 55 |
+
}
|
lib/Services/Paymill/Subscriptions.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for subscriptions resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Subscriptions extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'subscriptions/';
|
| 14 |
+
}
|
lib/Services/Paymill/Transactions.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for transactions resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Transactions extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'transactions/';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* General REST PUT verb
|
| 17 |
+
* Update resource item
|
| 18 |
+
*
|
| 19 |
+
* @param array $itemData
|
| 20 |
+
*
|
| 21 |
+
* @return array item updated or null
|
| 22 |
+
*/
|
| 23 |
+
public function update(array $itemData = array())
|
| 24 |
+
{
|
| 25 |
+
throw new Services_Paymill_Exception( __CLASS__ . " does not support " . __METHOD__, "404");
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* General REST DELETE verb
|
| 30 |
+
* Delete or inactivate/cancel resource item
|
| 31 |
+
*
|
| 32 |
+
* @param string $clientId
|
| 33 |
+
*
|
| 34 |
+
* @return array item deleted
|
| 35 |
+
*/
|
| 36 |
+
public function delete($clientId = null)
|
| 37 |
+
{
|
| 38 |
+
throw new Services_Paymill_Exception( __CLASS__ . " does not support " . __METHOD__, "404");
|
| 39 |
+
}
|
| 40 |
+
}
|
lib/Services/Paymill/Webhooks.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Base.php');
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Paymill API wrapper for webhooks resource
|
| 7 |
+
*/
|
| 8 |
+
class Services_Paymill_Webhooks extends Services_Paymill_Base
|
| 9 |
+
{
|
| 10 |
+
/**
|
| 11 |
+
* {@inheritDoc}
|
| 12 |
+
*/
|
| 13 |
+
protected $_serviceResource = 'webhooks/';
|
| 14 |
+
}
|
package.xml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Paymill_Paymill</name>
|
| 4 |
+
<version>3.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>Open Software License</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Paymill is an easy way to accept credit card payments. For more details and registration visit paymill.de.</summary>
|
| 10 |
+
<description>The Paymill Magento extension makes it easy to accept credit card and direct debit payments in your Magento store. The registration at Paymill is easy and fast (visit http://www.paymill.de). You could start using the Paymill Magento extension with a pair of test keys that you get in your Paymill account.
|
| 11 |
+
<br /><br />
|
| 12 |
+
The Paymill Magento extension provides a credit card form and a direct debit form in the onepage checkout process that handles credit card data via the Paymill API. Entered data is not stored or logged on your system -- it is only processed via PCI compliant connections.
|
| 13 |
+
<br /><br />
|
| 14 |
+
IMPORTANT: Only use the latest version.
|
| 15 |
+
</description>
|
| 16 |
+
<notes>* Rewrote from scratch</notes>
|
| 17 |
+
<authors><author><name>PayIntelligent</name><user>Paymill</user><email>community@paymill.de</email></author></authors>
|
| 18 |
+
<date>2013-07-04</date>
|
| 19 |
+
<time>09:06:17</time>
|
| 20 |
+
<contents><target name="magecommunity"><dir><dir name="Paymill"><dir name="Paymill"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><file name="Grid.php" hash="9380f3c3863e21697d042caf2c16d0ae"/></dir><file name="Log.php" hash="f69fe5d7d61525b6d78e322b98abb64e"/></dir><dir name="Payment"><dir name="Form"><file name="PaymentFormCreditcard.php" hash="309a00357615c52eac827a6ef3c2e4af"/><file name="PaymentFormDirectdebit.php" hash="e1f7793f554ca1e482a8f5b96af09b9b"/></dir><dir name="Info"><file name="PaymentFormCreditcard.php" hash="7867e48c7ee09cacd1a62c4ee55018ff"/><file name="PaymentFormDirectdebit.php" hash="14f868a8bb5c4b6b5dc99b94243edf70"/></dir></dir></dir><dir name="Helper"><file name="CustomerHelper.php" hash="538e28e2e766089523fbdbd4bb70b297"/><file name="Data.php" hash="0c8c1bba521a13abcd6b3c9c5f46f895"/><file name="FastCheckoutHelper.php" hash="6d693c6cc7537e2b6a9efd9449b471ff"/><file name="LoggingHelper.php" hash="829fcdb54137a5e698ffb55588d64a0c"/><file name="OptionHelper.php" hash="0830b15af6005cbd9a138e369ca99732"/><file name="PaymentHelper.php" hash="67237f0643491e3690ee0a4c192d69fa"/><file name="RefundHelper.php" hash="6bac199fd7b79472f2feac978495e471"/><file name="TransactionHelper.php" hash="d159914fb62b7e271703b901fd523f62"/></dir><dir name="Model"><file name="Fastcheckout.php" hash="69cf5376c50ea4f92cae3ddd14875faf"/><file name="Log.php" hash="3e3041ef278ed46eaf1e35f248a591e0"/><dir name="Method"><file name="MethodModelAbstract.php" hash="1754e881aa2a7e71cfef6a8a3da7670e"/><file name="MethodModelCreditcard.php" hash="177d878f8de698223776f4d35ddede79"/><file name="MethodModelDirectdebit.php" hash="776dd4814fd238527c6cc1032f3db67a"/></dir><dir name="Mysql4"><dir name="Fastcheckout"><file name="Collection.php" hash="14d4aa413ec952fd2452f08ab2a208f6"/></dir><file name="Fastcheckout.php" hash="56b09daa390ba1f4f5116f1d701833e4"/><dir name="Log"><file name="Collection.php" hash="cf4d8fec68a4cc44b2e47bf69e014cf3"/></dir><file name="Log.php" hash="9bd80dc9300cc189b6b3ebd921b4e3e6"/></dir><file name="Observer.php" hash="ab956832ed183739bc0312ea363c28e3"/><file name="TransactionData.php" hash="fb9fe947ebefe81d58e1857afba75d7f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="2ea1819bba69bbb8bd8d2500c07e21fd"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="383052bdb4651dacf1373a27349259fd"/><file name="config.xml" hash="d5dbe79f74268da99c801d110124ae76"/><file name="system.xml" hash="41e009dd582edfb3807a95b4b1011090"/></dir><dir name="sql"><dir name="paymill_setup"><file name="mysql4-install-3.0.0.php" hash="4516bbc5941f551fa24c01fd1fef345a"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="paymill.xml" hash="77d6d4e07a61ba76c8842249d267f62d"/></dir><dir name="template"><dir name="paymill"><dir name="payment"><dir name="info"><file name="creditcard.phtml" hash="428d7e826efb710077e910e2cd179ece"/><file name="directdebit.phtml" hash="428d7e826efb710077e910e2cd179ece"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="paymill.xml" hash="904a2f40ed0b67e62d84496001536ca3"/></dir><dir name="template"><dir name="paymill"><dir name="payment"><dir name="form"><file name="creditcard.phtml" hash="e9fdb52ab2fa7c407805f5104207cb8a"/><file name="directdebit.phtml" hash="b72d67e3e100eb9dcec65792e6d8f8f7"/></dir><dir name="info"><file name="creditcard.phtml" hash="9d1052f0361e4430834f9fdf01408c2a"/><file name="directdebit.phtml" hash="9d1052f0361e4430834f9fdf01408c2a"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Paymill_Paymill.xml" hash="d36d3af5f5752dcf87517272ddb9af53"/></dir></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Paymill_Paymill.csv" hash="2a463c7591ac61650ff30f0b19c1b1e1"/></dir><dir name="en_GB"><file name="Paymill_Paymill.csv" hash="cb0408f88830d7ac3fa96ba9cafc56dc"/></dir><dir name="en_US"><file name="Paymill_Paymill.csv" hash="cb0408f88830d7ac3fa96ba9cafc56dc"/></dir></dir></target><target name="mageweb"><dir><dir name="js"><dir name="paymill"><file name="paymentForm.js" hash="6ba7996e8713096557dea1353862e229"/></dir></dir></dir></target><target name="magelib"><dir><dir name="Services"><dir name="Paymill"><dir name="Apiclient"><file name="Curl.php" hash="5477da009d2ec4a5504a5457f46641b9"/><file name="Interface.php" hash="349309458455e550c562fb17cf23f4a6"/><file name="paymill.crt" hash="f85d1ff17b0079709f131f3ce3f288d2"/></dir><file name="Base.php" hash="9f583d1613257b20a7d325131d545fae"/><file name="Clients.php" hash="f9bc9034a6f3b88a842f35efd6524ab6"/><file name="Exception.php" hash="9beffb75d92c0de3c1c7ea5b33930fff"/><file name="LoggingInterface.php" hash="44ed553b6e64d0023dde88b34b7e8e80"/><file name="Offers.php" hash="28b2d420c87531ffa1f193ec3934fc5b"/><file name="PaymentProcessor.php" hash="ff7020e93fe508b1a5407d7a64f2ebf5"/><file name="Payments.php" hash="dd8e18548fb149956fff93fd55f68029"/><file name="Preauthorizations.php" hash="62dda9a5ee853e9c53d0c40fae7e95bd"/><file name="Refunds.php" hash="448f65904df1c9f7974fbc5569f7b6e8"/><file name="Subscriptions.php" hash="e8f55fcfd1065439d49bc5f734294be6"/><file name="Transactions.php" hash="fb6d248c88285105a426bf4491cbfc6b"/><file name="Webhooks.php" hash="06be5e57b81b3052a56371933e0674e9"/></dir></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="paymill"><file name="logo.css" hash="7000c544325686518772af11130e5b23"/></dir></dir><dir name="images"><dir name="paymill"><file name="icon_mastercard.png" hash="2a24acc0aa8e041ef01794e56314ef93"/><file name="icon_paymill.png" hash="303983a288b45cc7ddc5b88ad2eedd51"/><file name="icon_visa.png" hash="95b0323a6afd6648436628202d263f4b"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 21 |
+
<compatible/>
|
| 22 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0.</max></php></required></dependencies>
|
| 23 |
+
</package>
|
skin/frontend/base/default/css/paymill/logo.css
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.paymill_powered {
|
| 2 |
+
border: 1px solid #ccc;
|
| 3 |
+
width: 350px;
|
| 4 |
+
padding: 4px;
|
| 5 |
+
background: white url('../../images/paymill/icon_paymill.png') no-repeat center right;
|
| 6 |
+
-moz-border-radius: 3px;
|
| 7 |
+
border-radius: 3px;
|
| 8 |
+
margin-top: 10px;
|
| 9 |
+
}
|
| 10 |
+
.paymill_powered > .paymill_credits {
|
| 11 |
+
width: 160px;
|
| 12 |
+
color: #666;
|
| 13 |
+
}
|
| 14 |
+
.paymill_powered > a {
|
| 15 |
+
color: #666;
|
| 16 |
+
text-decoration: underline;
|
| 17 |
+
}
|
skin/frontend/base/default/images/paymill/icon_mastercard.png
ADDED
|
Binary file
|
skin/frontend/base/default/images/paymill/icon_paymill.png
ADDED
|
Binary file
|
skin/frontend/base/default/images/paymill/icon_visa.png
ADDED
|
Binary file
|
