Version Notes
- Send basic user information to Optimal for improved Fraud Detection
- Minor improvements for compatibility with future Optimal API Updates
- Fixes for minor issue related to issuing refunds
- Added Profile Key option to configuration for companies that share one Optimal account while processing credit cards in multiple places
- Various Minor Improvements
Download this release
Release Info
Developer | Demac Media |
Extension | 666999 |
Version | 0.3.2 |
Comparing to | |
See all releases |
Code changes from version 0.1.2 to 0.3.2
- app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit.php +5 -0
- app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit/Form.php +0 -1
- app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit/Tab/Form.php +0 -1
- app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit/Tabs.php +0 -1
- app/code/community/Demac/Optimal/Block/Customer/Cards.php +6 -0
- app/code/community/Demac/Optimal/Block/Customer/Cards/Form.php +28 -0
- app/code/community/Demac/Optimal/Block/Customer/Cards/Grid.php +31 -0
- app/code/community/Demac/Optimal/Block/Form/Creditcard.php +79 -0
- app/code/community/Demac/Optimal/Block/Info/Creditcard.php +48 -0
- app/code/community/Demac/Optimal/Block/Threat.php +2 -3
- app/code/community/Demac/Optimal/Helper/Data.php +353 -1
- app/code/community/Demac/Optimal/Helpers/Data.php +0 -13
- app/code/community/Demac/Optimal/Model/Client/Abstract.php +79 -13
- app/code/community/Demac/Optimal/Model/Config/Transaction.php +0 -1
- app/code/community/Demac/Optimal/Model/Creditcard.php +30 -0
- app/code/community/Demac/Optimal/Model/Creditcard/Client.php +191 -0
- app/code/community/Demac/Optimal/Model/Hosted/Client.php +18 -63
- app/code/community/Demac/Optimal/Model/Merchant/Customer.php +10 -0
- app/code/community/Demac/Optimal/Model/Method.php +0 -16
- app/code/community/Demac/Optimal/Model/Method/Hosted.php +337 -68
- app/code/community/Demac/Optimal/Model/Mysql4/Creditcard.php +75 -0
- app/code/community/Demac/Optimal/Model/Mysql4/Creditcard/Collection.php +17 -0
- app/code/community/Demac/Optimal/Model/Mysql4/Merchant/Customer.php +15 -0
- app/code/community/Demac/Optimal/Model/Mysql4/Merchant/Customer/Collection.php +10 -0
- app/code/community/Demac/Optimal/Model/Mysql4/Profile.php +57 -0
- app/code/community/Demac/Optimal/Model/Mysql4/Profile/Collection.php +17 -0
- app/code/community/Demac/Optimal/Model/Observer.php +1 -321
- app/code/community/Demac/Optimal/Model/Profile.php +28 -0
- app/code/community/Demac/Optimal/Model/Profile/Client.php +193 -0
- app/code/community/Demac/Optimal/Model/Source/Cctype.php +40 -0
- app/code/community/Demac/Optimal/controllers/Frontend/OptimalController.php +262 -0
- app/code/community/Demac/Optimal/etc/config.xml +32 -20
- app/code/community/Demac/Optimal/etc/system.xml +31 -191
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.0.php +30 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.1.php +53 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.2.php +60 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.3.php +61 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.4.php +61 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.5.php +63 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.6.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.7.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.9.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.0.php +30 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.1.php +53 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.2.php +60 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.3.php +61 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.4.php +61 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.5.php +63 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.6.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.7.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.9.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-upgrade-0.1.1-0.2.7.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/upgrade-0.1.1-0.2.7.php +64 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/upgrade-0.2.9-0.3.0.php +12 -0
- app/code/community/Demac/Optimal/sql/optimal_setup/upgrade-0.3.1-0.3.2.php +22 -0
- app/design/adminhtml/default/default/template/optimal/form/creditcard.phtml +110 -0
- app/design/adminhtml/default/default/template/optimal/info/creditcard.phtml +12 -0
- app/design/frontend/base/default/layout/optimal.xml +25 -0
- app/design/frontend/base/default/template/optimal/customer/cards.phtml +20 -0
- app/design/frontend/base/default/template/optimal/customer/cards/form.phtml +116 -0
- app/design/frontend/base/default/template/optimal/customer/cards/grid.phtml +36 -0
- app/design/frontend/base/default/template/optimal/form/creditcard.phtml +297 -0
- app/design/frontend/base/default/template/optimal/info/creditcard.phtml +6 -0
- package.xml +15 -12
app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit.php
CHANGED
@@ -21,6 +21,11 @@ class Demac_Optimal_Block_Adminhtml_Risk_Edit extends Mage_Adminhtml_Block_Widge
|
|
21 |
$this->_updateButton('delete', 'label', Mage::helper('optimal')->__('Delete Mapping'));
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
public function getHeaderText()
|
25 |
{
|
26 |
if( Mage::registry('mapping_data') && Mage::registry('mapping_data')->getId() ) {
|
21 |
$this->_updateButton('delete', 'label', Mage::helper('optimal')->__('Delete Mapping'));
|
22 |
}
|
23 |
|
24 |
+
/**
|
25 |
+
* Get header text
|
26 |
+
*
|
27 |
+
* @return mixed
|
28 |
+
*/
|
29 |
public function getHeaderText()
|
30 |
{
|
31 |
if( Mage::registry('mapping_data') && Mage::registry('mapping_data')->getId() ) {
|
app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit/Form.php
CHANGED
@@ -18,7 +18,6 @@ class Demac_Optimal_Block_Adminhtml_Risk_Edit_Form extends Mage_Adminhtml_Block_
|
|
18 |
'enctype' => 'multipart/form-data'
|
19 |
));
|
20 |
|
21 |
-
|
22 |
$form->setUseContainer(true);
|
23 |
$this->setForm($form);
|
24 |
return parent::_prepareForm();
|
18 |
'enctype' => 'multipart/form-data'
|
19 |
));
|
20 |
|
|
|
21 |
$form->setUseContainer(true);
|
22 |
$this->setForm($form);
|
23 |
return parent::_prepareForm();
|
app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit/Tab/Form.php
CHANGED
@@ -53,7 +53,6 @@ class Demac_Optimal_Block_Adminhtml_Risk_Edit_Tab_Form extends Mage_Adminhtml_Bl
|
|
53 |
'value' => 0,
|
54 |
));
|
55 |
|
56 |
-
//Mage::log(Mage::getSingleton('adminhtml/session'));
|
57 |
if ( Mage::getSingleton('adminhtml/session')->getRiskData() )
|
58 |
{
|
59 |
$form->setValues(Mage::getSingleton('adminhtml/session')->getRiskData());
|
53 |
'value' => 0,
|
54 |
));
|
55 |
|
|
|
56 |
if ( Mage::getSingleton('adminhtml/session')->getRiskData() )
|
57 |
{
|
58 |
$form->setValues(Mage::getSingleton('adminhtml/session')->getRiskData());
|
app/code/community/Demac/Optimal/Block/Adminhtml/Risk/Edit/Tabs.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
|
10 |
class Demac_Optimal_Block_Adminhtml_Risk_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
11 |
{
|
12 |
-
|
13 |
public function __construct()
|
14 |
{
|
15 |
parent::__construct();
|
9 |
|
10 |
class Demac_Optimal_Block_Adminhtml_Risk_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
11 |
{
|
|
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
app/code/community/Demac/Optimal/Block/Customer/Cards.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Block_Customer_Cards extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Demac/Optimal/Block/Customer/Cards/Form.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Block_Customer_Cards_Form extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Retrieve credit card expire months
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function getCcMonths()
|
11 |
+
{
|
12 |
+
$months = array($this->__('Month'));
|
13 |
+
$months = array_merge($months, Mage::getSingleton('payment/config')->getMonths());
|
14 |
+
return $months;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Retrieve credit card expire years
|
19 |
+
*
|
20 |
+
* @return array
|
21 |
+
*/
|
22 |
+
public function getCcYears()
|
23 |
+
{
|
24 |
+
$years = array($this->__('Year'));
|
25 |
+
$years = array_merge($years, Mage::getSingleton('payment/config')->getYears());
|
26 |
+
return $years;
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Demac/Optimal/Block/Customer/Cards/Grid.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Block_Customer_Cards_Grid extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
public $profiles = null;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Check for existing optimal profiles
|
9 |
+
*
|
10 |
+
* @return bool
|
11 |
+
*/
|
12 |
+
public function hasOptimalProfiles()
|
13 |
+
{
|
14 |
+
$session = Mage::getSingleton('customer/session');
|
15 |
+
$customerId = $session->getId();
|
16 |
+
if (isset($customerId))
|
17 |
+
{
|
18 |
+
$profiles = Mage::getModel('optimal/creditcard')
|
19 |
+
->getCollection()
|
20 |
+
->addFieldToFilter('customer_id', $customerId)
|
21 |
+
->addFieldToFilter('is_deleted', false);
|
22 |
+
if($profiles->count() >= 1)
|
23 |
+
{
|
24 |
+
$this->profiles = $profiles;
|
25 |
+
return true;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Demac/Optimal/Block/Form/Creditcard.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Payment
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Demac_Optimal_Block_Form_Creditcard extends Mage_Payment_Block_Form_Cc
|
29 |
+
{
|
30 |
+
public $profiles = null;
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
parent::_construct();
|
34 |
+
$this->setTemplate('optimal/form/creditcard.phtml');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Check for the existing optimal profiles
|
39 |
+
*
|
40 |
+
* @return bool
|
41 |
+
*/
|
42 |
+
public function hasOptimalProfiles()
|
43 |
+
{
|
44 |
+
$session = Mage::getSingleton('customer/session');
|
45 |
+
$customerId = $session->getId();
|
46 |
+
if (isset($customerId))
|
47 |
+
{
|
48 |
+
$profiles = Mage::getModel('optimal/creditcard')
|
49 |
+
->getCollection()
|
50 |
+
->addFieldToFilter('customer_id', $customerId)
|
51 |
+
->addFieldToFilter('is_deleted', false);
|
52 |
+
|
53 |
+
if($profiles->count() >= 1)
|
54 |
+
{
|
55 |
+
$this->profiles = $profiles;
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Check if profile saving is enabled
|
65 |
+
*
|
66 |
+
* @return bool
|
67 |
+
*/
|
68 |
+
public function canSaveProfiles()
|
69 |
+
{
|
70 |
+
$session = Mage::getSingleton('customer/session');
|
71 |
+
$profilesEnabled = Mage::getStoreConfig('payment/optimal_profiles/active',$this->getStore());
|
72 |
+
$checkoutMethod = Mage::getModel('checkout/cart')->getQuote()->getCheckoutMethod();
|
73 |
+
if (($session->getCustomerId() || $checkoutMethod == 'register') && $profilesEnabled)
|
74 |
+
{
|
75 |
+
return true;
|
76 |
+
}
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Demac/Optimal/Block/Info/Creditcard.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Demac_Optimal_Block_Info_Creditcard extends Mage_Payment_Block_Info_Cc
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->setTemplate('optimal/info/creditcard.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Get the used card information
|
12 |
+
*
|
13 |
+
* @return Mage_Payment_Model_Info|void
|
14 |
+
*/
|
15 |
+
public function getCardInfo()
|
16 |
+
{
|
17 |
+
$info = $this->getInfo();
|
18 |
+
$profileId = false;
|
19 |
+
if($info->getOrder() && $info->getOrder()->getPayment()) {
|
20 |
+
$orderInfo = unserialize($info->getOrder()->getPayment()->getAdditionalInformation('order'));
|
21 |
+
if(isset($orderInfo['optimal_profile_id']) && $orderInfo['optimal_profile_id'] > 0)
|
22 |
+
{
|
23 |
+
$profile = Mage::getModel('optimal/creditcard')
|
24 |
+
->load($orderInfo['optimal_profile_id']);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
if($profile) {
|
29 |
+
|
30 |
+
$info = array(
|
31 |
+
'name' => $profile->getCardHolder(),
|
32 |
+
'card_type' => $profile->getCardNickname(),
|
33 |
+
'card_number' => $profile->getLastFourDigits(),
|
34 |
+
'card_exp' => $profile->getCardExpiration(),
|
35 |
+
);
|
36 |
+
|
37 |
+
return $info;
|
38 |
+
}
|
39 |
+
|
40 |
+
$info = array(
|
41 |
+
'card_type' => $this->getCcTypeName(),
|
42 |
+
'card_number' => $info->getCcLast4(),
|
43 |
+
'card_exp' => $info->getCcExpMonth() . '/' . $info->getCcExpYear(),
|
44 |
+
);
|
45 |
+
|
46 |
+
return $info;
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Demac/Optimal/Block/Threat.php
CHANGED
@@ -20,7 +20,7 @@ class Demac_Optimal_Block_Threat extends Mage_Core_Block_Template
|
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
-
*
|
24 |
*
|
25 |
* @return mixed
|
26 |
*/
|
@@ -50,7 +50,7 @@ class Demac_Optimal_Block_Threat extends Mage_Core_Block_Template
|
|
50 |
public function getSessionKey($sessionId)
|
51 |
{
|
52 |
$orgId = $this->getOrgId();
|
53 |
-
$time = round(microtime(true) * 1000);
|
54 |
|
55 |
if(isset($sessionId) && isset($orgId) && isset($time))
|
56 |
{
|
@@ -71,7 +71,6 @@ class Demac_Optimal_Block_Threat extends Mage_Core_Block_Template
|
|
71 |
*/
|
72 |
public function getThreatMetrixUrl($m = null)
|
73 |
{
|
74 |
-
|
75 |
$orgId = $this->getOrgId();
|
76 |
$sessionId = $this->getSessionKey(Mage::getSingleton("core/session")->getEncryptedSessionId());
|
77 |
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
+
* Get the organization id
|
24 |
*
|
25 |
* @return mixed
|
26 |
*/
|
50 |
public function getSessionKey($sessionId)
|
51 |
{
|
52 |
$orgId = $this->getOrgId();
|
53 |
+
$time = number_format(round(microtime(true) * 1000), 0, '.', '');
|
54 |
|
55 |
if(isset($sessionId) && isset($orgId) && isset($time))
|
56 |
{
|
71 |
*/
|
72 |
public function getThreatMetrixUrl($m = null)
|
73 |
{
|
|
|
74 |
$orgId = $this->getOrgId();
|
75 |
$sessionId = $this->getSessionKey(Mage::getSingleton("core/session")->getEncryptedSessionId());
|
76 |
|
app/code/community/Demac/Optimal/Helper/Data.php
CHANGED
@@ -9,12 +9,21 @@
|
|
9 |
|
10 |
class Demac_Optimal_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
{
|
|
|
|
|
|
|
|
|
12 |
public function formatAmount($amount)
|
13 |
{
|
14 |
$amount = (int)(string)((number_format($amount,2,'.','')) * 100);
|
15 |
return $amount;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
public function getStreetDetails($address, $position)
|
19 |
{
|
20 |
if(isset($address[$position]))
|
@@ -24,4 +33,347 @@ class Demac_Optimal_Helper_Data extends Mage_Core_Helper_Abstract
|
|
24 |
return '';
|
25 |
}
|
26 |
}
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
class Demac_Optimal_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
{
|
12 |
+
/**
|
13 |
+
* @param $amount
|
14 |
+
* @return int
|
15 |
+
*/
|
16 |
public function formatAmount($amount)
|
17 |
{
|
18 |
$amount = (int)(string)((number_format($amount,2,'.','')) * 100);
|
19 |
return $amount;
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @param $address
|
24 |
+
* @param $position
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
public function getStreetDetails($address, $position)
|
28 |
{
|
29 |
if(isset($address[$position]))
|
33 |
return '';
|
34 |
}
|
35 |
}
|
36 |
+
|
37 |
+
public function getMerchantCustomerId($customer_id = false) {
|
38 |
+
|
39 |
+
if($customer_id !== false) {
|
40 |
+
$customer = Mage::getModel('optimal/merchant_customer')->load($customer_id, 'customer_id');
|
41 |
+
if($customer->getMerchantCustomerId()) {
|
42 |
+
return $this->processMerchantCustomerId($customer->getMerchantCustomerId());
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
$customer = Mage::getModel('optimal/merchant_customer');
|
47 |
+
if($customer_id) {
|
48 |
+
$customer->setCustomerId($customer_id);
|
49 |
+
}
|
50 |
+
$customer->setDataChanges(true); // force save in case we need to save just the ID.
|
51 |
+
$customer->save();
|
52 |
+
return $this->processMerchantCustomerId($customer->getMerchantCustomerId());
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function processMerchantCustomerId($internal_id) {
|
56 |
+
$profileKey = Mage::getStoreConfig('payment/optimal_profiles/profile_key');
|
57 |
+
return array(
|
58 |
+
'internal_id' => $internal_id,
|
59 |
+
'merchant_customer_id' => md5($profileKey . $internal_id)
|
60 |
+
);
|
61 |
+
}
|
62 |
+
|
63 |
+
public function cleanMerchantCustomerId($customer_id = false) {
|
64 |
+
if($customer_id) {
|
65 |
+
$cards = Mage::getModel('optimal/creditcard')
|
66 |
+
->getCollection();
|
67 |
+
$cards->addFieldToFilter('customer_id', array('eq', $customer_id));
|
68 |
+
if($cards->count() == 0) {
|
69 |
+
Mage::getModel('optimal/merchant_customer')->load($customer_id, 'customer_id')->delete();
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
function processCardNickname($nickname) {
|
75 |
+
return str_replace('Amex', 'American Express', str_replace('Mastercard', 'MasterCard', ucwords($nickname)));
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Prepare data for netbanks order creation
|
80 |
+
*
|
81 |
+
* @param $orderData
|
82 |
+
* @param $customerData
|
83 |
+
* @param bool $saveCard
|
84 |
+
* @param null $transactionMode
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
public function prepareNetbanksOrderData($orderData, $customerData, $saveCard = false, $transactionMode = null)
|
88 |
+
{
|
89 |
+
$shoppingCartArray = array();
|
90 |
+
$orderItems = $orderData['order_items'];
|
91 |
+
$billingAddress = $orderData['billing_address'];
|
92 |
+
$shippingAddress = $orderData['shipping_address'];
|
93 |
+
|
94 |
+
// Order extended options
|
95 |
+
$extendedOptionsArray = array();
|
96 |
+
|
97 |
+
// Minimum order information needed
|
98 |
+
$data = array(
|
99 |
+
'totalAmount' => (int) $this->formatAmount($orderData['base_grand_total']),
|
100 |
+
'currencyCode' => (string) $orderData['base_currency_code'],
|
101 |
+
'merchantRefNum' => (string) $orderData['increment_id'] . '-' . time(),
|
102 |
+
);
|
103 |
+
|
104 |
+
if(strlen(Mage::getStoreConfig('payment/optimal_hosted/merchant_email')) > 0) {
|
105 |
+
$data['merchantNotificationEmail'] = Mage::getStoreConfig('payment/optimal_hosted/merchant_email');
|
106 |
+
}
|
107 |
+
|
108 |
+
$data['customerNotificationEmail'] = (string) $orderData['customer_email'];
|
109 |
+
if(Mage::getStoreConfig('payment/optimal_hosted/email_customer') != 1) {
|
110 |
+
$extendedOptionsArray[] = array(
|
111 |
+
'key' => (string) 'suppressCustomerEmail',
|
112 |
+
'value' => true
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
// Customer Profile information
|
117 |
+
|
118 |
+
|
119 |
+
// 1) The customer wants to pay with a saved profile
|
120 |
+
// - We check for a profile id and a payment token
|
121 |
+
// 2) The customer wants to add a new card to his profile
|
122 |
+
// - We check for the customer profile id
|
123 |
+
|
124 |
+
$customerProfile['lastName'] = (string) $customerData['lastname'];
|
125 |
+
$customerProfile['firstName'] = (string) $customerData['firstname'];
|
126 |
+
|
127 |
+
if (!$customerData['is_guest']) {
|
128 |
+
// Check if there is a profile_id being passed
|
129 |
+
if (!empty($customerData['profile_id'])) {
|
130 |
+
$profile = Mage::getModel('optimal/creditcard')->load((int)$customerData['profile_id']);
|
131 |
+
if ($profile->getProfileId()) {
|
132 |
+
$customerProfile['id'] = (string)$profile->getProfileId();
|
133 |
+
|
134 |
+
// In case the profile exists
|
135 |
+
if (!$saveCard) {
|
136 |
+
$customerProfile['paymentToken'] = (string)$profile->getPaymentToken();
|
137 |
+
}
|
138 |
+
} else {
|
139 |
+
Mage::throwException($this->__("The select profile does not exists."));
|
140 |
+
}
|
141 |
+
} elseif($saveCard) {
|
142 |
+
|
143 |
+
// Check for existing profile id
|
144 |
+
$customerId = Mage::getSingleton('customer/session')->getId();
|
145 |
+
$merchantCustomerId = $this->getMerchantCustomerId($customerId);
|
146 |
+
$merchantCustomerId = $merchantCustomerId['merchant_customer_id'];
|
147 |
+
$profile = Mage::getModel('optimal/creditcard')->loadByMerchantCustomerId($merchantCustomerId);
|
148 |
+
|
149 |
+
if($profile->getProfileId()) {
|
150 |
+
$customerProfile['id'] = (string)$profile->getProfileId();
|
151 |
+
}else {
|
152 |
+
$customerProfile['merchantCustomerId'] = $merchantCustomerId;
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
// Need to be sure this matches the store on which the order was placed
|
159 |
+
if (is_null($transactionMode)) {
|
160 |
+
$transactionMode = Mage::getStoreConfig('payment/optimal_hosted/payment_action');
|
161 |
+
}
|
162 |
+
|
163 |
+
switch($transactionMode){
|
164 |
+
case Demac_Optimal_Model_Method_Hosted::ACTION_AUTHORIZE:
|
165 |
+
$extendedOptionsArray[] = array(
|
166 |
+
'key' => (string) 'authType',
|
167 |
+
'value' => (string) Demac_Optimal_Model_Config_Transaction::AUTH_VALUE
|
168 |
+
);
|
169 |
+
break;
|
170 |
+
case Demac_Optimal_Model_Method_Hosted::ACTION_AUTHORIZE_CAPTURE:
|
171 |
+
$extendedOptionsArray[] = array(
|
172 |
+
'key' => (string) 'authType',
|
173 |
+
'value' => (string) Demac_Optimal_Model_Config_Transaction::CAPT_VALUE
|
174 |
+
);
|
175 |
+
break;
|
176 |
+
default:
|
177 |
+
Mage::throwException($this->__("There is no transaction method set, please contact the website administrator."));
|
178 |
+
break;
|
179 |
+
}
|
180 |
+
|
181 |
+
$skip3d = Mage::getStoreConfig('payment/optimal_hosted/skip3d');
|
182 |
+
|
183 |
+
if($skip3d)
|
184 |
+
{
|
185 |
+
$extendedOptionsArray[] = array(
|
186 |
+
'key' => (string) 'skip3D',
|
187 |
+
'value' => true
|
188 |
+
);
|
189 |
+
} else {
|
190 |
+
$extendedOptionsArray[] = array(
|
191 |
+
'key' => (string) 'skip3D',
|
192 |
+
'value' => false
|
193 |
+
);
|
194 |
+
}
|
195 |
+
|
196 |
+
$addendumDataArray = array();
|
197 |
+
$threatMetrixId = Mage::getSingleton('core/session')->getThreatMetrixSessionKey();
|
198 |
+
|
199 |
+
if(isset($threatMetrixId) && Mage::getStoreConfig('payment/threat_metrix/active'))
|
200 |
+
{
|
201 |
+
$extendedOptionsArray[] = array(
|
202 |
+
'key' => (string) 'threatMetrixSessionId',
|
203 |
+
'value' => $threatMetrixId
|
204 |
+
);
|
205 |
+
}
|
206 |
+
|
207 |
+
// Ancillary fees information
|
208 |
+
$ancillaryFeesArray = array(
|
209 |
+
array(
|
210 |
+
'amount' => (int)$this->formatAmount($orderData['base_shipping_amount']),
|
211 |
+
'description' => "Shipping Amount"
|
212 |
+
),
|
213 |
+
array(
|
214 |
+
'amount' => (int)$this->formatAmount($orderData['base_tax_amount']),
|
215 |
+
'description' => "Tax Amount"
|
216 |
+
),
|
217 |
+
array(
|
218 |
+
'amount' => (int)$this->formatAmount($orderData['base_discount_amount']),
|
219 |
+
'description' => "Discount Amount"
|
220 |
+
),
|
221 |
+
array(
|
222 |
+
'amount' => (int)$this->formatAmount($orderData['base_customer_balance_amount']*-1),
|
223 |
+
'description' => "Store Credit Amount"
|
224 |
+
)
|
225 |
+
);
|
226 |
+
|
227 |
+
// Billing Details information
|
228 |
+
$billingDetailsArray = array(
|
229 |
+
'city' => (string) $billingAddress->getCity(),
|
230 |
+
'country' => (string) $billingAddress->getCountryId(),
|
231 |
+
'street' => (string) $this->getStreetDetails($billingAddress->getStreet(),0),
|
232 |
+
'street2' => (string) $this->getStreetDetails($billingAddress->getStreet(),1),
|
233 |
+
'zip' => (string) $billingAddress->getPostcode(),
|
234 |
+
'phone' => (string) $billingAddress->getTelephone(),
|
235 |
+
);
|
236 |
+
|
237 |
+
if($billingDetailsArray['street2'] == '')
|
238 |
+
{
|
239 |
+
unset($billingDetailsArray['street2']);
|
240 |
+
}
|
241 |
+
|
242 |
+
if($billingAddress->getCountryId() === 'CA' || $billingAddress->getCountryId() === 'US')
|
243 |
+
{
|
244 |
+
$billingDetailsArray['state'] = (string) $billingAddress->getRegionCode();
|
245 |
+
} else {
|
246 |
+
if((string) $billingAddress->getRegion() != '') {
|
247 |
+
$billingDetailsArray['state'] = (string) $billingAddress->getRegion();
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
// Start Refactor : Work around for downloadable and virtual products
|
252 |
+
if (!$shippingAddress) {
|
253 |
+
$shippingAddress = $billingAddress;
|
254 |
+
}
|
255 |
+
// End Refactor
|
256 |
+
|
257 |
+
if($billingAddress->getCustomerAddressId() === $shippingAddress->getCustomerAddressId())
|
258 |
+
{
|
259 |
+
$billingDetailsArray['useAsShippingAddress'] = true;
|
260 |
+
} else {
|
261 |
+
$billingDetailsArray['useAsShippingAddress'] = false;
|
262 |
+
}
|
263 |
+
|
264 |
+
// Shipping Details information
|
265 |
+
$shippingDetailsArray = array(
|
266 |
+
'city' => (string) $shippingAddress->getCity(),
|
267 |
+
'country' => (string) $shippingAddress->getCountryId(),
|
268 |
+
'street' => (string) $this->getStreetDetails($shippingAddress->getStreet(),0),
|
269 |
+
'street2' => (string) $this->getStreetDetails($shippingAddress->getStreet(),1),
|
270 |
+
'zip' => (string) $shippingAddress->getPostcode(),
|
271 |
+
'phone' => (string) $shippingAddress->getTelephone(),
|
272 |
+
);
|
273 |
+
|
274 |
+
|
275 |
+
if($shippingDetailsArray['street2'] == '')
|
276 |
+
{
|
277 |
+
unset($shippingDetailsArray['street2']);
|
278 |
+
}
|
279 |
+
|
280 |
+
if($shippingAddress->getCountryId() === 'CA' || $shippingAddress->getCountryId() === 'US')
|
281 |
+
{
|
282 |
+
$shippingDetailsArray['state'] = (string) $shippingAddress->getRegionCode();
|
283 |
+
} else {
|
284 |
+
if((string) $shippingAddress->getRegion() != '') {
|
285 |
+
$shippingDetailsArray['state'] = (string) $shippingAddress->getRegion();
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
// Shopping Cart Information
|
290 |
+
foreach($orderItems as $item)
|
291 |
+
{
|
292 |
+
$itemArray = array(
|
293 |
+
'amount' => (int) $this->formatAmount($item->getBasePrice()),
|
294 |
+
'quantity' => (int) $item->getQtyOrdered(),
|
295 |
+
'sku' => (string) $item->getSku(),
|
296 |
+
'description' => (string) substr($item->getName(),0,45)
|
297 |
+
);
|
298 |
+
|
299 |
+
$shoppingCartArray[] = $itemArray;
|
300 |
+
}
|
301 |
+
|
302 |
+
// Callback information
|
303 |
+
$callbackArray = array();
|
304 |
+
$callbackArray[] = array(
|
305 |
+
'format' => (string) 'json',
|
306 |
+
'rel' => (string) 'on_success',
|
307 |
+
'retries' => (int) Demac_Optimal_Model_Hosted_Client::CONNECTION_RETRIES,
|
308 |
+
'returnKeys' => array(
|
309 |
+
'id',
|
310 |
+
'transaction.confirmationNumber',
|
311 |
+
'transaction.status'
|
312 |
+
),
|
313 |
+
'synchronous' => true,
|
314 |
+
'uri' => Mage::getBaseUrl()
|
315 |
+
);
|
316 |
+
|
317 |
+
// Callback information
|
318 |
+
$redirectArray = array();
|
319 |
+
$redirectArray[] = array(
|
320 |
+
'rel' => (string) 'on_success',
|
321 |
+
'returnKeys' => array(
|
322 |
+
'id',
|
323 |
+
'transaction.confirmationNumber',
|
324 |
+
'transaction.status'
|
325 |
+
),
|
326 |
+
'uri' => Mage::getBaseUrl()
|
327 |
+
);
|
328 |
+
$redirectArray[] = array(
|
329 |
+
'rel' => (string) 'on_error',
|
330 |
+
'returnKeys' => array(
|
331 |
+
'id',
|
332 |
+
'transaction.confirmationNumber',
|
333 |
+
'transaction.status'
|
334 |
+
),
|
335 |
+
'uri' => Mage::getBaseUrl()
|
336 |
+
);
|
337 |
+
$redirectArray[] = array(
|
338 |
+
'rel' => (string) 'on_decline',
|
339 |
+
'returnKeys' => array(
|
340 |
+
'id',
|
341 |
+
'transaction.confirmationNumber',
|
342 |
+
'transaction.status'
|
343 |
+
),
|
344 |
+
'uri' => Mage::getBaseUrl()
|
345 |
+
);
|
346 |
+
$redirectArray[] = array(
|
347 |
+
'rel' => (string) 'on_timeout',
|
348 |
+
'returnKeys' => array(
|
349 |
+
'id',
|
350 |
+
'transaction.confirmationNumber',
|
351 |
+
'transaction.status'
|
352 |
+
),
|
353 |
+
'uri' => Mage::getBaseUrl()
|
354 |
+
);
|
355 |
+
$redirectArray[] = array(
|
356 |
+
'rel' => (string) 'on_hold',
|
357 |
+
'returnKeys' => array(
|
358 |
+
'id',
|
359 |
+
'transaction.confirmationNumber',
|
360 |
+
'transaction.status'
|
361 |
+
),
|
362 |
+
'uri' => Mage::getBaseUrl()
|
363 |
+
);
|
364 |
+
|
365 |
+
// Add extra information to the order Data
|
366 |
+
$data['shoppingCart'] = $shoppingCartArray;
|
367 |
+
$data['ancillaryFees'] = $ancillaryFeesArray;
|
368 |
+
$data['billingDetails'] = $billingDetailsArray;
|
369 |
+
$data['shippingDetails'] = $shippingDetailsArray;
|
370 |
+
$data['redirect'] = $redirectArray;
|
371 |
+
$data['profile'] = $customerProfile;
|
372 |
+
$data['extendedOptions'] = $extendedOptionsArray;
|
373 |
+
$data['addendumData'] = $addendumDataArray;
|
374 |
+
|
375 |
+
return $data;
|
376 |
+
|
377 |
+
}
|
378 |
+
|
379 |
+
}
|
app/code/community/Demac/Optimal/Helpers/Data.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by JetBrains PhpStorm.
|
4 |
-
* User: Allan MacGregor - Magento Practice Lead <allan@demacmedia.com>
|
5 |
-
* Company: Demac Media Inc.
|
6 |
-
* Date: 6/20/13
|
7 |
-
* Time: 2:05 PM
|
8 |
-
*/
|
9 |
-
|
10 |
-
class Demac_Optimal_Helpers_Data extends Mage_Core_Helper_Abstract
|
11 |
-
{
|
12 |
-
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Demac/Optimal/Model/Client/Abstract.php
CHANGED
@@ -1,13 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by
|
4 |
-
* User:
|
5 |
-
*
|
6 |
-
*
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: amacgregor
|
5 |
+
* Date: 05/05/14
|
6 |
+
* Time: 6:24 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Demac_Optimal_Model_Client_Abstract extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
protected $_storeId = null;
|
12 |
+
protected $_apiUrl = null;
|
13 |
+
|
14 |
+
|
15 |
+
public function __construct($parameters)
|
16 |
+
{
|
17 |
+
if(isset($parameters['store_id'])){
|
18 |
+
$this->_storeId = $parameters['store_id'];
|
19 |
+
}else {
|
20 |
+
$this->_storeId = Mage::app()->getStore()->getId();
|
21 |
+
}
|
22 |
+
|
23 |
+
parent::__construct();
|
24 |
+
}
|
25 |
+
|
26 |
+
public function _construct()
|
27 |
+
{
|
28 |
+
$this->_apiUrl = $this->_getApiUrl();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get the API url based on the configuration
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
protected function _getApiUrl()
|
37 |
+
{
|
38 |
+
if(Mage::getStoreConfig('payment/optimal_hosted/mode', $this->_storeId) === 'development')
|
39 |
+
{
|
40 |
+
$url = 'https://api.test.netbanx.com';
|
41 |
+
}else {
|
42 |
+
$url = 'https://api.netbanx.com';
|
43 |
+
}
|
44 |
+
return $url;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return bool|string
|
49 |
+
*
|
50 |
+
*/
|
51 |
+
protected function _getUserPwd()
|
52 |
+
{
|
53 |
+
try {
|
54 |
+
$user = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/optimal_hosted/login', $this->_storeId));
|
55 |
+
$pwd = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/optimal_hosted/trans_key', $this->_storeId));
|
56 |
+
|
57 |
+
if($user != '' && $pwd != '')
|
58 |
+
{
|
59 |
+
return $user . ':' . $pwd;
|
60 |
+
}else{
|
61 |
+
Mage::throwException("Something went wrong with your api credentials");
|
62 |
+
}
|
63 |
+
} catch (Exception $e) {
|
64 |
+
Mage::logException($e);
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
protected function _checkCurlVerifyPeer($curl)
|
70 |
+
{
|
71 |
+
if(Mage::getStoreConfig('payment/optimal_hosted/mode', $this->_storeId) === 'development')
|
72 |
+
{
|
73 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
74 |
+
}else {
|
75 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
app/code/community/Demac/Optimal/Model/Config/Transaction.php
CHANGED
@@ -34,5 +34,4 @@ class Demac_Optimal_Model_Config_Transaction extends Mage_Core_Model_Config_Data
|
|
34 |
),
|
35 |
);
|
36 |
}
|
37 |
-
|
38 |
}
|
34 |
),
|
35 |
);
|
36 |
}
|
|
|
37 |
}
|
app/code/community/Demac/Optimal/Model/Creditcard.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Model_Creditcard extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('optimal/creditcard');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function loadByProfileId($profileId)
|
12 |
+
{
|
13 |
+
$this->_getResource()->loadByProfileId($this, $profileId);
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function loadByProfileAndToken($profileId, $paymentToken)
|
18 |
+
{
|
19 |
+
$this->_getResource()->loadByProfileAndToken($this, $profileId, $paymentToken);
|
20 |
+
return $this;
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
public function loadByMerchantCustomerId($merchantCustomerId)
|
25 |
+
{
|
26 |
+
$this->_getResource()->loadByMerchantCustomerId($this, $merchantCustomerId);
|
27 |
+
return $this;
|
28 |
+
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Demac/Optimal/Model/Creditcard/Client.php
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by JetBrains PhpStorm.
|
4 |
+
* User: Allan MacGregor - Magento Practice Lead <allan@demacmedia.com>
|
5 |
+
* Company: Demac Media Inc.
|
6 |
+
* Date: 6/20/13
|
7 |
+
* Time: 12:53 PM
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Demac_Optimal_Model_Creditcard_Client extends Demac_Optimal_Model_Client_Abstract
|
11 |
+
{
|
12 |
+
protected $_merchantRefNum = null;
|
13 |
+
protected $_currencyCode = null;
|
14 |
+
protected $_totalAmount = null;
|
15 |
+
protected $_restEndpoints = array();
|
16 |
+
|
17 |
+
const CONNECTION_RETRIES = 3;
|
18 |
+
|
19 |
+
public function _construct()
|
20 |
+
{
|
21 |
+
// Initialize methods array
|
22 |
+
$this->_restEndpoints = array(
|
23 |
+
'delete' => 'customer/v1/cards/%s',
|
24 |
+
'get' => 'customer/v1/cards/%s',
|
25 |
+
);
|
26 |
+
|
27 |
+
parent::_construct();
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
*
|
33 |
+
* Create an Profile in Netbanks.
|
34 |
+
*
|
35 |
+
* @param $data (
|
36 |
+
* merchantRefNum = (string) MagentoOrderId
|
37 |
+
* currencyCode = (ISO4217) Order currency code
|
38 |
+
* totalAmount = (int) Order Grand Total
|
39 |
+
* customerIP = (string) remote_ip
|
40 |
+
*
|
41 |
+
* customerNotificationEmail = (string) Order customer email
|
42 |
+
* merchantNotificationEmail = (string) Order contact email
|
43 |
+
* )
|
44 |
+
* @return bool|mixed
|
45 |
+
*/
|
46 |
+
public function createProfile($data)
|
47 |
+
{
|
48 |
+
$mode = 'POST';
|
49 |
+
$url = $this->_getUrl('create');
|
50 |
+
|
51 |
+
return $this->callApi($url,$mode,$data);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
*
|
56 |
+
* Cancel an Order in Netbanks
|
57 |
+
*
|
58 |
+
* @param $id
|
59 |
+
* @internal param $data ( id = netbanksOrderId )
|
60 |
+
*
|
61 |
+
* @return bool|mixed
|
62 |
+
*/
|
63 |
+
public function deleteProfile($id)
|
64 |
+
{
|
65 |
+
$mode = 'DELETE';
|
66 |
+
$url = $this->_getUrl('delete', $id);
|
67 |
+
|
68 |
+
return $this->callApi($url,$mode);
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Mapping of the RESTFul Api
|
74 |
+
*
|
75 |
+
* Create a Profile - customer/v1/profiles [POST]
|
76 |
+
* Delete a Profile - customer/v1/profiles/{id} [DELETE]
|
77 |
+
* Get a Profile - customer/v1/profiles/{id} [GET]
|
78 |
+
*
|
79 |
+
* @param $method
|
80 |
+
* @param $url
|
81 |
+
* @param $data = Array(id,content)
|
82 |
+
* @return bool|mixed
|
83 |
+
*/
|
84 |
+
protected function callApi($url, $method, $data = array())
|
85 |
+
{
|
86 |
+
$response = json_decode($this->_callApi($url,$method,$data));
|
87 |
+
|
88 |
+
if(isset($response->error))
|
89 |
+
{
|
90 |
+
Mage:log('Netbanks Returned Error: ' . $response->error->message,null,'DemacOptimal_error.log');
|
91 |
+
Mage::throwException($response->error->message);
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
if(isset($response->transaction->errorCode))
|
95 |
+
{
|
96 |
+
$session = Mage::getSingleton('customer/session');
|
97 |
+
if (!$session->getCustomerId()) {
|
98 |
+
Mage::getSingleton('customer/session')->addError($response->transaction->errorMessage);
|
99 |
+
}
|
100 |
+
Mage::throwException($response->transaction->errorMessage);
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
return $response;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Makes CURL requests to the netbanks api
|
108 |
+
*
|
109 |
+
* @param $url
|
110 |
+
* @param $mode
|
111 |
+
* @param array $data
|
112 |
+
* @return mixed
|
113 |
+
*/
|
114 |
+
protected function _callApi($url,$mode,$data = array())
|
115 |
+
{
|
116 |
+
$helper = Mage::helper('optimal');
|
117 |
+
$data = json_encode($data);
|
118 |
+
|
119 |
+
try {
|
120 |
+
$curl = curl_init($url);
|
121 |
+
$headers[] = "Content-Type: application/json";
|
122 |
+
|
123 |
+
$this->_checkCurlVerifyPeer($curl);
|
124 |
+
|
125 |
+
|
126 |
+
curl_setopt($curl, CURLOPT_USERPWD, $this->_getUserPwd());
|
127 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
128 |
+
|
129 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
130 |
+
|
131 |
+
switch ($mode) {
|
132 |
+
case "POST":
|
133 |
+
curl_setopt($curl, CURLOPT_POST, true);
|
134 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
135 |
+
break;
|
136 |
+
case "DELETE":
|
137 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $mode);
|
138 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
139 |
+
break;
|
140 |
+
case "PUT":
|
141 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $mode);
|
142 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
143 |
+
break;
|
144 |
+
case "GET":
|
145 |
+
//hosted/v1/orders/{id}
|
146 |
+
break;
|
147 |
+
default:
|
148 |
+
Mage::throwException("{$mode} mode was not recognized. Please one of the valid REST actions GET, POST, PUT, DELETE");
|
149 |
+
break;
|
150 |
+
}
|
151 |
+
|
152 |
+
$curl_response = curl_exec($curl);
|
153 |
+
curl_close($curl);
|
154 |
+
|
155 |
+
// Check if the response is false
|
156 |
+
if($curl_response === false)
|
157 |
+
{
|
158 |
+
Mage::throwException("Something went wrong while trying to retrieve the response from the REST api");
|
159 |
+
}
|
160 |
+
|
161 |
+
// Check if the response threw an error
|
162 |
+
if($curl_response === false)
|
163 |
+
{
|
164 |
+
Mage::throwException("Something went wrong while trying to retrieve the response from the REST api");
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
+
} catch (Mage_Exception $e) {
|
169 |
+
Mage::logException($e);
|
170 |
+
return false;
|
171 |
+
} catch (Exception $e) {
|
172 |
+
Mage::logException($e);
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
|
176 |
+
return $curl_response;
|
177 |
+
}
|
178 |
+
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Build the RESTful url
|
182 |
+
*
|
183 |
+
* @param $method
|
184 |
+
* @param null $id
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
protected function _getUrl($method,$id = null)
|
188 |
+
{
|
189 |
+
return $this->_apiUrl . '/' . sprintf($this->_restEndpoints[$method],$id);
|
190 |
+
}
|
191 |
+
}
|
app/code/community/Demac/Optimal/Model/Hosted/Client.php
CHANGED
@@ -7,19 +7,17 @@
|
|
7 |
* Time: 12:53 PM
|
8 |
*/
|
9 |
|
10 |
-
class Demac_Optimal_Model_Hosted_Client extends
|
11 |
{
|
12 |
protected $_merchantRefNum = null;
|
13 |
protected $_currencyCode = null;
|
14 |
protected $_totalAmount = null;
|
15 |
-
|
16 |
-
protected $_restEndpoints = array();
|
17 |
|
18 |
const CONNECTION_RETRIES = 3;
|
19 |
|
20 |
public function _construct()
|
21 |
{
|
22 |
-
$this->_apiUrl = $this->_getApiUrl();
|
23 |
|
24 |
// Initialize methods array
|
25 |
$this->_restEndpoints = array(
|
@@ -33,6 +31,8 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
33 |
'report' => 'hosted/v1/orders',
|
34 |
'rebill' => 'hosted/v1/orders/%s',
|
35 |
);
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -180,22 +180,6 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
180 |
return $this->callApi($url,$mode);
|
181 |
}
|
182 |
|
183 |
-
/**
|
184 |
-
* Get the API url based on the configuration
|
185 |
-
*
|
186 |
-
* @return string
|
187 |
-
*/
|
188 |
-
protected function _getApiUrl()
|
189 |
-
{
|
190 |
-
if(Mage::getStoreConfig('payment/optimal_hosted/mode') === 'development')
|
191 |
-
{
|
192 |
-
$url = 'https://api.test.netbanx.com';
|
193 |
-
}else {
|
194 |
-
$url = 'https://api.netbanx.com';
|
195 |
-
}
|
196 |
-
return $url;
|
197 |
-
}
|
198 |
-
|
199 |
/**
|
200 |
* Mapping of the RESTFul Api
|
201 |
*
|
@@ -218,11 +202,9 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
218 |
|
219 |
$response = json_decode($this->_callApi($url,$method,$data));
|
220 |
|
221 |
-
// Do I need extra logic here ?
|
222 |
-
// Yes I do
|
223 |
if(isset($response->error))
|
224 |
{
|
225 |
-
Mage
|
226 |
Mage::throwException($response->error->message);
|
227 |
return false;
|
228 |
}
|
@@ -232,6 +214,7 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
232 |
if (!$session->getCustomerId()) {
|
233 |
Mage::getSingleton('customer/session')->addError($response->transaction->errorMessage);
|
234 |
}
|
|
|
235 |
Mage::throwException($response->transaction->errorMessage);
|
236 |
return false;
|
237 |
}
|
@@ -255,6 +238,8 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
255 |
$curl = curl_init($url);
|
256 |
$headers[] = "Content-Type: application/json";
|
257 |
|
|
|
|
|
258 |
curl_setopt($curl, CURLOPT_USERPWD, $this->_getUserPwd());
|
259 |
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
260 |
|
@@ -277,7 +262,7 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
277 |
//hosted/v1/orders/{id}
|
278 |
break;
|
279 |
default:
|
280 |
-
Mage::throwException(
|
281 |
break;
|
282 |
}
|
283 |
|
@@ -287,52 +272,18 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
287 |
// Check if the response is false
|
288 |
if($curl_response === false)
|
289 |
{
|
290 |
-
Mage::throwException(
|
291 |
-
}
|
292 |
-
|
293 |
-
// Check if the response threw an error
|
294 |
-
if($curl_response === false)
|
295 |
-
{
|
296 |
-
Mage::throwException($this->__("Something went wrong while trying to retrieve the response from the REST api"));
|
297 |
}
|
298 |
|
299 |
-
|
300 |
} catch (Mage_Exception $e) {
|
301 |
Mage::logException($e);
|
302 |
return false;
|
303 |
-
} catch (Exception $e) {
|
304 |
-
Mage::logException($e);
|
305 |
-
return false;
|
306 |
}
|
307 |
-
|
|
|
308 |
return $curl_response;
|
309 |
}
|
310 |
|
311 |
-
/**
|
312 |
-
* @return bool|string
|
313 |
-
*
|
314 |
-
* TODO: TEST MULTI STORE SCENARIOS
|
315 |
-
*
|
316 |
-
*/
|
317 |
-
protected function _getUserPwd()
|
318 |
-
{
|
319 |
-
try {
|
320 |
-
$user = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/optimal_hosted/login'));
|
321 |
-
$pwd = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/optimal_hosted/trans_key'));
|
322 |
-
|
323 |
-
if($user != '' && $pwd != '')
|
324 |
-
{
|
325 |
-
return $user . ':' . $pwd;
|
326 |
-
}else{
|
327 |
-
Mage::throwException($this->__("Something went wrong with your api credentials"));
|
328 |
-
}
|
329 |
-
} catch (Exception $e) {
|
330 |
-
Mage::logException($e);
|
331 |
-
return false;
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
|
336 |
/**
|
337 |
* @param $url
|
338 |
* @param $data
|
@@ -352,7 +303,9 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
352 |
}
|
353 |
|
354 |
$data_string = rtrim($data_string, '&');
|
355 |
-
curl_setopt($curl, CURLOPT_HTTPHEADER,
|
|
|
|
|
356 |
|
357 |
//set the url, number of POST vars, POST data
|
358 |
curl_setopt($curl,CURLOPT_URL, $url);
|
@@ -360,6 +313,9 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
360 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
361 |
curl_setopt($curl,CURLOPT_POSTFIELDS, $data_string);
|
362 |
$curl_response = curl_exec($curl);
|
|
|
|
|
|
|
363 |
curl_close($curl);
|
364 |
return true;
|
365 |
|
@@ -369,7 +325,6 @@ class Demac_Optimal_Model_Hosted_Client extends Mage_Core_Model_Abstract
|
|
369 |
}
|
370 |
}
|
371 |
|
372 |
-
|
373 |
/**
|
374 |
* Build the RESTful url
|
375 |
*
|
7 |
* Time: 12:53 PM
|
8 |
*/
|
9 |
|
10 |
+
class Demac_Optimal_Model_Hosted_Client extends Demac_Optimal_Model_Client_Abstract
|
11 |
{
|
12 |
protected $_merchantRefNum = null;
|
13 |
protected $_currencyCode = null;
|
14 |
protected $_totalAmount = null;
|
15 |
+
|
|
|
16 |
|
17 |
const CONNECTION_RETRIES = 3;
|
18 |
|
19 |
public function _construct()
|
20 |
{
|
|
|
21 |
|
22 |
// Initialize methods array
|
23 |
$this->_restEndpoints = array(
|
31 |
'report' => 'hosted/v1/orders',
|
32 |
'rebill' => 'hosted/v1/orders/%s',
|
33 |
);
|
34 |
+
|
35 |
+
parent::_construct();
|
36 |
}
|
37 |
|
38 |
/**
|
180 |
return $this->callApi($url,$mode);
|
181 |
}
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
/**
|
184 |
* Mapping of the RESTFul Api
|
185 |
*
|
202 |
|
203 |
$response = json_decode($this->_callApi($url,$method,$data));
|
204 |
|
|
|
|
|
205 |
if(isset($response->error))
|
206 |
{
|
207 |
+
Mage::helper('optimal')->cleanMerchantCustomerId(Mage::getSingleton('customer/session')->getId());
|
208 |
Mage::throwException($response->error->message);
|
209 |
return false;
|
210 |
}
|
214 |
if (!$session->getCustomerId()) {
|
215 |
Mage::getSingleton('customer/session')->addError($response->transaction->errorMessage);
|
216 |
}
|
217 |
+
Mage::helper('optimal')->cleanMerchantCustomerId(Mage::getSingleton('customer/session')->getId());
|
218 |
Mage::throwException($response->transaction->errorMessage);
|
219 |
return false;
|
220 |
}
|
238 |
$curl = curl_init($url);
|
239 |
$headers[] = "Content-Type: application/json";
|
240 |
|
241 |
+
$this->_checkCurlVerifyPeer($curl);
|
242 |
+
|
243 |
curl_setopt($curl, CURLOPT_USERPWD, $this->_getUserPwd());
|
244 |
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
245 |
|
262 |
//hosted/v1/orders/{id}
|
263 |
break;
|
264 |
default:
|
265 |
+
Mage::throwException("{$mode} mode was not recognized. Please one of the valid REST actions GET, POST, PUT, DELETE");
|
266 |
break;
|
267 |
}
|
268 |
|
272 |
// Check if the response is false
|
273 |
if($curl_response === false)
|
274 |
{
|
275 |
+
Mage::throwException("Something went wrong while trying to retrieve the response from the REST api");
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
}
|
277 |
|
|
|
278 |
} catch (Mage_Exception $e) {
|
279 |
Mage::logException($e);
|
280 |
return false;
|
|
|
|
|
|
|
281 |
}
|
282 |
+
Mage::log('OPTIMAL RESPONSE (_callApi):');
|
283 |
+
Mage::log($curl_response);
|
284 |
return $curl_response;
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
/**
|
288 |
* @param $url
|
289 |
* @param $data
|
303 |
}
|
304 |
|
305 |
$data_string = rtrim($data_string, '&');
|
306 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, array());
|
307 |
+
|
308 |
+
$this->_checkCurlVerifyPeer($curl);
|
309 |
|
310 |
//set the url, number of POST vars, POST data
|
311 |
curl_setopt($curl,CURLOPT_URL, $url);
|
313 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
314 |
curl_setopt($curl,CURLOPT_POSTFIELDS, $data_string);
|
315 |
$curl_response = curl_exec($curl);
|
316 |
+
|
317 |
+
Mage::log('OPTIMAL RESPONSE (submitPayment):');
|
318 |
+
Mage::log($curl_response);
|
319 |
curl_close($curl);
|
320 |
return true;
|
321 |
|
325 |
}
|
326 |
}
|
327 |
|
|
|
328 |
/**
|
329 |
* Build the RESTful url
|
330 |
*
|
app/code/community/Demac/Optimal/Model/Merchant/Customer.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Model_Merchant_Customer extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('optimal/merchant_customer');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Demac/Optimal/Model/Method.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by JetBrains PhpStorm.
|
4 |
-
* User: Allan MacGregor - Magento Practice Lead <allan@demacmedia.com>
|
5 |
-
* Company: Demac Media Inc.
|
6 |
-
* Date: 6/20/13
|
7 |
-
* Time: 1:29 PM
|
8 |
-
*/
|
9 |
-
|
10 |
-
class Demac_Optimal_Model_Method extends Mage_Payment_Model_Method_Cc
|
11 |
-
{
|
12 |
-
protected $_code = 'optimal';
|
13 |
-
protected $_canSaveCc = true;
|
14 |
-
protected $_formBlockType = 'payment/form_ccsave';
|
15 |
-
protected $_infoBlockType = 'payment/info_ccsave';
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Demac/Optimal/Model/Method/Hosted.php
CHANGED
@@ -20,10 +20,41 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
20 |
protected $_isGateway = false;
|
21 |
protected $_canRefund = true;
|
22 |
protected $_canRefundInvoicePartial = true;
|
|
|
|
|
23 |
|
24 |
-
protected $_formBlockType = '
|
25 |
-
protected $_infoBlockType = '
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
/**
|
29 |
* @param Mage_Sales_Model_Order_Payment $payment
|
@@ -59,30 +90,93 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
59 |
return $transaction;
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
/**
|
65 |
-
*
|
66 |
*
|
67 |
-
* @
|
|
|
68 |
*/
|
69 |
-
public function
|
70 |
{
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
-
*
|
76 |
*
|
77 |
-
* @param
|
78 |
-
* @
|
79 |
-
* @return bool
|
80 |
*/
|
81 |
-
public function
|
82 |
{
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
public function authorize(Varien_Object $payment, $amount)
|
87 |
{
|
88 |
if (!$this->canAuthorize()) {
|
@@ -90,22 +184,208 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
90 |
}
|
91 |
|
92 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
$
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
return $this;
|
103 |
} catch (Exception $e) {
|
104 |
Mage::logException($e);
|
105 |
-
|
|
|
106 |
}
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
|
111 |
/**
|
@@ -118,77 +398,60 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
118 |
*/
|
119 |
public function capture(Varien_Object $payment, $amount)
|
120 |
{
|
|
|
121 |
$helper = Mage::helper('optimal');
|
122 |
if ($amount <= 0) {
|
123 |
Mage::throwException(Mage::helper('payment')->__('Invalid amount for capture.'));
|
124 |
}
|
125 |
|
126 |
try {
|
127 |
-
$additionalInformation = $payment->getAdditionalInformation();
|
128 |
|
129 |
-
|
|
|
130 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
$paymentData = unserialize($additionalInformation['transaction']);
|
133 |
$orderData = unserialize($additionalInformation['order']);
|
134 |
-
$client = Mage::getModel('optimal/hosted_client');
|
135 |
|
|
|
136 |
$payment->setAmount($amount);
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Commenting code because OPTIMAL API is broken
|
142 |
-
* For the record going live right now is bullshit
|
143 |
-
*/
|
144 |
-
|
145 |
-
// if($paymentData->status == 'held')
|
146 |
-
// {
|
147 |
-
// $data = array(
|
148 |
-
// "transaction" => array(
|
149 |
-
// "status" => "success"
|
150 |
-
// )
|
151 |
-
// );
|
152 |
-
//
|
153 |
-
// $updateResponse = $client->updateOrder($data,$orderData['id']);
|
154 |
-
// $order->addStatusHistoryComment(
|
155 |
-
// 'Trans Type: Update<br/>' .
|
156 |
-
// 'Confirmation Number: ' . $updateResponse->transaction->confirmationNumber .'<br/>' .
|
157 |
-
// 'Transaction Status: ' . $updateResponse->transaction->status .'<br/>'
|
158 |
-
// );
|
159 |
-
//
|
160 |
-
// if($updateResponse->transaction->status != 'success'){
|
161 |
-
// Mage::throwException('There was a problem releasing the Transaction. Please contact support@demacmedia.com');
|
162 |
-
// }
|
163 |
-
// }
|
164 |
|
165 |
$data = array(
|
166 |
'amount' => (int)$helper->formatAmount($amount),
|
167 |
'merchantRefNum' => (string)$paymentData->merchantRefNum
|
168 |
);
|
169 |
|
170 |
-
$response
|
171 |
-
$orderStatus
|
172 |
-
$transaction
|
173 |
|
174 |
$associatedTransactions = $transaction->associatedTransactions;
|
175 |
|
176 |
$payment->setAdditionalInformation('transaction', serialize($transaction));
|
177 |
|
178 |
$order->addStatusHistoryComment(
|
179 |
-
'Trans Type: ' . $response->authType .'<br/>' .
|
180 |
-
'Confirmation Number: ' . $response->confirmationNumber .'<br/>' .
|
181 |
-
'Transaction Amount: ' . $response->amount/100 .'<br/>'
|
182 |
);
|
183 |
|
184 |
return $this;
|
185 |
-
|
186 |
} else {
|
187 |
Mage::throwException('Transaction information is not properly set. Please contact support@demacmedia.com');
|
188 |
}
|
189 |
} catch (Exception $e) {
|
190 |
Mage::logException($e);
|
191 |
-
|
192 |
}
|
193 |
}
|
194 |
|
@@ -206,7 +469,9 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
206 |
$additionalInformation = $payment->getAdditionalInformation();
|
207 |
|
208 |
if (isset($additionalInformation['transaction'])) {
|
209 |
-
$
|
|
|
|
|
210 |
|
211 |
$paymentData = unserialize($additionalInformation['transaction']);
|
212 |
$orderData = unserialize($additionalInformation['order']);
|
@@ -217,7 +482,6 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
217 |
->setIsTransactionClosed(1)
|
218 |
->setShouldCloseParentTransaction(1);
|
219 |
|
220 |
-
$order = $payment->getOrder();
|
221 |
|
222 |
$order->addStatusHistoryComment(
|
223 |
'Trans Type: ' . $response->authType .'<br/>'.
|
@@ -233,12 +497,10 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
233 |
}
|
234 |
} catch (Exception $e) {
|
235 |
Mage::logException($e);
|
236 |
-
|
237 |
}
|
238 |
-
|
239 |
}
|
240 |
|
241 |
-
|
242 |
/**
|
243 |
* Refund the amount
|
244 |
* Need to decode Last 4 digits for request.
|
@@ -264,7 +526,9 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
264 |
$additionalInformation = $payment->getAdditionalInformation();
|
265 |
|
266 |
if (isset($additionalInformation['transaction'])) {
|
267 |
-
$
|
|
|
|
|
268 |
|
269 |
$paymentData = unserialize($additionalInformation['transaction']);
|
270 |
$orderData = unserialize($additionalInformation['order']);
|
@@ -274,10 +538,15 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
274 |
'merchantRefNum' => (string)$paymentData->merchantRefNum
|
275 |
);
|
276 |
|
277 |
-
|
|
|
|
|
|
|
|
|
278 |
|
279 |
-
|
280 |
|
|
|
281 |
$order->addStatusHistoryComment(
|
282 |
'Trans Type: ' . $response->authType .'<br/>',
|
283 |
'Confirmation Number: ' . $response->confirmationNumber .'<br/>',
|
@@ -290,7 +559,7 @@ class Demac_Optimal_Model_Method_Hosted extends Mage_Payment_Model_Method_Cc
|
|
290 |
}
|
291 |
} catch (Exception $e) {
|
292 |
Mage::logException($e);
|
293 |
-
|
294 |
}
|
295 |
|
296 |
return $this;
|
20 |
protected $_isGateway = false;
|
21 |
protected $_canRefund = true;
|
22 |
protected $_canRefundInvoicePartial = true;
|
23 |
+
protected $_canUseInternal = true;
|
24 |
+
protected $_canUseCheckout = true;
|
25 |
|
26 |
+
protected $_formBlockType = 'optimal/form_creditcard';
|
27 |
+
protected $_infoBlockType = 'optimal/info_creditcard';
|
28 |
|
29 |
+
public function isGateway()
|
30 |
+
{
|
31 |
+
return $this->_isGateway;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function canRefund()
|
35 |
+
{
|
36 |
+
return $this->_canRefund;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function canVoid(Varien_Object $payment)
|
40 |
+
{
|
41 |
+
return $this->_canVoid;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function canCapturePartial()
|
45 |
+
{
|
46 |
+
return $this->_canCapturePartial;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function canAuthorize()
|
50 |
+
{
|
51 |
+
return $this->_canAuthorize;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function canCapture()
|
55 |
+
{
|
56 |
+
return $this->_canCapture;
|
57 |
+
}
|
58 |
|
59 |
/**
|
60 |
* @param Mage_Sales_Model_Order_Payment $payment
|
90 |
return $transaction;
|
91 |
}
|
92 |
|
|
|
|
|
93 |
/**
|
94 |
+
* Assign data to info model instance
|
95 |
*
|
96 |
+
* @param mixed $data
|
97 |
+
* @return Mage_Payment_Model_Info
|
98 |
*/
|
99 |
+
public function assignData($data)
|
100 |
{
|
101 |
+
if (!($data instanceof Varien_Object)) {
|
102 |
+
$data = new Varien_Object($data);
|
103 |
+
}
|
104 |
+
$info = $this->getInfoInstance();
|
105 |
+
|
106 |
+
$profileId = $data->getProfileId();
|
107 |
+
|
108 |
+
if(isset($profileId) && ($profileId != 0)) {
|
109 |
+
$profile = Mage::getModel('optimal/creditcard')
|
110 |
+
->load($profileId, 'entity_id');
|
111 |
+
$expiry = explode('/', $profile->getCardExpiration());
|
112 |
+
$expiry[1] = 2000 + $expiry[1];
|
113 |
+
$info
|
114 |
+
->unsOptimalCreateProfile()
|
115 |
+
->setCcType($profile->getCardNickname())
|
116 |
+
->setCcOwner($profile->getCardHolder())
|
117 |
+
->setCcLast4($profile->getLastFourDigits())
|
118 |
+
->setCcExpMonth($expiry[0])
|
119 |
+
->setCcExpYear($expiry[1])
|
120 |
+
->setCcCidEnc($info->encrypt($data->getCcCid()))
|
121 |
+
->setOptimalProfileId($profileId);
|
122 |
+
$info->save();
|
123 |
+
} else {
|
124 |
+
$info
|
125 |
+
->setCcType($data->getCcType())
|
126 |
+
->setCcOwner($data->getCcOwner())
|
127 |
+
->setCcLast4(substr($data->getCcNumber(), -4))
|
128 |
+
->setCcNumber($data->getCcNumber())
|
129 |
+
->setCcCid($data->getCcCid())
|
130 |
+
->setCcExpMonth($data->getCcExpMonth())
|
131 |
+
->setCcExpYear($data->getCcExpYear())
|
132 |
+
->setCcSsIssue($data->getCcSsIssue())
|
133 |
+
->setCcSsStartMonth($data->getCcSsStartMonth())
|
134 |
+
->setCcSsStartYear($data->getCcSsStartYear())
|
135 |
+
->setOptimalCreateProfile($data->getOptimalCreateProfile());
|
136 |
+
}
|
137 |
+
return $this;
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
+
* Validate payment method information object
|
142 |
*
|
143 |
+
* @param Mage_Payment_Model_Info $info
|
144 |
+
* @return Mage_Payment_Model_Abstract
|
|
|
145 |
*/
|
146 |
+
public function validate()
|
147 |
{
|
148 |
+
$info = $this->getInfoInstance();
|
149 |
+
$errorMsg = false;
|
150 |
+
$availableTypes = explode(',',$this->getConfigData('cctypes'));
|
151 |
+
|
152 |
+
|
153 |
+
$optimalProfileId = $info->getOptimalProfileId();
|
154 |
+
if ($optimalProfileId) {
|
155 |
+
|
156 |
+
//validate credit card verification number
|
157 |
+
if ($errorMsg === false && $this->hasVerification()) {
|
158 |
+
$ccId = $info->getCcCid();
|
159 |
+
if (!isset($ccId)){
|
160 |
+
$errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
if($errorMsg){
|
165 |
+
Mage::throwException($errorMsg);
|
166 |
+
}
|
167 |
+
|
168 |
+
} else {
|
169 |
+
parent::validate();
|
170 |
+
}
|
171 |
+
|
172 |
+
return $this;
|
173 |
}
|
174 |
|
175 |
+
/**
|
176 |
+
* @param Varien_Object $payment
|
177 |
+
* @param $amount
|
178 |
+
* @return $this
|
179 |
+
*/
|
180 |
public function authorize(Varien_Object $payment, $amount)
|
181 |
{
|
182 |
if (!$this->canAuthorize()) {
|
184 |
}
|
185 |
|
186 |
try {
|
187 |
+
$error = false;
|
188 |
+
$customerSession = Mage::getSingleton('customer/session');
|
189 |
+
$adminQuoteSession = Mage::getSingleton('adminhtml/session_quote');
|
190 |
+
if ($customerSession->isLoggedIn()){
|
191 |
+
$customerId = $customerSession->getId();
|
192 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
193 |
+
} elseif($adminQuoteSession->getCustomerId()){
|
194 |
+
$customer = Mage::getModel('customer/customer')->load($adminQuoteSession->getCustomerId());
|
195 |
+
}
|
196 |
|
197 |
+
if ( $amount < 0 ) {
|
198 |
+
$error = Mage::helper('paygate')->__('Invalid amount for capture.');
|
199 |
+
}
|
200 |
+
|
201 |
+
if ( $error !== false ) {
|
202 |
+
Mage::throwException('There was a problem authorizing the order.');
|
203 |
+
}
|
204 |
+
|
205 |
+
$order = $payment->getOrder();
|
206 |
+
$client = Mage::getModel('optimal/hosted_client');
|
207 |
+
$helper = Mage::helper('optimal');
|
208 |
+
|
209 |
+
$createProfile = false;
|
210 |
+
|
211 |
+
$orderData = array();
|
212 |
+
$customerData = array();
|
213 |
+
// Get order data
|
214 |
+
$orderData['remote_ip'] = $order->getRemoteIp();
|
215 |
+
$orderData['order_items'] = $order->getAllVisibleItems();
|
216 |
+
$orderData['increment_id'] = $order->getIncrementId();
|
217 |
+
$orderData['customer_email'] = $order->getCustomerEmail();
|
218 |
+
$orderData['billing_address'] = $order->getBillingAddress();
|
219 |
+
$orderData['shipping_address'] = $order->getShippingAddress();
|
220 |
+
|
221 |
+
$orderData['base_tax_amount'] = $order->getBaseTaxAmount();
|
222 |
+
$orderData['base_grand_total'] = $order->getBaseGrandTotal();
|
223 |
+
$orderData['base_currency_code'] = $order->getBaseCurrencyCode();
|
224 |
+
$orderData['base_shipping_amount'] = $order->getBaseShippingAmount();
|
225 |
+
$orderData['base_discount_amount'] = $order->getBaseDiscountAmount();
|
226 |
+
$orderData['base_customer_balance_amount'] = $order->getBaseCustomerBalanceAmount();
|
227 |
+
|
228 |
+
$paymentData = $payment->getData();
|
229 |
+
|
230 |
+
if(isset($paymentData['optimal_create_profile'])){
|
231 |
+
$createProfile = $paymentData['optimal_create_profile'];
|
232 |
+
}
|
233 |
+
|
234 |
+
// Get customer information
|
235 |
+
if ($customerSession->isLoggedIn()){
|
236 |
+
$customerData = $customer->getData();
|
237 |
+
$customerData['is_guest'] = false;
|
238 |
+
$customerData['lastname'] = (string)$customer->getLastname();
|
239 |
+
$customerData['firstname'] = (string)$customer->getFirstname();
|
240 |
+
$customerData['email'] = (string)$customer->getEmail();
|
241 |
+
|
242 |
+
} else {
|
243 |
+
if ($createProfile) {
|
244 |
+
$customerData['is_guest'] = false;
|
245 |
+
$customerData['lastname'] = (string)$order->getCustomerLastname();
|
246 |
+
$customerData['firstname'] = (string)$order->getCustomerFirstname();
|
247 |
+
$customerData['email'] = (string)$order->getCustomerEmail();
|
248 |
+
} else {
|
249 |
+
$customerData['is_guest'] = true;
|
250 |
+
$customerData['lastname'] = (string)$order->getCustomerLastname();
|
251 |
+
$customerData['firstname'] = (string)$order->getCustomerFirstname();
|
252 |
+
$customerData['email'] = (string)$order->getCustomerEmail();
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
$savedCreditCardProfileId = 0;
|
257 |
+
if(isset($paymentData['optimal_profile_id']) && $paymentData['optimal_profile_id'] > 0) {
|
258 |
+
$savedCreditCardProfileId = $customerData['profile_id'] = $paymentData['optimal_profile_id'];
|
259 |
+
}
|
260 |
+
|
261 |
+
// Call the helper and get the data for netbank
|
262 |
+
$data = $helper->prepareNetbanksOrderData($orderData ,$customerData, $createProfile);
|
263 |
+
|
264 |
+
// Call Netbanks API and create the order
|
265 |
+
$response = $client->createOrder($data);
|
266 |
+
if (isset($response->link)) {
|
267 |
+
foreach ($response->link as $link) {
|
268 |
+
if($link->rel === 'hosted_payment') {
|
269 |
+
$postURL = $link->uri;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
} else {
|
273 |
+
Mage::throwException($this->__("There was a problem creating the order"));
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
if(isset($postURL)) {
|
278 |
+
$paymentData = $this->_preparePayment($payment->getData());
|
279 |
+
|
280 |
+
if($customerData['profile_id'])
|
281 |
+
{
|
282 |
+
unset($paymentData['cardNum']);
|
283 |
+
unset($paymentData['cardExpiryMonth']);
|
284 |
+
unset($paymentData['cardExpiryYear']);
|
285 |
+
$paymentData['id'] = $customerData['profile_id'];
|
286 |
+
$paymentData['paymentToken'] = $data['profile']['paymentToken'];
|
287 |
+
}
|
288 |
+
|
289 |
+
$paymentResponse = $client->submitPayment($postURL,$paymentData);
|
290 |
+
$orderStatus = $client->retrieveOrder($response->id);
|
291 |
+
$transaction = $orderStatus->transaction;
|
292 |
+
|
293 |
+
// Now we need to check the payment status if the transaction is available
|
294 |
+
if($transaction->status == 'declined' || $transaction->status == 'cancelled')
|
295 |
+
{
|
296 |
+
Mage::throwException($this->__("There was a processing your payment"));
|
297 |
+
} else {
|
298 |
+
|
299 |
+
// Check the order status for the profile information and try to save it
|
300 |
+
if($createProfile){
|
301 |
+
if(isset($orderStatus->profile)){
|
302 |
+
$profile = Mage::getModel('optimal/creditcard');
|
303 |
+
$merchantCustomerId = $orderStatus->profile->merchantCustomerId;
|
304 |
+
|
305 |
+
if(!isset($merchantCustomerId))
|
306 |
+
{
|
307 |
+
$merchantCustomerId = Mage::helper('optimal')->getMerchantCustomerId($order->getCustomerId());
|
308 |
+
$merchantCustomerId = $merchantCustomerId['merchant_customer_id'];
|
309 |
+
}
|
310 |
+
|
311 |
+
// Set Profile Info
|
312 |
+
$profile->setCustomerId($order->getCustomerId());
|
313 |
+
$profile->setProfileId($orderStatus->profile->id);
|
314 |
+
$profile->setMerchantCustomerId($merchantCustomerId);
|
315 |
+
$profile->setPaymentToken($orderStatus->profile->paymentToken);
|
316 |
+
|
317 |
+
// Set Nickname
|
318 |
+
$cardName = $orderStatus->transaction->card->brand;
|
319 |
+
$profile->setCardNickname(Mage::helper('optimal')->processCardNickname($cardName));
|
320 |
+
|
321 |
+
// Set Nickname
|
322 |
+
//$cardHolder = $payment->getCcOwner();
|
323 |
+
$cardHolder = $customerData['firstname'] . ' ' . $customerData['lastname']; // $params['firstname'] . $params['lastname'];
|
324 |
+
$profile->setCardHolder($cardHolder);
|
325 |
+
|
326 |
+
// Set Card Info
|
327 |
+
$lastfour = $payment->getCcLast4();
|
328 |
+
$profile->setLastFourDigits($lastfour);
|
329 |
+
|
330 |
+
// Format card expiration date [todo]: Make a helper function
|
331 |
+
$expirationDate = sprintf("%02s", $paymentData['cardExpiryMonth']) . "/" . substr($paymentData['cardExpiryYear'], -2);
|
332 |
+
|
333 |
+
$profile->setCardExpiration($expirationDate);
|
334 |
+
|
335 |
+
$profile->save();
|
336 |
+
}else {
|
337 |
+
Mage::throwException($this->__("There was a problem saving your payment information."));
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
|
342 |
+
|
343 |
+
$order->addStatusHistoryComment(
|
344 |
+
'Netbanks Order Id: ' . $orderStatus->id .'<br/>' .
|
345 |
+
'Reference: # ' . $orderStatus->merchantRefNum .'<br/>' .
|
346 |
+
'Transaction Id: ' . $transaction->confirmationNumber .'<br/>' .
|
347 |
+
'Status: ' . $transaction->status .'<br/>'
|
348 |
+
);
|
349 |
+
|
350 |
+
$payment->setStatus('APPROVED');
|
351 |
+
$payment->setAdditionalInformation('order', serialize(array('id' => $orderStatus->id, 'optimal_profile_id' => $savedCreditCardProfileId)));
|
352 |
+
$payment->setAdditionalInformation('transaction', serialize($transaction));
|
353 |
+
$payment->setTransactionId($orderStatus->id);
|
354 |
+
// magento will automatically close the transaction on auth preventing the invoice from being captured online.
|
355 |
+
$payment->setIsTransactionClosed(false);
|
356 |
+
$payment->setAdditionalInformation('payment_type', $this->getInfoInstance()->getCcType());
|
357 |
+
|
358 |
+
}
|
359 |
}
|
360 |
|
361 |
return $this;
|
362 |
} catch (Exception $e) {
|
363 |
Mage::logException($e);
|
364 |
+
Mage::throwException("Optimal Gateway Transaction Error: " . $e->getMessage());
|
365 |
+
Mage::helper('optimal')->cleanMerchantCustomerId(Mage::getSingleton('customer/session')->getId());
|
366 |
}
|
367 |
}
|
368 |
|
369 |
+
/**
|
370 |
+
* @param $paymentData
|
371 |
+
* @return array
|
372 |
+
*/
|
373 |
+
protected function _preparePayment($paymentData)
|
374 |
+
{
|
375 |
+
$fPaymentData = array(
|
376 |
+
'cardNum' => (string) $paymentData['cc_number'],
|
377 |
+
'cardExpiryMonth' => (int) $paymentData['cc_exp_month'],
|
378 |
+
'cardExpiryYear' => (int) $paymentData['cc_exp_year'],
|
379 |
+
'cvdNumber' => (string) $paymentData['cc_cid'],
|
380 |
+
);
|
381 |
+
|
382 |
+
if($paymentData['optimal_create_profile'])
|
383 |
+
{
|
384 |
+
$fPaymentData['storeCardIndicator'] = (bool) $paymentData['optimal_create_profile'];
|
385 |
+
}
|
386 |
+
|
387 |
+
return $fPaymentData;
|
388 |
+
}
|
389 |
|
390 |
|
391 |
/**
|
398 |
*/
|
399 |
public function capture(Varien_Object $payment, $amount)
|
400 |
{
|
401 |
+
// Start Refactor : Fix capture for multistore setup
|
402 |
$helper = Mage::helper('optimal');
|
403 |
if ($amount <= 0) {
|
404 |
Mage::throwException(Mage::helper('payment')->__('Invalid amount for capture.'));
|
405 |
}
|
406 |
|
407 |
try {
|
|
|
408 |
|
409 |
+
$transactionMode = Mage::getStoreConfig('payment/optimal_hosted/payment_action');
|
410 |
+
if($transactionMode == Demac_Optimal_Model_Method_Hosted::ACTION_AUTHORIZE_CAPTURE)
|
411 |
{
|
412 |
+
$result = $this->authorize($payment, $amount);
|
413 |
+
return $result;
|
414 |
+
}
|
415 |
+
|
416 |
+
$additionalInformation = $payment->getAdditionalInformation();
|
417 |
+
|
418 |
+
if (isset($additionalInformation['transaction'])) {
|
419 |
|
420 |
$paymentData = unserialize($additionalInformation['transaction']);
|
421 |
$orderData = unserialize($additionalInformation['order']);
|
|
|
422 |
|
423 |
+
$order = $payment->getOrder();
|
424 |
$payment->setAmount($amount);
|
425 |
+
|
426 |
+
$client = Mage::getModel('optimal/hosted_client', array('store_id' => $order->getStoreId()));
|
427 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
|
429 |
$data = array(
|
430 |
'amount' => (int)$helper->formatAmount($amount),
|
431 |
'merchantRefNum' => (string)$paymentData->merchantRefNum
|
432 |
);
|
433 |
|
434 |
+
$response = $client->settleOrder($data, $orderData['id']);
|
435 |
+
$orderStatus = $client->retrieveOrder($orderData['id']);
|
436 |
+
$transaction = $orderStatus->transaction;
|
437 |
|
438 |
$associatedTransactions = $transaction->associatedTransactions;
|
439 |
|
440 |
$payment->setAdditionalInformation('transaction', serialize($transaction));
|
441 |
|
442 |
$order->addStatusHistoryComment(
|
443 |
+
'Trans Type: ' . $response->authType . '<br/>' .
|
444 |
+
'Confirmation Number: ' . $response->confirmationNumber . '<br/>' .
|
445 |
+
'Transaction Amount: ' . $response->amount / 100 . '<br/>'
|
446 |
);
|
447 |
|
448 |
return $this;
|
|
|
449 |
} else {
|
450 |
Mage::throwException('Transaction information is not properly set. Please contact support@demacmedia.com');
|
451 |
}
|
452 |
} catch (Exception $e) {
|
453 |
Mage::logException($e);
|
454 |
+
Mage::throwException("Optimal Gateway Transaction Error: " . $e->getMessage());
|
455 |
}
|
456 |
}
|
457 |
|
469 |
$additionalInformation = $payment->getAdditionalInformation();
|
470 |
|
471 |
if (isset($additionalInformation['transaction'])) {
|
472 |
+
$order = $payment->getOrder();
|
473 |
+
|
474 |
+
$client = Mage::getModel('optimal/hosted_client', array('store_id' => $order->getStoreId()));
|
475 |
|
476 |
$paymentData = unserialize($additionalInformation['transaction']);
|
477 |
$orderData = unserialize($additionalInformation['order']);
|
482 |
->setIsTransactionClosed(1)
|
483 |
->setShouldCloseParentTransaction(1);
|
484 |
|
|
|
485 |
|
486 |
$order->addStatusHistoryComment(
|
487 |
'Trans Type: ' . $response->authType .'<br/>'.
|
497 |
}
|
498 |
} catch (Exception $e) {
|
499 |
Mage::logException($e);
|
500 |
+
Mage::throwException("Optimal Gateway Transaction Error: " . $e->getMessage());
|
501 |
}
|
|
|
502 |
}
|
503 |
|
|
|
504 |
/**
|
505 |
* Refund the amount
|
506 |
* Need to decode Last 4 digits for request.
|
526 |
$additionalInformation = $payment->getAdditionalInformation();
|
527 |
|
528 |
if (isset($additionalInformation['transaction'])) {
|
529 |
+
$order = $payment->getOrder();
|
530 |
+
|
531 |
+
$client = Mage::getModel('optimal/hosted_client', array('store_id' => $order->getStoreId()));
|
532 |
|
533 |
$paymentData = unserialize($additionalInformation['transaction']);
|
534 |
$orderData = unserialize($additionalInformation['order']);
|
538 |
'merchantRefNum' => (string)$paymentData->merchantRefNum
|
539 |
);
|
540 |
|
541 |
+
if(is_null($paymentData->associatedTransactions[0]->reference))
|
542 |
+
{
|
543 |
+
$transactionId = $payment->getLastTransId();
|
544 |
+
}else {
|
545 |
+
$transactionId = $paymentData->associatedTransactions[0]->reference;
|
546 |
|
547 |
+
}
|
548 |
|
549 |
+
$response = $client->refundOrder($data,$transactionId);
|
550 |
$order->addStatusHistoryComment(
|
551 |
'Trans Type: ' . $response->authType .'<br/>',
|
552 |
'Confirmation Number: ' . $response->confirmationNumber .'<br/>',
|
559 |
}
|
560 |
} catch (Exception $e) {
|
561 |
Mage::logException($e);
|
562 |
+
Mage::throwException("Optimal Gateway Transaction Error: " . $e->getMessage());
|
563 |
}
|
564 |
|
565 |
return $this;
|
app/code/community/Demac/Optimal/Model/Mysql4/Creditcard.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Allan MacGregor - Magento Practice Lead <allan@demacmedia.com>
|
5 |
+
* Company: Demac Media Inc.
|
6 |
+
* Date: 3/10/14
|
7 |
+
* Time: 11:03 AM
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Demac_Optimal_Model_Mysql4_Creditcard extends Mage_Core_Model_Mysql4_Abstract
|
11 |
+
{
|
12 |
+
protected $_isPkAutoIncrement = true;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Resource initialization
|
16 |
+
*/
|
17 |
+
protected function _construct()
|
18 |
+
{
|
19 |
+
$this->_init('optimal/creditcard', 'entity_id');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function loadByProfileId(Demac_Optimal_Model_Creditcard $object, $profileId)
|
23 |
+
{
|
24 |
+
$adapter = $this->_getReadAdapter();
|
25 |
+
$where = $adapter->quoteInto("profile_id = ?", $profileId);
|
26 |
+
|
27 |
+
$select = $adapter->select()
|
28 |
+
->from($this->getMainTable())
|
29 |
+
->where($where);
|
30 |
+
if($data = $adapter->fetchRow($select))
|
31 |
+
{
|
32 |
+
$object->setData($data);
|
33 |
+
$this->_afterLoad($object);
|
34 |
+
}
|
35 |
+
return $this;
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
public function loadByProfileAndToken(Demac_Optimal_Model_Creditcard $object, $profileId, $paymentToken)
|
41 |
+
{
|
42 |
+
$adapter = $this->_getReadAdapter();
|
43 |
+
$whereProfile = $adapter->quoteInto("profile_id = ?", $profileId);
|
44 |
+
$whereToken = $adapter->quoteInto("payment_token = ?", $paymentToken);
|
45 |
+
|
46 |
+
$select = $adapter->select()
|
47 |
+
->from($this->getMainTable())
|
48 |
+
->where($whereProfile)
|
49 |
+
->where($whereToken);
|
50 |
+
if($data = $adapter->fetchRow($select))
|
51 |
+
{
|
52 |
+
$object->setData($data);
|
53 |
+
$this->_afterLoad($object);
|
54 |
+
}
|
55 |
+
return $this;
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
public function loadByMerchantCustomerId(Demac_Optimal_Model_Creditcard $object, $merchantCustomerId)
|
60 |
+
{
|
61 |
+
$adapter = $this->_getReadAdapter();
|
62 |
+
$where = $adapter->quoteInto("merchant_customer_id = ?", $merchantCustomerId);
|
63 |
+
|
64 |
+
$select = $adapter->select()
|
65 |
+
->from($this->getMainTable())
|
66 |
+
->where($where);
|
67 |
+
if($data = $adapter->fetchRow($select))
|
68 |
+
{
|
69 |
+
$object->setData($data);
|
70 |
+
$this->_afterLoad($object);
|
71 |
+
}
|
72 |
+
return $this;
|
73 |
+
|
74 |
+
}
|
75 |
+
}
|
app/code/community/Demac/Optimal/Model/Mysql4/Creditcard/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by JetBrains PhpStorm.
|
4 |
+
* User: amacgregor
|
5 |
+
* Date: 12/09/13
|
6 |
+
* Time: 9:12 AM
|
7 |
+
* To change this template use File | Settings | File Templates.
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Demac_Optimal_Model_Mysql4_Creditcard_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
+
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('optimal/creditcard');
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Demac/Optimal/Model/Mysql4/Merchant/Customer.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Model_Mysql4_Merchant_Customer extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
protected $_isPkAutoIncrement = true;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Resource initialization
|
9 |
+
*/
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('optimal/merchant_customer', 'merchant_customer_id');
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
app/code/community/Demac/Optimal/Model/Mysql4/Merchant/Customer/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Model_Mysql4_Merchant_Customer_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('optimal/merchant_customer');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Demac/Optimal/Model/Mysql4/Profile.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: Allan MacGregor - Magento Practice Lead <allan@demacmedia.com>
|
5 |
+
* Company: Demac Media Inc.
|
6 |
+
* Date: 3/10/14
|
7 |
+
* Time: 11:13 AM
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Demac_Optimal_Model_Mysql4_Profile extends Mage_Core_Model_Mysql4_Abstract
|
11 |
+
{
|
12 |
+
protected $_isPkAutoIncrement = true;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Resource initialization
|
16 |
+
*/
|
17 |
+
protected function _construct()
|
18 |
+
{
|
19 |
+
$this->_init('optimal/profile', 'entity_id');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function loadByCustomerId(Demac_Optimal_Model_Profile $object, $customerId)
|
23 |
+
{
|
24 |
+
$adapter = $this->_getReadAdapter();
|
25 |
+
$where = $adapter->quoteInto("customer_id = ?", $customerId);
|
26 |
+
|
27 |
+
$select = $adapter->select()
|
28 |
+
->from($this->getMainTable())
|
29 |
+
->where($where);
|
30 |
+
if($data = $adapter->fetchRow($select))
|
31 |
+
{
|
32 |
+
$object->setData($data);
|
33 |
+
$this->_afterLoad($object);
|
34 |
+
}
|
35 |
+
return $this;
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
public function loadByProfileAndToken(Demac_Optimal_Model_Profile $object, $profileId, $paymentToken)
|
40 |
+
{
|
41 |
+
$adapter = $this->_getReadAdapter();
|
42 |
+
$whereProfile = $adapter->quoteInto("profile_id = ?", $profileId);
|
43 |
+
$whereToken = $adapter->quoteInto("payment_token = ?", $paymentToken);
|
44 |
+
|
45 |
+
$select = $adapter->select()
|
46 |
+
->from($this->getMainTable())
|
47 |
+
->where($whereProfile)
|
48 |
+
->where($whereToken);
|
49 |
+
if($data = $adapter->fetchRow($select))
|
50 |
+
{
|
51 |
+
$object->setData($data);
|
52 |
+
$this->_afterLoad($object);
|
53 |
+
}
|
54 |
+
return $this;
|
55 |
+
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Demac/Optimal/Model/Mysql4/Profile/Collection.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by JetBrains PhpStorm.
|
4 |
+
* User: amacgregor
|
5 |
+
* Date: 12/09/13
|
6 |
+
* Time: 9:12 AM
|
7 |
+
* To change this template use File | Settings | File Templates.
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Demac_Optimal_Model_Mysql4_Profile_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
11 |
+
{
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->_init('optimal/profile');
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Demac/Optimal/Model/Observer.php
CHANGED
@@ -9,309 +9,6 @@
|
|
9 |
|
10 |
class Demac_Optimal_Model_Observer
|
11 |
{
|
12 |
-
/**
|
13 |
-
*
|
14 |
-
* Before we actually submit an order we need to:
|
15 |
-
* 1- Create a netbanks order using their IP
|
16 |
-
* 2- Store the response inside the order object
|
17 |
-
* 3- Get the payment information entered by the customer
|
18 |
-
* 4- Post that directly to the callback url that we got from step 1
|
19 |
-
* 5- Handle the response from the silentpost form
|
20 |
-
*
|
21 |
-
* @param Varien_Event_Observer $observer
|
22 |
-
*/
|
23 |
-
public function salesOrderPlaceBefore(Varien_Event_Observer $observer)
|
24 |
-
{
|
25 |
-
$order = $observer->getOrder();
|
26 |
-
$payment = $order->getPayment();
|
27 |
-
$postURL = null;
|
28 |
-
|
29 |
-
if($payment->getMethod() == Demac_Optimal_Model_Method_Hosted::METHOD_CODE)
|
30 |
-
{
|
31 |
-
$client = Mage::getModel('optimal/hosted_client');
|
32 |
-
$helper = Mage::helper('optimal');
|
33 |
-
|
34 |
-
$billingAddress = $order->getBillingAddress();
|
35 |
-
$shippingAddress = $order->getShippingAddress();
|
36 |
-
$shoppingCartArray = array();
|
37 |
-
$orderItems = $order->getAllVisibleItems();
|
38 |
-
|
39 |
-
// Minimum order information needed
|
40 |
-
$data = array(
|
41 |
-
'merchantRefNum' => (string) $order->getIncrementId() . '-' . time(),
|
42 |
-
'currencyCode' => (string) $order->getBaseCurrencyCode(),
|
43 |
-
'totalAmount' => (int) $helper->formatAmount($order->getBaseGrandTotal()),
|
44 |
-
'customerNotificationEmail' => (string) $order->getCustomerEmail(),
|
45 |
-
'merchantNotificationEmail' => 'allan@demacmedia.com',
|
46 |
-
);
|
47 |
-
|
48 |
-
// Customer Profile information
|
49 |
-
$customer = Mage::getSingleton('customer/session');
|
50 |
-
$customerProfileArray = array(
|
51 |
-
'merchantCustomerId' => (string) $order->getRemoteIp(),
|
52 |
-
);
|
53 |
-
|
54 |
-
if($customer->isLoggedIn()) {
|
55 |
-
$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
|
56 |
-
$customerProfile['firstName'] = (string) $customerData['firstname'];
|
57 |
-
$customerProfile['lastName'] = (string) $customerData['lastname'];;
|
58 |
-
} else {
|
59 |
-
$customerProfile['firstName'] = (string) 'Guest';
|
60 |
-
$customerProfile['lastName'] = (string) 'Customer';
|
61 |
-
}
|
62 |
-
|
63 |
-
// Order extended options
|
64 |
-
$extendedOptionsArray = array();
|
65 |
-
|
66 |
-
// Need to be sure this matches the store on which the order was placed
|
67 |
-
$transactionMode = Mage::getStoreConfig('payment/optimal_hosted/payment_action');
|
68 |
-
|
69 |
-
switch($transactionMode){
|
70 |
-
case Demac_Optimal_Model_Method_Hosted::ACTION_AUTHORIZE:
|
71 |
-
$extendedOptionsArray[] = array(
|
72 |
-
'key' => (string) 'authType',
|
73 |
-
'value' => (string) Demac_Optimal_Model_Config_Transaction::AUTH_VALUE
|
74 |
-
);
|
75 |
-
break;
|
76 |
-
case Demac_Optimal_Model_Method_Hosted::ACTION_AUTHORIZE_CAPTURE:
|
77 |
-
$extendedOptionsArray[] = array(
|
78 |
-
'key' => (string) 'authType',
|
79 |
-
'value' => (string) Demac_Optimal_Model_Config_Transaction::CAPT_VALUE
|
80 |
-
);
|
81 |
-
break;
|
82 |
-
default:
|
83 |
-
Mage::throwException($this->__("There is no transaction method set, please contact the website administrator."));
|
84 |
-
break;
|
85 |
-
}
|
86 |
-
|
87 |
-
$skip3d = Mage::getStoreConfig('payment/optimal_hosted/skip3d');
|
88 |
-
|
89 |
-
if($skip3d)
|
90 |
-
{
|
91 |
-
$extendedOptionsArray[] = array(
|
92 |
-
'key' => (string) 'skip3D',
|
93 |
-
'value' => true
|
94 |
-
);
|
95 |
-
}else {
|
96 |
-
$extendedOptionsArray[] = array(
|
97 |
-
'key' => (string) 'skip3D',
|
98 |
-
'value' => false
|
99 |
-
);
|
100 |
-
}
|
101 |
-
|
102 |
-
$addendumDataArray = array();
|
103 |
-
$threatMetrixId = Mage::getSingleton('core/session')->getThreatMetrixSessionKey();
|
104 |
-
|
105 |
-
if(isset($threatMetrixId) && Mage::getStoreConfig('payment/threat_metrix/active'))
|
106 |
-
{
|
107 |
-
$extendedOptionsArray[] = array(
|
108 |
-
'key' => (string) 'threatMetrixSessionId',
|
109 |
-
'value' => $threatMetrixId
|
110 |
-
);
|
111 |
-
}
|
112 |
-
|
113 |
-
// Ancillary fees information
|
114 |
-
$ancillaryFeesArray = array(
|
115 |
-
array(
|
116 |
-
'amount' => (int)$helper->formatAmount($order->getBaseShippingAmount()),
|
117 |
-
'description' => "Shipping Amount"
|
118 |
-
),
|
119 |
-
array(
|
120 |
-
'amount' => (int)$helper->formatAmount($order->getBaseTaxAmount()),
|
121 |
-
'description' => "Tax Amount"
|
122 |
-
),
|
123 |
-
array(
|
124 |
-
'amount' => (int)$helper->formatAmount($order->getBaseDiscountAmount()),
|
125 |
-
'description' => "Discount Amount"
|
126 |
-
),
|
127 |
-
array(
|
128 |
-
'amount' => (int)$helper->formatAmount($order->getBaseCustomerBalanceAmount()*-1),
|
129 |
-
'description' => "Store Credit Amount"
|
130 |
-
)
|
131 |
-
);
|
132 |
-
|
133 |
-
// Billing Details information
|
134 |
-
$billingDetailsArray = array(
|
135 |
-
'city' => (string) $billingAddress->getCity(),
|
136 |
-
'country' => (string) $billingAddress->getCountryId(),
|
137 |
-
'street' => (string) $helper->getStreetDetails($billingAddress->getStreet(),0),
|
138 |
-
'street2' => (string) $helper->getStreetDetails($billingAddress->getStreet(),1),
|
139 |
-
'zip' => (string) $billingAddress->getPostcode(),
|
140 |
-
'phone' => (string) $billingAddress->getTelephone(),
|
141 |
-
);
|
142 |
-
|
143 |
-
if($billingDetailsArray['street2'] == '')
|
144 |
-
{
|
145 |
-
unset($billingDetailsArray['street2']);
|
146 |
-
}
|
147 |
-
|
148 |
-
if($billingAddress->getCountryId() === 'CA' || $billingAddress->getCountryId() === 'US')
|
149 |
-
{
|
150 |
-
$billingDetailsArray['state'] = (int) $billingAddress->getRegionCode();
|
151 |
-
}else {
|
152 |
-
$billingDetailsArray['state'] = (string) $billingAddress->getRegion();
|
153 |
-
}
|
154 |
-
|
155 |
-
if($billingAddress->getCustomerAddressId() === $shippingAddress->getCustomerAddressId())
|
156 |
-
{
|
157 |
-
$billingDetailsArray['useAsShippingAddress'] = true;
|
158 |
-
} else {
|
159 |
-
$billingDetailsArray['useAsShippingAddress'] = false;
|
160 |
-
}
|
161 |
-
|
162 |
-
// Shipping Details information
|
163 |
-
$shippingDetailsArray = array(
|
164 |
-
'city' => (string) $shippingAddress->getCity(),
|
165 |
-
'country' => (string) $shippingAddress->getCountryId(),
|
166 |
-
'street' => (string) $helper->getStreetDetails($shippingAddress->getStreet(),0),
|
167 |
-
'street2' => (string) $helper->getStreetDetails($shippingAddress->getStreet(),1),
|
168 |
-
'zip' => (string) $shippingAddress->getPostcode(),
|
169 |
-
'phone' => (string) $shippingAddress->getTelephone(),
|
170 |
-
);
|
171 |
-
|
172 |
-
|
173 |
-
if($shippingDetailsArray['street2'] == '')
|
174 |
-
{
|
175 |
-
unset($shippingDetailsArray['street2']);
|
176 |
-
}
|
177 |
-
|
178 |
-
$shippingDetailsArray['state'] = (string) $shippingAddress->getRegionCode();
|
179 |
-
|
180 |
-
if($shippingAddress->getCountryId() === 'CA' || $shippingAddress->getCountryId() === 'US')
|
181 |
-
{
|
182 |
-
$shippingDetailsArray['state'] = (int) $shippingAddress->getRegionCode();
|
183 |
-
}else {
|
184 |
-
$shippingDetailsArray['state'] = (string) $shippingAddress->getRegion();
|
185 |
-
}
|
186 |
-
|
187 |
-
// Shopping Cart Information
|
188 |
-
foreach($orderItems as $item)
|
189 |
-
{
|
190 |
-
$itemArray = array(
|
191 |
-
'amount' => (int) $helper->formatAmount($item->getBasePrice()),
|
192 |
-
'quantity' => (int) $item->getQtyOrdered(),
|
193 |
-
'sku' => (string) $item->getSku(),
|
194 |
-
'description' => (string) substr($item->getName(),0,45)
|
195 |
-
);
|
196 |
-
|
197 |
-
$shoppingCartArray[] = $itemArray;
|
198 |
-
}
|
199 |
-
|
200 |
-
// Callback information
|
201 |
-
$callbackArray = array();
|
202 |
-
$callbackArray[] = array(
|
203 |
-
'format' => (string) 'json',
|
204 |
-
'rel' => (string) 'on_success',
|
205 |
-
'retries' => (int) Demac_Optimal_Model_Hosted_Client::CONNECTION_RETRIES,
|
206 |
-
'returnKeys' => array(
|
207 |
-
'id',
|
208 |
-
'transaction.confirmationNumber',
|
209 |
-
'transaction.status'
|
210 |
-
),
|
211 |
-
'synchronous' => true,
|
212 |
-
'uri' => Mage::getBaseUrl()
|
213 |
-
);
|
214 |
-
|
215 |
-
// Callback information
|
216 |
-
$redirectArray = array();
|
217 |
-
$redirectArray[] = array(
|
218 |
-
'rel' => (string) 'on_success',
|
219 |
-
'returnKeys' => array(
|
220 |
-
'id',
|
221 |
-
'transaction.confirmationNumber',
|
222 |
-
'transaction.status'
|
223 |
-
),
|
224 |
-
'uri' => Mage::getBaseUrl()
|
225 |
-
);
|
226 |
-
$redirectArray[] = array(
|
227 |
-
'rel' => (string) 'on_error',
|
228 |
-
'returnKeys' => array(
|
229 |
-
'id',
|
230 |
-
'transaction.confirmationNumber',
|
231 |
-
'transaction.status'
|
232 |
-
),
|
233 |
-
'uri' => Mage::getBaseUrl()
|
234 |
-
);
|
235 |
-
$redirectArray[] = array(
|
236 |
-
'rel' => (string) 'on_decline',
|
237 |
-
'returnKeys' => array(
|
238 |
-
'id',
|
239 |
-
'transaction.confirmationNumber',
|
240 |
-
'transaction.status'
|
241 |
-
),
|
242 |
-
'uri' => Mage::getBaseUrl()
|
243 |
-
);
|
244 |
-
$redirectArray[] = array(
|
245 |
-
'rel' => (string) 'on_timeout',
|
246 |
-
'returnKeys' => array(
|
247 |
-
'id',
|
248 |
-
'transaction.confirmationNumber',
|
249 |
-
'transaction.status'
|
250 |
-
),
|
251 |
-
'uri' => Mage::getBaseUrl()
|
252 |
-
);
|
253 |
-
$redirectArray[] = array(
|
254 |
-
'rel' => (string) 'on_hold',
|
255 |
-
'returnKeys' => array(
|
256 |
-
'id',
|
257 |
-
'transaction.confirmationNumber',
|
258 |
-
'transaction.status'
|
259 |
-
),
|
260 |
-
'uri' => Mage::getBaseUrl()
|
261 |
-
);
|
262 |
-
|
263 |
-
// Add extra information to the order Data
|
264 |
-
$data['shoppingCart'] = $shoppingCartArray;
|
265 |
-
$data['ancillaryFees'] = $ancillaryFeesArray;
|
266 |
-
$data['billingDetails'] = $billingDetailsArray;
|
267 |
-
$data['shippingDetails'] = $shippingDetailsArray;
|
268 |
-
$data['redirect'] = $redirectArray;
|
269 |
-
$data['profile'] = $customerProfile;
|
270 |
-
$data['extendedOptions'] = $extendedOptionsArray;
|
271 |
-
$data['addendumData'] = $addendumDataArray;
|
272 |
-
|
273 |
-
// Call Netbanks API and create the order
|
274 |
-
$response = $client->createOrder($data);
|
275 |
-
if (isset($response->link)) {
|
276 |
-
foreach ($response->link as $link) {
|
277 |
-
if($link->rel === 'hosted_payment') {
|
278 |
-
$postURL = $link->uri;
|
279 |
-
}
|
280 |
-
}
|
281 |
-
} else {
|
282 |
-
Mage::throwException($this->__("There was a problem creating the order"));
|
283 |
-
}
|
284 |
-
|
285 |
-
if(isset($postURL)){
|
286 |
-
$paymentData = $this->_preparePayment($order->getPayment()->getData());
|
287 |
-
|
288 |
-
$payment = $client->submitPayment($postURL,$paymentData);
|
289 |
-
$orderStatus = $client->retrieveOrder($response->id);
|
290 |
-
$transaction = $orderStatus->transaction;
|
291 |
-
|
292 |
-
// Now we need to check the payment status if the transaction is available
|
293 |
-
if(!isset($transaction) || $transaction->status == 'declined' || $transaction->status == 'cancelled')
|
294 |
-
{
|
295 |
-
Mage::throwException($this->__("There was a processing your payment"));
|
296 |
-
return false;
|
297 |
-
}else{
|
298 |
-
$order->addStatusHistoryComment(
|
299 |
-
'Netbanks Order Id: ' . $orderStatus->id .'<br/>' .
|
300 |
-
'Reference: # ' . $orderStatus->merchantRefNum .'<br/>' .
|
301 |
-
'Transaction Id: ' . $transaction->confirmationNumber .'<br/>' .
|
302 |
-
'Status: ' . $transaction->status .'<br/>'
|
303 |
-
);
|
304 |
-
|
305 |
-
$order->getPayment()->setAdditionalInformation('order', serialize(array('id' => $orderStatus->id)));
|
306 |
-
$order->getPayment()->setAdditionalInformation('transaction', serialize($transaction));
|
307 |
-
$order->getPayment()->setTransactionId($orderStatus->id);
|
308 |
-
|
309 |
-
return true;
|
310 |
-
}
|
311 |
-
}
|
312 |
-
}
|
313 |
-
}
|
314 |
-
|
315 |
/**
|
316 |
* Process the transaction response from
|
317 |
*
|
@@ -369,21 +66,4 @@ class Demac_Optimal_Model_Observer
|
|
369 |
}
|
370 |
}
|
371 |
}
|
372 |
-
|
373 |
-
|
374 |
-
/**
|
375 |
-
* @param $paymentData
|
376 |
-
* @return array
|
377 |
-
*/
|
378 |
-
protected function _preparePayment($paymentData)
|
379 |
-
{
|
380 |
-
$fPaymentData = array(
|
381 |
-
'cardNum' => (string) $paymentData['cc_number'],
|
382 |
-
'cardExpiryMonth' => (int) $paymentData['cc_exp_month'],
|
383 |
-
'cardExpiryYear' => (int) $paymentData['cc_exp_year'],
|
384 |
-
'cvdNumber' => (string) $paymentData['cc_cid'],
|
385 |
-
);
|
386 |
-
|
387 |
-
return $fPaymentData;
|
388 |
-
}
|
389 |
-
}
|
9 |
|
10 |
class Demac_Optimal_Model_Observer
|
11 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
* Process the transaction response from
|
14 |
*
|
66 |
}
|
67 |
}
|
68 |
}
|
69 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Demac/Optimal/Model/Profile.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_Optimal_Model_Profile extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('optimal/profile');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param $customerId
|
13 |
+
* @return $this
|
14 |
+
*/
|
15 |
+
public function loadByCustomerId($customerId)
|
16 |
+
{
|
17 |
+
$this->_getResource()->loadByCustomerId($this, $customerId);
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function loadByProfileAndToken($profileId, $paymentToken)
|
22 |
+
{
|
23 |
+
$this->_getResource()->loadByProfileAndToken($this, $profileId, $paymentToken);
|
24 |
+
return $this;
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
app/code/community/Demac/Optimal/Model/Profile/Client.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by JetBrains PhpStorm.
|
4 |
+
* User: Allan MacGregor - Magento Practice Lead <allan@demacmedia.com>
|
5 |
+
* Company: Demac Media Inc.
|
6 |
+
* Date: 6/20/13
|
7 |
+
* Time: 12:53 PM
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Demac_Optimal_Model_Profile_Client extends Demac_Optimal_Model_Client_Abstract
|
11 |
+
{
|
12 |
+
protected $_merchantRefNum = null;
|
13 |
+
protected $_currencyCode = null;
|
14 |
+
protected $_totalAmount = null;
|
15 |
+
protected $_restEndpoints = array();
|
16 |
+
|
17 |
+
const CONNECTION_RETRIES = 3;
|
18 |
+
|
19 |
+
public function _construct()
|
20 |
+
{
|
21 |
+
|
22 |
+
// Initialize methods array
|
23 |
+
$this->_restEndpoints = array(
|
24 |
+
'create' => 'customer/v1/profiles',
|
25 |
+
'delete' => 'customer/v1/profiles/%s',
|
26 |
+
'get' => 'customer/v1/profiles/%s',
|
27 |
+
);
|
28 |
+
|
29 |
+
parent::_construct();
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
*
|
35 |
+
* Create an Profile in Netbanks.
|
36 |
+
*
|
37 |
+
* @param $data (
|
38 |
+
* merchantRefNum = (string) MagentoOrderId
|
39 |
+
* currencyCode = (ISO4217) Order currency code
|
40 |
+
* totalAmount = (int) Order Grand Total
|
41 |
+
* customerIP = (string) remote_ip
|
42 |
+
*
|
43 |
+
* customerNotificationEmail = (string) Order customer email
|
44 |
+
* merchantNotificationEmail = (string) Order contact email
|
45 |
+
* )
|
46 |
+
* @return bool|mixed
|
47 |
+
*/
|
48 |
+
public function createProfile($data)
|
49 |
+
{
|
50 |
+
$mode = 'POST';
|
51 |
+
$url = $this->_getUrl('create');
|
52 |
+
|
53 |
+
return $this->callApi($url,$mode,$data);
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
*
|
58 |
+
* Cancel an Order in Netbanks
|
59 |
+
*
|
60 |
+
* @param $id
|
61 |
+
* @internal param $data ( id = netbanksOrderId )
|
62 |
+
*
|
63 |
+
* @return bool|mixed
|
64 |
+
*/
|
65 |
+
public function deleteProfile($id)
|
66 |
+
{
|
67 |
+
$mode = 'DELETE';
|
68 |
+
$url = $this->_getUrl('delete', $id);
|
69 |
+
|
70 |
+
return $this->callApi($url,$mode);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Mapping of the RESTFul Api
|
75 |
+
*
|
76 |
+
* Create a Profile - customer/v1/profiles [POST]
|
77 |
+
* Delete a Profile - customer/v1/profiles/{id} [DELETE]
|
78 |
+
* Get a Profile - customer/v1/profiles/{id} [GET]
|
79 |
+
*
|
80 |
+
* @param $method
|
81 |
+
* @param $url
|
82 |
+
* @param $data = Array(id,content)
|
83 |
+
* @return bool|mixed
|
84 |
+
*/
|
85 |
+
protected function callApi($url, $method, $data = array())
|
86 |
+
{
|
87 |
+
|
88 |
+
$response = json_decode($this->_callApi($url,$method,$data));
|
89 |
+
|
90 |
+
// Do I need extra logic here ?
|
91 |
+
// Yes I do
|
92 |
+
if(isset($response->error))
|
93 |
+
{
|
94 |
+
Mage:log('Netbanks Returned Error: ' . $response->error->message,null,'DemacOptimal_error.log');
|
95 |
+
Mage::throwException($response->error->message);
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
if(isset($response->transaction->errorCode))
|
99 |
+
{
|
100 |
+
$session = Mage::getSingleton('customer/session');
|
101 |
+
if (!$session->getCustomerId()) {
|
102 |
+
Mage::getSingleton('customer/session')->addError($response->transaction->errorMessage);
|
103 |
+
}
|
104 |
+
Mage::throwException($response->transaction->errorMessage);
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
return $response;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Makes CURL requests to the netbanks api
|
112 |
+
*
|
113 |
+
* @param $url
|
114 |
+
* @param $mode
|
115 |
+
* @param array $data
|
116 |
+
* @return mixed
|
117 |
+
*/
|
118 |
+
protected function _callApi($url,$mode,$data = array())
|
119 |
+
{
|
120 |
+
$helper = Mage::helper('optimal');
|
121 |
+
$data = json_encode($data);
|
122 |
+
|
123 |
+
try {
|
124 |
+
$curl = curl_init($url);
|
125 |
+
$headers[] = "Content-Type: application/json";
|
126 |
+
|
127 |
+
$this->_checkCurlVerifyPeer($curl);
|
128 |
+
|
129 |
+
curl_setopt($curl, CURLOPT_USERPWD, $this->_getUserPwd());
|
130 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
131 |
+
|
132 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
133 |
+
|
134 |
+
switch ($mode) {
|
135 |
+
case "POST":
|
136 |
+
curl_setopt($curl, CURLOPT_POST, true);
|
137 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
138 |
+
break;
|
139 |
+
case "DELETE":
|
140 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $mode);
|
141 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
142 |
+
break;
|
143 |
+
case "PUT":
|
144 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $mode);
|
145 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
146 |
+
break;
|
147 |
+
case "GET":
|
148 |
+
//hosted/v1/orders/{id}
|
149 |
+
break;
|
150 |
+
default:
|
151 |
+
Mage::throwException("{$mode} mode was not recognized. Please one of the valid REST actions GET, POST, PUT, DELETE");
|
152 |
+
break;
|
153 |
+
}
|
154 |
+
|
155 |
+
$curl_response = curl_exec($curl);
|
156 |
+
curl_close($curl);
|
157 |
+
|
158 |
+
// Check if the response is false
|
159 |
+
if($curl_response === false)
|
160 |
+
{
|
161 |
+
Mage::throwException("Something went wrong while trying to retrieve the response from the REST api");
|
162 |
+
}
|
163 |
+
|
164 |
+
// Check if the response threw an error
|
165 |
+
if($curl_response === false)
|
166 |
+
{
|
167 |
+
Mage::throwException("Something went wrong while trying to retrieve the response from the REST api");
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
} catch (Mage_Exception $e) {
|
172 |
+
Mage::logException($e);
|
173 |
+
return false;
|
174 |
+
} catch (Exception $e) {
|
175 |
+
Mage::logException($e);
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
return $curl_response;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Build the RESTful url
|
184 |
+
*
|
185 |
+
* @param $method
|
186 |
+
* @param null $id
|
187 |
+
* @return string
|
188 |
+
*/
|
189 |
+
protected function _getUrl($method,$id = null)
|
190 |
+
{
|
191 |
+
return $this->_apiUrl . '/' . sprintf($this->_restEndpoints[$method],$id);
|
192 |
+
}
|
193 |
+
}
|
app/code/community/Demac/Optimal/Model/Source/Cctype.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paygate
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Authorizenet Payment CC Types Source Model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paygate
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Demac_Optimal_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype
|
35 |
+
{
|
36 |
+
public function getAllowedTypes()
|
37 |
+
{
|
38 |
+
return array('VI', 'MC', 'AE', 'DI');
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Demac/Optimal/controllers/Frontend/OptimalController.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Customer
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Customer account controller
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Customer
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Demac_Optimal_Frontend_OptimalController extends Mage_Core_Controller_Front_Action
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Retrieve customer session model object
|
38 |
+
*
|
39 |
+
* @return Mage_Customer_Model_Session
|
40 |
+
*/
|
41 |
+
protected function _getSession()
|
42 |
+
{
|
43 |
+
return Mage::getSingleton('customer/session');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Action predispatch
|
48 |
+
*
|
49 |
+
* Check customer authentication for some actions
|
50 |
+
*/
|
51 |
+
public function preDispatch()
|
52 |
+
{
|
53 |
+
// a brute-force protection here would be nice
|
54 |
+
|
55 |
+
parent::preDispatch();
|
56 |
+
|
57 |
+
if (!$this->getRequest()->isDispatched()) {
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
$action = $this->getRequest()->getActionName();
|
62 |
+
$openActions = array(
|
63 |
+
'view'
|
64 |
+
);
|
65 |
+
$pattern = '/^(' . implode('|', $openActions) . ')/i';
|
66 |
+
|
67 |
+
if (!preg_match($pattern, $action)) {
|
68 |
+
if (!$this->_getSession()->authenticate($this)) {
|
69 |
+
$this->setFlag('', 'no-dispatch', true);
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
$this->_getSession()->setNoReferer(true);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Action postdispatch
|
78 |
+
*
|
79 |
+
* Remove No-referer flag from customer session after each action
|
80 |
+
*/
|
81 |
+
public function postDispatch()
|
82 |
+
{
|
83 |
+
parent::postDispatch();
|
84 |
+
$this->_getSession()->unsNoReferer(false);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Default customer account page
|
89 |
+
*/
|
90 |
+
public function indexAction()
|
91 |
+
{
|
92 |
+
$this->loadLayout();
|
93 |
+
$this->_initLayoutMessages('customer/session');
|
94 |
+
$this->_initLayoutMessages('catalog/session');
|
95 |
+
|
96 |
+
$this->getLayout()->getBlock('content')->append(
|
97 |
+
$this->getLayout()->createBlock('optimal/customer_cards')
|
98 |
+
);
|
99 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Manage Credit Cards'));
|
100 |
+
$this->renderLayout();
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
*
|
105 |
+
*/
|
106 |
+
public function deleteAction()
|
107 |
+
{
|
108 |
+
$params = $this->getRequest()->getParams();
|
109 |
+
$referrerUrl = $this->_getRefererUrl();
|
110 |
+
|
111 |
+
if($params['profile_id'])
|
112 |
+
{
|
113 |
+
/* Disable actual card deletion on the netbanks end
|
114 |
+
*
|
115 |
+
* $client = Mage::getModel('optimal/profile_client');
|
116 |
+
* $result = $client->deleteProfile((int)$params['profile_id']);
|
117 |
+
*/
|
118 |
+
|
119 |
+
$profile = Mage::getModel('optimal/creditcard')->load($params['profile_id']);
|
120 |
+
if($profile->getId())
|
121 |
+
{
|
122 |
+
$profile->setIsDeleted(true);
|
123 |
+
$profile->save();
|
124 |
+
Mage::getSingleton('customer/session')->addSuccess('Card Deleted');
|
125 |
+
|
126 |
+
}else {
|
127 |
+
Mage::getSingleton('customer/session')->addError('There was a problem deleting your card');
|
128 |
+
}
|
129 |
+
|
130 |
+
$this->_redirectReferer($referrerUrl);
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
*
|
136 |
+
*/
|
137 |
+
public function addPostAction()
|
138 |
+
{
|
139 |
+
$referrerUrl = $this->_getRefererUrl();
|
140 |
+
try {
|
141 |
+
$session = Mage::getSingleton('customer/session');
|
142 |
+
$client = Mage::getModel('optimal/hosted_client');
|
143 |
+
$helper = Mage::helper('optimal');
|
144 |
+
$customer = $session->getCustomer();
|
145 |
+
$params = $this->getRequest()->getPost();
|
146 |
+
|
147 |
+
$customerData = $customer->getData();
|
148 |
+
|
149 |
+
|
150 |
+
$createProfile = true;
|
151 |
+
|
152 |
+
$orderData = array();
|
153 |
+
|
154 |
+
// Get order data
|
155 |
+
$orderData['remote_ip'] = Mage::helper('core/http')->getRemoteAddr(true);
|
156 |
+
$orderData['order_items'] = null;
|
157 |
+
$orderData['increment_id'] = 0;
|
158 |
+
$orderData['customer_email'] = $customerData['email'];
|
159 |
+
|
160 |
+
$billingAddressId = $customer->getDefaultBilling();
|
161 |
+
if ($billingAddressId) {
|
162 |
+
$orderData['billing_address'] = Mage::getModel('customer/address')->load($billingAddressId);
|
163 |
+
} else {
|
164 |
+
Mage::throwException($this->__("There was a problem adding the credit card. You must create a billing address first."));
|
165 |
+
}
|
166 |
+
|
167 |
+
$shippingAddressId = $customer->getDefaultShipping();
|
168 |
+
if ($shippingAddressId) {
|
169 |
+
$orderData['shipping_address'] = Mage::getModel('customer/address')->load($shippingAddressId);
|
170 |
+
} else {
|
171 |
+
$orderData['shipping_address'] = $orderData['billing_address'];
|
172 |
+
}
|
173 |
+
|
174 |
+
$orderData['base_tax_amount'] = 0;
|
175 |
+
$orderData['base_grand_total'] = 0;
|
176 |
+
$orderData['base_currency_code'] = 'CAD';
|
177 |
+
$orderData['base_shipping_amount'] = 0;
|
178 |
+
$orderData['base_discount_amount'] = 0;
|
179 |
+
$orderData['base_customer_balance_amount'] = 0;
|
180 |
+
|
181 |
+
// Get Customer Information
|
182 |
+
$customerData['is_guest'] = false;
|
183 |
+
$customerData['lastname'] = (string)$orderData['billing_address']->getLastname();
|
184 |
+
$customerData['firstname'] = (string)$orderData['billing_address']->getFirstname();
|
185 |
+
|
186 |
+
|
187 |
+
// Call the helper and get the data for netbanks
|
188 |
+
$data = $helper->prepareNetbanksOrderData($orderData ,$customerData, $createProfile, 'authorize');
|
189 |
+
|
190 |
+
// Call Netbanks API and create the order
|
191 |
+
$response = $client->createOrder($data);
|
192 |
+
if (isset($response->link)) {
|
193 |
+
foreach ($response->link as $link) {
|
194 |
+
if($link->rel === 'hosted_payment') {
|
195 |
+
$postURL = $link->uri;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
} else {
|
199 |
+
Mage::throwException($this->__("There was a problem adding your credit card."));
|
200 |
+
}
|
201 |
+
|
202 |
+
if(isset($postURL)){
|
203 |
+
|
204 |
+
$paymentData = array(
|
205 |
+
'cardNum' => (string) $params['cc_number'],
|
206 |
+
'cardExpiryMonth' => (int) $params['cc_exp_month'],
|
207 |
+
'cardExpiryYear' => (int) $params['cc_exp_year'],
|
208 |
+
'cvdNumber' => (string) $params['cc_cid'],
|
209 |
+
'storeCardIndicator' => true
|
210 |
+
);
|
211 |
+
|
212 |
+
$paymentResponse = $client->submitPayment($postURL,$paymentData);
|
213 |
+
$orderStatus = $client->retrieveOrder($response->id);
|
214 |
+
$transaction = $orderStatus->transaction;
|
215 |
+
|
216 |
+
// Check the order status for the profile information and try to save it
|
217 |
+
if($createProfile){
|
218 |
+
if(isset($orderStatus->profile)){
|
219 |
+
$profile = Mage::getModel('optimal/creditcard');
|
220 |
+
$merchantCustomerId = $orderStatus->profile->merchantCustomerId;
|
221 |
+
|
222 |
+
if(!isset($merchantCustomerId))
|
223 |
+
{
|
224 |
+
$merchantCustomerId = Mage::helper('optimal')->getMerchantCustomerId($session->getId());
|
225 |
+
$merchantCustomerId = $merchantCustomerId['merchant_customer_id'];
|
226 |
+
}
|
227 |
+
|
228 |
+
// Set Profile Info
|
229 |
+
$profile->setCustomerId($session->getId());
|
230 |
+
$profile->setProfileId($orderStatus->profile->id);
|
231 |
+
$profile->setMerchantCustomerId($merchantCustomerId);
|
232 |
+
$profile->setPaymentToken($orderStatus->profile->paymentToken);
|
233 |
+
|
234 |
+
// Set Nickname
|
235 |
+
$cardName = $orderStatus->transaction->card->brand;
|
236 |
+
$profile->setCardNickname(Mage::helper('optimal')->processCardNickname($cardName));
|
237 |
+
|
238 |
+
$cardHolder = $customerData['firstname'] . ' ' . $customerData['lastname']; // $params['firstname'] . $params['lastname'];
|
239 |
+
$profile->setCardHolder($cardHolder);
|
240 |
+
|
241 |
+
// Set Card Info
|
242 |
+
$lastfour = substr($params['cc_number'],-4);
|
243 |
+
$profile->setLastFourDigits($lastfour);
|
244 |
+
|
245 |
+
// Format card expiration date [todo]: Make a helper function
|
246 |
+
$expirationDate = sprintf("%02s", $paymentData['cardExpiryMonth']) . "/" . substr($paymentData['cardExpiryYear'], -2);
|
247 |
+
|
248 |
+
$profile->setCardExpiration($expirationDate);
|
249 |
+
|
250 |
+
$profile->save();
|
251 |
+
|
252 |
+
}else {
|
253 |
+
Mage::throwException($this->__("There was a problem saving your payment information."));
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
} catch (Mage_Core_Exception $exception) {
|
258 |
+
Mage::getSingleton('core/session')->addError($exception->getMessage());
|
259 |
+
}
|
260 |
+
$this->_redirectReferer($referrerUrl);
|
261 |
+
}
|
262 |
+
}
|
app/code/community/Demac/Optimal/etc/config.xml
CHANGED
@@ -2,18 +2,10 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Demac_Optimal>
|
5 |
-
<version>0.
|
6 |
</Demac_Optimal>
|
7 |
</modules>
|
8 |
|
9 |
-
<phpunit>
|
10 |
-
<suite>
|
11 |
-
<modules>
|
12 |
-
<Demac_Optimal/>
|
13 |
-
</modules>
|
14 |
-
</suite>
|
15 |
-
</phpunit>
|
16 |
-
|
17 |
<adminhtml>
|
18 |
<layout>
|
19 |
<updates>
|
@@ -52,17 +44,7 @@
|
|
52 |
</modules>
|
53 |
</translate>
|
54 |
</frontend>
|
55 |
-
|
56 |
<events>
|
57 |
-
<sales_order_place_before>
|
58 |
-
<observers>
|
59 |
-
<optimal_hosted_order>
|
60 |
-
<type>singleton</type>
|
61 |
-
<class>Demac_Optimal_Model_Observer</class>
|
62 |
-
<method>salesOrderPlaceBefore</method>
|
63 |
-
</optimal_hosted_order>
|
64 |
-
</observers>
|
65 |
-
</sales_order_place_before>
|
66 |
<sales_order_place_after>
|
67 |
<observers>
|
68 |
<optimal_hosted_order_after>
|
@@ -73,9 +55,27 @@
|
|
73 |
</observers>
|
74 |
</sales_order_place_after>
|
75 |
</events>
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
</frontend>
|
78 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
<models>
|
80 |
<optimal>
|
81 |
<class>Demac_Optimal_Model</class>
|
@@ -87,6 +87,15 @@
|
|
87 |
<risk>
|
88 |
<table>demac_optimal_risk</table>
|
89 |
</risk>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</entities>
|
91 |
</optimal_mysql4>
|
92 |
</models>
|
@@ -156,6 +165,9 @@
|
|
156 |
<!--<payment_action>authorize</payment_action>-->
|
157 |
<allowspecific>0</allowspecific>
|
158 |
</optimal_hosted>
|
|
|
|
|
|
|
159 |
</payment>
|
160 |
</default>
|
161 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Demac_Optimal>
|
5 |
+
<version>0.3.2</version>
|
6 |
</Demac_Optimal>
|
7 |
</modules>
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<adminhtml>
|
10 |
<layout>
|
11 |
<updates>
|
44 |
</modules>
|
45 |
</translate>
|
46 |
</frontend>
|
|
|
47 |
<events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<sales_order_place_after>
|
49 |
<observers>
|
50 |
<optimal_hosted_order_after>
|
55 |
</observers>
|
56 |
</sales_order_place_after>
|
57 |
</events>
|
58 |
+
<routers>
|
59 |
+
<customer>
|
60 |
+
<args>
|
61 |
+
<modules>
|
62 |
+
<optimal before="Mage_Customer">Demac_Optimal_Frontend</optimal>
|
63 |
+
</modules>
|
64 |
+
</args>
|
65 |
+
</customer>
|
66 |
+
</routers>
|
67 |
</frontend>
|
68 |
<global>
|
69 |
+
<fieldsets>
|
70 |
+
<sales_convert_quote_payment>
|
71 |
+
<optimal_create_profile>
|
72 |
+
<to_order_payment>*</to_order_payment>
|
73 |
+
</optimal_create_profile>
|
74 |
+
<optimal_profile_id>
|
75 |
+
<to_order_payment>*</to_order_payment>
|
76 |
+
</optimal_profile_id>
|
77 |
+
</sales_convert_quote_payment>
|
78 |
+
</fieldsets>
|
79 |
<models>
|
80 |
<optimal>
|
81 |
<class>Demac_Optimal_Model</class>
|
87 |
<risk>
|
88 |
<table>demac_optimal_risk</table>
|
89 |
</risk>
|
90 |
+
<profile>
|
91 |
+
<table>demac_optimal_profile</table>
|
92 |
+
</profile>
|
93 |
+
<creditcard>
|
94 |
+
<table>demac_optimal_creditcard</table>
|
95 |
+
</creditcard>
|
96 |
+
<merchant_customer>
|
97 |
+
<table>demac_optimal_merchant_customer</table>
|
98 |
+
</merchant_customer>
|
99 |
</entities>
|
100 |
</optimal_mysql4>
|
101 |
</models>
|
165 |
<!--<payment_action>authorize</payment_action>-->
|
166 |
<allowspecific>0</allowspecific>
|
167 |
</optimal_hosted>
|
168 |
+
<optimal_profiles>
|
169 |
+
<profile_key>mage</profile_key>
|
170 |
+
</optimal_profiles>
|
171 |
</payment>
|
172 |
</default>
|
173 |
</config>
|
app/code/community/Demac/Optimal/etc/system.xml
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<optimal_hosted translate="label" module="optimal">
|
7 |
<label>Optimal Payments - Hosted</label>
|
8 |
<frontend_type>text</frontend_type>
|
9 |
-
<sort_order>
|
10 |
<show_in_default>1</show_in_default>
|
11 |
<show_in_website>1</show_in_website>
|
12 |
<show_in_store>1</show_in_store>
|
@@ -105,7 +105,7 @@
|
|
105 |
<cctypes translate="label">
|
106 |
<label>Credit Card Types</label>
|
107 |
<frontend_type>multiselect</frontend_type>
|
108 |
-
<source_model>
|
109 |
<sort_order>140</sort_order>
|
110 |
<show_in_default>1</show_in_default>
|
111 |
<show_in_website>1</show_in_website>
|
@@ -165,10 +165,37 @@
|
|
165 |
</sort_order>
|
166 |
</fields>
|
167 |
</optimal_hosted>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
<threat_metrix translate="label" module="optimal">
|
169 |
<label>Optimal Payments - ThreatMetrix</label>
|
170 |
<frontend_type>text</frontend_type>
|
171 |
-
<sort_order>
|
172 |
<show_in_default>1</show_in_default>
|
173 |
<show_in_website>1</show_in_website>
|
174 |
<show_in_store>1</show_in_store>
|
@@ -183,7 +210,7 @@
|
|
183 |
<show_in_store>0</show_in_store>
|
184 |
</active>
|
185 |
<org_id translate="label">
|
186 |
-
<label>Organization Id
|
187 |
<frontend_type>text</frontend_type>
|
188 |
<sort_order>11</sort_order>
|
189 |
<show_in_default>1</show_in_default>
|
@@ -192,193 +219,6 @@
|
|
192 |
</org_id>
|
193 |
</fields>
|
194 |
</threat_metrix>
|
195 |
-
<!--<optimal_web translate="label" module="optimal">-->
|
196 |
-
<!--<label>Optimal Payments - Web API</label>-->
|
197 |
-
<!--<frontend_type>text</frontend_type>-->
|
198 |
-
<!--<sort_order>34</sort_order>-->
|
199 |
-
<!--<show_in_default>1</show_in_default>-->
|
200 |
-
<!--<show_in_website>1</show_in_website>-->
|
201 |
-
<!--<show_in_store>1</show_in_store>-->
|
202 |
-
<!--<fields>-->
|
203 |
-
<!--<active translate="label">-->
|
204 |
-
<!--<label>Enabled</label>-->
|
205 |
-
<!--<frontend_type>select</frontend_type>-->
|
206 |
-
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
207 |
-
<!--<sort_order>10</sort_order>-->
|
208 |
-
<!--<show_in_default>1</show_in_default>-->
|
209 |
-
<!--<show_in_website>1</show_in_website>-->
|
210 |
-
<!--<show_in_store>0</show_in_store>-->
|
211 |
-
<!--</active>-->
|
212 |
-
<!--<payment_action translate="label">-->
|
213 |
-
<!--<label>Payment Action</label>-->
|
214 |
-
<!--<frontend_type>select</frontend_type>-->
|
215 |
-
<!--<source_model>paygate/authorizenet_source_paymentAction</source_model>-->
|
216 |
-
<!--<sort_order>20</sort_order>-->
|
217 |
-
<!--<show_in_default>1</show_in_default>-->
|
218 |
-
<!--<show_in_website>1</show_in_website>-->
|
219 |
-
<!--<show_in_store>0</show_in_store>-->
|
220 |
-
<!--</payment_action>-->
|
221 |
-
<!--<title translate="label">-->
|
222 |
-
<!--<label>Title</label>-->
|
223 |
-
<!--<frontend_type>text</frontend_type>-->
|
224 |
-
<!--<sort_order>30</sort_order>-->
|
225 |
-
<!--<show_in_default>1</show_in_default>-->
|
226 |
-
<!--<show_in_website>1</show_in_website>-->
|
227 |
-
<!--<show_in_store>1</show_in_store>-->
|
228 |
-
<!--</title>-->
|
229 |
-
<!--<login translate="label">-->
|
230 |
-
<!--<label>API Login ID</label>-->
|
231 |
-
<!--<frontend_type>obscure</frontend_type>-->
|
232 |
-
<!--<backend_model>adminhtml/system_config_backend_encrypted</backend_model>-->
|
233 |
-
<!--<sort_order>40</sort_order>-->
|
234 |
-
<!--<show_in_default>1</show_in_default>-->
|
235 |
-
<!--<show_in_website>1</show_in_website>-->
|
236 |
-
<!--<show_in_store>0</show_in_store>-->
|
237 |
-
<!--</login>-->
|
238 |
-
<!--<trans_key translate="label">-->
|
239 |
-
<!--<label>Transaction Key</label>-->
|
240 |
-
<!--<frontend_type>obscure</frontend_type>-->
|
241 |
-
<!--<backend_model>adminhtml/system_config_backend_encrypted</backend_model>-->
|
242 |
-
<!--<sort_order>50</sort_order>-->
|
243 |
-
<!--<show_in_default>1</show_in_default>-->
|
244 |
-
<!--<show_in_website>1</show_in_website>-->
|
245 |
-
<!--<show_in_store>0</show_in_store>-->
|
246 |
-
<!--</trans_key>-->
|
247 |
-
<!--<trans_md5 translate="label">-->
|
248 |
-
<!--<label>Merchant MD5</label>-->
|
249 |
-
<!--<frontend_type>obscure</frontend_type>-->
|
250 |
-
<!--<backend_model>adminhtml/system_config_backend_encrypted</backend_model>-->
|
251 |
-
<!--<sort_order>60</sort_order>-->
|
252 |
-
<!--<show_in_default>1</show_in_default>-->
|
253 |
-
<!--<show_in_website>1</show_in_website>-->
|
254 |
-
<!--<show_in_store>0</show_in_store>-->
|
255 |
-
<!--</trans_md5>-->
|
256 |
-
<!--<order_status translate="label">-->
|
257 |
-
<!--<label>New Order Status</label>-->
|
258 |
-
<!--<frontend_type>select</frontend_type>-->
|
259 |
-
<!--<source_model>adminhtml/system_config_source_order_status_processing</source_model>-->
|
260 |
-
<!--<sort_order>70</sort_order>-->
|
261 |
-
<!--<show_in_default>1</show_in_default>-->
|
262 |
-
<!--<show_in_website>1</show_in_website>-->
|
263 |
-
<!--<show_in_store>0</show_in_store>-->
|
264 |
-
<!--</order_status>-->
|
265 |
-
<!--<test translate="label">-->
|
266 |
-
<!--<label>Test Mode</label>-->
|
267 |
-
<!--<frontend_type>select</frontend_type>-->
|
268 |
-
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
269 |
-
<!--<sort_order>80</sort_order>-->
|
270 |
-
<!--<show_in_default>1</show_in_default>-->
|
271 |
-
<!--<show_in_website>1</show_in_website>-->
|
272 |
-
<!--<show_in_store>0</show_in_store>-->
|
273 |
-
<!--</test>-->
|
274 |
-
<!--<cgi_url translate="label">-->
|
275 |
-
<!--<label>Gateway URL</label>-->
|
276 |
-
<!--<frontend_type>text</frontend_type>-->
|
277 |
-
<!--<sort_order>90</sort_order>-->
|
278 |
-
<!--<show_in_default>1</show_in_default>-->
|
279 |
-
<!--<show_in_website>1</show_in_website>-->
|
280 |
-
<!--<show_in_store>0</show_in_store>-->
|
281 |
-
<!--</cgi_url>-->
|
282 |
-
<!--<currency translate="label">-->
|
283 |
-
<!--<label>Accepted Currency</label>-->
|
284 |
-
<!--<frontend_type>select</frontend_type>-->
|
285 |
-
<!--<source_model>adminhtml/system_config_source_currency</source_model>-->
|
286 |
-
<!--<sort_order>100</sort_order>-->
|
287 |
-
<!--<show_in_default>1</show_in_default>-->
|
288 |
-
<!--<show_in_website>1</show_in_website>-->
|
289 |
-
<!--<show_in_store>0</show_in_store>-->
|
290 |
-
<!--</currency>-->
|
291 |
-
<!--<debug translate="label">-->
|
292 |
-
<!--<label>Debug</label>-->
|
293 |
-
<!--<frontend_type>select</frontend_type>-->
|
294 |
-
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
295 |
-
<!--<sort_order>110</sort_order>-->
|
296 |
-
<!--<show_in_default>1</show_in_default>-->
|
297 |
-
<!--<show_in_website>1</show_in_website>-->
|
298 |
-
<!--<show_in_store>0</show_in_store>-->
|
299 |
-
<!--</debug>-->
|
300 |
-
<!--<email_customer translate="label">-->
|
301 |
-
<!--<label>Email Customer</label>-->
|
302 |
-
<!--<frontend_type>select</frontend_type>-->
|
303 |
-
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
304 |
-
<!--<sort_order>120</sort_order>-->
|
305 |
-
<!--<show_in_default>1</show_in_default>-->
|
306 |
-
<!--<show_in_website>1</show_in_website>-->
|
307 |
-
<!--<show_in_store>0</show_in_store>-->
|
308 |
-
<!--</email_customer>-->
|
309 |
-
<!--<merchant_email translate="label">-->
|
310 |
-
<!--<label>Merchant's Email</label>-->
|
311 |
-
<!--<frontend_type>text</frontend_type>-->
|
312 |
-
<!--<validate>validate-email</validate>-->
|
313 |
-
<!--<sort_order>130</sort_order>-->
|
314 |
-
<!--<show_in_default>1</show_in_default>-->
|
315 |
-
<!--<show_in_website>1</show_in_website>-->
|
316 |
-
<!--<show_in_store>0</show_in_store>-->
|
317 |
-
<!--</merchant_email>-->
|
318 |
-
<!--<cctypes translate="label">-->
|
319 |
-
<!--<label>Credit Card Types</label>-->
|
320 |
-
<!--<frontend_type>multiselect</frontend_type>-->
|
321 |
-
<!--<source_model>paygate/authorizenet_source_cctype</source_model>-->
|
322 |
-
<!--<sort_order>140</sort_order>-->
|
323 |
-
<!--<show_in_default>1</show_in_default>-->
|
324 |
-
<!--<show_in_website>1</show_in_website>-->
|
325 |
-
<!--<show_in_store>0</show_in_store>-->
|
326 |
-
<!--</cctypes>-->
|
327 |
-
<!--<useccv translate="label">-->
|
328 |
-
<!--<label>Credit Card Verification</label>-->
|
329 |
-
<!--<frontend_type>select</frontend_type>-->
|
330 |
-
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
331 |
-
<!--<sort_order>150</sort_order>-->
|
332 |
-
<!--<show_in_default>1</show_in_default>-->
|
333 |
-
<!--<show_in_website>1</show_in_website>-->
|
334 |
-
<!--<show_in_store>0</show_in_store>-->
|
335 |
-
<!--</useccv>-->
|
336 |
-
<!--<allowspecific translate="label">-->
|
337 |
-
<!--<label>Payment from Applicable Countries</label>-->
|
338 |
-
<!--<frontend_type>allowspecific</frontend_type>-->
|
339 |
-
<!--<sort_order>160</sort_order>-->
|
340 |
-
<!--<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>-->
|
341 |
-
<!--<show_in_default>1</show_in_default>-->
|
342 |
-
<!--<show_in_website>1</show_in_website>-->
|
343 |
-
<!--<show_in_store>0</show_in_store>-->
|
344 |
-
<!--</allowspecific>-->
|
345 |
-
<!--<specificcountry translate="label">-->
|
346 |
-
<!--<label>Payment from Specific Countries</label>-->
|
347 |
-
<!--<frontend_type>multiselect</frontend_type>-->
|
348 |
-
<!--<sort_order>170</sort_order>-->
|
349 |
-
<!--<source_model>adminhtml/system_config_source_country</source_model>-->
|
350 |
-
<!--<show_in_default>1</show_in_default>-->
|
351 |
-
<!--<show_in_website>1</show_in_website>-->
|
352 |
-
<!--<show_in_store>0</show_in_store>-->
|
353 |
-
<!--</specificcountry>-->
|
354 |
-
<!--<min_order_total translate="label">-->
|
355 |
-
<!--<label>Minimum Order Total</label>-->
|
356 |
-
<!--<frontend_type>text</frontend_type>-->
|
357 |
-
<!--<sort_order>180</sort_order>-->
|
358 |
-
<!--<show_in_default>1</show_in_default>-->
|
359 |
-
<!--<show_in_website>1</show_in_website>-->
|
360 |
-
<!--<show_in_store>0</show_in_store>-->
|
361 |
-
<!--</min_order_total>-->
|
362 |
-
<!--<max_order_total translate="label">-->
|
363 |
-
<!--<label>Maximum Order Total</label>-->
|
364 |
-
<!--<frontend_type>text</frontend_type>-->
|
365 |
-
<!--<sort_order>190</sort_order>-->
|
366 |
-
<!--<show_in_default>1</show_in_default>-->
|
367 |
-
<!--<show_in_website>1</show_in_website>-->
|
368 |
-
<!--<show_in_store>0</show_in_store>-->
|
369 |
-
<!--</max_order_total>-->
|
370 |
-
<!--<sort_order translate="label">-->
|
371 |
-
<!--<label>Sort Order</label>-->
|
372 |
-
<!--<frontend_type>text</frontend_type>-->
|
373 |
-
<!--<sort_order>200</sort_order>-->
|
374 |
-
<!--<show_in_default>1</show_in_default>-->
|
375 |
-
<!--<show_in_website>1</show_in_website>-->
|
376 |
-
<!--<show_in_store>0</show_in_store>-->
|
377 |
-
<!--<frontend_class>validate-number</frontend_class>-->
|
378 |
-
<!--</sort_order>-->
|
379 |
-
<!--</fields>-->
|
380 |
-
<!--</optimal_web>-->
|
381 |
-
|
382 |
</groups>
|
383 |
</payment>
|
384 |
</sections>
|
6 |
<optimal_hosted translate="label" module="optimal">
|
7 |
<label>Optimal Payments - Hosted</label>
|
8 |
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>97</sort_order>
|
10 |
<show_in_default>1</show_in_default>
|
11 |
<show_in_website>1</show_in_website>
|
12 |
<show_in_store>1</show_in_store>
|
105 |
<cctypes translate="label">
|
106 |
<label>Credit Card Types</label>
|
107 |
<frontend_type>multiselect</frontend_type>
|
108 |
+
<source_model>optimal/source_cctype</source_model>
|
109 |
<sort_order>140</sort_order>
|
110 |
<show_in_default>1</show_in_default>
|
111 |
<show_in_website>1</show_in_website>
|
165 |
</sort_order>
|
166 |
</fields>
|
167 |
</optimal_hosted>
|
168 |
+
<optimal_profiles translate="label" module="optimal">
|
169 |
+
<label>Optimal Payments - Credit Card Profiles</label>
|
170 |
+
<frontend_type>text</frontend_type>
|
171 |
+
<sort_order>98</sort_order>
|
172 |
+
<show_in_default>1</show_in_default>
|
173 |
+
<show_in_website>1</show_in_website>
|
174 |
+
<show_in_store>1</show_in_store>
|
175 |
+
<fields>
|
176 |
+
<active translate="label">
|
177 |
+
<label>Enabled</label>
|
178 |
+
<frontend_type>select</frontend_type>
|
179 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
180 |
+
<sort_order>10</sort_order>
|
181 |
+
<show_in_default>1</show_in_default>
|
182 |
+
<show_in_website>1</show_in_website>
|
183 |
+
<show_in_store>0</show_in_store>
|
184 |
+
</active>
|
185 |
+
<profile_key translate="label">
|
186 |
+
<label>Profile Key</label>
|
187 |
+
<frontend_type>text</frontend_type>
|
188 |
+
<sort_order>11</sort_order>
|
189 |
+
<show_in_default>1</show_in_default>
|
190 |
+
<show_in_website>0</show_in_website>
|
191 |
+
<show_in_store>0</show_in_store>
|
192 |
+
</profile_key>
|
193 |
+
</fields>
|
194 |
+
</optimal_profiles>
|
195 |
<threat_metrix translate="label" module="optimal">
|
196 |
<label>Optimal Payments - ThreatMetrix</label>
|
197 |
<frontend_type>text</frontend_type>
|
198 |
+
<sort_order>99</sort_order>
|
199 |
<show_in_default>1</show_in_default>
|
200 |
<show_in_website>1</show_in_website>
|
201 |
<show_in_store>1</show_in_store>
|
210 |
<show_in_store>0</show_in_store>
|
211 |
</active>
|
212 |
<org_id translate="label">
|
213 |
+
<label>Organization Id</label>
|
214 |
<frontend_type>text</frontend_type>
|
215 |
<sort_order>11</sort_order>
|
216 |
<show_in_default>1</show_in_default>
|
219 |
</org_id>
|
220 |
</fields>
|
221 |
</threat_metrix>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
</groups>
|
223 |
</payment>
|
224 |
</sections>
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.0.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
10 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
11 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
13 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
14 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
15 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
16 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
17 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
18 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
19 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
20 |
+
PRIMARY KEY (`entity_id`),
|
21 |
+
KEY `profile_id` (`profile_id`),
|
22 |
+
KEY `customer_id` (`customer_id`),
|
23 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
24 |
+
KEY `payment_token` (`payment_token`),
|
25 |
+
KEY `created_at` (`created_at`)
|
26 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
27 |
+
|
28 |
+
");
|
29 |
+
|
30 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.1.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
33 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
34 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
35 |
+
PRIMARY KEY (`entity_id`),
|
36 |
+
KEY `profile_id` (`profile_id`),
|
37 |
+
KEY `customer_id` (`customer_id`),
|
38 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
39 |
+
KEY `payment_token` (`payment_token`),
|
40 |
+
KEY `created_at` (`created_at`)
|
41 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
42 |
+
|
43 |
+
");
|
44 |
+
|
45 |
+
|
46 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
47 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
48 |
+
|
49 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
50 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
51 |
+
|
52 |
+
|
53 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.2.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
33 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
34 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
35 |
+
PRIMARY KEY (`entity_id`),
|
36 |
+
KEY `profile_id` (`profile_id`),
|
37 |
+
KEY `customer_id` (`customer_id`),
|
38 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
39 |
+
KEY `payment_token` (`payment_token`),
|
40 |
+
KEY `created_at` (`created_at`)
|
41 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
42 |
+
|
43 |
+
");
|
44 |
+
|
45 |
+
|
46 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
47 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
48 |
+
|
49 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
50 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
51 |
+
|
52 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
53 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
54 |
+
|
55 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
56 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.3.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
34 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
35 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
36 |
+
PRIMARY KEY (`entity_id`),
|
37 |
+
KEY `profile_id` (`profile_id`),
|
38 |
+
KEY `customer_id` (`customer_id`),
|
39 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
40 |
+
KEY `payment_token` (`payment_token`),
|
41 |
+
KEY `created_at` (`created_at`)
|
42 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
43 |
+
|
44 |
+
");
|
45 |
+
|
46 |
+
|
47 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
48 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
54 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.4.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
34 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
35 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
36 |
+
PRIMARY KEY (`entity_id`),
|
37 |
+
KEY `profile_id` (`profile_id`),
|
38 |
+
KEY `customer_id` (`customer_id`),
|
39 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
40 |
+
KEY `payment_token` (`payment_token`),
|
41 |
+
KEY `created_at` (`created_at`)
|
42 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
43 |
+
|
44 |
+
");
|
45 |
+
|
46 |
+
|
47 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
48 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
54 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.5.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
37 |
+
PRIMARY KEY (`entity_id`),
|
38 |
+
KEY `profile_id` (`profile_id`),
|
39 |
+
KEY `customer_id` (`customer_id`),
|
40 |
+
KEY `card_id` (`card_id`),
|
41 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
42 |
+
KEY `payment_token` (`payment_token`),
|
43 |
+
KEY `created_at` (`created_at`)
|
44 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
45 |
+
|
46 |
+
");
|
47 |
+
|
48 |
+
|
49 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
50 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
51 |
+
|
52 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
53 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
54 |
+
|
55 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
56 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
57 |
+
|
58 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
59 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.6.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.7.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/install-0.2.9.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.0.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
10 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
11 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
13 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
14 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
15 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
16 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
17 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
18 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
19 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
20 |
+
PRIMARY KEY (`entity_id`),
|
21 |
+
KEY `profile_id` (`profile_id`),
|
22 |
+
KEY `customer_id` (`customer_id`),
|
23 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
24 |
+
KEY `payment_token` (`payment_token`),
|
25 |
+
KEY `created_at` (`created_at`)
|
26 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
27 |
+
|
28 |
+
");
|
29 |
+
|
30 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.1.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
33 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
34 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
35 |
+
PRIMARY KEY (`entity_id`),
|
36 |
+
KEY `profile_id` (`profile_id`),
|
37 |
+
KEY `customer_id` (`customer_id`),
|
38 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
39 |
+
KEY `payment_token` (`payment_token`),
|
40 |
+
KEY `created_at` (`created_at`)
|
41 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
42 |
+
|
43 |
+
");
|
44 |
+
|
45 |
+
|
46 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
47 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
48 |
+
|
49 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
50 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
51 |
+
|
52 |
+
|
53 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.2.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
33 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
34 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
35 |
+
PRIMARY KEY (`entity_id`),
|
36 |
+
KEY `profile_id` (`profile_id`),
|
37 |
+
KEY `customer_id` (`customer_id`),
|
38 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
39 |
+
KEY `payment_token` (`payment_token`),
|
40 |
+
KEY `created_at` (`created_at`)
|
41 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
42 |
+
|
43 |
+
");
|
44 |
+
|
45 |
+
|
46 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
47 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
48 |
+
|
49 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
50 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
51 |
+
|
52 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
53 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
54 |
+
|
55 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
56 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.3.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
34 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
35 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
36 |
+
PRIMARY KEY (`entity_id`),
|
37 |
+
KEY `profile_id` (`profile_id`),
|
38 |
+
KEY `customer_id` (`customer_id`),
|
39 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
40 |
+
KEY `payment_token` (`payment_token`),
|
41 |
+
KEY `created_at` (`created_at`)
|
42 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
43 |
+
|
44 |
+
");
|
45 |
+
|
46 |
+
|
47 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
48 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
54 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.4.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`nickname` varchar(255) NOT NULL DEFAULT '',
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
34 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
35 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
36 |
+
PRIMARY KEY (`entity_id`),
|
37 |
+
KEY `profile_id` (`profile_id`),
|
38 |
+
KEY `customer_id` (`customer_id`),
|
39 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
40 |
+
KEY `payment_token` (`payment_token`),
|
41 |
+
KEY `created_at` (`created_at`)
|
42 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
43 |
+
|
44 |
+
");
|
45 |
+
|
46 |
+
|
47 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
48 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
54 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.5.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
37 |
+
PRIMARY KEY (`entity_id`),
|
38 |
+
KEY `profile_id` (`profile_id`),
|
39 |
+
KEY `customer_id` (`customer_id`),
|
40 |
+
KEY `card_id` (`card_id`),
|
41 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
42 |
+
KEY `payment_token` (`payment_token`),
|
43 |
+
KEY `created_at` (`created_at`)
|
44 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
45 |
+
|
46 |
+
");
|
47 |
+
|
48 |
+
|
49 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
50 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
51 |
+
|
52 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
53 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
54 |
+
|
55 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
56 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
57 |
+
|
58 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
59 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.6.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.7.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-install-0.2.9.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/mysql4-upgrade-0.1.1-0.2.7.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/upgrade-0.1.1-0.2.7.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
|
7 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/risk')}`;
|
8 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/risk')}` (
|
9 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`risk_code` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`description` text NOT NULL,
|
12 |
+
`status` varchar(255) NOT NULL DEFAULT '',
|
13 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
14 |
+
PRIMARY KEY (`entity_id`),
|
15 |
+
KEY `risk_code` (`risk_code`),
|
16 |
+
KEY `status` (`status`),
|
17 |
+
KEY `created_at` (`created_at`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->run("
|
23 |
+
|
24 |
+
DROP TABLE IF EXISTS `{$this->getTable('optimal/creditcard')}`;
|
25 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('optimal/creditcard')}` (
|
26 |
+
`entity_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
27 |
+
`customer_id` int(20) NOT NULL DEFAULT 0,
|
28 |
+
`merchant_customer_id` varchar(255) NOT NULL DEFAULT '',
|
29 |
+
`card_id` int(20) NOT NULL DEFAULT 0,
|
30 |
+
`card_holder` varchar(255) NOT NULL DEFAULT '',
|
31 |
+
`card_nickname` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`card_expiration` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
`payment_token` varchar(255) NOT NULL DEFAULT '',
|
34 |
+
`last_four_digits` int(4) NOT NULL DEFAULT 0,
|
35 |
+
`profile_id` int(20) NOT NULL DEFAULT 0,
|
36 |
+
`is_deleted` boolean NOT NULL DEFAULT false,
|
37 |
+
`created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
38 |
+
PRIMARY KEY (`entity_id`),
|
39 |
+
KEY `profile_id` (`profile_id`),
|
40 |
+
KEY `customer_id` (`customer_id`),
|
41 |
+
KEY `card_id` (`card_id`),
|
42 |
+
KEY `merchant_customer_id` (`merchant_customer_id`),
|
43 |
+
KEY `payment_token` (`payment_token`),
|
44 |
+
KEY `created_at` (`created_at`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
|
50 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
51 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
52 |
+
|
53 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
54 |
+
'optimal_create_profile', 'BOOLEAN NOT NULL AFTER `method`');
|
55 |
+
|
56 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'),
|
57 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
58 |
+
|
59 |
+
$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_payment'),
|
60 |
+
'optimal_profile_id', 'INT(10) NOT NULL DEFAULT 0 AFTER `method`');
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/upgrade-0.2.9-0.3.0.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->run("
|
6 |
+
ALTER TABLE `{$this->getTable('optimal/creditcard')}`
|
7 |
+
MODIFY `profile_id` VARCHAR(80)
|
8 |
+
|
9 |
+
");
|
10 |
+
|
11 |
+
|
12 |
+
$installer->endSetup();
|
app/code/community/Demac/Optimal/sql/optimal_setup/upgrade-0.3.1-0.3.2.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$table = $installer->getConnection()
|
7 |
+
->newTable($installer->getTable('optimal/merchant_customer'))
|
8 |
+
->addColumn('merchant_customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, NULL, array(
|
9 |
+
'identity' => TRUE,
|
10 |
+
'unsigned' => TRUE,
|
11 |
+
'nullable' => FALSE,
|
12 |
+
'primary' => TRUE,
|
13 |
+
), 'Merchant Customer ID')
|
14 |
+
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, NULL, array(
|
15 |
+
'unsigned' => TRUE,
|
16 |
+
'nullable' => FALSE,
|
17 |
+
'primary' => TRUE
|
18 |
+
), 'Customer ID');
|
19 |
+
|
20 |
+
$installer->getConnection()->createTable($table);
|
21 |
+
|
22 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/optimal/form/creditcard.phtml
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<fieldset class="form-list">
|
2 |
+
<?php $_code=$this->getMethodCode() ?>
|
3 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
4 |
+
<li>
|
5 |
+
<label for="<?php echo $_code ?>_cc_owner"><?php echo $this->__('Name on Card') ?> <span class="required">*</span></label>
|
6 |
+
<div class="input-box">
|
7 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="" />
|
8 |
+
</div>
|
9 |
+
</li>
|
10 |
+
<li>
|
11 |
+
<label for="<?php echo $_code ?>_cc_type"><?php echo $this->__('Card Type') ?> <span class="required">*</span></label>
|
12 |
+
<div class="input-box">
|
13 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-cc-type-select">
|
14 |
+
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
15 |
+
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
16 |
+
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
17 |
+
<option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
|
18 |
+
<?php endforeach ?>
|
19 |
+
</select>
|
20 |
+
</div>
|
21 |
+
</li>
|
22 |
+
<li>
|
23 |
+
<label for="<?php echo $_code ?>_cc_number"><?php echo $this->__('Card Number') ?> <span class="required">*</span></label>
|
24 |
+
<div class="input-box">
|
25 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
<li>
|
29 |
+
<label for="<?php echo $_code ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label>
|
30 |
+
<div class="input-box">
|
31 |
+
<div class="v-fix">
|
32 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
|
33 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
34 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
35 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
36 |
+
<?php endforeach ?>
|
37 |
+
</select>
|
38 |
+
</div>
|
39 |
+
<div class="v-fix">
|
40 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
41 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
|
42 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
43 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
44 |
+
<?php endforeach ?>
|
45 |
+
</select>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
</li>
|
49 |
+
<?php echo $this->getChildHtml() ?>
|
50 |
+
<?php if($this->hasVerification()): ?>
|
51 |
+
<li>
|
52 |
+
<label for="<?php echo $_code ?>_cc_cid"><?php echo $this->__('Security Code') ?> <span class="required">*</span></label>
|
53 |
+
<div class="input-box">
|
54 |
+
<div class="v-fix">
|
55 |
+
<input type="text" title="<?php echo $this->__('Security Code') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
</li>
|
59 |
+
<?php endif; ?>
|
60 |
+
<?php if ($this->hasSsCardType()): ?>
|
61 |
+
<li id="<?php echo $_code ?>_cc_type_ss_div">
|
62 |
+
<ul class="inner-form">
|
63 |
+
<li class="form-alt"><label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Switch/Solo/Maestro Only') ?></label> <span class="required">*</span></li>
|
64 |
+
<li>
|
65 |
+
<label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
|
66 |
+
<span class="input-box">
|
67 |
+
<input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
|
68 |
+
</span>
|
69 |
+
</li>
|
70 |
+
|
71 |
+
<li>
|
72 |
+
<label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
|
73 |
+
<div class="input-box">
|
74 |
+
<div class="v-fix">
|
75 |
+
<select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
|
76 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
77 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
78 |
+
<?php endforeach ?>
|
79 |
+
</select>
|
80 |
+
</div>
|
81 |
+
<div class="v-fix">
|
82 |
+
<select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
|
83 |
+
<?php foreach ($this->getSsStartYears() as $k=>$v): ?>
|
84 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
85 |
+
<?php endforeach ?>
|
86 |
+
</select>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
</li>
|
90 |
+
<li class="adv-container"> </li>
|
91 |
+
</ul>
|
92 |
+
<script type="text/javascript">
|
93 |
+
//<![CDATA[
|
94 |
+
var SSChecked<?php echo $_code ?> = function() {
|
95 |
+
var elm = $('<?php echo $_code ?>_cc_type');
|
96 |
+
if (['SS','SM','SO'].indexOf(elm.value) != -1) {
|
97 |
+
$('<?php echo $_code ?>_cc_type_ss_div').show();
|
98 |
+
} else {
|
99 |
+
$('<?php echo $_code ?>_cc_type_ss_div').hide();
|
100 |
+
}
|
101 |
+
};
|
102 |
+
|
103 |
+
Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
|
104 |
+
SSChecked<?php echo $_code ?>();
|
105 |
+
//]]>
|
106 |
+
</script>
|
107 |
+
</li>
|
108 |
+
<?php endif; ?>
|
109 |
+
</ul>
|
110 |
+
</fieldset>
|
app/design/adminhtml/default/default/template/optimal/info/creditcard.phtml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$info = $this->getCardInfo();
|
3 |
+
?>
|
4 |
+
|
5 |
+
<?php if(isset($info)): ?>
|
6 |
+
<?php echo $this->__('Name on the Card: %s', $this->htmlEscape($info['name'])) ?><br />
|
7 |
+
<?php echo $this->__('Credit Card Type: %s', $this->htmlEscape(ucwords($info['card_type']))) ?><br />
|
8 |
+
<?php echo $this->__('Credit Card Number: xxxx-%s', $this->htmlEscape($info['card_number'])) ?><br />
|
9 |
+
<?php echo $this->__('Expiration Date: %s', $this->htmlEscape($info['card_exp'])) ?>
|
10 |
+
<?php else: ?>
|
11 |
+
<p><?php echo $this->__('There was a problem retriving the payment information') ?></p>
|
12 |
+
<?php endif; ?>
|
app/design/frontend/base/default/layout/optimal.xml
CHANGED
@@ -5,4 +5,29 @@
|
|
5 |
<block type="optimal/threat" template="demac/threatmeter.phtml" name="optimal_threat" as="optimal_threat"/>
|
6 |
</reference>
|
7 |
</checkout_onepage_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</layout>
|
5 |
<block type="optimal/threat" template="demac/threatmeter.phtml" name="optimal_threat" as="optimal_threat"/>
|
6 |
</reference>
|
7 |
</checkout_onepage_index>
|
8 |
+
|
9 |
+
<customer_account>
|
10 |
+
<reference name="customer_account_navigation">
|
11 |
+
<action method="addLink" ifconfig="payment/optimal_profiles/active">
|
12 |
+
<name>optimal_profiles</name>
|
13 |
+
<path>customer/optimal/index</path>
|
14 |
+
<label>Manage Credit Cards</label>
|
15 |
+
</action>
|
16 |
+
</reference>
|
17 |
+
</customer_account>
|
18 |
+
|
19 |
+
<customer_optimal_index translate="label">
|
20 |
+
<label>Customer Manage Credit Cards</label>
|
21 |
+
<update handle="customer_account"/>
|
22 |
+
<!-- Mage_Customer -->
|
23 |
+
<reference name="root">
|
24 |
+
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
|
25 |
+
</reference>
|
26 |
+
<reference name="my.account.wrapper">
|
27 |
+
<block type="optimal/customer_cards" name="optimal_customer_cards" template="optimal/customer/cards.phtml">
|
28 |
+
<block type="optimal/customer_cards_grid" name="optimal_customer_cards_grid" as="card_grid" template="optimal/customer/cards/grid.phtml"/>
|
29 |
+
<block type="optimal/customer_cards_form" name="optimal_customer_cards_form" as="card_form" template="optimal/customer/cards/form.phtml"/>
|
30 |
+
</block>
|
31 |
+
</reference>
|
32 |
+
</customer_optimal_index>
|
33 |
</layout>
|
app/design/frontend/base/default/template/optimal/customer/cards.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="dashboard">
|
2 |
+
<div class="page-title">
|
3 |
+
<h1><?php echo $this->__('My Credit Cards') ?></h1>
|
4 |
+
</div>
|
5 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
6 |
+
<?php echo $this->getChildHtml('hello') ?>
|
7 |
+
<?php echo $this->getChildHtml('top') ?>
|
8 |
+
<div class="box-account box-info">
|
9 |
+
<div class="box-head">
|
10 |
+
<h2><?php echo $this->__('Credit Cards') ?></h2>
|
11 |
+
</div>
|
12 |
+
<?php echo $this->getChildHtml('card_grid') ?>
|
13 |
+
</div>
|
14 |
+
<div class="box-account box-info">
|
15 |
+
<div class="box-head">
|
16 |
+
<h2><?php echo $this->__('Add A New Card') ?></h2>
|
17 |
+
</div>
|
18 |
+
<?php echo $this->getChildHtml('card_form') ?>
|
19 |
+
</div>
|
20 |
+
</div>
|
app/design/frontend/base/default/template/optimal/customer/cards/form.phtml
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form action="<?php echo $this->getUrl('customer/optimal/addPost') ?>" method="post" id="form-validate">
|
2 |
+
<div class="fieldset">
|
3 |
+
<input type="hidden" name="success_url" value="">
|
4 |
+
<input type="hidden" name="error_url" value="">
|
5 |
+
<h2 class="legend"><?php echo $this->__('Credit Card Information') ?></h2>
|
6 |
+
<ul class="form-list">
|
7 |
+
<li class="fields">
|
8 |
+
<div class="customer-name">
|
9 |
+
</div>
|
10 |
+
</li>
|
11 |
+
<li class="wide">
|
12 |
+
<label for="cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
13 |
+
<div class="input-box">
|
14 |
+
<input type="text" name="cc_number" id="cc_number" title="Credit Card Number" value="" class="input-text required-entry">
|
15 |
+
</div>
|
16 |
+
</li>
|
17 |
+
<li class="fields">
|
18 |
+
<div class="field">
|
19 |
+
<label for="cc_cid" class="required"><em>*</em><?php echo $this->__('CVV') ?></label>
|
20 |
+
<div class="input-box">
|
21 |
+
<input type="text" name="cc_cid" value="" title="cc_cid" class="input-text required-entry" id="cc_cid">
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
<div class="field">
|
25 |
+
<label for="cc_exp_month" class="required"><em>*</em><?php echo $this->__('Expiration Date Month') ?></label>
|
26 |
+
<select id="cc_exp_month" name="cc_exp_month" class="month validate-cc-exp required-entry">
|
27 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
28 |
+
<option value="<?php echo $k?$k:'' ?>"><?php echo $v ?></option>
|
29 |
+
<?php endforeach ?>
|
30 |
+
</select>
|
31 |
+
</div>
|
32 |
+
<div class="field">
|
33 |
+
<label for="cc_exp_year" class="required"><em>*</em><?php echo $this->__('Expiration Date Year') ?></label>
|
34 |
+
<select id="cc_exp_year" name="cc_exp_year" class="year validate-cc-exp required-entry">
|
35 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
36 |
+
<option value="<?php echo $v ?>"><?php echo $v ?></option>
|
37 |
+
<?php endforeach ?>
|
38 |
+
</select>
|
39 |
+
</div>
|
40 |
+
</li>
|
41 |
+
</ul>
|
42 |
+
</div>
|
43 |
+
<div class="buttons-set">
|
44 |
+
<p class="required">* <?php echo $this->__('Required Fields') ?></p>
|
45 |
+
<p class="back-link"><a href=""><small>« </small><?php echo $this->__('Back') ?></a></p>
|
46 |
+
<button type="submit" title="Save Credit Card" class="button"><span><span><?php echo $this->__('Save Credit Card') ?></span></span></button>
|
47 |
+
</div>
|
48 |
+
</form>
|
49 |
+
|
50 |
+
<script type="text/javascript">
|
51 |
+
var CreditCard = {
|
52 |
+
CARDS: {
|
53 |
+
Visa: /^4[0-9]{12}(?:[0-9]{3})?$/,
|
54 |
+
MasterCard: /^5[1-5][0-9]{14}$/,
|
55 |
+
DinersClub: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
|
56 |
+
Amex: /^3[47][0-9]{13}$/,
|
57 |
+
Discover: /^6(?:011|5[0-9]{2})[0-9]{12}$/
|
58 |
+
},
|
59 |
+
TEST_NUMBERS: $w('378282246310005 371449635398431 378734493671000 '+
|
60 |
+
'30569309025904 38520000023237 6011111111111117 '+
|
61 |
+
'6011000990139424 5555555555554444 5105105105105100 '+
|
62 |
+
'4111111111111111 4012888888881881 4222222222222'
|
63 |
+
),
|
64 |
+
|
65 |
+
// Validate that is a Luhn valid number
|
66 |
+
// Validate that is one of the valid credit card types
|
67 |
+
// Validate that is not a test number
|
68 |
+
validate: function(number){
|
69 |
+
return CreditCard.verifyLuhn10(number)
|
70 |
+
&& !!CreditCard.type(number)
|
71 |
+
&& !CreditCard.isTestNumber(number);
|
72 |
+
},
|
73 |
+
|
74 |
+
// The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple
|
75 |
+
// checksum formula used to validate a variety of identification numbers, such as credit card numbers,
|
76 |
+
// IMEI numbers, National Provider Identifier numbers in US and Canadian Social Insurance Numbers.
|
77 |
+
verifyLuhn10: function(number){
|
78 |
+
return ($A(CreditCard.strip(number)).reverse().inject(0,function(a,n,index){
|
79 |
+
return a + $A((parseInt(n) * [1,2][index%2]).toString())
|
80 |
+
.inject(0, function(b,o){ return b + parseInt(o) }) }) % 10 == 0);
|
81 |
+
},
|
82 |
+
|
83 |
+
// Check if is test number
|
84 |
+
isTestNumber: function(number){
|
85 |
+
return CreditCard.TEST_NUMBERS.include(CreditCard.strip(number));
|
86 |
+
},
|
87 |
+
|
88 |
+
// Remove spaces
|
89 |
+
strip: function(number) {
|
90 |
+
return number.gsub(/\s/,'');
|
91 |
+
},
|
92 |
+
|
93 |
+
// Check credit card types
|
94 |
+
type: function(number) {
|
95 |
+
for(var card in CreditCard.CARDS)
|
96 |
+
if(CreditCard['is'+card](number)) return card;
|
97 |
+
}
|
98 |
+
};
|
99 |
+
|
100 |
+
(function(){
|
101 |
+
for(var card in CreditCard.CARDS)
|
102 |
+
CreditCard['is'+card] = function(card, number){
|
103 |
+
return CreditCard.CARDS[card].test(CreditCard.strip(number));
|
104 |
+
}.curry(card);
|
105 |
+
})();
|
106 |
+
|
107 |
+
|
108 |
+
Event.observe('form-validate', 'submit', function (event) {
|
109 |
+
var creditcard = $('credit_number').value;
|
110 |
+
if (!CreditCard.validate(creditcard)) {
|
111 |
+
Event.stop(event);
|
112 |
+
$('credit_number').addClassName('validation-failed');
|
113 |
+
alert('Your Credit Card is not valid');
|
114 |
+
}
|
115 |
+
});
|
116 |
+
</script>
|
app/design/frontend/base/default/template/optimal/customer/cards/grid.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if($this->hasOptimalProfiles()): ?>
|
2 |
+
|
3 |
+
<table class="data-table" id="my-orders-table">
|
4 |
+
<colgroup>
|
5 |
+
<col width="1">
|
6 |
+
<col>
|
7 |
+
<col width="1">
|
8 |
+
<col width="1">
|
9 |
+
<col width="1">
|
10 |
+
<col>
|
11 |
+
</colgroup><thead>
|
12 |
+
<tr class="first last">
|
13 |
+
<th><?php echo $this->__('Card Alias') ?></th>
|
14 |
+
<th><?php echo $this->__('Number') ?></th>
|
15 |
+
<th><?php echo $this->__('Exp. Date') ?></th>
|
16 |
+
<th><?php echo $this->__('Cardholder Name') ?></th>
|
17 |
+
<th> </th>
|
18 |
+
</tr>
|
19 |
+
</thead>
|
20 |
+
<tbody>
|
21 |
+
<?php foreach($this->profiles as $profile): ?>
|
22 |
+
<tr class="odd">
|
23 |
+
<td><?php echo $profile->getCardNickname(); ?></td>
|
24 |
+
<td>**** **** **** <?php echo $profile->getLastFourDigits(); ?></td>
|
25 |
+
<td><span class="nobr"><?php echo $profile->getCardExpiration(); ?></span></td>
|
26 |
+
<td><?php echo $profile->getCardHolder(); ?></td>
|
27 |
+
<td>
|
28 |
+
<button type="button" title="Delete" class="button" onclick='window.location="<?php echo Mage::getUrl('customer/optimal/delete') . 'profile_id/' . $profile->getId(); ?>";'><span><span>Delete</span></span></button>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
<?php endforeach; ?>
|
32 |
+
|
33 |
+
</tbody>
|
34 |
+
</table>
|
35 |
+
|
36 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/optimal/form/creditcard.phtml
ADDED
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_code=$this->getMethodCode() ?>
|
28 |
+
<?php if($this->hasOptimalProfiles() === true): ?>
|
29 |
+
<div id="select_card_form" >
|
30 |
+
<ul class="profile_list form-list" id="payment_form_<?php echo $_code ?>" >
|
31 |
+
<li class="wide">
|
32 |
+
<label for="<?php echo $_code ?>_profile_id"><?php echo $this->__('Select a Credit Card Profile.') ?></label>
|
33 |
+
<div class="input-box">
|
34 |
+
<select class="<?php echo $_code ?>_profile_id" id="<?php echo $_code ?>_profile_id" name="payment[profile_id]">
|
35 |
+
<?php foreach($this->profiles as $profile): ?>
|
36 |
+
<option selected="" value="<?php echo $profile->getEntityId(); ?>"><?php echo ucwords($profile->getCardNickname()); ?> / **** **** **** <?php echo $profile->getLastFourDigits(); ?></option>
|
37 |
+
<?php endforeach; ?>
|
38 |
+
<option value="0"><?php echo $this->__('New Profile') ?></option>
|
39 |
+
</select>
|
40 |
+
</div>
|
41 |
+
</li>
|
42 |
+
<li>
|
43 |
+
<label class="<?php echo $_code ?>_cc_cid" for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
44 |
+
<div class="input-box">
|
45 |
+
<div class="v-fix">
|
46 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
</li>
|
50 |
+
</ul>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<div id="create_card_form" style="display:none;">
|
54 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>">
|
55 |
+
<li>
|
56 |
+
<label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
57 |
+
<div class="input-box">
|
58 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="cc_type required-entry validate-cc-type-select">
|
59 |
+
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
60 |
+
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
61 |
+
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
62 |
+
<option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
|
63 |
+
<?php endforeach ?>
|
64 |
+
</select>
|
65 |
+
</div>
|
66 |
+
</li>
|
67 |
+
<li>
|
68 |
+
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
69 |
+
<div class="input-box">
|
70 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
|
71 |
+
</div>
|
72 |
+
</li>
|
73 |
+
<li>
|
74 |
+
<label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
75 |
+
<div class="input-box">
|
76 |
+
<div class="v-fix">
|
77 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
|
78 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
79 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
80 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
81 |
+
<?php endforeach ?>
|
82 |
+
</select>
|
83 |
+
</div>
|
84 |
+
<div class="v-fix">
|
85 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
86 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
|
87 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
88 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
89 |
+
<?php endforeach ?>
|
90 |
+
</select>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
</li>
|
94 |
+
<?php echo $this->getChildHtml() ?>
|
95 |
+
<?php if($this->hasVerification()): ?>
|
96 |
+
<li>
|
97 |
+
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
98 |
+
<div class="input-box">
|
99 |
+
<div class="v-fix">
|
100 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
</li>
|
104 |
+
<?php endif; ?>
|
105 |
+
<li class="control">
|
106 |
+
<input type="checkbox" title="<?php echo $this->__('Create Profile and Save Card') ?>" class="radio" value="1" id="<?php echo $_code ?>_create_profile" name="payment[optimal_create_profile]">
|
107 |
+
<label for="<?php echo $_code ?>_optimal_create_profile"><?php echo $this->__('Create Profile and Save Card') ?> </label>
|
108 |
+
</li>
|
109 |
+
</ul>
|
110 |
+
</div>
|
111 |
+
<script type="text/javascript">
|
112 |
+
//<![CDATA[
|
113 |
+
// initially hide all containers for tab
|
114 |
+
|
115 |
+
Event.observe($('p_method_optimal_hosted'),'change', function(){
|
116 |
+
$('optimal_hosted_profile_id').enable();
|
117 |
+
$$('.profile_list')[0].select('#optimal_hosted_cc_cid')[0].enable();
|
118 |
+
|
119 |
+
$('create_card_form').select('input').each(function(el){
|
120 |
+
$(el).disable();
|
121 |
+
});
|
122 |
+
|
123 |
+
$('create_card_form').select('select').each(function(el){
|
124 |
+
$(el).disable();
|
125 |
+
});
|
126 |
+
$$('.cc_type')[0].writeAttribute("id", "<?php echo $_code ?>_cc_type_disabled");
|
127 |
+
|
128 |
+
});
|
129 |
+
|
130 |
+
Event.observe(window, "load", function() {
|
131 |
+
var f = $('optimal_hosted_profile_id').value;
|
132 |
+
setOptimalPaymentsCreditCardForm(f);
|
133 |
+
});
|
134 |
+
|
135 |
+
|
136 |
+
Event.observe($('optimal_hosted_profile_id'),'change', function() {
|
137 |
+
var f = $('optimal_hosted_profile_id').value;
|
138 |
+
setOptimalPaymentsCreditCardForm(f);
|
139 |
+
});
|
140 |
+
|
141 |
+
function setOptimalPaymentsCreditCardForm(f) {
|
142 |
+
//var f = $('optimal_hosted_profile_id').value;
|
143 |
+
if(f == '0') {
|
144 |
+
$('create_card_form').show();
|
145 |
+
$$('.profile_list')[0].select('#optimal_hosted_cc_cid')[0].hide();
|
146 |
+
$$('.profile_list')[0].select('#optimal_hosted_cc_cid')[0].disable();
|
147 |
+
|
148 |
+
$$('.cc_type')[0].writeAttribute("id", "<?php echo $_code ?>_cc_type");
|
149 |
+
|
150 |
+
$('create_card_form').select('input').each(function(el){
|
151 |
+
$(el).enable();
|
152 |
+
});
|
153 |
+
$$('.<?php echo $_code ?>_cc_cid')[0].hide();
|
154 |
+
|
155 |
+
$('create_card_form').select('select').each(function(el){
|
156 |
+
$(el).enable();
|
157 |
+
});
|
158 |
+
|
159 |
+
} else {
|
160 |
+
$('create_card_form').hide();
|
161 |
+
$$('.profile_list')[0].select('#optimal_hosted_cc_cid')[0].enable();
|
162 |
+
$$('.profile_list')[0].select('#optimal_hosted_cc_cid')[0].show();
|
163 |
+
|
164 |
+
$$('.cc_type')[0].writeAttribute("id", "<?php echo $_code ?>_cc_type_disabled");
|
165 |
+
|
166 |
+
$('create_card_form').select('input').each(function(el){
|
167 |
+
$(el).disable();
|
168 |
+
});
|
169 |
+
$$('.<?php echo $_code ?>_cc_cid')[0].show();
|
170 |
+
|
171 |
+
$('create_card_form').select('select').each(function(el){
|
172 |
+
$(el).disable();
|
173 |
+
});
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
//]]>
|
178 |
+
|
179 |
+
|
180 |
+
</script>
|
181 |
+
<?php else: ?>
|
182 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
183 |
+
<li>
|
184 |
+
<label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
|
185 |
+
<div class="input-box">
|
186 |
+
<input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->escapeHtml($this->getInfoData('cc_owner')) ?>" />
|
187 |
+
</div>
|
188 |
+
</li>
|
189 |
+
<li>
|
190 |
+
<label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
|
191 |
+
<div class="input-box">
|
192 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" title="<?php echo $this->__('Credit Card Type') ?>" class="required-entry validate-cc-type-select">
|
193 |
+
<option value=""><?php echo $this->__('--Please Select--') ?></option>
|
194 |
+
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
195 |
+
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
196 |
+
<option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
|
197 |
+
<?php endforeach ?>
|
198 |
+
</select>
|
199 |
+
</div>
|
200 |
+
</li>
|
201 |
+
<li>
|
202 |
+
<label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
|
203 |
+
<div class="input-box">
|
204 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
|
205 |
+
</div>
|
206 |
+
</li>
|
207 |
+
<li>
|
208 |
+
<label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
|
209 |
+
<div class="input-box">
|
210 |
+
<div class="v-fix">
|
211 |
+
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
|
212 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
213 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
214 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
215 |
+
<?php endforeach ?>
|
216 |
+
</select>
|
217 |
+
</div>
|
218 |
+
<div class="v-fix">
|
219 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
220 |
+
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
|
221 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
222 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
223 |
+
<?php endforeach ?>
|
224 |
+
</select>
|
225 |
+
</div>
|
226 |
+
</div>
|
227 |
+
</li>
|
228 |
+
<?php echo $this->getChildHtml() ?>
|
229 |
+
<?php if($this->hasVerification()): ?>
|
230 |
+
<li>
|
231 |
+
<label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
|
232 |
+
<div class="input-box">
|
233 |
+
<div class="v-fix">
|
234 |
+
<input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
</li>
|
238 |
+
<?php endif; ?>
|
239 |
+
<?php if($this->canSaveProfiles()): ?>
|
240 |
+
<li class="control">
|
241 |
+
<input type="checkbox" title="<?php echo $this->__('Create Profile and Save Card') ?>" class="radio" value="1" id="<?php echo $_code ?>_create_profile" name="payment[optimal_create_profile]">
|
242 |
+
<label for="<?php echo $_code ?>_optimal_create_profile" class="required"><em>*</em><?php echo $this->__('Create Profile and Save Card') ?> </label>
|
243 |
+
</li>
|
244 |
+
<?php else: ?>
|
245 |
+
<input type="hidden" title="<?php echo $this->__('Create Profile and Save Card') ?>" class="radio" value="0" id="<?php echo $_code ?>_create_profile" name="payment[optimal_create_profile]">
|
246 |
+
<?php endif; ?>
|
247 |
+
<?php if ($this->hasSsCardType()): ?>
|
248 |
+
<li id="<?php echo $_code ?>_cc_type_ss_div">
|
249 |
+
<ul class="inner-form">
|
250 |
+
<li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
|
251 |
+
<li>
|
252 |
+
<label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
|
253 |
+
<span class="input-box">
|
254 |
+
<input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
|
255 |
+
</span>
|
256 |
+
</li>
|
257 |
+
|
258 |
+
<li>
|
259 |
+
<label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
|
260 |
+
<div class="input-box">
|
261 |
+
<div class="v-fix">
|
262 |
+
<select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
|
263 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
264 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
265 |
+
<?php endforeach ?>
|
266 |
+
</select>
|
267 |
+
</div>
|
268 |
+
<div class="v-fix">
|
269 |
+
<select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
|
270 |
+
<?php foreach ($this->getSsStartYears() as $k=>$v): ?>
|
271 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
272 |
+
<?php endforeach ?>
|
273 |
+
</select>
|
274 |
+
</div>
|
275 |
+
</div>
|
276 |
+
</li>
|
277 |
+
<li class="adv-container"> </li>
|
278 |
+
</ul>
|
279 |
+
<script type="text/javascript">
|
280 |
+
//<![CDATA[
|
281 |
+
var SSChecked<?php echo $_code ?> = function() {
|
282 |
+
var elm = $('<?php echo $_code ?>_cc_type');
|
283 |
+
if (['SS','SM','SO'].indexOf(elm.value) != -1) {
|
284 |
+
$('<?php echo $_code ?>_cc_type_ss_div').show();
|
285 |
+
} else {
|
286 |
+
$('<?php echo $_code ?>_cc_type_ss_div').hide();
|
287 |
+
}
|
288 |
+
};
|
289 |
+
|
290 |
+
Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
|
291 |
+
SSChecked<?php echo $_code ?>();
|
292 |
+
//]]>
|
293 |
+
</script>
|
294 |
+
</li>
|
295 |
+
<?php endif; ?>
|
296 |
+
</ul>
|
297 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/optimal/info/creditcard.phtml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$info = $this->getCardInfo();
|
3 |
+
?>
|
4 |
+
<?php echo $this->__('Credit Card Type: %s', $this->htmlEscape(ucwords($info['card_type']))) ?><br />
|
5 |
+
<?php echo $this->__('Credit Card Number: xxxx-%s', $this->htmlEscape($info['card_number'])) ?><br />
|
6 |
+
<?php echo $this->__('Expiration Date: %s', $this->htmlEscape($info['card_exp'])) ?>
|
package.xml
CHANGED
@@ -1,26 +1,29 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>666999</name>
|
4 |
-
<version>0.
|
5 |
<stability>beta</stability>
|
6 |
<license uri="http://opensource.org/licenses/GPL-3.0">GPL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Securely access and process online payments with the NETBANX payment gateway
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
<br /> <br />
|
15 |
This integration significantly reduces PCI compliance requirements and liability as all of the credit card information is processed in Optimal Payments Level 1 PCI compliant environment and servers leaving no sensitive customer payment information stored locally on merchant servers.
|
16 |
-
|
17 |
Through the Optimal integration merchants also have the option to enable Threatmetrix fraud detection and management services. ThreatMetrix works by collecting relevant data about the customer and the order, and validating this information during the checkout. Fully integrated into the NETBANX payment gateway, enabling the ThreatMetrix option will allow merchants to automatically hold and flag suspicious orders, drastically reducing any fraud occurrences. Depending on the Score returned by ThreatMetrix an order can be held and flagged or altogether denied during the checkout.
|
18 |
</description>
|
19 |
-
<notes>
|
|
|
|
|
|
|
|
|
20 |
<authors><author><name>Demac Media</name><user>demacmedia</user><email>support@demacmedia.com</email></author></authors>
|
21 |
-
<date>
|
22 |
-
<time>
|
23 |
-
<contents><target name="magecommunity"><dir name="Demac"><dir name="Optimal"><dir name="Block"><dir name="Adminhtml"><dir name="Risk"><dir name="Edit"><file name="Form.php" hash="
|
24 |
<compatible/>
|
25 |
<dependencies><required><php><min>5.3.0</min><max>5.4.30</max></php></required></dependencies>
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>666999</name>
|
4 |
+
<version>0.3.2</version>
|
5 |
<stability>beta</stability>
|
6 |
<license uri="http://opensource.org/licenses/GPL-3.0">GPL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Securely access and process online payments with the NETBANX payment gateway</summary>
|
10 |
+
<description>The Optimal Payments Magento extension allows ecommerce businesses to securely accept and process online payments using Optimal's NETBANX payment gateway and services. The integration is easy to implement and provides the ultimate in payment processing capabilities, fraud management, and reporting.
|
11 |
+

|
12 |
+
The Optimal Payments extension uses a Silent Post integration to the merchant's website. During checkout, payment information is entered on the merchant website and then transmitted securely via Silent Post for processing to the NETBANX payment gateway. The customer remains on the merchant's website at all times allowing the merchant to manage the customer experience. When the customer clicks on the Pay button, payment data is transmitted directly to NETBANX using a PCI-compliant process without accessing any merchant servers.
|
13 |
+

|
|
|
14 |
This integration significantly reduces PCI compliance requirements and liability as all of the credit card information is processed in Optimal Payments Level 1 PCI compliant environment and servers leaving no sensitive customer payment information stored locally on merchant servers.
|
15 |
+

|
16 |
Through the Optimal integration merchants also have the option to enable Threatmetrix fraud detection and management services. ThreatMetrix works by collecting relevant data about the customer and the order, and validating this information during the checkout. Fully integrated into the NETBANX payment gateway, enabling the ThreatMetrix option will allow merchants to automatically hold and flag suspicious orders, drastically reducing any fraud occurrences. Depending on the Score returned by ThreatMetrix an order can be held and flagged or altogether denied during the checkout.
|
17 |
</description>
|
18 |
+
<notes> - Send basic user information to Optimal for improved Fraud Detection
|
19 |
+
- Minor improvements for compatibility with future Optimal API Updates
|
20 |
+
- Fixes for minor issue related to issuing refunds
|
21 |
+
- Added Profile Key option to configuration for companies that share one Optimal account while processing credit cards in multiple places
|
22 |
+
- Various Minor Improvements</notes>
|
23 |
<authors><author><name>Demac Media</name><user>demacmedia</user><email>support@demacmedia.com</email></author></authors>
|
24 |
+
<date>2014-07-14</date>
|
25 |
+
<time>19:11:28</time>
|
26 |
+
<contents><target name="magecommunity"><dir><dir name="Demac"><dir name="Optimal"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Risk"><dir name="Edit"><file name="Form.php" hash="25d4bcb59e33a94799bc9f6cb0509cc3"/><dir name="Tab"><file name="Form.php" hash="3731d284c28ed279eb5e00b41f494810"/></dir><file name="Tabs.php" hash="61a8d2ac9942356db313b423fc3c47c2"/></dir><file name="Edit.php" hash="959e8af1e6aae6d02560c98bcabea5ab"/><file name="Grid.php" hash="e999f01578aac6084520029f86852c09"/></dir><file name="Risk.php" hash="6bf5127ba14f9dd38519c6b62203f1f8"/></dir><dir name="Customer"><dir name="Cards"><file name="Form.php" hash="ce79e221d5caf995a10e47cbb4e51f8b"/><file name="Grid.php" hash="d14eb692082fe1299977e7b3ee75dcf3"/></dir><file name="Cards.php" hash="f99686c2296a850312713f6aadc4d04a"/></dir><dir name="Form"><file name="Creditcard.php" hash="d3642d432409cf55069253680bf9ee34"/></dir><dir name="Info"><file name="Creditcard.php" hash="95d59f0f6bf250685499163b2f3843e5"/></dir><file name="Threat.php" hash="69605e0b8aacc80f47b5ed91e8631248"/></dir><dir name="Helper"><file name="Data.php" hash="ed7395ffa0972314c01656f3e324dac5"/></dir><dir name="Model"><dir name="Client"><file name="Abstract.php" hash="f83275be8d3b248eb145d45c2a926d84"/></dir><dir name="Config"><file name="Mode.php" hash="798d2a9bab2c0fc2749116ac1a3fc926"/><file name="Status.php" hash="767ba25406456aae4a0bd86b11023b45"/><file name="Transaction.php" hash="e83e8427e4b14c4d3cd83058c68f8965"/></dir><dir name="Creditcard"><file name="Client.php" hash="f1014811d23c1cf5efbccf61c3c6c80c"/></dir><file name="Creditcard.php" hash="26e89a35558c0692d5f90afdcad25c12"/><dir name="Hosted"><file name="Client.php" hash="6cfcae2d6ba921df9d3f3afd700661aa"/></dir><dir name="Merchant"><file name="Customer.php" hash="be743a5c7aababb9752bf961570b0c27"/></dir><dir name="Method"><file name="Hosted.php" hash="109064dd9492b5251d00617eeba0b528"/></dir><dir name="Mysql4"><dir name="Creditcard"><file name="Collection.php" hash="700985c287355082a3966d4b3f74838f"/></dir><file name="Creditcard.php" hash="a4e5ea4090d2f127edd19de9d2feb343"/><dir name="Merchant"><dir name="Customer"><file name="Collection.php" hash="aa0fbf9c0cc0a3207565443e35ae3779"/></dir><file name="Customer.php" hash="fe991d98537b7b3a07160d5b9b10802d"/></dir><dir name="Profile"><file name="Collection.php" hash="f5cd814fe62d2af8fbcc2214f94bfeb4"/></dir><file name="Profile.php" hash="6944c811248ef955a51357989ca11dd3"/><dir name="Risk"><file name="Collection.php" hash="558dc26690672dc09ae6fbfa8e780302"/></dir><file name="Risk.php" hash="5c77111382678451da4dde209a43b0fa"/></dir><file name="Observer.php" hash="8c8d058b70dae31e828a4455bd6437aa"/><dir name="Profile"><file name="Client.php" hash="4358736ced5bdc7d2a7fbbf53e2ff07d"/></dir><file name="Profile.php" hash="798cef09bbc0556545edf1f00bae9bf0"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="e936830d9e4f74badc3b7663f60436dc"/></dir></dir><file name="Risk.php" hash="fab5519b0e257b8ef2f66f5f76d49f2b"/><dir name="Source"><file name="Cctype.php" hash="dd21379a29444a4c58e33e90ddeb300e"/></dir><dir name="Web"><file name="Client.php" hash="d565e254fc281e7c246cc9cfe8c2f39d"/></dir></dir><dir name="Test"><dir name="Model"><dir name="Hosted"><file name="Client.php" hash="83e69edc0636294a7e6a93e8cd745b33"/></dir><dir name="Method"><file name="Hosted.php" hash="2acc5b7427dc4bb36b8ec8f75987cd1e"/></dir><file name="Observer.php" hash="581a5f9151aaffad292670af5118926f"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ThreatController.php" hash="5db39713fbd0ae13e943a891940bb22c"/></dir><dir name="Frontend"><file name="OptimalController.php" hash="c370c3a30a6563ed15a6596246e2d725"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="964295d91c6f5e1fcbebda18b9ad54b5"/><file name="config.xml" hash="0515298670f1cf73ebe15cb3aa004dbe"/><file name="system.xml" hash="cd61f9cdb9b368fca29ab683d5350c93"/></dir><dir name="sql"><dir name="optimal_setup"><file name="install-0.1.1.php" hash="422b6afb2d2320f5d9c59cd5bff0dc3d"/><file name="install-0.2.0.php" hash="71dbb515c55c34f1910463d72f66f9d2"/><file name="install-0.2.1.php" hash="0bd65edba72966cffce19dd3c480863b"/><file name="install-0.2.2.php" hash="33bb51df7561eb747ee07d8e8aa43ce4"/><file name="install-0.2.3.php" hash="abafde589308828b601c306b45f1aa41"/><file name="install-0.2.4.php" hash="abafde589308828b601c306b45f1aa41"/><file name="install-0.2.5.php" hash="9a0bb5235e982cfc1794dd8d0172e26d"/><file name="install-0.2.6.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="install-0.2.7.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="install-0.2.9.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="mysql4-install-0.1.1.php" hash="422b6afb2d2320f5d9c59cd5bff0dc3d"/><file name="mysql4-install-0.2.0.php" hash="71dbb515c55c34f1910463d72f66f9d2"/><file name="mysql4-install-0.2.1.php" hash="0bd65edba72966cffce19dd3c480863b"/><file name="mysql4-install-0.2.2.php" hash="33bb51df7561eb747ee07d8e8aa43ce4"/><file name="mysql4-install-0.2.3.php" hash="abafde589308828b601c306b45f1aa41"/><file name="mysql4-install-0.2.4.php" hash="abafde589308828b601c306b45f1aa41"/><file name="mysql4-install-0.2.5.php" hash="9a0bb5235e982cfc1794dd8d0172e26d"/><file name="mysql4-install-0.2.6.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="mysql4-install-0.2.7.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="mysql4-install-0.2.9.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="mysql4-upgrade-0.1.1-0.2.7.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="upgrade-0.1.1-0.2.7.php" hash="0a8eb965fa5af575593d09722b6712b1"/><file name="upgrade-0.2.9-0.3.0.php" hash="989e6c4043fccfa6cdcba0a09938dd07"/><file name="upgrade-0.3.1-0.3.2.php" hash="aea721b40772c92db786b96fbb9c8bda"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Demac_Optimal.xml" hash="2ebfc5a3a1c5688639c0cc5eb34fded0"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="demac"><file name="threatmeter.phtml" hash="3dd0ea7621038895aa1dd1e322ba7d99"/></dir><dir name="optimal"><dir><dir name="customer"><dir name="cards"><file name="form.phtml" hash="969544827b5e5765b6bb2bea2f62392a"/><file name="grid.phtml" hash="9a160522aa31ed44eb2f5751f40718c8"/><file name="form.phtml" hash="969544827b5e5765b6bb2bea2f62392a"/><file name="grid.phtml" hash="9a160522aa31ed44eb2f5751f40718c8"/></dir><file name="cards.phtml" hash="ed3f6e56b134674e7d8ddcb6a1deac59"/><file name="cards.phtml" hash="ed3f6e56b134674e7d8ddcb6a1deac59"/></dir><dir name="form"><file name="creditcard.phtml" hash="be04e0511fc1686ed7ea81c6e61e89ad"/><file name="creditcard.phtml" hash="be04e0511fc1686ed7ea81c6e61e89ad"/></dir><dir name="info"><file name="creditcard.phtml" hash="d886bd24ae993548a3663b537e2456df"/><file name="creditcard.phtml" hash="d886bd24ae993548a3663b537e2456df"/></dir></dir></dir></dir><dir name="layout"><file name="optimal.xml" hash="a07172addfaad63e7a9aeded9de8baa8"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="optimal"><dir name="form"><file name="creditcard.phtml" hash="550c80a4e0dc4224946de029f4c3ecf6"/></dir><dir name="info"><file name="creditcard.phtml" hash="642dd94f8c1b1e43fe89226b3a0eb02a"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
27 |
<compatible/>
|
28 |
<dependencies><required><php><min>5.3.0</min><max>5.4.30</max></php></required></dependencies>
|
29 |
</package>
|