Version Notes
Initial Release from Juicy Media
Download this release
Release Info
Developer | Juicy Media |
Extension | Juicy_BarclaysPSPID |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Juicy/Barclayspspid/Block/Dynamic.php +18 -0
- app/code/local/Juicy/Barclayspspid/Block/Failure.php +34 -0
- app/code/local/Juicy/Barclayspspid/Block/Form.php +18 -0
- app/code/local/Juicy/Barclayspspid/Block/Info.php +117 -0
- app/code/local/Juicy/Barclayspspid/Block/Motoform.php +136 -0
- app/code/local/Juicy/Barclayspspid/Block/Motoinfo.php +138 -0
- app/code/local/Juicy/Barclayspspid/Block/Redirect.php +32 -0
- app/code/local/Juicy/Barclayspspid/Helper/Data.php +61 -0
- app/code/local/Juicy/Barclayspspid/Model/Barclaysmoto.php +251 -0
- app/code/local/Juicy/Barclayspspid/Model/Barclayspspid.php +174 -0
- app/code/local/Juicy/Barclayspspid/Model/Config.php +140 -0
- app/code/local/Juicy/Barclayspspid/Model/Directlink.php +463 -0
- app/code/local/Juicy/Barclayspspid/Model/Resource/Eav/Mysql4/Setup.php +6 -0
- app/code/local/Juicy/Barclayspspid/Model/Session.php +16 -0
- app/code/local/Juicy/Barclayspspid/Model/Source/CardcodeAction.php +25 -0
- app/code/local/Juicy/Barclayspspid/Model/Source/CreditCards.php +27 -0
- app/code/local/Juicy/Barclayspspid/Model/Source/CurrencyAction.php +55 -0
- app/code/local/Juicy/Barclayspspid/Model/Source/PaymentAction.php +19 -0
- app/code/local/Juicy/Barclayspspid/Model/Submitform.php +342 -0
- app/code/local/Juicy/Barclayspspid/controllers/PaymentController.php +242 -0
- app/code/local/Juicy/Barclayspspid/controllers/RefundController.php +9 -0
- app/code/local/Juicy/Barclayspspid/etc/adminhtml.xml +53 -0
- app/code/local/Juicy/Barclayspspid/etc/adminhtml/acl.xml +13 -0
- app/code/local/Juicy/Barclayspspid/etc/adminhtml/system.xml +145 -0
- app/code/local/Juicy/Barclayspspid/etc/config.xml +122 -0
- app/code/local/Juicy/Barclayspspid/etc/system.xml +365 -0
- app/code/local/Juicy/Barclayspspid/sql/barclayspspid_setup/mysql4-install-1.0.0.php +24 -0
- app/design/adminhtml/default/default/template/barclayspspid/info.phtml +97 -0
- app/design/adminhtml/default/default/template/barclayspspid/motoform.phtml +77 -0
- app/design/adminhtml/default/default/template/barclayspspid/motoinfo.phtml +78 -0
- app/etc/modules/Juicy_Barclayspspid.xml +9 -0
- package.xml +18 -0
app/code/local/Juicy/Barclayspspid/Block/Dynamic.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Redirection to Barclays CPI
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Juicy_Barclayspspid_Block_Dynamic extends Mage_Core_Block_Abstract
|
12 |
+
{
|
13 |
+
protected function _toHtml()
|
14 |
+
{
|
15 |
+
$html = $this->getformhtml();
|
16 |
+
return $html;
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Juicy/Barclayspspid/Block/Failure.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Failure message block
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Block_Failure extends Mage_Core_Block_Template
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Return StatusDetail field value from Response
|
14 |
+
*
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
public function getErrorMessage ()
|
18 |
+
{
|
19 |
+
$error = Mage::getSingleton('Mage_Checkout_Model_Session')->getErrorMessage();
|
20 |
+
Mage::getSingleton('Mage_Checkout_Model_Session')->unsErrorMessage();
|
21 |
+
Mage::log('Juicy_Barclayspspid_Block_Failure: '.$error, null, 'barclays-pspid.log');
|
22 |
+
return $error;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Get continue shopping url
|
27 |
+
*/
|
28 |
+
public function getContinueShoppingUrl()
|
29 |
+
{
|
30 |
+
return Mage::getUrl('checkout/cart');
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
app/code/local/Juicy/Barclayspspid/Block/Form.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Form for the checkout page
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Juicy_Barclayspspid_Block_Form extends Mage_Payment_Block_Form
|
12 |
+
{
|
13 |
+
protected function _construct()
|
14 |
+
{
|
15 |
+
parent::_construct();
|
16 |
+
$this->setTemplate('barclayspspid/form.phtml');
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Juicy/Barclayspspid/Block/Info.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Juicy_Barclayspspid_Block_Info extends Mage_Payment_Block_Info
|
4 |
+
{
|
5 |
+
protected $_template = 'barclayspspid/info.phtml';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Returns code of payment method
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
+
|
13 |
+
protected function _construct()
|
14 |
+
{
|
15 |
+
parent::_construct();
|
16 |
+
$this->setTemplate('barclayspspid/info.phtml');
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getMethodCode()
|
20 |
+
{
|
21 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getStuff() {
|
25 |
+
|
26 |
+
$data_in = $this->getInfo()->getOrder()->getPayment()->getAdditionalData();
|
27 |
+
$data = unserialize($data_in);
|
28 |
+
|
29 |
+
Mage::log('Juicy_Barclayspspid_Block_Info: '.$data_in, null, 'barclays-pspid.log');
|
30 |
+
|
31 |
+
unset($data['SHASIGN']);
|
32 |
+
unset($data['ED']);
|
33 |
+
unset($data['NCERROR']);
|
34 |
+
unset($data['BIN']);
|
35 |
+
unset($data['ECI']);
|
36 |
+
unset($data['SCORING']);
|
37 |
+
unset($data['SCO_CATEGORY']);
|
38 |
+
unset($data['VC']);
|
39 |
+
|
40 |
+
foreach ($data as $key => $value) {
|
41 |
+
|
42 |
+
|
43 |
+
switch ($key) {
|
44 |
+
case "SUBBRAND":
|
45 |
+
$key2 = "Card Holders Bank";
|
46 |
+
break;
|
47 |
+
case "CVCCheck":
|
48 |
+
$key2 = "CVC Check";
|
49 |
+
break;
|
50 |
+
case "AAVCheck";
|
51 |
+
$key2 = "AVS Check";
|
52 |
+
break;
|
53 |
+
case "AAVZIP":
|
54 |
+
$key2 = "AVS Postcode";
|
55 |
+
break;
|
56 |
+
case "AAVADDRESS":
|
57 |
+
$key2 = "AVS Address";
|
58 |
+
break;
|
59 |
+
case "IPCTY":
|
60 |
+
$key2 = "Order Placed from";
|
61 |
+
break;
|
62 |
+
case "CCCTY":
|
63 |
+
$key2 = "Bank Country of Origin";
|
64 |
+
break;
|
65 |
+
case "orderID":
|
66 |
+
$key2 = "Order ID";
|
67 |
+
break;
|
68 |
+
case "CN":
|
69 |
+
$key2 = "Card Holder Name";
|
70 |
+
break;
|
71 |
+
case "CARDNO":
|
72 |
+
$key2 = "Credit Card Number (Masked)";
|
73 |
+
break;
|
74 |
+
case "currency":
|
75 |
+
$key2 = "Payment Currency";
|
76 |
+
break;
|
77 |
+
case "amount":
|
78 |
+
$key2 = "Amount Paid";
|
79 |
+
break;
|
80 |
+
case "PM":
|
81 |
+
$key2 = "Payment Method";
|
82 |
+
break;
|
83 |
+
case "TRXDATE":
|
84 |
+
$key2 = "Transaction Date";
|
85 |
+
break;
|
86 |
+
case "IP":
|
87 |
+
$key2 = "IP address of Payee";
|
88 |
+
break;
|
89 |
+
case "PAYID":
|
90 |
+
$key2 = "Payment ID";
|
91 |
+
break;
|
92 |
+
case "ACCEPTANCE":
|
93 |
+
$key2 = "Authorization Code";
|
94 |
+
break;
|
95 |
+
case "BRAND":
|
96 |
+
$key2 = "Card Type";
|
97 |
+
break;
|
98 |
+
case "STATUS":
|
99 |
+
$key2 = "Status";
|
100 |
+
break;
|
101 |
+
default:
|
102 |
+
$key2 = $key;
|
103 |
+
break;
|
104 |
+
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
$data2[$key2] = $value;
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
return $data2;
|
115 |
+
|
116 |
+
}
|
117 |
+
}
|
app/code/local/Juicy/Barclayspspid/Block/Motoform.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Form for the checkout page
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Juicy_Barclayspspid_Block_Motoform extends Mage_Payment_Block_Form
|
12 |
+
{
|
13 |
+
protected function _construct()
|
14 |
+
{
|
15 |
+
parent::_construct();
|
16 |
+
$this->setTemplate('barclayspspid/motoform.phtml');
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _getConfig()
|
20 |
+
{
|
21 |
+
return Mage::getSingleton('payment/config');
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Returns an array of credit card expiry months
|
26 |
+
*
|
27 |
+
* @return unknown
|
28 |
+
*/
|
29 |
+
public function getCcMonths()
|
30 |
+
{
|
31 |
+
$months = $this->getData('cc_months');
|
32 |
+
|
33 |
+
if (is_null($months))
|
34 |
+
{
|
35 |
+
$months = array();
|
36 |
+
$monthList = $this->_getConfig()->getMonths();
|
37 |
+
|
38 |
+
$months[0] = $this->__('Month');
|
39 |
+
for ($nCount = 1; $nCount <= sizeof($monthList); $nCount++)
|
40 |
+
{
|
41 |
+
$value = $nCount;
|
42 |
+
if($value < 10)
|
43 |
+
{
|
44 |
+
$value = '0'.$value;
|
45 |
+
}
|
46 |
+
$months[$value] = $monthList[$nCount];
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->setData('cc_months', $months);
|
50 |
+
}
|
51 |
+
|
52 |
+
return $months;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Returns an array of credit card expiry years
|
57 |
+
*
|
58 |
+
* @return unknown
|
59 |
+
*/
|
60 |
+
public function getCcYears()
|
61 |
+
{
|
62 |
+
$years = $this->getData('cc_years');
|
63 |
+
|
64 |
+
if (is_null($years))
|
65 |
+
{
|
66 |
+
$years = array();
|
67 |
+
$first = date("Y");
|
68 |
+
|
69 |
+
$years = array($this->__('Year'));
|
70 |
+
for ($index = 0; $index < 10; $index++)
|
71 |
+
{
|
72 |
+
$year = $first + $index;
|
73 |
+
$yearPartial = substr($year, 2);
|
74 |
+
$years[$yearPartial] = $year;
|
75 |
+
}
|
76 |
+
$this->setData('cc_years', $years);
|
77 |
+
}
|
78 |
+
|
79 |
+
return $years;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Returns an array credit card start months
|
84 |
+
*
|
85 |
+
* @return unknown
|
86 |
+
*/
|
87 |
+
public function getCcStartMonths()
|
88 |
+
{
|
89 |
+
$months = $this->getData('cc_ss_start_month');
|
90 |
+
|
91 |
+
if (is_null($months))
|
92 |
+
{
|
93 |
+
$months = array();
|
94 |
+
$monthList = $this->_getConfig()->getMonths();
|
95 |
+
|
96 |
+
for ($nCount = 1; $nCount <= sizeof($monthList); $nCount++)
|
97 |
+
{
|
98 |
+
$value = $nCount;
|
99 |
+
if($value < 10)
|
100 |
+
{
|
101 |
+
$value = '0'.$value;
|
102 |
+
}
|
103 |
+
$months[$value] = $monthList[$nCount];
|
104 |
+
}
|
105 |
+
$this->setData('cc_ss_start_month', $months);
|
106 |
+
}
|
107 |
+
|
108 |
+
return $months;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Returns an array of credit card start years
|
113 |
+
*
|
114 |
+
* @return unknown
|
115 |
+
*/
|
116 |
+
public function getCcStartYears()
|
117 |
+
{
|
118 |
+
$years = $this->getData('cc_start_years');
|
119 |
+
|
120 |
+
if(is_null($years))
|
121 |
+
{
|
122 |
+
$years = array();
|
123 |
+
$first = date("Y");
|
124 |
+
|
125 |
+
for ($index = 0; $index < 10; $index++)
|
126 |
+
{
|
127 |
+
$year = $first - $index;
|
128 |
+
$yearPartial = substr($year, 2);
|
129 |
+
$years[$yearPartial] = $year;
|
130 |
+
}
|
131 |
+
$this->setData('cc_start_years', $years);
|
132 |
+
}
|
133 |
+
|
134 |
+
return $years;
|
135 |
+
}
|
136 |
+
}
|
app/code/local/Juicy/Barclayspspid/Block/Motoinfo.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 Phoenix
|
22 |
+
* @package Phoenix_Moneybookers
|
23 |
+
* @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
class Juicy_Barclayspspid_Block_Motoinfo extends Mage_Payment_Block_Info
|
27 |
+
{
|
28 |
+
protected $_template = 'barclayspspid/motoinfo.phtml';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Returns code of payment method
|
32 |
+
*
|
33 |
+
* @return string
|
34 |
+
*/
|
35 |
+
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
parent::_construct();
|
39 |
+
$this->setTemplate('barclayspspid/motoinfo.phtml');
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getMethodCode()
|
43 |
+
{
|
44 |
+
return $this->getInfo()->getMethodInstance()->getCode();
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getStuff() {
|
48 |
+
|
49 |
+
$data = $this->getInfo()->getOrder()->getPayment()->getAdditionalData();
|
50 |
+
$data = unserialize($data);
|
51 |
+
|
52 |
+
unset($data['SHASIGN']);
|
53 |
+
unset($data['ED']);
|
54 |
+
unset($data['NCERROR']);
|
55 |
+
unset($data['BIN']);
|
56 |
+
unset($data['ECI']);
|
57 |
+
unset($data['SCORING']);
|
58 |
+
unset($data['SCO_CATEGORY']);
|
59 |
+
unset($data['VC']);
|
60 |
+
|
61 |
+
foreach ($data as $key => $value) {
|
62 |
+
|
63 |
+
|
64 |
+
switch ($key) {
|
65 |
+
case "SUBBRAND":
|
66 |
+
$key2 = "Card Holders Bank";
|
67 |
+
break;
|
68 |
+
case "CVCCheck":
|
69 |
+
$key2 = "CVC Check";
|
70 |
+
break;
|
71 |
+
case "AAVCheck";
|
72 |
+
$key2 = "AVS Check";
|
73 |
+
break;
|
74 |
+
case "AAVZIP":
|
75 |
+
$key2 = "AVS Postcode";
|
76 |
+
break;
|
77 |
+
case "AAVADDRESS":
|
78 |
+
$key2 = "AVS Address";
|
79 |
+
break;
|
80 |
+
case "IPCTY":
|
81 |
+
$key2 = "Order Placed from";
|
82 |
+
break;
|
83 |
+
case "CCCTY":
|
84 |
+
$key2 = "Bank Country of Origin";
|
85 |
+
break;
|
86 |
+
case "orderID":
|
87 |
+
$key2 = "Order ID";
|
88 |
+
break;
|
89 |
+
case "CN":
|
90 |
+
$key2 = "Card Holder Name";
|
91 |
+
break;
|
92 |
+
case "CARDNO":
|
93 |
+
$key2 = "Credit Card Number (Masked)";
|
94 |
+
break;
|
95 |
+
case "currency":
|
96 |
+
$key2 = "Payment Currency";
|
97 |
+
break;
|
98 |
+
case "amount":
|
99 |
+
$key2 = "Amount Paid";
|
100 |
+
break;
|
101 |
+
case "PM":
|
102 |
+
$key2 = "Payment Method";
|
103 |
+
break;
|
104 |
+
case "TRXDATE":
|
105 |
+
$key2 = "Transaction Date";
|
106 |
+
break;
|
107 |
+
case "IP":
|
108 |
+
$key2 = "IP address of Payee";
|
109 |
+
break;
|
110 |
+
case "PAYID":
|
111 |
+
$key2 = "Payment ID";
|
112 |
+
break;
|
113 |
+
case "ACCEPTANCE":
|
114 |
+
$key2 = "Authorization Code";
|
115 |
+
break;
|
116 |
+
case "BRAND":
|
117 |
+
$key2 = "Card Type";
|
118 |
+
break;
|
119 |
+
case "STATUS":
|
120 |
+
$key2 = "Status";
|
121 |
+
break;
|
122 |
+
default:
|
123 |
+
$key2 = $key;
|
124 |
+
break;
|
125 |
+
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
$data2[$key2] = $value;
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
return $data2;
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
app/code/local/Juicy/Barclayspspid/Block/Redirect.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Redirection to Barclays CPI
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2014
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (support@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Juicy_Barclayspspid_Block_Redirect extends Mage_Core_Block_Abstract
|
12 |
+
{
|
13 |
+
protected function _toHtml()
|
14 |
+
{
|
15 |
+
|
16 |
+
//Mage::log('Juicy_Barclayspspid_Block_Redirect: Start', null, 'barclays-pspid.log');
|
17 |
+
|
18 |
+
$form = $this->getepdqform();
|
19 |
+
|
20 |
+
//Mage::log('Juicy_Barclayspspid_Block_Redirect: Form: '.$form, null, 'barclays-pspid.log');
|
21 |
+
|
22 |
+
$html = '<html><body>';
|
23 |
+
$html .= '<div style="color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">';
|
24 |
+
$html .= $this->__('You will be redirected to the Barclays website to make your payment, please wait a few seconds.');
|
25 |
+
$html .= '</div>';
|
26 |
+
$html .= $form;
|
27 |
+
$html .= '<script type="text/javascript">document.getElementById("form1").submit();</script>';
|
28 |
+
$html .= '</body></html>';
|
29 |
+
|
30 |
+
return $html;
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Juicy/Barclayspspid/Helper/Data.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper file - not used right now
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
public function log($eventname, $variables)
|
13 |
+
{
|
14 |
+
|
15 |
+
$config = new Juicy_Barclayspspid_Model_Config();
|
16 |
+
|
17 |
+
$debuglog = $config->getDebuglog();
|
18 |
+
$debugemail = $config->getDebugEmail();
|
19 |
+
|
20 |
+
if ($debuglog == "1") {
|
21 |
+
$message = "Event Name - ".$eventname." - Trace - ".print_r($variables, true);
|
22 |
+
Mage::log($message, null, "barclays-pspid.log");
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
if ($debugemail == "1") {
|
27 |
+
|
28 |
+
$siteurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
29 |
+
|
30 |
+
$subject = "Barclays PSPID DEBUG LOG FOR - ".$siteurl." - Event :".$eventname;
|
31 |
+
|
32 |
+
|
33 |
+
$message = "Actual URL:".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
34 |
+
$message .= "<br /><br />";
|
35 |
+
$message .= "Event Name = ".$eventname."<br /><br />";
|
36 |
+
$message .= "Event Trace = ".print_r($variables, true)."<br /><br />";
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
$mail = Mage::getModel('core/email');
|
41 |
+
$mail->setToName('Juicy DEBUG NOTIFY');
|
42 |
+
$mail->setToEmail('servers@juicymedia.co.uk');
|
43 |
+
$mail->setBody($message);
|
44 |
+
$mail->setSubject($subject);
|
45 |
+
$mail->setFromEmail('debug@juicymedia.co.uk');
|
46 |
+
$mail->setFromName("Barclays PSPID Debug Issue");
|
47 |
+
$mail->setType('html');// YOu can use Html or text as Mail format
|
48 |
+
|
49 |
+
try {
|
50 |
+
$mail->send();
|
51 |
+
}
|
52 |
+
catch (Exception $e) {
|
53 |
+
//var_dump($e>getMessage());
|
54 |
+
}
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
}
|
61 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Barclaysmoto.php
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Standard model that does the hard work of sending data to Barclays
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Model_Barclaysmoto extends Mage_Payment_Model_Method_Abstract
|
11 |
+
{
|
12 |
+
protected $_code = 'barclayspspid_moto';
|
13 |
+
protected $_formBlockType = 'Juicy_Barclayspspid_Block_Motoform';
|
14 |
+
protected $_infoBlockType = 'Juicy_Barclayspspid_Block_Motoinfo';
|
15 |
+
|
16 |
+
|
17 |
+
const PAYMENT_TYPE_PAYMENT = 'SAL';
|
18 |
+
const PAYMENT_TYPE_AUTHENTICATE = 'RES';
|
19 |
+
|
20 |
+
protected $_isGateway = true;
|
21 |
+
//protected $_isInitializeNeeded = false;
|
22 |
+
protected $_canAuthorize = false;
|
23 |
+
protected $_canCapture = true;
|
24 |
+
protected $_canCapturePartial = true;
|
25 |
+
protected $_canRefundInvoicePartial = true;
|
26 |
+
protected $_canRefund = true;
|
27 |
+
protected $_canVoid = false;
|
28 |
+
protected $_canUseInternal = true;
|
29 |
+
protected $_canUseCheckout = false;
|
30 |
+
protected $_canUseForMultishipping = false;
|
31 |
+
|
32 |
+
protected $_order = null;
|
33 |
+
|
34 |
+
|
35 |
+
public function refund(Varien_Object $payment, $amount)
|
36 |
+
{
|
37 |
+
|
38 |
+
$orderStatus = 'closed';
|
39 |
+
$szMessage = 'Payment refunded';
|
40 |
+
|
41 |
+
$directlink = new Juicy_Barclayspspid_Model_Directlink();
|
42 |
+
|
43 |
+
$result = $directlink->refundpayment($payment, $amount);
|
44 |
+
|
45 |
+
$status = (int)$result['STATUS'];
|
46 |
+
|
47 |
+
$error = false;
|
48 |
+
|
49 |
+
if ($status != 81) {
|
50 |
+
$error == $result['NCERRORPLUS'];
|
51 |
+
}
|
52 |
+
|
53 |
+
if($error === false)
|
54 |
+
{
|
55 |
+
$order = $payment->getOrder();
|
56 |
+
$payment = $order->getPayment();
|
57 |
+
$arAdditionalInformationArray = $payment->getAdditionalInformation();
|
58 |
+
|
59 |
+
$arAdditionalInformationArray["Refunded"] = 1;
|
60 |
+
$payment->setAdditionalInformation($arAdditionalInformationArray);
|
61 |
+
$payment->save();
|
62 |
+
|
63 |
+
$order->setState('refunded', $orderStatus, $szMessage, false);
|
64 |
+
$order->save();
|
65 |
+
}
|
66 |
+
else
|
67 |
+
{
|
68 |
+
Mage::throwException($error);
|
69 |
+
}
|
70 |
+
|
71 |
+
return $this;
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Form block description
|
80 |
+
*
|
81 |
+
* @return object
|
82 |
+
*/
|
83 |
+
public function createFormBlock($name)
|
84 |
+
{
|
85 |
+
$block = $this->getLayout()->createBlock('Juicy_Barclayspspid_Block_Motoform', $name);
|
86 |
+
$block->setMethod('barclayspspid_moto');
|
87 |
+
$block->setPayment($this->getPayment());
|
88 |
+
$block->setTemplate('barclayspspid/motoform.phtml');
|
89 |
+
|
90 |
+
return $block;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Get Config model
|
95 |
+
*
|
96 |
+
* @return object Juicy_Barclayscpi_Model_Config
|
97 |
+
*/
|
98 |
+
public function getConfig()
|
99 |
+
{
|
100 |
+
return Mage::getSingleton('Juicy_Barclayspspid_Model_Config');
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
public function checkShaout($data)
|
105 |
+
{
|
106 |
+
$config = Mage::getModel('Juicy_Barclayspspid_Model_Config');
|
107 |
+
|
108 |
+
$shaout = $config->getShaout();
|
109 |
+
|
110 |
+
$datacheck = array();
|
111 |
+
|
112 |
+
foreach ($data as $key => $value) {
|
113 |
+
if ($value == "") {
|
114 |
+
continue;
|
115 |
+
}
|
116 |
+
$datacheck[$key] = $value;
|
117 |
+
}
|
118 |
+
|
119 |
+
$origsig = $datacheck['SHASIGN'];
|
120 |
+
|
121 |
+
unset($datacheck['SHASIGN']);
|
122 |
+
|
123 |
+
uksort($datacheck, 'strcasecmp');
|
124 |
+
$shasign = "";
|
125 |
+
|
126 |
+
|
127 |
+
foreach ($datacheck as $key => $value) {
|
128 |
+
$shasig .= trim(strtoupper($key)).'='.utf8_encode(trim($value)).$shaout;
|
129 |
+
}
|
130 |
+
|
131 |
+
$shasig = strtoupper(hash('sha1',$shasig));
|
132 |
+
|
133 |
+
if ($shasig == $origsig) {
|
134 |
+
return true;
|
135 |
+
} else {
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
public function capture(Varien_Object $payment, $amount)
|
142 |
+
{
|
143 |
+
|
144 |
+
$order = $payment->getOrder();
|
145 |
+
|
146 |
+
$data = unserialize($payment->getadditional_data());
|
147 |
+
|
148 |
+
if ($data['STATUS'] != 9) {
|
149 |
+
|
150 |
+
$directlink = new Juicy_Barclayspspid_Model_Directlink();
|
151 |
+
|
152 |
+
$result = $directlink->capturepayment($payment, $amount);
|
153 |
+
|
154 |
+
|
155 |
+
|
156 |
+
if ($result['STATUS'] == 91) {
|
157 |
+
|
158 |
+
$order->getPayment()->setTransactionId($result['PAYID']);
|
159 |
+
$order->save();
|
160 |
+
} else {
|
161 |
+
Mage::throwException('Capture Failed');
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
return $this;
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
public function authorize(Varien_Object $payment, $amount)
|
174 |
+
{
|
175 |
+
|
176 |
+
$error = false;
|
177 |
+
|
178 |
+
$order = $payment->getOrder();
|
179 |
+
|
180 |
+
$directlink = Mage::getModel('Juicy_Barclayspspid_Model_Directlink');
|
181 |
+
|
182 |
+
$result = $directlink->authorizepayment($payment, $amount);
|
183 |
+
|
184 |
+
|
185 |
+
|
186 |
+
$status = (int)$result['STATUS'];
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
if ($status == 9) {
|
191 |
+
|
192 |
+
$order->getPayment()->setadditional_data(serialize($result));
|
193 |
+
$order->getPayment()->setTransactionId($result['PAYID']);
|
194 |
+
|
195 |
+
$invoice = $order->prepareInvoice();
|
196 |
+
$invoice->register()->capture();
|
197 |
+
Mage::getModel('Mage_Core_Model_Resource_Transaction')
|
198 |
+
->addObject($invoice)
|
199 |
+
->addObject($invoice->getOrder())
|
200 |
+
->save();
|
201 |
+
|
202 |
+
$session = Mage::getModel("Mage_Admin_Model_Session");
|
203 |
+
$session->addSuccess('Your Order was Successfully processed and the authorisation code was '.$result['ACCEPTANCE']);
|
204 |
+
|
205 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
206 |
+
$order->getPayment()->setSkipTransactionCreation(true);
|
207 |
+
$order->save();
|
208 |
+
|
209 |
+
} else if ($status == 5) {
|
210 |
+
|
211 |
+
$order->getPayment()->setadditional_data(serialize($result));
|
212 |
+
$order->getPayment()->setSkipTransactionCreation(true);
|
213 |
+
|
214 |
+
//$order->getPayment()->setTransactionId($additionaldata['PAYID']);
|
215 |
+
$invoice = $order->prepareInvoice();
|
216 |
+
$invoice->register();
|
217 |
+
Mage::getModel('Mage_Core_Model_Resource_Transaction')
|
218 |
+
->addObject($invoice)
|
219 |
+
->addObject($invoice->getOrder())
|
220 |
+
->save();
|
221 |
+
|
222 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'barclayspspid_authorized', "Transaction was successfully pre-authorized", true);
|
223 |
+
$order->save();
|
224 |
+
|
225 |
+
$session = Mage::getModel("Mage_Admin_Model_Session");
|
226 |
+
$session->addSuccess('Your Order was Successfully authorized and the authorisation code was '.$result['ACCEPTANCE']);
|
227 |
+
|
228 |
+
} else {
|
229 |
+
$error = true;
|
230 |
+
}
|
231 |
+
|
232 |
+
|
233 |
+
if($error)
|
234 |
+
{
|
235 |
+
Mage::throwException($result['NCERRORPLUS']);
|
236 |
+
}
|
237 |
+
else
|
238 |
+
{
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
return $this;
|
243 |
+
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
|
248 |
+
|
249 |
+
|
250 |
+
|
251 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Barclayspspid.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Standard model that does the hard work of sending data to Barclays
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Model_Barclayspspid extends Mage_Payment_Model_Method_Abstract
|
11 |
+
{
|
12 |
+
protected $_code = 'barclayspspid_standard';
|
13 |
+
protected $_formBlockType = 'Juicy_Barclayspspid_Block_Form';
|
14 |
+
protected $_infoBlockType = 'Juicy_Barclayspspid_Block_Info';
|
15 |
+
|
16 |
+
|
17 |
+
const PAYMENT_TYPE_PAYMENT = 'SAL';
|
18 |
+
const PAYMENT_TYPE_AUTHENTICATE = 'RES';
|
19 |
+
|
20 |
+
protected $_isGateway = false;
|
21 |
+
protected $_canAuthorize = true;
|
22 |
+
protected $_canCapture = true;
|
23 |
+
protected $_canCapturePartial = true;
|
24 |
+
protected $_canRefundInvoicePartial = true;
|
25 |
+
protected $_canRefund = true;
|
26 |
+
protected $_canVoid = false;
|
27 |
+
protected $_canUseInternal = false;
|
28 |
+
protected $_canUseCheckout = true;
|
29 |
+
protected $_canUseForMultishipping = false;
|
30 |
+
|
31 |
+
protected $_order = null;
|
32 |
+
|
33 |
+
|
34 |
+
public function refund(Varien_Object $payment, $amount)
|
35 |
+
{
|
36 |
+
$orderStatus = 'closed';
|
37 |
+
$szMessage = 'Payment refunded';
|
38 |
+
|
39 |
+
$directlink = new Juicy_Barclayspspid_Model_Directlink();
|
40 |
+
|
41 |
+
$result = $directlink->refundpayment($payment, $amount);
|
42 |
+
|
43 |
+
$status = (int)$result['STATUS'];
|
44 |
+
|
45 |
+
$error = false;
|
46 |
+
|
47 |
+
if ($status != 81) {
|
48 |
+
$error = $result['NCERRORPLUS'];
|
49 |
+
}
|
50 |
+
|
51 |
+
if($error === false)
|
52 |
+
{
|
53 |
+
$order = $payment->getOrder();
|
54 |
+
$payment = $order->getPayment();
|
55 |
+
$arAdditionalInformationArray = $payment->getAdditionalInformation();
|
56 |
+
|
57 |
+
$arAdditionalInformationArray["Refunded"] = 1;
|
58 |
+
$payment->setAdditionalInformation($arAdditionalInformationArray);
|
59 |
+
$payment->save();
|
60 |
+
|
61 |
+
$order->setState('refunded', $orderStatus, $szMessage, false);
|
62 |
+
$order->save();
|
63 |
+
}
|
64 |
+
else
|
65 |
+
{
|
66 |
+
Mage::throwException($error);
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this;
|
70 |
+
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Form block description
|
77 |
+
*
|
78 |
+
* @return object
|
79 |
+
*/
|
80 |
+
public function createFormBlock($name)
|
81 |
+
{
|
82 |
+
$block = $this->getLayout()->createBlock('Juicy_Barclayspspid_Block_Form', $name);
|
83 |
+
$block->setMethod('barclayspspid_standard');
|
84 |
+
$block->setPayment($this->getPayment());
|
85 |
+
$block->setTemplate('form.phtml');
|
86 |
+
|
87 |
+
return $block;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get Config model
|
92 |
+
*
|
93 |
+
* @return object Juicy_Barclayscpi_Model_Config
|
94 |
+
*/
|
95 |
+
public function getConfig()
|
96 |
+
{
|
97 |
+
return Mage::getSingleton('Juicy_Barclayspspid_Model_Config');
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
public function checkShaout($data)
|
102 |
+
{
|
103 |
+
$config = Mage::getModel('Juicy_Barclayspspid_Model_Config');
|
104 |
+
|
105 |
+
$shaout = $config->getShaout();
|
106 |
+
|
107 |
+
$datacheck = array();
|
108 |
+
|
109 |
+
foreach ($data as $key => $value) {
|
110 |
+
if ($value == "") {
|
111 |
+
continue;
|
112 |
+
}
|
113 |
+
$datacheck[$key] = $value;
|
114 |
+
}
|
115 |
+
|
116 |
+
$origsig = $datacheck['SHASIGN'];
|
117 |
+
|
118 |
+
unset($datacheck['SHASIGN']);
|
119 |
+
|
120 |
+
uksort($datacheck, 'strcasecmp');
|
121 |
+
$shasign = "";
|
122 |
+
|
123 |
+
$shasig = null;
|
124 |
+
foreach ($datacheck as $key => $value) {
|
125 |
+
$shasig .= trim(strtoupper($key)).'='.utf8_encode(trim($value)).$shaout;
|
126 |
+
}
|
127 |
+
|
128 |
+
$shasig = strtoupper(hash('sha1',$shasig));
|
129 |
+
|
130 |
+
if ($shasig == $origsig) {
|
131 |
+
return true;
|
132 |
+
} else {
|
133 |
+
return false;
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
public function capture(Varien_Object $payment, $amount)
|
139 |
+
{
|
140 |
+
|
141 |
+
$order = $payment->getOrder();
|
142 |
+
|
143 |
+
$data = unserialize($payment->getadditional_data());
|
144 |
+
|
145 |
+
if ($data['STATUS'] != 9) {
|
146 |
+
|
147 |
+
$directlink = new Juicy_Barclayspspid_Model_Directlink();
|
148 |
+
|
149 |
+
$result = $directlink->capturepayment($payment, $amount);
|
150 |
+
|
151 |
+
if ($result['STATUS'] == 91) {
|
152 |
+
|
153 |
+
$order->getPayment()->setTransactionId($result['PAYID']);
|
154 |
+
$order->save();
|
155 |
+
} else {
|
156 |
+
Mage::throwException('Capture Failed');
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
return $this;
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Return Order Place Redirect URL
|
167 |
+
*
|
168 |
+
* @return string Order Redirect URL
|
169 |
+
*/
|
170 |
+
public function getOrderPlaceRedirectUrl()
|
171 |
+
{
|
172 |
+
return Mage::getUrl('barclayspspid/payment/redirect');
|
173 |
+
}
|
174 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Config.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Gets variables from Magentos config
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Model_Config extends Varien_Object
|
11 |
+
{
|
12 |
+
const PAYMENT_TYPE_PAYMENT = 'Auth';
|
13 |
+
const PAYMENT_TYPE_AUTHENTICATE = 'PreAuth';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Return config var
|
17 |
+
*
|
18 |
+
* @param string Var key
|
19 |
+
* @param string Default value for non-existing key
|
20 |
+
* @return mixed
|
21 |
+
*/
|
22 |
+
public function getConfigData($key, $default=false)
|
23 |
+
{
|
24 |
+
if (!$this->hasData($key)) {
|
25 |
+
$value = Mage::getStoreConfig('payment/barclayspspid_standard/'.$key);
|
26 |
+
if (is_null($value) || false===$value) {
|
27 |
+
$value = $default;
|
28 |
+
}
|
29 |
+
$this->setData($key, $value);
|
30 |
+
}
|
31 |
+
return $this->getData($key);
|
32 |
+
}
|
33 |
+
|
34 |
+
/*
|
35 |
+
* Return CSC
|
36 |
+
*/
|
37 |
+
public function getPspid() {
|
38 |
+
return $this->getConfigData('pspid');
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getDebuglog() {
|
42 |
+
return $this->getConfigData('debuglog');
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getDebugEmail() {
|
46 |
+
return $this->getConfigData('debugemail');
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getMagheader() {
|
50 |
+
return $this->getConfigData('magheader');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getUsername() {
|
54 |
+
return $this->getConfigData('username');
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getUserpassword() {
|
58 |
+
return $this->getConfigData('userpassword');
|
59 |
+
}
|
60 |
+
|
61 |
+
public function getBasket() {
|
62 |
+
return $this->getConfigData('basket');
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getDelivery() {
|
66 |
+
return $this->getConfigData('delivery');
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPagetitle() {
|
70 |
+
return $this->getConfigData('pagetitle');
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getPaymentaction() {
|
74 |
+
return $this->getConfigData('paymentaction');
|
75 |
+
}
|
76 |
+
|
77 |
+
public function getDynamic() {
|
78 |
+
return $this->getConfigData('dynamic');
|
79 |
+
}
|
80 |
+
|
81 |
+
public function getDynamictemplate() {
|
82 |
+
return $this->getConfigData('dynamictemplate');
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getTestmode() {
|
86 |
+
return $this->getConfigData('testmode');
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getCardtypes() {
|
90 |
+
return $this->getConfigData('cardtypes');
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getCurrency() {
|
94 |
+
return $this->getConfigData('currency');
|
95 |
+
}
|
96 |
+
|
97 |
+
public function getShain() {
|
98 |
+
return $this->getConfigData('shain');
|
99 |
+
}
|
100 |
+
|
101 |
+
public function getShaout() {
|
102 |
+
return $this->getConfigData('shaout');
|
103 |
+
}
|
104 |
+
|
105 |
+
public function getBgcolor() {
|
106 |
+
return $this->getConfigData('bgcolor');
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getTxtcolor() {
|
110 |
+
return $this->getConfigData('txtcolor');
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getTblbgcolor() {
|
114 |
+
return $this->getConfigData('tblbgcolor');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function getTbltxtcolor() {
|
118 |
+
return $this->getConfigData('tbltxtcolor');
|
119 |
+
}
|
120 |
+
|
121 |
+
public function getButtonbgcolor() {
|
122 |
+
return $this->getConfigData('buttonbgcolor');
|
123 |
+
}
|
124 |
+
|
125 |
+
public function getButtontxtcolor() {
|
126 |
+
return $this->getConfigData('buttontxtcolor');
|
127 |
+
}
|
128 |
+
|
129 |
+
public function getLogo() {
|
130 |
+
return $this->getConfigData('logo');
|
131 |
+
}
|
132 |
+
|
133 |
+
public function getFonttype() {
|
134 |
+
return $this->getConfigData('fonttype');
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
|
140 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Directlink.php
ADDED
@@ -0,0 +1,463 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Standard model that does the hard work of sending data to Barclays
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class Juicy_Barclayspspid_Model_Directlink extends Mage_Core_Model_Abstract
|
13 |
+
{
|
14 |
+
|
15 |
+
protected $_liveurl = "https://payments.edpq.co.uk/ncol/prod/maintenancedirect.asp";
|
16 |
+
protected $_testurl = "https://mdepayments.epdq.co.uk/ncol/test/maintenancedirect.asp";
|
17 |
+
|
18 |
+
protected $_liveorderurl = "https://payments.epdq.co.uk/ncol/prod/orderdirect.asp";
|
19 |
+
protected $_testorderurl = "https://mdepayments.epdq.co.uk/ncol/test/orderdirect.asp";
|
20 |
+
|
21 |
+
/*
|
22 |
+
* Get the config model
|
23 |
+
*/
|
24 |
+
private function getConfig()
|
25 |
+
{
|
26 |
+
$config = new Juicy_Barclayspspid_Model_Config();
|
27 |
+
return $config;
|
28 |
+
}
|
29 |
+
|
30 |
+
/*
|
31 |
+
* Refund the payment
|
32 |
+
*/
|
33 |
+
public function refundpayment($payment, $amount)
|
34 |
+
{
|
35 |
+
$config = $this->getConfig();
|
36 |
+
|
37 |
+
$info = $payment->getadditional_data();
|
38 |
+
$info = unserialize($info);
|
39 |
+
$payid = $info['PAYID'];
|
40 |
+
$orderid = $payment->getOrder()->getIncrementId();
|
41 |
+
|
42 |
+
$order = $payment->getOrder();
|
43 |
+
|
44 |
+
|
45 |
+
$parameters = array();
|
46 |
+
$parameters['ORDERID'] = $orderid;
|
47 |
+
$parameters['AMOUNT'] = $amount * 100;
|
48 |
+
|
49 |
+
if ($order->getBaseTotalRefunded() == $order->getBaseGrandTotal())
|
50 |
+
{
|
51 |
+
$parameters['OPERATION'] = "RFS";
|
52 |
+
} else {
|
53 |
+
$parameters['OPERATION'] = "RFD";
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
$test = $config->getTestmode();
|
58 |
+
if ($test == "1") {
|
59 |
+
$url = $this->_testurl;
|
60 |
+
} else {
|
61 |
+
$url = $this->_liveurl;
|
62 |
+
}
|
63 |
+
|
64 |
+
Mage::helper('barclayspspid')->log("Refund Post Parameters",$parameters);
|
65 |
+
|
66 |
+
$result = $this->performRequest($parameters, $url);
|
67 |
+
|
68 |
+
Mage::helper('barclayspspid')->log("Refund Reply Parameters",$result);
|
69 |
+
|
70 |
+
return $result;
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Refund the payment
|
76 |
+
*/
|
77 |
+
public function capturepayment($payment, $amount)
|
78 |
+
{
|
79 |
+
$config = $this->getConfig();
|
80 |
+
|
81 |
+
$info = $payment->getadditional_data();
|
82 |
+
$info = unserialize($info);
|
83 |
+
$payid = $info['PAYID'];
|
84 |
+
$orderid = $payment->getOrder()->getIncrementId();
|
85 |
+
|
86 |
+
$order = $payment->getOrder();
|
87 |
+
|
88 |
+
|
89 |
+
$parameters = array();
|
90 |
+
$parameters['ORDERID'] = $orderid;
|
91 |
+
$parameters['AMOUNT'] = $amount * 100;
|
92 |
+
|
93 |
+
|
94 |
+
$parameters['OPERATION'] = "SAS";
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
$test = $config->getTestmode();
|
99 |
+
|
100 |
+
if ($test == "1") {
|
101 |
+
$url = $this->_testurl;
|
102 |
+
} else {
|
103 |
+
$url = $this->_liveurl;
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
+
Mage::helper('barclayspspid')->log("Capture Post Parameters",$parameters);
|
108 |
+
|
109 |
+
$result = $this->performRequest($parameters, $url);
|
110 |
+
|
111 |
+
Mage::helper('barclayspspid')->log("Capture Reply Parameters",$result);
|
112 |
+
|
113 |
+
return $result;
|
114 |
+
}
|
115 |
+
|
116 |
+
/*
|
117 |
+
* Authorize the payment using direct link API
|
118 |
+
*/
|
119 |
+
public function authorizepayment($payment, $amount)
|
120 |
+
{
|
121 |
+
|
122 |
+
$order = $payment->getOrder();
|
123 |
+
|
124 |
+
$config = Mage::getModel('Juicy_Barclayspspid_Model_Config');
|
125 |
+
|
126 |
+
$pspid = $config->getPspid();
|
127 |
+
$testmode = $config->getTestmode();
|
128 |
+
$cardtypes = $config->getCardtypes();
|
129 |
+
$currency = $config->getCurrency();
|
130 |
+
$shain = $config->getShain();
|
131 |
+
$shaout = $config->getShaout();
|
132 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
133 |
+
|
134 |
+
|
135 |
+
$paymentaction = $config->getPaymentaction();
|
136 |
+
|
137 |
+
|
138 |
+
if ($testmode == "0") {
|
139 |
+
$url = $this->_liveorderurl;
|
140 |
+
} else {
|
141 |
+
$url = $this->_testorderurl;
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
$basket = $config->getBasket();
|
146 |
+
$delivery = $config->getDelivery();
|
147 |
+
|
148 |
+
$orderid = $order->getIncrementId();
|
149 |
+
|
150 |
+
$grandtotal = (int)money_format("%.0n",$amount * 100);
|
151 |
+
|
152 |
+
$email = $order->getCustomerEmail();
|
153 |
+
|
154 |
+
|
155 |
+
$discountamount = (int)$order->getBaseDiscountAmount() * 100;
|
156 |
+
|
157 |
+
$shippingamount = number_format($order->getbase_shipping_amount(),2);
|
158 |
+
|
159 |
+
$shipping = $order->getShippingAddress();
|
160 |
+
$billing = $order->getBillingAddress();
|
161 |
+
|
162 |
+
$name = $billing->getFirstname().' '.$billing->getLastname();
|
163 |
+
|
164 |
+
$billfirst = $billing->getFirstname();
|
165 |
+
$billlast = $billing->getLastname();
|
166 |
+
|
167 |
+
$shipfirst = $shipping->getFirstname();
|
168 |
+
$shiplast = $shipping->getLastname();
|
169 |
+
|
170 |
+
$shippingdescription = $order->getShippingDescription();
|
171 |
+
$shippingcost = (int)money_format("%.0n",$order->getBaseShippingInclTax() * 100);
|
172 |
+
|
173 |
+
$bill1 = $billing->getStreet(1);
|
174 |
+
$bill2 = $billing->getStreet(2);
|
175 |
+
$billcity = $billing->getCity();
|
176 |
+
$billcountry = $billing->getCountry();
|
177 |
+
$billregion = $billing->getRegion();
|
178 |
+
$billpostcode = $billing->getPostcode();
|
179 |
+
$billstate = $billing->getRegionCode();
|
180 |
+
$billphone = $billing->getTelephone();
|
181 |
+
|
182 |
+
if ($shipping) {
|
183 |
+
$shippostcode = $shipping->getPostcode();
|
184 |
+
$ship1 = $shipping->getStreet(1);
|
185 |
+
$ship2 = $shipping->getStreet(2);
|
186 |
+
$shipcity = $shipping->getCity();
|
187 |
+
$shipcounty = $shipping->getRegion();
|
188 |
+
$shipcountry = $shipping->getCountry();
|
189 |
+
$shipstate = $shipping->getRegionCode();
|
190 |
+
$shipphone = $shipping->getTelephone();
|
191 |
+
|
192 |
+
} else {
|
193 |
+
$ship1 = $bill1;
|
194 |
+
$ship2 = $bill2;
|
195 |
+
$shipcity = $billcity;
|
196 |
+
$shipcounty = $billregion;
|
197 |
+
$shipcountry = $billcountry;
|
198 |
+
$shippostcode = $billpostcode;
|
199 |
+
$shipstate = $billstate;
|
200 |
+
$shipphone = $billphone;
|
201 |
+
}
|
202 |
+
|
203 |
+
$shasig = "";
|
204 |
+
$shaarray = array();
|
205 |
+
|
206 |
+
if ($pspid != "") { $shaarray['PSPID'] = $pspid; }
|
207 |
+
if ($orderid != "") { $shaarray['ORDERID'] = $orderid; }
|
208 |
+
if ($grandtotal != "") { $shaarray['AMOUNT'] = $grandtotal; }
|
209 |
+
$shaarray['INVDISCOUNT'] = $discountamount;
|
210 |
+
if ($currency != "") { $shaarray['CURRENCY'] = $currency; }
|
211 |
+
if ($locale != "") { $shaarray['LANGUAGE'] = $locale; }
|
212 |
+
if ($name != "") { $shaarray['CN'] = $name; }
|
213 |
+
if ($email != "") { $shaarray['EMAIL'] = $email; }
|
214 |
+
if ($billpostcode != "") { $shaarray['OWNERZIP'] = $billpostcode; }
|
215 |
+
if ($bill1 != "") { $shaarray['OWNERADDRESS'] = $bill1; }
|
216 |
+
if ($billcity != "") { $shaarray['OWNERCTY'] = $billcity; }
|
217 |
+
if ($bill2 != "") { $shaarray['OWNERTOWN'] = $bill2; }
|
218 |
+
if ($billphone != "") { $shaarray['OWNERTELNO'] = $billphone; }
|
219 |
+
if ($orderid != "") { $shaarray['COM'] = 'Payment for Order :-'.$orderid ; }
|
220 |
+
if ($paymentaction != "") { $shaarray['OPERATION'] = $paymentaction ; }
|
221 |
+
|
222 |
+
$cardcv2 = $payment->getCcCid();
|
223 |
+
$cardname = $payment->getCcOwner();
|
224 |
+
$cardnumber = $payment->getCcNumber();
|
225 |
+
$cardissuenumber = $payment->getCcSsIssue();
|
226 |
+
$cardexpmonth = $payment->getCcExpMonth();
|
227 |
+
$cardexpyear = $payment->getCcExpYear();
|
228 |
+
$cardstartmonth = $payment->getCcSsStartMonth();
|
229 |
+
$cardstartyear = $payment->getCcSsStartYear();
|
230 |
+
|
231 |
+
$shaarray['ECI'] = "1";
|
232 |
+
$shaarray['CARDNO'] = $cardnumber;
|
233 |
+
$shaarray['ED'] = $cardexpmonth.$cardexpyear;
|
234 |
+
$shaarray['CVC'] = $cardcv2;
|
235 |
+
|
236 |
+
|
237 |
+
Mage::helper('barclayspspid')->log("Authorize Post Parameters",$shaarray);
|
238 |
+
|
239 |
+
$result = $this->performRequest($shaarray, $url);
|
240 |
+
|
241 |
+
Mage::helper('barclayspspid')->log("Authorize Reply Parameters",$result);
|
242 |
+
|
243 |
+
|
244 |
+
return $result;
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Perform a CURL call and log request end response to logfile
|
252 |
+
*
|
253 |
+
* @param array $params
|
254 |
+
* @return mixed
|
255 |
+
*/
|
256 |
+
public function call($params, $url)
|
257 |
+
{
|
258 |
+
try {
|
259 |
+
$http = new Varien_Http_Adapter_Curl();
|
260 |
+
$config = array('timeout' => 30);
|
261 |
+
$http->setConfig($config);
|
262 |
+
$http->write(Zend_Http_Client::POST, $url, '1.1', array(), http_build_query($params, null, '&'));
|
263 |
+
$response = $http->read();
|
264 |
+
$response = substr($response, strpos($response, "<?xml"), strlen($response));
|
265 |
+
return $response;
|
266 |
+
} catch (Exception $e) {
|
267 |
+
Mage::logException($e);
|
268 |
+
Mage::throwException(
|
269 |
+
Mage::helper('barclayspspid')->__('Barclays server is temporarily not available, please try again later.')
|
270 |
+
);
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
return $response;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Performs a POST request to the Direct Link Gateway with the given
|
279 |
+
* parameters and returns the result parameters as array
|
280 |
+
*
|
281 |
+
* @param array $params
|
282 |
+
* @return array
|
283 |
+
*/
|
284 |
+
public function performRequest($requestParams, $url, $storeId = 0)
|
285 |
+
{
|
286 |
+
$helper = Mage::helper('barclayspspid');
|
287 |
+
$params = $this->getEncodedParametersWithHash(
|
288 |
+
array_merge($requestParams,$this->buildAuthenticationParams($storeId)) //Merge Logic Operation Data with Authentication Data
|
289 |
+
, null, $storeId);
|
290 |
+
|
291 |
+
$responseParams = $this->getResponseParams($params, $url);
|
292 |
+
|
293 |
+
|
294 |
+
|
295 |
+
|
296 |
+
|
297 |
+
$this->checkResponse($responseParams);
|
298 |
+
|
299 |
+
return $responseParams;
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
public function getEncodedParametersWithHash($params, $shaCode=null, $storeId)
|
304 |
+
{
|
305 |
+
$shain = $this->getConfig()->getShain();
|
306 |
+
$shaCode = $shain;
|
307 |
+
|
308 |
+
$params['SHASIGN'] = $this->shaCrypt(iconv('iso-8859-1', 'utf-8', $this->getSHASign($params, $shaCode, $storeId)));
|
309 |
+
|
310 |
+
return $params;
|
311 |
+
}
|
312 |
+
|
313 |
+
|
314 |
+
/**
|
315 |
+
*
|
316 |
+
* wraps the request and response handling and repeats request/response
|
317 |
+
* if there are errors
|
318 |
+
*
|
319 |
+
* @param array $params - request params
|
320 |
+
* @param string $url - the url for the request
|
321 |
+
* @param int $retryCount - current request count
|
322 |
+
* @return array | null - null if requests were not successful, array containing Ogone payment data otherwise
|
323 |
+
*
|
324 |
+
*/
|
325 |
+
protected function getResponseParams($params, $url, $retryCount = 0)
|
326 |
+
{
|
327 |
+
$responseParams = null;
|
328 |
+
|
329 |
+
|
330 |
+
|
331 |
+
if ($retryCount < 3) {
|
332 |
+
try {
|
333 |
+
$responseParams = $this->getParamArrFromXmlString(
|
334 |
+
$this->call($params, $url)
|
335 |
+
);
|
336 |
+
} catch (Exception $e) {
|
337 |
+
|
338 |
+
Mage::helper('barclayspspid')->log('DirectLink::getResponseParams failed: ' .
|
339 |
+
$e->getMessage() . ' current retry count: ' . $retryCount . ' for quote ' .$params['ORDERID']
|
340 |
+
);
|
341 |
+
$responseParams = $this->getResponseParams($params, $url, ++$retryCount);
|
342 |
+
}
|
343 |
+
} else {
|
344 |
+
Mage::throwException(Mage::helper('barclayspspid')->__('An error occured during the Ogone request. Your action could not be executed.'));
|
345 |
+
}
|
346 |
+
return $responseParams;
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Return Authentication Params for OPS Call
|
351 |
+
*
|
352 |
+
* @return array
|
353 |
+
*/
|
354 |
+
protected function buildAuthenticationParams($storeId = 0)
|
355 |
+
{
|
356 |
+
return array(
|
357 |
+
'PSPID' => $this->getConfig()->getPspid(),
|
358 |
+
'USERID' =>$this->getConfig()->getUsername(),
|
359 |
+
'PSWD' => $this->getConfig()->getUserpassword()
|
360 |
+
);
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Parses the XML-String to an array with the result data
|
365 |
+
*
|
366 |
+
* @param string xmlString
|
367 |
+
* @return array
|
368 |
+
*/
|
369 |
+
public function getParamArrFromXmlString($xmlString)
|
370 |
+
{
|
371 |
+
try {
|
372 |
+
$xml = new SimpleXMLElement($xmlString);
|
373 |
+
foreach($xml->attributes() as $key => $value) {
|
374 |
+
$arrAttr[$key] = (string)$value;
|
375 |
+
}
|
376 |
+
foreach($xml->children() as $child) {
|
377 |
+
$arrAttr[$child->getName()] = (string) $child;
|
378 |
+
}
|
379 |
+
return $arrAttr;
|
380 |
+
} catch (Exception $e) {
|
381 |
+
Mage::log('Could not convert string to xml in ' . __FILE__ . '::' . __METHOD__ . ': ' . $xmlString);
|
382 |
+
Mage::logException($e);
|
383 |
+
throw $e;
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Check if the Response from OPS reports Errors
|
389 |
+
*
|
390 |
+
* @param array $responseParams
|
391 |
+
* @return mixed
|
392 |
+
*/
|
393 |
+
public function checkResponse($responseParams)
|
394 |
+
{
|
395 |
+
if (false === is_array($responseParams) || false === array_key_exists('NCERROR', $responseParams) || $responseParams['NCERROR'] > 0) {
|
396 |
+
if (empty($responseParams['NCERRORPLUS'])) {
|
397 |
+
$responseParams['NCERRORPLUS'] = Mage::helper('ops')->__('Invalid payment information')." Errorcode:".$responseParams['NCERROR'];
|
398 |
+
}
|
399 |
+
|
400 |
+
//avoid exception if STATUS is set with special values
|
401 |
+
if (isset($responseParams['STATUS']) && is_numeric($responseParams['STATUS'])) {
|
402 |
+
return;
|
403 |
+
}
|
404 |
+
|
405 |
+
Mage::throwException(
|
406 |
+
Mage::helper('ops')->__('An error occured during the Barclays request. Your action could not be executed. Message: "%s".',$responseParams['NCERRORPLUS'])
|
407 |
+
);
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
/*
|
412 |
+
* Get SHA-1-IN hash for ops-authentification
|
413 |
+
*
|
414 |
+
* All Parameters have to be alphabetically, UPPERCASE
|
415 |
+
* Empty Parameters shouldn't appear in the secure string
|
416 |
+
*
|
417 |
+
* @param array $formFields
|
418 |
+
* @param string $shaCode
|
419 |
+
*
|
420 |
+
* @return string
|
421 |
+
*/
|
422 |
+
public function getSHASign($formFields, $shaCode = null, $storeId = null)
|
423 |
+
{
|
424 |
+
if (is_null($shaCode)) {
|
425 |
+
$shaCode = $this->getConfig()->getShaout();
|
426 |
+
}
|
427 |
+
$formFields = array_change_key_case($formFields, CASE_UPPER);
|
428 |
+
|
429 |
+
unset($formFields['ORDERSHIPMETH']);
|
430 |
+
|
431 |
+
uksort($formFields, 'strnatcasecmp');
|
432 |
+
$plainHashString = '';
|
433 |
+
foreach ($formFields as $formKey => $formVal) {
|
434 |
+
if (is_null($formVal) || '' === $formVal || $formKey == 'SHASIGN') {
|
435 |
+
continue;
|
436 |
+
}
|
437 |
+
$plainHashString .= strtoupper($formKey) . '=' . $formVal . $shaCode;
|
438 |
+
}
|
439 |
+
|
440 |
+
return $plainHashString;
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Crypt Data by SHA1 ctypting algorithm by secret key
|
445 |
+
*
|
446 |
+
* @param array $data
|
447 |
+
* @param string $key
|
448 |
+
*
|
449 |
+
* @return hash
|
450 |
+
*/
|
451 |
+
public function shaCrypt($data, $key = '')
|
452 |
+
{
|
453 |
+
if (is_array($data)) {
|
454 |
+
return hash('SHA1', implode("", $data));
|
455 |
+
}
|
456 |
+
if (is_string($data)) {
|
457 |
+
return hash('SHA1', $data);
|
458 |
+
} else {
|
459 |
+
return "";
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Resource/Eav/Mysql4/Setup.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Juicy_Barclayspspid_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Session.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Session file
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclaysepdq_Model_Session extends Mage_Core_Model_Session_Abstract
|
11 |
+
{
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
$this->init('barclayspspid');
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Source/CardcodeAction.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Config - Mandate CSC Option
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclaysepdq_Model_Source_CardcodeAction
|
11 |
+
{
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
|
15 |
+
$array = array(
|
16 |
+
array('value' => '1', 'label' => Mage::helper('barclayspspid')->__('Yes')),
|
17 |
+
array('value' => '2', 'label' => Mage::helper('barclayspspid')->__('No'))
|
18 |
+
);
|
19 |
+
|
20 |
+
|
21 |
+
return $array;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
?>
|
app/code/local/Juicy/Barclayspspid/Model/Source/CreditCards.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Config - Credit Card Types
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Model_Source_CreditCards
|
11 |
+
{
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
|
15 |
+
|
16 |
+
$array = array(
|
17 |
+
array('value' => 'VISA', 'label' => Mage::helper('barclayspspid')->__('VISA')),
|
18 |
+
array('value' => 'MasterCard', 'label' => Mage::helper('barclayspspid')->__('MasterCard')),
|
19 |
+
array('value' => 'American Express', 'label' => Mage::helper('barclayspspid')->__('American Express')),
|
20 |
+
|
21 |
+
);
|
22 |
+
|
23 |
+
|
24 |
+
return $array;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
?>
|
app/code/local/Juicy/Barclayspspid/Model/Source/CurrencyAction.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Config - Currency Codes
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Model_Source_CurrencyAction
|
11 |
+
{
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
|
15 |
+
$array = array(
|
16 |
+
array('value' => 'GBP', 'label' => Mage::helper('barclayspspid')->__('GBP')),
|
17 |
+
array('value' => 'EUR', 'label' => Mage::helper('barclayspspid')->__('EUR')),
|
18 |
+
array('value' => 'AUD', 'label' => Mage::helper('barclayspspid')->__('AUD')),
|
19 |
+
array('value' => 'CAD', 'label' => Mage::helper('barclayspspid')->__('CAD')),
|
20 |
+
array('value' => 'CNY', 'label' => Mage::helper('barclayspspid')->__('CNY')),
|
21 |
+
array('value' => 'CYR', 'label' => Mage::helper('barclayspspid')->__('CYR')),
|
22 |
+
array('value' => 'CZK', 'label' => Mage::helper('barclayspspid')->__('CZK')),
|
23 |
+
array('value' => 'DKK', 'label' => Mage::helper('barclayspspid')->__('DKK')),
|
24 |
+
array('value' => 'EEK', 'label' => Mage::helper('barclayspspid')->__('EEK')),
|
25 |
+
array('value' => 'HKD', 'label' => Mage::helper('barclayspspid')->__('HKD')),
|
26 |
+
array('value' => 'ISK', 'label' => Mage::helper('barclayspspid')->__('ISK')),
|
27 |
+
array('value' => 'INR', 'label' => Mage::helper('barclayspspid')->__('INR')),
|
28 |
+
array('value' => 'ILS', 'label' => Mage::helper('barclayspspid')->__('ILS')),
|
29 |
+
array('value' => 'JPY', 'label' => Mage::helper('barclayspspid')->__('JPY')),
|
30 |
+
array('value' => 'LVL', 'label' => Mage::helper('barclayspspid')->__('LVL')),
|
31 |
+
array('value' => 'LTL', 'label' => Mage::helper('barclayspspid')->__('LTL')),
|
32 |
+
array('value' => 'MTL', 'label' => Mage::helper('barclayspspid')->__('MTL')),
|
33 |
+
array('value' => 'MAL', 'label' => Mage::helper('barclayspspid')->__('MAL')),
|
34 |
+
array('value' => 'NZD', 'label' => Mage::helper('barclayspspid')->__('NZD')),
|
35 |
+
array('value' => 'NOK', 'label' => Mage::helper('barclayspspid')->__('NOK')),
|
36 |
+
array('value' => 'PLN', 'label' => Mage::helper('barclayspspid')->__('PLN')),
|
37 |
+
array('value' => 'RUB', 'label' => Mage::helper('barclayspspid')->__('RUB')),
|
38 |
+
array('value' => 'SGD', 'label' => Mage::helper('barclayspspid')->__('SGD')),
|
39 |
+
array('value' => 'SKK', 'label' => Mage::helper('barclayspspid')->__('SKK')),
|
40 |
+
array('value' => 'KRW', 'label' => Mage::helper('barclayspspid')->__('KRW')),
|
41 |
+
array('value' => 'SEK', 'label' => Mage::helper('barclayspspid')->__('SEK')),
|
42 |
+
array('value' => 'SEF', 'label' => Mage::helper('barclayspspid')->__('SEF')),
|
43 |
+
array('value' => 'USD', 'label' => Mage::helper('barclayspspid')->__('USD')),
|
44 |
+
array('value' => 'SAR', 'label' => Mage::helper('barclayspspid')->__('SAR')),
|
45 |
+
array('value' => 'PLN', 'label' => Mage::helper('barclayspspid')->__('PLN')),
|
46 |
+
array('value' => 'THB', 'label' => Mage::helper('barclayspspid')->__('THB')),
|
47 |
+
array('value' => 'AED', 'label' => Mage::helper('barclayspspid')->__('AED'))
|
48 |
+
);
|
49 |
+
|
50 |
+
|
51 |
+
return $array;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
?>
|
app/code/local/Juicy/Barclayspspid/Model/Source/PaymentAction.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Config - Payment Action
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (craig.henry@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
class Juicy_Barclayspspid_Model_Source_PaymentAction
|
11 |
+
{
|
12 |
+
public function toOptionArray()
|
13 |
+
{
|
14 |
+
return array(
|
15 |
+
array('value' => 'SAL', 'label' => Mage::helper('barclayspspid')->__('Sale')),
|
16 |
+
array('value' => 'RES', 'label' => Mage::helper('barclayspspid')->__('Authorisation')),
|
17 |
+
);
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Juicy/Barclayspspid/Model/Submitform.php
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Juicy_Barclayspspid_Model_Submitform extends Mage_Payment_Model_Method_Abstract
|
4 |
+
{
|
5 |
+
protected $_liveurl = "https://payments.epdq.co.uk/ncol/prod/orderstandard.asp";
|
6 |
+
protected $_testurl = "https://mdepayments.epdq.co.uk/ncol/test/orderstandard.asp";
|
7 |
+
|
8 |
+
private function licensecheck() {
|
9 |
+
return true;
|
10 |
+
/*$config = Mage::getModel('Juicy_Barclayspspid_Model_Config');
|
11 |
+
|
12 |
+
$licensekey = $config->getConfigData('licensekey');
|
13 |
+
|
14 |
+
$key = "barclayspspju1cy123456";
|
15 |
+
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
16 |
+
|
17 |
+
$salt = $key.$url;
|
18 |
+
$hash = hash("SHA1",$salt);
|
19 |
+
|
20 |
+
if ($hash == $licensekey) {
|
21 |
+
return true;
|
22 |
+
} else {
|
23 |
+
|
24 |
+
$message = "Actual URL:".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
25 |
+
|
26 |
+
$mail = Mage::getModel('core/email');
|
27 |
+
$mail->setToName('Juicy License Notification');
|
28 |
+
$mail->setToEmail('servers@juicymedia.co.uk');
|
29 |
+
$mail->setBody($message);
|
30 |
+
$mail->setSubject('Barclays PSPID Licensing Issue');
|
31 |
+
$mail->setFromEmail('licensing@barclaycard.co.uk');
|
32 |
+
$mail->setFromName("Barclays PSPID Licensing Issue");
|
33 |
+
$mail->setType('html');// YOu can use Html or text as Mail format
|
34 |
+
|
35 |
+
try {
|
36 |
+
$mail->send();
|
37 |
+
}
|
38 |
+
catch (Exception $e) {
|
39 |
+
//var_dump($e>getMessage());
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
return false;
|
44 |
+
}*/
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
*
|
49 |
+
* This constructs the form for submission to the CPI payment page
|
50 |
+
*
|
51 |
+
* @param string $epqdata
|
52 |
+
* @param object $order
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function constructSubmitform($order) {
|
56 |
+
|
57 |
+
if ($this->licensecheck() == false) {
|
58 |
+
$html = "";
|
59 |
+
$html .= "<h1>License Issue</h1>";
|
60 |
+
$html .= "<p>I'm sorry there is a license issue with this extension please contact support at support@juicymedia.co.uk</p>";
|
61 |
+
return $html;
|
62 |
+
}
|
63 |
+
|
64 |
+
$config = Mage::getModel('Juicy_Barclayspspid_Model_Config');
|
65 |
+
|
66 |
+
$pspid = $config->getPspid();
|
67 |
+
$currency = $config->getCurrency();
|
68 |
+
$shain = $config->getShain();
|
69 |
+
//$shaout = $config->getShaout(); /* Unused */
|
70 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
71 |
+
|
72 |
+
$cardtypes = $config->getCardtypes();
|
73 |
+
$cardvalue = str_replace(",",";",$cardtypes);
|
74 |
+
|
75 |
+
$pagetitle = $config->getPagetitle();
|
76 |
+
$bgcolor = $config->getBgcolor();
|
77 |
+
$txtcolor = $config->getTxtcolor();
|
78 |
+
$tblbgcolor = $config->getTblbgcolor();
|
79 |
+
$tbltxtcolor = $config->getTbltxtcolor();
|
80 |
+
$buttonbgcolor = $config->getButtonbgcolor();
|
81 |
+
$buttontxtcolor = $config->getButtontxtcolor();
|
82 |
+
$logo = $config->getLogo();
|
83 |
+
$fonttype = $config->getFonttype();
|
84 |
+
$paymentaction = $config->getPaymentaction();
|
85 |
+
|
86 |
+
$template = $config->getDynamic();
|
87 |
+
$dynamictemplate = $config->getDynamictemplate();
|
88 |
+
|
89 |
+
$url = $this->_liveurl;
|
90 |
+
if ($config->getTestmode() === "1") {
|
91 |
+
$url = $this->_testurl;
|
92 |
+
}
|
93 |
+
|
94 |
+
$basket = $config->getBasket();
|
95 |
+
$delivery = $config->getDelivery();
|
96 |
+
$orderid = $order->getIncrementId();
|
97 |
+
$grandtotal = (int)money_format("%.0n",$order->getBaseGrandTotal() * 100);
|
98 |
+
$email = $order->getCustomerEmail();
|
99 |
+
|
100 |
+
$resulturl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK).'barclayspspid/payment/process/';
|
101 |
+
|
102 |
+
$discountamount = (int) $order->getBaseDiscountAmount() * 100;
|
103 |
+
$shippingBaseTax = (int) money_format("%.0n",$order->getBaseShippingTaxAmount() * 100);
|
104 |
+
$shippingamount = (int) money_format("%.0n",$order->getBaseShippingAmount() * 100);
|
105 |
+
|
106 |
+
$shipping = $order->getShippingAddress();
|
107 |
+
$billing = $order->getBillingAddress();
|
108 |
+
|
109 |
+
$name = $billing->getFirstname().' '.$billing->getLastname();
|
110 |
+
|
111 |
+
$billfirst = $billing->getFirstname();
|
112 |
+
$billlast = $billing->getLastname();
|
113 |
+
|
114 |
+
$shipfirst = substr($shipping->getFirstname(),0,50);
|
115 |
+
$shiplast = substr($shipping->getLastname(),0,50);
|
116 |
+
|
117 |
+
$shippingdescription = $order->getShippingDescription();
|
118 |
+
if (strlen($shippingdescription) > 25){
|
119 |
+
$shippingdescription = substr($shippingdescription,0,25);
|
120 |
+
}
|
121 |
+
|
122 |
+
$bill1 = substr($billing->getStreet(1),0,35);
|
123 |
+
$bill2 = substr($billing->getStreet(2),0,35);
|
124 |
+
$billcity = substr($billing->getCity(),0,25);
|
125 |
+
$billcountry = substr($billing->getCountry(),0,25);
|
126 |
+
$billregion = $billing->getRegion();
|
127 |
+
$billstate = $billing->getRegionCode();
|
128 |
+
$billphone = substr($billing->getTelephone(),0,30);
|
129 |
+
$billpostcode = substr($billing->getPostcode(),0,10);
|
130 |
+
|
131 |
+
if ($shipping) {
|
132 |
+
$ship1 = substr($shipping->getStreet(1),0,35);
|
133 |
+
$ship2 = substr($shipping->getStreet(2),0,35);
|
134 |
+
$shipcity = substr($shipping->getCity(),0,25);
|
135 |
+
$shipcounty = substr($shipping->getRegion(),0,25);
|
136 |
+
$shipcountry = substr($shipping->getCountry(),0,25);
|
137 |
+
$shipstate = $shipping->getRegionCode();
|
138 |
+
$shipphone = substr($shipping->getTelephone(),0,30);
|
139 |
+
$shippostcode = substr($shipping->getPostcode(),0,10);
|
140 |
+
} else {
|
141 |
+
$ship1 = $bill1;
|
142 |
+
$ship2 = $bill2;
|
143 |
+
$shipcity = $billcity;
|
144 |
+
$shipcounty = $billregion;
|
145 |
+
$shipcountry = $billcountry;
|
146 |
+
$shipstate = $billstate;
|
147 |
+
$shipphone = $billphone;
|
148 |
+
$shippostcode = $billpostcode;
|
149 |
+
}
|
150 |
+
|
151 |
+
$shasig = "";
|
152 |
+
$shaarray = array();
|
153 |
+
$urlz = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, array('_secure'=>true)).'barclayspspid/payment/dynamic';
|
154 |
+
|
155 |
+
$shaarray['ACCEPTURL'] = $resulturl;
|
156 |
+
$shaarray['DECLINEURL'] = $resulturl;
|
157 |
+
$shaarray['EXCEPTIONURL'] = $resulturl;
|
158 |
+
|
159 |
+
//isset($pspid) ? $shaarray['PSPID'] = $pspid : ""; /* Why not? */
|
160 |
+
if ($pspid != "") { $shaarray['PSPID'] = $pspid; }
|
161 |
+
if ($orderid != "") { $shaarray['ORDERID'] = $orderid; }
|
162 |
+
if ($grandtotal != "") { $shaarray['AMOUNT'] = $grandtotal; }
|
163 |
+
$shaarray['INVDISCOUNT'] = $discountamount;
|
164 |
+
if ($currency != "") { $shaarray['CURRENCY'] = $currency; }
|
165 |
+
if ($locale != "") { $shaarray['LANGUAGE'] = $locale; }
|
166 |
+
if ($name != "") { $shaarray['CN'] = $name; }
|
167 |
+
if ($email != "") { $shaarray['EMAIL'] = $email; }
|
168 |
+
if ($billpostcode != "") { $shaarray['OWNERZIP'] = $billpostcode; }
|
169 |
+
if ($bill1 != "") { $shaarray['OWNERADDRESS'] = $bill1; }
|
170 |
+
$shaarray['OWNERCTY'] = $billcountry;
|
171 |
+
if ($bill2 != "") { $shaarray['OWNERTOWN'] = $bill2; }
|
172 |
+
if ($billphone != "") { $shaarray['OWNERTELNO'] = $billphone; }
|
173 |
+
if ($cardvalue != "") { $shaarray['PMLIST'] = $cardvalue; }
|
174 |
+
if ($orderid != "") { $shaarray['COM'] = 'Payment for Order :-'.$orderid ; }
|
175 |
+
if ($paymentaction != "") { $shaarray['OPERATION'] = $paymentaction ; }
|
176 |
+
|
177 |
+
if ($template == "1"){
|
178 |
+
if ($dynamictemplate != "") { $shaarray['TP'] = $urlz; }
|
179 |
+
}else{
|
180 |
+
if ($pagetitle != "") { $shaarray['TITLE'] = $pagetitle; }
|
181 |
+
if ($bgcolor != "") { $shaarray['BGCOLOR'] = $bgcolor; }
|
182 |
+
if ($txtcolor != "") { $shaarray['TXTCOLOR'] = $txtcolor; }
|
183 |
+
if ($tblbgcolor != "") { $shaarray['TBLBGCOLOR'] = $tblbgcolor; }
|
184 |
+
if ($tbltxtcolor != "") { $shaarray['TBLTXTCOLOR'] = $tbltxtcolor; }
|
185 |
+
if ($buttonbgcolor != "") { $shaarray['BUTTONBGCOLOR'] = $buttonbgcolor; }
|
186 |
+
if ($buttontxtcolor != "") { $shaarray['BUTTONTXTCOLOR'] = $buttontxtcolor; }
|
187 |
+
if ($logo != "") { $shaarray['LOGO'] = $logo; }
|
188 |
+
if ($fonttype != "") { $shaarray['FONTTYPE'] = $fonttype; }
|
189 |
+
}
|
190 |
+
if ($shippingdescription != "") { $shaarray['ORDERSHIPMETH'] = $shippingdescription; }
|
191 |
+
|
192 |
+
$shaarray['ORDERSHIPCOST'] = $shippingamount;
|
193 |
+
$shaarray['ORDERSHIPTAX'] = $shippingBaseTax;
|
194 |
+
/*if ($shippingamount != "") {
|
195 |
+
$shaarray['ORDERSHIPCOST'] = $shippingamount;
|
196 |
+
$shaarray['ORDERSHIPTAX'] = $shippingBaseTax;
|
197 |
+
}*/
|
198 |
+
//if ($shippingamount != "") { $shaarray['ORDERSHIPCOST'] = $shippingcost; }
|
199 |
+
|
200 |
+
if ($delivery == "1") {
|
201 |
+
if ($billfirst != "") { $shaarray['ECOM_BILLTO_POSTAL_NAME_FIRST'] = $billfirst; }
|
202 |
+
if ($billlast != "") { $shaarray['ECOM_BILLTO_POSTAL_NAME_LAST'] = $billlast; }
|
203 |
+
if ($bill1 != "") { $shaarray['ECOM_BILLTO_POSTAL_STREET_LINE1'] = $bill1; }
|
204 |
+
if ($billcity != "") { $shaarray['ECOM_BILLTO_POSTAL_CITY'] = $billcity; }
|
205 |
+
if ($billpostcode != "") { $shaarray['ECOM_BILLTO_POSTAL_POSTALCODE'] = $billpostcode; }
|
206 |
+
if ($billcountry != "") { $shaarray['ECOM_BILLTO_POSTAL_COUNTRYCODE'] = $billcountry; }
|
207 |
+
if ($shipfirst != "") { $shaarray['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shipfirst; }
|
208 |
+
if ($shiplast != "") { $shaarray['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shiplast; }
|
209 |
+
if ($ship1 != "") { $shaarray['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $ship1; }
|
210 |
+
if ($shipcity != "") { $shaarray['ECOM_SHIPTO_POSTAL_CITY'] = $shipcity; }
|
211 |
+
if ($shippostcode != "") { $shaarray['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippostcode; }
|
212 |
+
if ($shipcountry != "") { $shaarray['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shipcountry; }
|
213 |
+
if ($email != "") { $shaarray['ECOM_SHIPTO_ONLINE_EMAIL'] = $email; }
|
214 |
+
}
|
215 |
+
if ($basket == "1") {
|
216 |
+
$counter = 1;
|
217 |
+
$items = $order->getAllItems();
|
218 |
+
if ($items) {
|
219 |
+
foreach($items as $item) {
|
220 |
+
if ($item->getParentItem()) {
|
221 |
+
continue;
|
222 |
+
}
|
223 |
+
$quantity = $item->getQtyOrdered();
|
224 |
+
$ordername = $item->getName();
|
225 |
+
$sku = $item->getSku();
|
226 |
+
$cost = sprintf('%.2f', $item->getPrice() - $item->getBaseDiscountAmount());
|
227 |
+
$vat = sprintf('%.2f', $item->getBaseTaxAmount());
|
228 |
+
//$cost = (int)$cost * 100;
|
229 |
+
$shaarray['ITEMID'.$counter] = $sku;
|
230 |
+
$shaarray['ITEMNAME'.$counter] = $ordername;
|
231 |
+
$shaarray['ITEMPRICE'.$counter] = $cost;
|
232 |
+
$shaarray['ITEMVAT'.$counter] = ($vat/$quantity);
|
233 |
+
$shaarray['ITEMQUANT'.$counter] = (int)$quantity;
|
234 |
+
$counter++;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
ksort($shaarray);
|
240 |
+
foreach ($shaarray as $key => $value) {
|
241 |
+
$shasig .= $key.'='.utf8_encode($value).$shain;
|
242 |
+
}
|
243 |
+
|
244 |
+
$shasigpre = $shasig;
|
245 |
+
$shahash = hash('sha1',$shasigpre);
|
246 |
+
$shasig = strtoupper($shahash);
|
247 |
+
|
248 |
+
$html = '<form id="form1" name="form1" action="'.$url.'" method="post">';
|
249 |
+
$html .= '<input type="hidden" name="ACCEPTURL" value="'.$resulturl.'">';
|
250 |
+
$html .= '<input type="hidden" name="DECLINEURL" value="'.$resulturl.'">';
|
251 |
+
$html .= '<input type="hidden" name="EXCEPTIONURL" value="'.$resulturl.'">';
|
252 |
+
$html .= '<input type="hidden" name="AMOUNT" value="'.$grandtotal.'">';
|
253 |
+
$html .= '<input type="hidden" name="INVDISCOUNT" value="'.$discountamount.'">';
|
254 |
+
$html .= '<input type="hidden" name="CN" value="'.$name.'">';
|
255 |
+
$html .= '<input type="hidden" name="COM" value="Payment for Order :-'.$orderid.'">';
|
256 |
+
$html .= '<input type="hidden" name="CURRENCY" value="'.$currency.'">';
|
257 |
+
$html .= '<input type="hidden" name="EMAIL" value="'.$email.'">';
|
258 |
+
$html .= '<input type="hidden" name="LANGUAGE" value="'.$locale.'">';
|
259 |
+
$html .= '<input type="hidden" name="ORDERID" value="'.$orderid.'">';
|
260 |
+
$html .= '<input type="hidden" name="OPERATION" value="'.$paymentaction.'">';
|
261 |
+
$html .= '<input type="hidden" name="OWNERADDRESS" value="'.$bill1.'">';
|
262 |
+
$html .= '<input type="hidden" name="OWNERCTY" value="'.$billcountry.'">';
|
263 |
+
$html .= '<input type="hidden" name="OWNERTELNO" value="'.$billphone.'">';
|
264 |
+
$html .= '<input type="hidden" name="OWNERTOWN" value="'.$bill2.'">';
|
265 |
+
$html .= '<input type="hidden" name="OWNERZIP" value="'.$billpostcode.'">';
|
266 |
+
$html .= '<input type="hidden" name="PMLIST" value="'.$cardvalue.'">';
|
267 |
+
$html .= '<input type="hidden" name="PSPID" value="'.$pspid.'">';
|
268 |
+
$html .= '<input type="hidden" name="SHASIGN" value="'.$shasig.'">';
|
269 |
+
$html .= '<input type="hidden" name="ORDERSHIPMETH" value="'.$shippingdescription.'">';
|
270 |
+
$html .= '<input type="hidden" name="ORDERSHIPCOST" value="'.$shippingamount.'">';
|
271 |
+
$html .= '<input type="hidden" name="ORDERSHIPTAX" value="'.$shippingBaseTax.'">';
|
272 |
+
|
273 |
+
if ($template == "1"){
|
274 |
+
$html .= '<input type="hidden" name="TP" value="'.$urlz.'">';
|
275 |
+
}else{
|
276 |
+
$html .= '<input type="hidden" name="TITLE" value="'.$pagetitle.'">';
|
277 |
+
$html .= '<input type="hidden" name="BGCOLOR" value="'.$bgcolor.'">';
|
278 |
+
$html .= '<input type="hidden" name="TXTCOLOR" value="'.$txtcolor.'">';
|
279 |
+
$html .= '<input type="hidden" name="TBLBGCOLOR" value="'.$tblbgcolor.'">';
|
280 |
+
$html .= '<input type="hidden" name="TBLTXTCOLOR" value="'.$tbltxtcolor.'">';
|
281 |
+
$html .= '<input type="hidden" name="BUTTONBGCOLOR" value="'.$buttonbgcolor.'">';
|
282 |
+
$html .= '<input type="hidden" name="BUTTONTXTCOLOR" value="'.$buttontxtcolor.'">';
|
283 |
+
$html .= '<input type="hidden" name="LOGO" value="'.$logo.'">';
|
284 |
+
$html .= '<input type="hidden" name="FONTTYPE" value="'.$fonttype.'">';
|
285 |
+
}
|
286 |
+
|
287 |
+
if ($delivery == "1"){
|
288 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_ONLINE_EMAIL" value="'.$email.'">';
|
289 |
+
$html .= '<input type="hidden" name="ECOM_BILLTO_POSTAL_NAME_FIRST" value="'.$billfirst.'">';
|
290 |
+
$html .= '<input type="hidden" name="ECOM_BILLTO_POSTAL_NAME_LAST" value="'.$billlast.'">';
|
291 |
+
$html .= '<input type="hidden" name="ECOM_BILLTO_POSTAL_STREET_LINE1" value="'.$bill1.'">';
|
292 |
+
$html .= '<input type="hidden" name="ECOM_BILLTO_POSTAL_CITY" value="'.$billcity.'">';
|
293 |
+
$html .= '<input type="hidden" name="ECOM_BILLTO_POSTAL_POSTALCODE" value="'.$billpostcode.'">';
|
294 |
+
$html .= '<input type="hidden" name="ECOM_BILLTO_POSTAL_COUNTRYCODE" value="'.$billcountry.'">';
|
295 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_POSTAL_NAME_FIRST" value="'.$shipfirst.'">';
|
296 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_POSTAL_NAME_LAST" value="'.$shiplast.'">';
|
297 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_POSTAL_STREET_LINE1" value="'.$ship1.'">';
|
298 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_POSTAL_CITY" value="'.$shipcity.'">';
|
299 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_POSTAL_POSTALCODE" value="'.$shippostcode.'">';
|
300 |
+
$html .= '<input type="hidden" name="ECOM_SHIPTO_POSTAL_COUNTRYCODE" value="'.$shipcountry.'">';
|
301 |
+
}
|
302 |
+
if ($basket == "1") {
|
303 |
+
$counter = 1;
|
304 |
+
$items = $order->getAllItems();
|
305 |
+
if ($items){
|
306 |
+
foreach($items as $item){
|
307 |
+
if ($item->getParentItem()){
|
308 |
+
continue;
|
309 |
+
}
|
310 |
+
|
311 |
+
$quantity = $item->getQtyOrdered();
|
312 |
+
$ordername = $item->getName();
|
313 |
+
$sku = $item->getSku();
|
314 |
+
$cost = sprintf('%.2f', $item->getPrice() - $item->getBaseDiscountAmount());
|
315 |
+
$vat = sprintf('%.2f', $item->getBaseTaxAmount());
|
316 |
+
//$cost = (int)$cost * 100;
|
317 |
+
$html .= '<input type="hidden" name="ITEMID'.$counter.'" value="'.$sku.'">';
|
318 |
+
$html .= '<input type="hidden" name="ITEMNAME'.$counter.'" value="'.$ordername.'">';
|
319 |
+
$html .= '<input type="hidden" name="ITEMPRICE'.$counter.'" value="'.$cost.'">';
|
320 |
+
$html .= '<input type="hidden" name="ITEMVAT'.$counter.'" value="'.($vat/$quantity).'">';
|
321 |
+
$html .= '<input type="hidden" name="ITEMQUANT'.$counter.'" value="'.(int)$quantity.'">';
|
322 |
+
$counter++;
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
$html .= '</form>';
|
327 |
+
|
328 |
+
Mage::helper('barclayspspid')->log("HASH",$shahash);
|
329 |
+
Mage::helper('barclayspspid')->log("SHASIGN",$shasig);
|
330 |
+
Mage::helper('barclayspspid')->log("SHA ARRAY",$shaarray);
|
331 |
+
Mage::helper('barclayspspid')->log("FORM POST",$html);
|
332 |
+
//Mage::helper('barclayspspid')->log("SHASIGN PRE",$shasigpre);
|
333 |
+
/*
|
334 |
+
Mage::log("Juicy_Barclayspspid_Model_Submitform: HASH:\n".$shahash, null, 'barclays-pspid.log');
|
335 |
+
Mage::log("Juicy_Barclayspspid_Model_Submitform: SHASIGN PRE:\n".$shasigpre, null, 'barclays-pspid.log');
|
336 |
+
Mage::log("Juicy_Barclayspspid_Model_Submitform: SHASIGN:\n".$shasig, null, 'barclays-pspid.log');
|
337 |
+
Mage::log("Juicy_Barclayspspid_Model_Submitform: SHA ARRAY:\n".$shaarray, null, 'barclays-pspid.log');
|
338 |
+
*/
|
339 |
+
return $html;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
?>
|
app/code/local/Juicy/Barclayspspid/controllers/PaymentController.php
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Standard controller that does the work of handling payments
|
4 |
+
*
|
5 |
+
* @copyright Juicy Media Ltd, 2011
|
6 |
+
* @license Commercial, visit: www.juicyextensions.co.uk
|
7 |
+
* @author chenry (support@juicymedia.co.uk)
|
8 |
+
* @version 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Juicy_Barclayspspid_PaymentController extends Mage_Core_Controller_Front_Action
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* @var boolean $isValidResponse
|
16 |
+
*/
|
17 |
+
public $isValidResponse = false;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get singleton with sagepay strandard
|
21 |
+
*
|
22 |
+
* @return object Juicy_Barclayscpi_Model_Standard
|
23 |
+
*/
|
24 |
+
public function getStandard()
|
25 |
+
{
|
26 |
+
return Mage::getSingleton('Juicy_Barclayspspid_Model_Barclayspspid');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get Config model
|
31 |
+
*
|
32 |
+
* @return object Juicy_Barclayscpi_Model_Config
|
33 |
+
*/
|
34 |
+
public function getConfig()
|
35 |
+
{
|
36 |
+
return $this->getStandard()->getConfig();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Return debug flag
|
41 |
+
*
|
42 |
+
* @return boolean
|
43 |
+
*/
|
44 |
+
public function getDebug()
|
45 |
+
{
|
46 |
+
return $this->getStandard()->getDebug();
|
47 |
+
}
|
48 |
+
|
49 |
+
public function dynamicAction()
|
50 |
+
{
|
51 |
+
$config = $this->getConfig();
|
52 |
+
$form = $config->getDynamictemplate();
|
53 |
+
|
54 |
+
|
55 |
+
$header = $config->getMagheader();
|
56 |
+
|
57 |
+
if ($header == "1") {
|
58 |
+
|
59 |
+
$this->loadLayout();
|
60 |
+
|
61 |
+
$block = $this->getLayout()->createBlock('Juicy_Barclayspspid_Block_Dynamic')->setformhtml($form);
|
62 |
+
|
63 |
+
$template = Mage::getConfig()->getNode('global/page/layouts/one_column/template');
|
64 |
+
$this->getLayout()->getBlock('root')->setTemplate($template);
|
65 |
+
$this->getLayout()->getBlock('content')->append($block);
|
66 |
+
|
67 |
+
$this->renderLayout();
|
68 |
+
|
69 |
+
} else {
|
70 |
+
$this->getResponse()
|
71 |
+
->setBody($this->getLayout()
|
72 |
+
->createBlock('Juicy_Barclayspspid_Block_Dynamic')
|
73 |
+
->setformhtml($form)
|
74 |
+
->toHtml());
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/**
|
83 |
+
* When a customer chooses Barclays CPI on Checkout/Payment page
|
84 |
+
*
|
85 |
+
*/
|
86 |
+
public function redirectAction()
|
87 |
+
{
|
88 |
+
|
89 |
+
$this->loadLayout(false);
|
90 |
+
$post = $this->getRequest()->getPost();
|
91 |
+
|
92 |
+
|
93 |
+
$session = Mage::getSingleton('Mage_Checkout_Model_Session');
|
94 |
+
$session->setBarclaysQuoteID($session->getQuoteId());
|
95 |
+
|
96 |
+
//Tell us the customer went to Barclays
|
97 |
+
$order = Mage::getModel('Mage_Sales_Model_Order');
|
98 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
99 |
+
$order->addStatusToHistory(
|
100 |
+
$order->getStatus(),
|
101 |
+
Mage::helper('barclayspspid')->__('Customer was redirected to Barclays ePDQ')
|
102 |
+
);
|
103 |
+
$order->save();
|
104 |
+
|
105 |
+
//Get figures
|
106 |
+
$grandtotal = $order->getBaseGrandTotal();
|
107 |
+
//Mage::log('Juicy_Barclayspspid_PaymentController: redirectAction: gt = '.$grandtotal, null, 'barclays-pspid.log');
|
108 |
+
|
109 |
+
$formz = Mage::getModel('Juicy_Barclayspspid_Model_Submitform');
|
110 |
+
|
111 |
+
$orderid = $session->getLastRealOrderId();
|
112 |
+
|
113 |
+
//Mage::log('Juicy_Barclayspspid_PaymentController: redirectAction: oid = '.$orderid, null, 'barclays-pspid.log');
|
114 |
+
|
115 |
+
//Construct the from
|
116 |
+
$form = $formz->constructSubmitform($order);
|
117 |
+
|
118 |
+
|
119 |
+
//display form in block and redirect
|
120 |
+
$this->getResponse()
|
121 |
+
->setBody($this->getLayout()
|
122 |
+
->createBlock('Juicy_Barclayspspid_Block_Redirect')
|
123 |
+
->setOrder($order)
|
124 |
+
->setepdqform($form)
|
125 |
+
->toHtml());
|
126 |
+
|
127 |
+
$session->unsQuoteId();
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
public function processAction() {
|
132 |
+
|
133 |
+
$postData = $this->getRequest()->getParams();
|
134 |
+
|
135 |
+
Mage::helper('barclayspspid')->log("Front End Post Back",$postData);
|
136 |
+
|
137 |
+
$standard = Mage::getModel('Juicy_Barclayspspid_Model_Barclayspspid');
|
138 |
+
|
139 |
+
$verify = $standard->checkShaout($postData);
|
140 |
+
|
141 |
+
|
142 |
+
$order = Mage::getModel('Mage_Sales_Model_Order');
|
143 |
+
$order->load($postData['orderID'], "increment_id");
|
144 |
+
|
145 |
+
|
146 |
+
if ($verify == true) {
|
147 |
+
|
148 |
+
$status = (int)$postData['STATUS'];
|
149 |
+
|
150 |
+
if ($status == 5 || $status == 9) {
|
151 |
+
$order->getPayment()->setTransactionId($postData['PAYID']);
|
152 |
+
$order->getPayment()->setadditional_data(serialize($postData));
|
153 |
+
$order->addStatusToHistory(
|
154 |
+
$order->getStatus(),
|
155 |
+
Mage::helper('barclayspspid')->__('Customer successfully returned from Barclays ePDQ')
|
156 |
+
);
|
157 |
+
|
158 |
+
if ($status == 9) {
|
159 |
+
if ($order->canInvoice()) {
|
160 |
+
$invoice = $order->prepareInvoice();
|
161 |
+
$invoice->register()->capture();
|
162 |
+
Mage::getModel('Mage_Core_Model_Resource_Transaction')
|
163 |
+
->addObject($invoice)
|
164 |
+
->addObject($invoice->getOrder())
|
165 |
+
->save();
|
166 |
+
}
|
167 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
168 |
+
$order->save();
|
169 |
+
} else {
|
170 |
+
if ($order->canInvoice()) {
|
171 |
+
$invoice = $order->prepareInvoice();
|
172 |
+
$invoice->register();
|
173 |
+
Mage::getModel('Mage_Core_Model_Resource_Transaction')
|
174 |
+
->addObject($invoice)
|
175 |
+
->addObject($invoice->getOrder())
|
176 |
+
->save();
|
177 |
+
}
|
178 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'barclayspspid_authorized', "Transaction was successfully pre-authorized", true);
|
179 |
+
$order->save();
|
180 |
+
|
181 |
+
}
|
182 |
+
$session = Mage::getModel("Mage_Checkout_Model_Session");
|
183 |
+
$session->addSuccess('Your Order was Successfully processed and the authorisation code was '.$postData['ACCEPTANCE']);
|
184 |
+
|
185 |
+
// PKD added to send customer notification of new order
|
186 |
+
try
|
187 |
+
{
|
188 |
+
$order->sendNewOrderEmail();
|
189 |
+
|
190 |
+
} catch (Exception $ex) { }
|
191 |
+
|
192 |
+
$this->_redirect('checkout/onepage/success');
|
193 |
+
|
194 |
+
} else {
|
195 |
+
$order->getPayment()->setadditional_data(serialize($postData));
|
196 |
+
$order->addStatusToHistory(
|
197 |
+
$order->getStatus(),
|
198 |
+
Mage::helper('barclayspspid')->__('Transaction was cancelled due to unsuccessful payment')
|
199 |
+
);
|
200 |
+
$session = Mage::getModel("Mage_Checkout_Model_Session");
|
201 |
+
$session->addError('Transaction was cancelled due to unsuccessful payment');
|
202 |
+
$order->cancel();
|
203 |
+
$order->save();
|
204 |
+
$this->_redirect('checkout/onepage/failure');
|
205 |
+
}
|
206 |
+
|
207 |
+
} else {
|
208 |
+
$order->getPayment()->setadditional_data(serialize($postData));
|
209 |
+
$order->addStatusToHistory(
|
210 |
+
$order->getStatus(),
|
211 |
+
Mage::helper('barclayspspid')->__('There was a verification issue and the order was cancelled')
|
212 |
+
);
|
213 |
+
$session = Mage::getModel("Mage_Checkout_Model_Session");
|
214 |
+
$session->addError('There was a verification issue and the order was cancelled');
|
215 |
+
$order->cancel();
|
216 |
+
$order->save();
|
217 |
+
$this->_redirect('barclayspspid/payment/failure');
|
218 |
+
}
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
|
224 |
+
|
225 |
+
/**
|
226 |
+
*
|
227 |
+
* This displays the failure page
|
228 |
+
*/
|
229 |
+
public function failureAction()
|
230 |
+
{
|
231 |
+
$session = Mage::getSingleton('Mage_Checkout_Model_Session');
|
232 |
+
|
233 |
+
if (!$session->getErrorMessage()) {
|
234 |
+
$this->_redirect('checkout/cart');
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
|
238 |
+
$this->loadLayout();
|
239 |
+
$this->renderLayout();
|
240 |
+
}
|
241 |
+
|
242 |
+
}
|
app/code/local/Juicy/Barclayspspid/controllers/RefundController.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Juicy_Barclayspspid_RefundController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function testAction()
|
6 |
+
{
|
7 |
+
die();
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Juicy/Barclayspspid/etc/adminhtml.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
To change this license header, choose License Headers in Project Properties.
|
4 |
+
To change this template file, choose Tools | Templates
|
5 |
+
and open the template in the editor.
|
6 |
+
-->
|
7 |
+
|
8 |
+
|
9 |
+
<config>
|
10 |
+
<menu>
|
11 |
+
<juicy>
|
12 |
+
<title>Juicy Media</title>
|
13 |
+
<sort_order>72</sort_order>
|
14 |
+
<children>
|
15 |
+
<barclayspspid module="barclayspspid">
|
16 |
+
<title>Barclays PSPID</title>
|
17 |
+
<sort_order>3</sort_order>
|
18 |
+
<children>
|
19 |
+
<barclayspspid_manager module="barclayspspid">
|
20 |
+
<title>Payment Gateway Manager</title>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
<action>adminhtml/system_config/edit/section/payment</action>
|
23 |
+
</barclayspspid_manager>
|
24 |
+
</children>
|
25 |
+
</barclayspspid>
|
26 |
+
</children>
|
27 |
+
</juicy>
|
28 |
+
</menu>
|
29 |
+
<acl>
|
30 |
+
<resources>
|
31 |
+
<all>
|
32 |
+
<title>Allow Everything</title>
|
33 |
+
</all>
|
34 |
+
<admin>
|
35 |
+
<children>
|
36 |
+
<system>
|
37 |
+
<children>
|
38 |
+
<config>
|
39 |
+
<children>
|
40 |
+
<barclayspspid module="barclayspspid">
|
41 |
+
<title>Barclays PSPID Config</title>
|
42 |
+
<sort_order>99</sort_order>
|
43 |
+
</barclayspspid>
|
44 |
+
</children>
|
45 |
+
</config>
|
46 |
+
</children>
|
47 |
+
</system>
|
48 |
+
</children>
|
49 |
+
</admin>
|
50 |
+
</resources>
|
51 |
+
</acl>
|
52 |
+
</config>
|
53 |
+
|
app/code/local/Juicy/Barclayspspid/etc/adminhtml/acl.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<acl>
|
3 |
+
<resources>
|
4 |
+
<resource id="Mage_Adminhtml::admin">
|
5 |
+
<resource id="Mage_Adminhtml::system">
|
6 |
+
<resource id="Mage_Adminhtml::config">
|
7 |
+
<resource id="Juicy_Barclayspspid::barclayspspid" module="Juicy_Barclayspspid" title="Juicy Media Barclyse PSPID Settings" />
|
8 |
+
</resource>
|
9 |
+
</resource>
|
10 |
+
</resource>
|
11 |
+
</resources>
|
12 |
+
</acl>
|
13 |
+
</config>
|
app/code/local/Juicy/Barclayspspid/etc/adminhtml/system.xml
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<!--
|
3 |
+
<system>
|
4 |
+
<section id="payment" translate="label" module="Mage_Payment" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1">
|
5 |
+
<label>Payment Methods</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<resource>Mage_Payment::payment</resource>
|
8 |
+
<group id="barclayspspid_standard" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
|
9 |
+
<label>Barclays EPDQ PSPID by Juicy Media</label>
|
10 |
+
|
11 |
+
<field id="active" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
|
12 |
+
<label>Enabled</label>
|
13 |
+
<comment>Enables the PSP form plugin</comment>
|
14 |
+
<source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
|
15 |
+
</field>
|
16 |
+
|
17 |
+
<field id="paymentaction" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0">
|
18 |
+
<label>Authorisation Mode</label>
|
19 |
+
<source_model>Juicy_Barclayspspid_Model_Source_PaymentAction</source_model>
|
20 |
+
</field>
|
21 |
+
|
22 |
+
<field id="testmode" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0">
|
23 |
+
<label>Test Mode</label>
|
24 |
+
<comment>No will send the transction in live mode, Yes will send the transaction in live mode</comment>
|
25 |
+
<source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
|
26 |
+
</field>
|
27 |
+
|
28 |
+
<field id="cardtypes" translate="label" type="multiselect" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0">
|
29 |
+
<label>Accepted Credit Cards</label>
|
30 |
+
<source_model>Juicy_Barclayspspid_Model_Source_CreditCards</source_model>
|
31 |
+
</field>
|
32 |
+
|
33 |
+
<field id="title" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0">
|
34 |
+
<label>Title</label>
|
35 |
+
</field>
|
36 |
+
|
37 |
+
<field id="currency" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0">
|
38 |
+
<label>Currency</label>
|
39 |
+
<source_model>Juicy_Barclayspspid_Model_Source_CurrencyAction</source_model>
|
40 |
+
</field>
|
41 |
+
|
42 |
+
<field id="pspid" translate="label" type="text" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0">
|
43 |
+
<label>PSP ID</label>
|
44 |
+
</field>
|
45 |
+
|
46 |
+
<field id="shain" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="0">
|
47 |
+
<label>SHA-IN</label>
|
48 |
+
</field>
|
49 |
+
|
50 |
+
<field id="shaout" translate="label" type="text" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="0">
|
51 |
+
<label>SHA-OUT</label>
|
52 |
+
</field>
|
53 |
+
|
54 |
+
<field id="pagetitle" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
|
55 |
+
<label>Payment Page - Title</label>
|
56 |
+
</field>
|
57 |
+
|
58 |
+
<field id="bgcolor" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="0">
|
59 |
+
<label>Payment Page - Background Colour</label>
|
60 |
+
</field>
|
61 |
+
|
62 |
+
<field id="txtcolor" translate="label" type="text" sortOrder="12" showInDefault="1" showInWebsite="1" showInStore="0">
|
63 |
+
<label>Payment Page - Text Colour</label>
|
64 |
+
</field>
|
65 |
+
|
66 |
+
<field id="tblbgcolor" translate="label" type="text" sortOrder="13" showInDefault="1" showInWebsite="1" showInStore="0">
|
67 |
+
<label>Payment Page - Table Background Colour</label>
|
68 |
+
</field>
|
69 |
+
|
70 |
+
<field id="tbltxtcolor" translate="label" type="text" sortOrder="14" showInDefault="1" showInWebsite="1" showInStore="0">
|
71 |
+
<label>Paymnet Page - Table Text Colour</label>
|
72 |
+
</field>
|
73 |
+
|
74 |
+
<field id="buttonbgcolor" translate="label" type="text" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
|
75 |
+
<label>Paymnet Page - Button Background Colour</label>
|
76 |
+
</field>
|
77 |
+
|
78 |
+
<field id="buttontxtcolor" translate="label" type="text" sortOrder="16" showInDefault="1" showInWebsite="1" showInStore="0">
|
79 |
+
<label>Paymnet Page - Button Text Colour</label>
|
80 |
+
</field>
|
81 |
+
|
82 |
+
<field id="logo" translate="label" type="text" sortOrder="17" showInDefault="1" showInWebsite="1" showInStore="0">
|
83 |
+
<label>Paymnet Page - Logo</label>
|
84 |
+
</field>
|
85 |
+
|
86 |
+
<field id="fonttype" translate="label" type="text" sortOrder="18" showInDefault="1" showInWebsite="1" showInStore="0">
|
87 |
+
<label>Paymnet Page - Font Type</label>
|
88 |
+
</field>
|
89 |
+
|
90 |
+
|
91 |
+
<field id="basket" translate="label comment" type="select" sortOrder="19" showInDefault="1" showInWebsite="1" showInStore="0">
|
92 |
+
<label>Send Basket Info?</label>
|
93 |
+
<comment>Sends basket info</comment>
|
94 |
+
<source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
|
95 |
+
</field>
|
96 |
+
|
97 |
+
<field id="delivery" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
|
98 |
+
<label>Send Delivery Info?</label>
|
99 |
+
<comment>Send Delivery Info</comment>
|
100 |
+
<source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
|
101 |
+
</field>
|
102 |
+
|
103 |
+
|
104 |
+
<field id="dynamic" translate="label comment" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="0">
|
105 |
+
<label>Send Dynamic Template?</label>
|
106 |
+
<comment>Sends a dynamic template to Barclays</comment>
|
107 |
+
<source_model>Mage_Backend_Model_Config_Source_Yesno</source_model>
|
108 |
+
</field>
|
109 |
+
|
110 |
+
<field id="dynamictemplate" translate="label" type="textarea" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="0">
|
111 |
+
<label>Dynamic Template Content</label>
|
112 |
+
</field>
|
113 |
+
|
114 |
+
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="23" showInDefault="1" showInWebsite="1" showInStore="0">
|
115 |
+
<label>Payment from Applicable Countries</label>
|
116 |
+
<source_model>Mage_Payment_Model_Config_Source_Allspecificcountries</source_model>
|
117 |
+
</field>
|
118 |
+
|
119 |
+
<field id="specificcountry" translate="label" type="multiselect" sortOrder="24" showInDefault="1" showInWebsite="1" showInStore="0">
|
120 |
+
<label>Payment from Specific Countries</label>
|
121 |
+
<source_model>Mage_Directory_Model_Config_Source_Country</source_model>
|
122 |
+
<can_be_empty>1</can_be_empty>
|
123 |
+
</field>
|
124 |
+
|
125 |
+
|
126 |
+
<field id="sort_order" translate="label" type="text" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="0">
|
127 |
+
<label>Sort Order</label>
|
128 |
+
<frontend_class>validate-number</frontend_class>
|
129 |
+
</field>
|
130 |
+
|
131 |
+
|
132 |
+
</group>
|
133 |
+
|
134 |
+
</section>
|
135 |
+
</system>
|
136 |
+
-->
|
137 |
+
</config>
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
|
142 |
+
|
143 |
+
|
144 |
+
|
145 |
+
|
app/code/local/Juicy/Barclayspspid/etc/config.xml
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
|
4 |
+
<config>
|
5 |
+
<modules>
|
6 |
+
<Juicy_Barclayspspid>
|
7 |
+
<version>1.0.0</version>
|
8 |
+
<active>true</active>
|
9 |
+
<codePool>local</codePool>
|
10 |
+
</Juicy_Barclayspspid>
|
11 |
+
</modules>
|
12 |
+
<global>
|
13 |
+
<resources>
|
14 |
+
<barclayspspid_setup>
|
15 |
+
<setup>
|
16 |
+
<module>Juicy_Barclayspspid</module>
|
17 |
+
<class>Juicy_Barclayspspid_Model_Resource_Eav_Mysql4_Setup</class>
|
18 |
+
</setup>
|
19 |
+
<connection>
|
20 |
+
<use>core_setup</use>
|
21 |
+
</connection>
|
22 |
+
</barclayspspid_setup>
|
23 |
+
</resources>
|
24 |
+
<payment>
|
25 |
+
<groups>
|
26 |
+
<barclayspspid>Juicy Media Barclays PSPID</barclayspspid>
|
27 |
+
</groups>
|
28 |
+
</payment>
|
29 |
+
<helpers>
|
30 |
+
<barclayspspid>
|
31 |
+
<class>Juicy_Barclayspspid_Helper</class>
|
32 |
+
</barclayspspid>
|
33 |
+
</helpers>
|
34 |
+
</global>
|
35 |
+
<frontend>
|
36 |
+
<routers>
|
37 |
+
<barclayspspid>
|
38 |
+
<use>standard</use>
|
39 |
+
<args>
|
40 |
+
<module>Juicy_Barclayspspid</module>
|
41 |
+
<frontName>barclayspspid</frontName>
|
42 |
+
</args>
|
43 |
+
</barclayspspid>
|
44 |
+
</routers>
|
45 |
+
<layout>
|
46 |
+
<updates>
|
47 |
+
<barclayspspid module="Juicy_Barclayspspid">
|
48 |
+
<file>layout.xml</file>
|
49 |
+
</barclayspspid>
|
50 |
+
</updates>
|
51 |
+
</layout>
|
52 |
+
</frontend>
|
53 |
+
<admin>
|
54 |
+
<routers>
|
55 |
+
<adminhtml>
|
56 |
+
<args>
|
57 |
+
<modules>
|
58 |
+
<barclayspspid after="Mage_Adminhtml">Juicy_Barclayspspid</barclayspspid>
|
59 |
+
</modules>
|
60 |
+
</args>
|
61 |
+
</adminhtml>
|
62 |
+
</routers>
|
63 |
+
</admin>
|
64 |
+
<adminhtml>
|
65 |
+
<translate>
|
66 |
+
<modules>
|
67 |
+
<Juicy_Barclayspspid>
|
68 |
+
<files>
|
69 |
+
<default>Juicy_Barclayspspid.csv</default>
|
70 |
+
</files>
|
71 |
+
</Juicy_Barclayspspid>
|
72 |
+
</modules>
|
73 |
+
</translate>
|
74 |
+
<layout>
|
75 |
+
<updates>
|
76 |
+
<barclayspspid module="Juicy_Barclayspspid">
|
77 |
+
<file>layout.xml</file>
|
78 |
+
</barclayspspid>
|
79 |
+
</updates>
|
80 |
+
</layout>
|
81 |
+
</adminhtml>
|
82 |
+
<default>
|
83 |
+
<payment>
|
84 |
+
<barclayspspid_standard>
|
85 |
+
<group>barclayspspid_standard</group>
|
86 |
+
<model>Juicy_Barclayspspid_Model_Barclayspspid</model>
|
87 |
+
<title>Barclays PSPID</title>
|
88 |
+
<active>0</active>
|
89 |
+
<testmode>0</testmode>
|
90 |
+
|
91 |
+
<title>Credit/Debit Card (Powered by Barclays)</title>
|
92 |
+
<pagetitle>Credit/Debit Card Payment</pagetitle>
|
93 |
+
<dynamic>1</dynamic>
|
94 |
+
<dynamictemplate>$$$PAYMENT ZONE$$$</dynamictemplate>
|
95 |
+
<bgcolor>#fff</bgcolor>
|
96 |
+
<txtcolor>#000</txtcolor>
|
97 |
+
<tblbgcolor>#fff</tblbgcolor>
|
98 |
+
<tbltxtcolor>#000</tbltxtcolor>
|
99 |
+
<buttonbgcolor>#000</buttonbgcolor>
|
100 |
+
<buttontxtcolor>#fff</buttontxtcolor>
|
101 |
+
<logo></logo>
|
102 |
+
<fonttype>initial</fonttype>
|
103 |
+
|
104 |
+
<basket>1</basket>
|
105 |
+
<delivery>1</delivery>
|
106 |
+
<magheader>1</magheader>
|
107 |
+
<allowspecific>0</allowspecific>
|
108 |
+
|
109 |
+
<debuglog>1</debuglog>
|
110 |
+
<debugemail>1</debugemail>
|
111 |
+
</barclayspspid_standard>
|
112 |
+
<barclayspspid_moto>
|
113 |
+
<group>barclayspspid_moto</group>
|
114 |
+
<active>1</active>
|
115 |
+
<payment_action>authorize</payment_action>
|
116 |
+
<model>Juicy_Barclayspspid_Model_Barclaysmoto</model>
|
117 |
+
<title>Barclays PSPID Moto</title>
|
118 |
+
<allowspecific>0</allowspecific>
|
119 |
+
</barclayspspid_moto>
|
120 |
+
</payment>
|
121 |
+
</default>
|
122 |
+
</config>
|
app/code/local/Juicy/Barclayspspid/etc/system.xml
ADDED
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<juicy translate="label" module="barclayspspid">
|
5 |
+
<label>Juicy Media</label>
|
6 |
+
<sort_order>10</sort_order>
|
7 |
+
</juicy>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<payment>
|
11 |
+
<groups>
|
12 |
+
<barclayspspid_moto translate="label" module="barclayspspid">
|
13 |
+
<label>Barclays PSPID Moto by Juicy Media Ltd</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>0</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<active translate="label">
|
21 |
+
<label>Enabled</label>
|
22 |
+
<frontend_type>select</frontend_type>
|
23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>0</show_in_store>
|
28 |
+
</active>
|
29 |
+
<payment_action translate="label">
|
30 |
+
<label>Payment Action</label>
|
31 |
+
<frontend_type>select</frontend_type>
|
32 |
+
<source_model>paygate/authorizenet_source_paymentAction</source_model>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
</payment_action>
|
38 |
+
</fields>
|
39 |
+
</barclayspspid_moto>
|
40 |
+
|
41 |
+
|
42 |
+
<barclayspspid_standard translate="label" module="barclayspspid">
|
43 |
+
<label>Barclays PSPID by Juicy Media Ltd</label>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<sort_order>1</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>0</show_in_store>
|
49 |
+
<fields>
|
50 |
+
<head_init translate="label">
|
51 |
+
<label>Initial</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<sort_order>0</sort_order>
|
56 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
57 |
+
</head_init>
|
58 |
+
<active translate="label">
|
59 |
+
<label>Enabled</label>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>1</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>0</show_in_store>
|
66 |
+
</active>
|
67 |
+
<testmode translate="label">
|
68 |
+
<label>Test Mode</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
71 |
+
<sort_order>2</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
</testmode>
|
76 |
+
|
77 |
+
<head_req translate="label">
|
78 |
+
<label>Required</label>
|
79 |
+
<frontend_type>text</frontend_type>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<sort_order>10</sort_order>
|
83 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
84 |
+
</head_req>
|
85 |
+
<pspid translate="label">
|
86 |
+
<label>PSPID</label>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>30</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
</pspid>
|
93 |
+
<username translate="label comment">
|
94 |
+
<label>User Name</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<comment></comment>
|
97 |
+
<sort_order>31</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
</username>
|
102 |
+
<userpassword translate="label comment">
|
103 |
+
<label>User Password</label>
|
104 |
+
<frontend_type>obscure</frontend_type>
|
105 |
+
<comment></comment>
|
106 |
+
<sort_order>32</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
</userpassword>
|
111 |
+
<shain translate="label">
|
112 |
+
<label>SHA-IN</label>
|
113 |
+
<frontend_type>text</frontend_type>
|
114 |
+
<sort_order>33</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>1</show_in_store>
|
118 |
+
</shain>
|
119 |
+
<shaout translate="label">
|
120 |
+
<label>SHA-OUT</label>
|
121 |
+
<frontend_type>text</frontend_type>
|
122 |
+
<sort_order>34</sort_order>
|
123 |
+
<show_in_default>1</show_in_default>
|
124 |
+
<show_in_website>1</show_in_website>
|
125 |
+
<show_in_store>1</show_in_store>
|
126 |
+
</shaout>
|
127 |
+
<cardtypes translate="label">
|
128 |
+
<label>Card Types</label>
|
129 |
+
<frontend_type>multiselect</frontend_type>
|
130 |
+
<source_model>Juicy_Barclayspspid_Model_Source_CreditCards</source_model>
|
131 |
+
<sort_order>35</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>0</show_in_store>
|
135 |
+
</cardtypes>
|
136 |
+
<currency translate="label">
|
137 |
+
<label>Currency</label>
|
138 |
+
<frontend_type>select</frontend_type>
|
139 |
+
<source_model>Juicy_Barclayspspid_Model_Source_CurrencyAction</source_model>
|
140 |
+
<sort_order>36</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>0</show_in_store>
|
144 |
+
</currency>
|
145 |
+
|
146 |
+
<head_styles translate="label">
|
147 |
+
<label>Styles</label>
|
148 |
+
<frontend_type>text</frontend_type>
|
149 |
+
<show_in_default>1</show_in_default>
|
150 |
+
<show_in_website>1</show_in_website>
|
151 |
+
<sort_order>39</sort_order>
|
152 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
153 |
+
</head_styles>
|
154 |
+
<title translate="label">
|
155 |
+
<label>Title</label>
|
156 |
+
<frontend_type>text</frontend_type>
|
157 |
+
<sort_order>40</sort_order>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>1</show_in_website>
|
160 |
+
<show_in_store>1</show_in_store>
|
161 |
+
</title>
|
162 |
+
<pagetitle translate="label">
|
163 |
+
<label>Page Title</label>
|
164 |
+
<frontend_type>text</frontend_type>
|
165 |
+
<sort_order>80</sort_order>
|
166 |
+
<show_in_default>1</show_in_default>
|
167 |
+
<show_in_website>1</show_in_website>
|
168 |
+
<show_in_store>1</show_in_store>
|
169 |
+
</pagetitle>
|
170 |
+
<dynamic translate="label">
|
171 |
+
<label>Send Dynamic Template</label>
|
172 |
+
<frontend_type>select</frontend_type>
|
173 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
174 |
+
<sort_order>90</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>0</show_in_store>
|
178 |
+
</dynamic>
|
179 |
+
<dynamictemplate translate="label">
|
180 |
+
<label>Dynamic Template</label>
|
181 |
+
<frontend_type>textarea</frontend_type>
|
182 |
+
<sort_order>95</sort_order>
|
183 |
+
<show_in_default>1</show_in_default>
|
184 |
+
<show_in_website>1</show_in_website>
|
185 |
+
<show_in_store>1</show_in_store>
|
186 |
+
<depends><dynamic>1</dynamic></depends>
|
187 |
+
</dynamictemplate>
|
188 |
+
<bgcolor translate="label">
|
189 |
+
<label>Background Colour</label>
|
190 |
+
<frontend_type>text</frontend_type>
|
191 |
+
<sort_order>95</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>1</show_in_website>
|
194 |
+
<show_in_store>1</show_in_store>
|
195 |
+
<depends><dynamic>0</dynamic></depends>
|
196 |
+
</bgcolor>
|
197 |
+
<txtcolor translate="label">
|
198 |
+
<label>Text Colour</label>
|
199 |
+
<frontend_type>text</frontend_type>
|
200 |
+
<sort_order>100</sort_order>
|
201 |
+
<show_in_default>1</show_in_default>
|
202 |
+
<show_in_website>1</show_in_website>
|
203 |
+
<show_in_store>1</show_in_store>
|
204 |
+
<depends><dynamic>0</dynamic></depends>
|
205 |
+
</txtcolor>
|
206 |
+
<tblbgcolor translate="label">
|
207 |
+
<label>Table Background Colour</label>
|
208 |
+
<frontend_type>text</frontend_type>
|
209 |
+
<sort_order>110</sort_order>
|
210 |
+
<show_in_default>1</show_in_default>
|
211 |
+
<show_in_website>1</show_in_website>
|
212 |
+
<show_in_store>1</show_in_store>
|
213 |
+
<depends><dynamic>0</dynamic></depends>
|
214 |
+
</tblbgcolor>
|
215 |
+
<tbltxtcolor translate="label">
|
216 |
+
<label>Table Text Colour</label>
|
217 |
+
<frontend_type>text</frontend_type>
|
218 |
+
<sort_order>120</sort_order>
|
219 |
+
<show_in_default>1</show_in_default>
|
220 |
+
<show_in_website>1</show_in_website>
|
221 |
+
<show_in_store>1</show_in_store>
|
222 |
+
<depends><dynamic>0</dynamic></depends>
|
223 |
+
</tbltxtcolor>
|
224 |
+
<buttonbgcolor translate="label">
|
225 |
+
<label>Button Background Colour</label>
|
226 |
+
<frontend_type>text</frontend_type>
|
227 |
+
<sort_order>130</sort_order>
|
228 |
+
<show_in_default>1</show_in_default>
|
229 |
+
<show_in_website>1</show_in_website>
|
230 |
+
<show_in_store>1</show_in_store>
|
231 |
+
<depends><dynamic>0</dynamic></depends>
|
232 |
+
</buttonbgcolor>
|
233 |
+
<buttontxtcolor translate="label">
|
234 |
+
<label>Button Text Colour</label>
|
235 |
+
<frontend_type>text</frontend_type>
|
236 |
+
<sort_order>140</sort_order>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
<depends><dynamic>0</dynamic></depends>
|
241 |
+
</buttontxtcolor>
|
242 |
+
<logo translate="label">
|
243 |
+
<label>Logo URL</label>
|
244 |
+
<frontend_type>text</frontend_type>
|
245 |
+
<sort_order>150</sort_order>
|
246 |
+
<show_in_default>1</show_in_default>
|
247 |
+
<show_in_website>1</show_in_website>
|
248 |
+
<show_in_store>1</show_in_store>
|
249 |
+
<depends><dynamic>0</dynamic></depends>
|
250 |
+
</logo>
|
251 |
+
<fonttype translate="label">
|
252 |
+
<label>Font Type</label>
|
253 |
+
<frontend_type>text</frontend_type>
|
254 |
+
<sort_order>160</sort_order>
|
255 |
+
<show_in_default>1</show_in_default>
|
256 |
+
<show_in_website>1</show_in_website>
|
257 |
+
<show_in_store>1</show_in_store>
|
258 |
+
<depends><dynamic>0</dynamic></depends>
|
259 |
+
</fonttype>
|
260 |
+
<magheader translate="label">
|
261 |
+
<label>Include Magento Theme</label>
|
262 |
+
<frontend_type>select</frontend_type>
|
263 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
264 |
+
<sort_order>165</sort_order>
|
265 |
+
<show_in_default>1</show_in_default>
|
266 |
+
<show_in_website>1</show_in_website>
|
267 |
+
<show_in_store>0</show_in_store>
|
268 |
+
</magheader>
|
269 |
+
|
270 |
+
<head_additional translate="label">
|
271 |
+
<label>Additional</label>
|
272 |
+
<frontend_type>text</frontend_type>
|
273 |
+
<show_in_default>1</show_in_default>
|
274 |
+
<show_in_website>1</show_in_website>
|
275 |
+
<sort_order>168</sort_order>
|
276 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
277 |
+
</head_additional>
|
278 |
+
<paymentaction translate="label">
|
279 |
+
<label>Authorisation Mode</label>
|
280 |
+
<frontend_type>select</frontend_type>
|
281 |
+
<source_model>Juicy_Barclayspspid_Model_Source_PaymentAction</source_model>
|
282 |
+
<sort_order>169</sort_order>
|
283 |
+
<show_in_default>2</show_in_default>
|
284 |
+
<show_in_website>1</show_in_website>
|
285 |
+
<show_in_store>0</show_in_store>
|
286 |
+
</paymentaction>
|
287 |
+
<basket translate="label">
|
288 |
+
<label>Send Basket Info</label>
|
289 |
+
<frontend_type>select</frontend_type>
|
290 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
291 |
+
<sort_order>170</sort_order>
|
292 |
+
<show_in_default>1</show_in_default>
|
293 |
+
<show_in_website>1</show_in_website>
|
294 |
+
<show_in_store>0</show_in_store>
|
295 |
+
</basket>
|
296 |
+
<delivery translate="label">
|
297 |
+
<label>Send Delivery Info</label>
|
298 |
+
<frontend_type>select</frontend_type>
|
299 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
300 |
+
<sort_order>180</sort_order>
|
301 |
+
<show_in_default>1</show_in_default>
|
302 |
+
<show_in_website>1</show_in_website>
|
303 |
+
<show_in_store>0</show_in_store>
|
304 |
+
</delivery>
|
305 |
+
<allowspecific translate="label">
|
306 |
+
<label>Payment from Applicable Countries</label>
|
307 |
+
<frontend_type>allowspecific</frontend_type>
|
308 |
+
<sort_order>240</sort_order>
|
309 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
310 |
+
<show_in_default>1</show_in_default>
|
311 |
+
<show_in_website>1</show_in_website>
|
312 |
+
<show_in_store>0</show_in_store>
|
313 |
+
</allowspecific>
|
314 |
+
<specificcountry translate="label">
|
315 |
+
<label>Payment from Specific Countries</label>
|
316 |
+
<frontend_type>multiselect</frontend_type>
|
317 |
+
<sort_order>250</sort_order>
|
318 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
319 |
+
<show_in_default>1</show_in_default>
|
320 |
+
<show_in_website>1</show_in_website>
|
321 |
+
<show_in_store>0</show_in_store>
|
322 |
+
<depends><allowspecific>1</allowspecific></depends>
|
323 |
+
</specificcountry>
|
324 |
+
<sort_order translate="label">
|
325 |
+
<label>Sort Order</label>
|
326 |
+
<frontend_type>text</frontend_type>
|
327 |
+
<sort_order>260</sort_order>
|
328 |
+
<show_in_default>1</show_in_default>
|
329 |
+
<show_in_website>1</show_in_website>
|
330 |
+
<show_in_store>0</show_in_store>
|
331 |
+
</sort_order>
|
332 |
+
|
333 |
+
<head_debug translate="label">
|
334 |
+
<label>Debug</label>
|
335 |
+
<frontend_type>text</frontend_type>
|
336 |
+
<show_in_default>1</show_in_default>
|
337 |
+
<show_in_website>1</show_in_website>
|
338 |
+
<sort_order>265</sort_order>
|
339 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
340 |
+
</head_debug>
|
341 |
+
<debuglog translate="label">
|
342 |
+
<label>Activate Debug Logging</label>
|
343 |
+
<frontend_type>select</frontend_type>
|
344 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
345 |
+
<sort_order>270</sort_order>
|
346 |
+
<show_in_default>1</show_in_default>
|
347 |
+
<show_in_website>1</show_in_website>
|
348 |
+
<show_in_store>0</show_in_store>
|
349 |
+
</debuglog>
|
350 |
+
<debugemail translate="label">
|
351 |
+
<label>Send Debug Email to Developers</label>
|
352 |
+
<frontend_type>select</frontend_type>
|
353 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
354 |
+
<sort_order>280</sort_order>
|
355 |
+
<show_in_default>1</show_in_default>
|
356 |
+
<show_in_website>1</show_in_website>
|
357 |
+
<show_in_store>0</show_in_store>
|
358 |
+
<depends><debuglog>1</debuglog></depends>
|
359 |
+
</debugemail>
|
360 |
+
</fields>
|
361 |
+
</barclayspspid_standard>
|
362 |
+
</groups>
|
363 |
+
</payment>
|
364 |
+
</sections>
|
365 |
+
</config>
|
app/code/local/Juicy/Barclayspspid/sql/barclayspspid_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
|
8 |
+
try
|
9 |
+
{
|
10 |
+
$installer->run("
|
11 |
+
DELETE FROM `{$installer->getTable('sales_order_status')}` WHERE (`status`='pys_failed_hosted_payment');
|
12 |
+
|
13 |
+
|
14 |
+
INSERT INTO `{$installer->getTable('sales_order_status')}` (`status`, `label`) VALUES ('barclayspspid_authorized', 'Barclays - Authorized');
|
15 |
+
|
16 |
+
");
|
17 |
+
}
|
18 |
+
catch(Exception $exc)
|
19 |
+
{
|
20 |
+
Mage::log("Error during script installation: ". $exc->__toString());
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/barclayspspid/info.phtml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $data = $this->getStuff(); ?>
|
2 |
+
|
3 |
+
<h3>Order Info</h3>
|
4 |
+
<table cellspacing="0" class="form-list">
|
5 |
+
<tbody>
|
6 |
+
<tr>
|
7 |
+
<td class="label"><label>Magento Order ID</label></td>
|
8 |
+
<td class="value"><?php if (isset($data['Order ID'])) { ?><?php echo $data['Order ID']; ?><?php } ?></td>
|
9 |
+
</tr>
|
10 |
+
<tr>
|
11 |
+
<td class="label"><label>Payment ID</label></td>
|
12 |
+
<td class="value"><?php if (isset($data['Payment ID'])) { ?><?php echo $data['Payment ID']; ?><?php } ?></td>
|
13 |
+
</tr>
|
14 |
+
<tr>
|
15 |
+
<td class="label"><label>Payment Currency</label></td>
|
16 |
+
<td class="value"><?php if (isset($data['Payment Currency'])) { ?><?php echo $data['Payment Currency']; ?><?php } ?></td>
|
17 |
+
</tr>
|
18 |
+
<tr>
|
19 |
+
<td class="label"><label>Amount Paid</label></td>
|
20 |
+
<td class="value"><?php if (isset($data['Amount Paid'])) { ?><?php echo $data['Amount Paid']; ?><?php } ?></td>
|
21 |
+
</tr>
|
22 |
+
<tr>
|
23 |
+
<td class="label"><label>Transaction Date</label></td>
|
24 |
+
<td class="value"><?php if (isset($data['Transaction Date'])) { ?><?php echo $data['Transaction Date']; ?><?php } ?></td>
|
25 |
+
</tr>
|
26 |
+
</tbody>
|
27 |
+
</table>
|
28 |
+
|
29 |
+
|
30 |
+
<h3>Payment Info</h3>
|
31 |
+
<table cellspacing="0" class="form-list">
|
32 |
+
<tbody>
|
33 |
+
<tr>
|
34 |
+
<td class="label"><label>Payment Method</label></td>
|
35 |
+
<td class="value"><?php if (isset($data['Payment Method'])) { ?><?php echo $data['Payment Method']; ?><?php } ?></td>
|
36 |
+
</tr>
|
37 |
+
<tr>
|
38 |
+
<td class="label"><label>Credit Card Number (Masked)</label></td>
|
39 |
+
<td class="value"><?php if (isset($data['Credit Card Number (Masked)'])) { ?><?php echo $data['Credit Card Number (Masked)']; ?><?php } ?></td>
|
40 |
+
</tr>
|
41 |
+
<tr>
|
42 |
+
<td class="label"><label>Card Holder Name</label></td>
|
43 |
+
<td class="value"><?php if (isset($data['Card Holder Name'])) { ?><?php echo $data['Card Holder Name']; ?><?php } ?></td>
|
44 |
+
</tr>
|
45 |
+
<tr>
|
46 |
+
<td class="label"><label>Card Holders Bank</label></td>
|
47 |
+
<td class="value"><?php if (isset($data['Card Holders Bank'])) { ?><?php echo $data['Card Holders Bank']; ?><?php } ?></td>
|
48 |
+
</tr>
|
49 |
+
<tr>
|
50 |
+
<td class="label"><label>Bank Country of Origin</label></td>
|
51 |
+
<td class="value"><?php if (isset($data['Bank Country of Origin'])) { ?><?php echo $data['Bank Country of Origin']; ?><?php } ?></td>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td class="label"><label>Amount Paid</label></td>
|
55 |
+
<td class="value"><?php if (isset($data['Amount Paid'])) { ?><?php echo $data['Amount Paid']; ?><?php } ?></td>
|
56 |
+
</tr>
|
57 |
+
<tr>
|
58 |
+
<td class="label"><label>Authorization Code</label></td>
|
59 |
+
<td class="value"><?php if (isset($data['Authorization Code'])) { ?><?php echo $data['Authorization Code']; ?><?php } ?></td>
|
60 |
+
</tr>
|
61 |
+
|
62 |
+
</tbody>
|
63 |
+
</table>
|
64 |
+
|
65 |
+
|
66 |
+
<h3>Security Info</h3>
|
67 |
+
<table cellspacing="0" class="form-list">
|
68 |
+
<tbody>
|
69 |
+
<tr>
|
70 |
+
<td class="label"><label>CVC Check</label></td>
|
71 |
+
<td class="value"><?php if (isset($data['CVC Check'])) { ?><?php echo $data['CVC Check']; ?><?php } ?></td>
|
72 |
+
</tr>
|
73 |
+
<tr>
|
74 |
+
<td class="label"><label>AVS Check</label></td>
|
75 |
+
<td class="value"><?php if (isset($data['AVS Check'])) { ?><?php echo $data['AVS Check']; ?><?php } ?></td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td class="label"><label>AVS Address</label></td>
|
79 |
+
<td class="value"><?php if (isset($data['AVS Address'])) { ?><?php echo $data['AVS Address']; ?><?php } ?></td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<td class="label"><label>AVS Postcode</label></td>
|
83 |
+
<td class="value"><?php if (isset($data['AVS Postcode'])) { ?><?php echo $data['AVS Postcode']; ?><?php } ?></td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td class="label"><label>Order Placed from</label></td>
|
87 |
+
<td class="value"><?php if (isset($data['Order Placed from'])) { ?><?php echo $data['Order Placed from']; ?><?php } ?></td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td class="label"><label>IP address of Payee</label></td>
|
91 |
+
<td class="value"><?php if (isset($data['IP address of Payee'])) { ?><?php echo $data['IP address of Payee']; ?><?php } ?></td>
|
92 |
+
</tr>
|
93 |
+
</tbody>
|
94 |
+
</table>
|
95 |
+
|
96 |
+
<h3>Currency</h3>
|
97 |
+
|
app/design/adminhtml/default/default/template/barclayspspid/motoform.phtml
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $direct = Mage::getModel('JuicyMedia_Barclayspspid_Model_Barclaysmoto'); ?>
|
2 |
+
<?php $_code = $this->getMethodCode() ?>
|
3 |
+
<?php $fieldCode = ''?>
|
4 |
+
|
5 |
+
<fieldset class="form-list">
|
6 |
+
<ul id="payment_form_<?php echo $_code; ?>" style="display:none">
|
7 |
+
<li>
|
8 |
+
<div class="input-box">
|
9 |
+
<label for="<?php echo $_code; ?>_cc_owner"><?php echo $this->__('Name On Card') ?> <span class="required">*</span></label><br/>
|
10 |
+
<input type="text" title="<?php echo $this->__('Name On Card') ?>" class="input-text required-entry validate-length maximum-length-100" id="<?php echo $_code; ?>_cc_owner" name="payment<?php echo $fieldCode; ?>[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
|
11 |
+
</div>
|
12 |
+
</li>
|
13 |
+
<li>
|
14 |
+
<div class="input-box">
|
15 |
+
<label for="<?php echo $_code; ?>_cc_number"><?php echo $this->__('Card Number') ?> <span class="required">*</span></label><br/>
|
16 |
+
<input type="text" id="<?php echo $_code; ?>_cc_number" name="payment<?php echo $fieldCode; ?>[cc_number]" title="<?php echo $this->__('Card Number') ?>" class="input-text required-entry validate-digits validate-length maximum-length-20" value=""/>
|
17 |
+
</div>
|
18 |
+
</li>
|
19 |
+
<li>
|
20 |
+
<label for="<?php echo $_code; ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label><br/>
|
21 |
+
<div class="input-box">
|
22 |
+
<div class="v-fix">
|
23 |
+
<select id="<?php echo $_code; ?>_expiration" name="payment<?php echo $fieldCode; ?>[cc_exp_month]" class="month validate-cc-exp required-entry">
|
24 |
+
<?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
|
25 |
+
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
26 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
27 |
+
<?php endforeach ?>
|
28 |
+
</select>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<div class="v-fix">
|
32 |
+
<?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
|
33 |
+
<select id="<?php echo $_code; ?>_expiration_yr" name="payment<?php echo $fieldCode; ?>[cc_exp_year]" class="year required-entry">
|
34 |
+
<?php foreach ($this->getCcYears() as $k=>$v): ?>
|
35 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
36 |
+
<?php endforeach ?>
|
37 |
+
</select>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
</li>
|
41 |
+
<li>
|
42 |
+
<label for="<?php echo $_code; ?>_cc_ss_start_month"><?php echo $this->__('Start Date') ?></label><br />
|
43 |
+
<div class="input-box">
|
44 |
+
<div class="v-fix">
|
45 |
+
<select id="<?php echo $_code; ?>_cc_ss_start_month" name="payment<?php echo $fieldCode; ?>[cc_ss_start_month]" class="month">
|
46 |
+
<?php $_ccStartMonth = $this->getInfoData('cc_ss_start_month') ?>
|
47 |
+
<?php foreach ($this->getCcStartMonths() as $k=>$v): ?>
|
48 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
49 |
+
<?php endforeach ?>
|
50 |
+
</select>
|
51 |
+
</div>
|
52 |
+
<div class="v-fix">
|
53 |
+
<?php $_ccStartYear = $this->getInfoData('cc_ss_start_year') ?>
|
54 |
+
<select id="<?php echo $_code ?>_cc_ss_start_year" name="payment<?php echo $fieldCode; ?>[cc_ss_start_year]" class="year">
|
55 |
+
<?php foreach ($this->getCcStartYears() as $k=>$v): ?>
|
56 |
+
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
57 |
+
<?php endforeach ?>
|
58 |
+
</select>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
</li>
|
62 |
+
<li>
|
63 |
+
<div class="input-box">
|
64 |
+
<label for="<?php echo $_code; ?>_cc_ss_issue"><?php echo $this->__('Issue Number') ?></label><br />
|
65 |
+
<div class="v-fix"><input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-digits validate-length maximum-length-2" id="<?php echo $_code ?>_cc_ss_issue" name="payment<?php echo $fieldCode; ?>[cc_ss_issue]" style="width:50px;" value="" /></div>
|
66 |
+
</div>
|
67 |
+
</li>
|
68 |
+
<li>
|
69 |
+
<div class="input-box">
|
70 |
+
<label for="<?php echo $_code; ?>_cc_cid"><?php echo $this->__('CV2') ?> <span class="required">*</span></label><br/>
|
71 |
+
<div class="v-fix"><input type="text" title="<?php echo $this->__('CV2') ?>" class="input-text required-entry validate-digits validate-length minimum-length-3 maximum-length-4" id="<?php echo $_code; ?>_cc_cid" name="payment<?php echo $fieldCode; ?>[cc_cid]" style="width:50px;" value=""/></div>
|
72 |
+
|
73 |
+
<a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
|
74 |
+
</div>
|
75 |
+
</li>
|
76 |
+
</ul>
|
77 |
+
</fieldset>
|
app/design/adminhtml/default/default/template/barclayspspid/motoinfo.phtml
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style>
|
2 |
+
ul.cardinfo li {
|
3 |
+
list-style:none;
|
4 |
+
}
|
5 |
+
</style>
|
6 |
+
<?php $data = $this->getStuff(); ?>
|
7 |
+
|
8 |
+
|
9 |
+
<h2>Paid via Barclays PSPID</h2>
|
10 |
+
|
11 |
+
<h4>Order Info</h4>
|
12 |
+
<ul class="cardinfo">
|
13 |
+
<?php if ($data['Order ID']) { ?>
|
14 |
+
<li><strong>Order ID</strong> :- <?php echo $data['Order ID']; ?></li>
|
15 |
+
<?php } ?>
|
16 |
+
<?php if ($data['Payment ID']) { ?>
|
17 |
+
<li><strong>Payment ID</strong> :- <?php echo $data['Payment ID']; ?></li>
|
18 |
+
<?php } ?>
|
19 |
+
<?php if ($data['Payment Currency']) { ?>
|
20 |
+
<li><strong>Payment Currency</strong> :- <?php echo $data['Payment Currency']; ?></li>
|
21 |
+
<?php } ?>
|
22 |
+
<?php if ($data['Amount Paid']) { ?>
|
23 |
+
<li><strong>Amount Paid</strong> :- <?php echo $data['Amount Paid']; ?></li>
|
24 |
+
<?php } ?>
|
25 |
+
<?php if ($data['Transaction Date']) { ?>
|
26 |
+
<li><strong>Transaction Date</strong> :- <?php echo $data['Transaction Date']; ?></li>
|
27 |
+
<?php } ?>
|
28 |
+
</ul>
|
29 |
+
|
30 |
+
<h4>Card Info</h4>
|
31 |
+
<ul class="cardinfo">
|
32 |
+
<?php if ($data['Payment Method']) { ?>
|
33 |
+
<li><strong>Payment Method</strong> :- <?php echo $data['Payment Method']; ?></li>
|
34 |
+
<?php } ?>
|
35 |
+
<?php if ($data['Credit Card Number (Masked)']) { ?>
|
36 |
+
<li><strong>Credit Card Number (Masked)</strong> :- <?php echo $data['Credit Card Number (Masked)']; ?></li>
|
37 |
+
<?php } ?>
|
38 |
+
<?php if ($data['Card Holder Name']) { ?>
|
39 |
+
<li><strong>Card Holder Name</strong> :- <?php echo $data['Card Holder Name']; ?></li>
|
40 |
+
<?php } ?>
|
41 |
+
<?php if ($data['Payment Method']) { ?>
|
42 |
+
<li><strong>Payment Method</strong> :- <?php echo $data['Payment Method']; ?></li>
|
43 |
+
<?php } ?>
|
44 |
+
<?php if ($data['Card Holders Bank']) { ?>
|
45 |
+
<li><strong>Card Holders Bank</strong> :- <?php echo $data['Card Holders Bank']; ?></li>
|
46 |
+
<?php } ?>
|
47 |
+
<?php if ($data['Bank Country of Origin']) { ?>
|
48 |
+
<li><strong>Bank Country of Origin</strong> :- <?php echo $data['Bank Country of Origin']; ?></li>
|
49 |
+
<?php } ?>
|
50 |
+
<?php if ($data['Amount Paid']) { ?>
|
51 |
+
<li><strong>Amount Paid</strong> :- <?php echo $data['Amount Paid']; ?></li>
|
52 |
+
<?php } ?>
|
53 |
+
<?php if ($data['Authorization Code']) { ?>
|
54 |
+
<li><strong>Authorization Code</strong> :- <?php echo $data['Authorization Code']; ?></li>
|
55 |
+
<?php } ?>
|
56 |
+
</ul>
|
57 |
+
|
58 |
+
<h4>Security Info</h4>
|
59 |
+
<ul class="cardinfo">
|
60 |
+
<?php if ($data['CVC Check']) { ?>
|
61 |
+
<li><strong>CVC Check</strong> :- <?php echo $data['CVC Check']; ?></li>
|
62 |
+
<?php } ?>
|
63 |
+
<?php if ($data['AVS Check']) { ?>
|
64 |
+
<li><strong>AVS Check</strong> :- <?php echo $data['AVS Check']; ?></li>
|
65 |
+
<?php } ?>
|
66 |
+
<?php if ($data['AVS Address']) { ?>
|
67 |
+
<li><strong>AVS Address</strong> :- <?php echo $data['AVS Address']; ?></li>
|
68 |
+
<?php } ?>
|
69 |
+
<?php if ($data['AVS Postcode']) { ?>
|
70 |
+
<li><strong>AVS Postcode</strong> :- <?php echo $data['AVS Postcode']; ?></li>
|
71 |
+
<?php } ?>
|
72 |
+
<?php if ($data['Order Placed from']) { ?>
|
73 |
+
<li><strong>Order Placed from</strong> :- <?php echo $data['Order Placed from']; ?></li>
|
74 |
+
<?php } ?>
|
75 |
+
<?php if ($data['IP address of Payee']) { ?>
|
76 |
+
<li><strong>IP address of Payee</strong> :- <?php echo $data['IP address of Payee']; ?></li>
|
77 |
+
<?php } ?>
|
78 |
+
</ul>
|
app/etc/modules/Juicy_Barclayspspid.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Juicy_Barclayspspid>
|
4 |
+
<version>1.0.0.0</version>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Juicy_Barclayspspid>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Juicy_BarclaysPSPID</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Barclays PSPID Payment gateway solution from Juicy Media</summary>
|
10 |
+
<description>Barclays PSPID Payment gateway solution from Juicy Media</description>
|
11 |
+
<notes>Initial Release from Juicy Media</notes>
|
12 |
+
<authors><author><name>Juicy Media</name><user>juicymedia</user><email>jonathan.webb@juicymedia.co.uk</email></author></authors>
|
13 |
+
<date>2015-01-16</date>
|
14 |
+
<time>14:16:12</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Juicy"><dir name="Barclayspspid"><dir name="Block"><file name="Dynamic.php" hash="4137b57f1088eaf9545e428a1152a799"/><file name="Failure.php" hash="db0b7261cd536d40c8bedd5416ee26bf"/><file name="Form.php" hash="270a5d2ac3b22c0a3c728484e7365246"/><file name="Info.php" hash="a5270fe895b83b71ad69c764ae765821"/><file name="Motoform.php" hash="e33033bf4b33849946c9cffe8aae5a9a"/><file name="Motoinfo.php" hash="4b541df7928a24aa82db5adf72d03c2b"/><file name="Redirect.php" hash="3907d29d14d5599db3f8b400a9bae2c9"/></dir><dir name="Helper"><file name="Data.php" hash="383d65622ea68829ec87492a45f4e995"/></dir><dir name="Model"><file name="Barclaysmoto.php" hash="a818adaf0c5eb82ecc61a00a8fd6b8f4"/><file name="Barclayspspid.php" hash="b4de1b038e03515cbe0087693d97dbc6"/><file name="Config.php" hash="001ecb5f3c2b58300f7529269ff68e0f"/><file name="Directlink.php" hash="9cdb8ca9e53549f179e7059e5061bded"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="bdde91e908925e167663c66ee6919b28"/></dir></dir></dir><file name="Session.php" hash="50dd3a74fda13bc71684ddeca782e122"/><dir name="Source"><file name="CardcodeAction.php" hash="1689f56c8d57a7d863e4da968b7b9214"/><file name="CreditCards.php" hash="9505bf8f0113b0bd68041472abce597a"/><file name="CurrencyAction.php" hash="56641ce30591dcd0a5c70b543d40a550"/><file name="PaymentAction.php" hash="02b8f864cc8233bea5e2bf26134c655a"/></dir><file name="Submitform.php" hash="eb0283ca0851619e5453d0f83447913e"/></dir><dir name="controllers"><file name="PaymentController.php" hash="7700f53b12e10a758b48256882cd8d51"/><file name="RefundController.php" hash="515f179ce5c2e43119a5ee1e1101d8c8"/></dir><dir name="etc"><dir name="adminhtml"><file name="acl.xml" hash="0f201b5b96868ac9e06cb77a6c3efd9e"/><file name="system.xml" hash="fc3960b4818b5fb5af1d38131d87f311"/></dir><file name="adminhtml.xml" hash="7268a179979e78b27e41a845124e9b92"/><file name="config.xml" hash="3b05e5982f23a59b7ce35e0a0a43c1c4"/><file name="system.xml" hash="d7a0cbb7b7651b8414c37b6af10e5f3c"/></dir><dir name="sql"><dir name="barclayspspid_setup"><file name="mysql4-install-1.0.0.php" hash="0889601005384f8415cbd428a22a60e7"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><file name="barclayspspid" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Juicy_Barclayspspid.xml" hash="f4cb22251d52a8e0d9de86775b74690a"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="barclayspspid"><file name="info.phtml" hash="167c33dfa221b8c50607dee92298f69b"/><file name="motoform.phtml" hash="d8a2b2552a47c883eacb89b8de7916ef"/><file name="motoinfo.phtml" hash="446732fbd64dd4a6d2ccc7305e9e4945"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
|
18 |
+
</package>
|