worldpayzaq12wsx - Version 1.1.0

Version Notes

compatible with 1.9

Download this release

Release Info

Developer faisal
Extension worldpayzaq12wsx
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

Files changed (38) hide show
  1. app/code/local/WorldPayTech/.DS_Store +0 -0
  2. app/code/local/WorldPayTech/WorldAch/.DS_Store +0 -0
  3. app/code/local/WorldPayTech/WorldAch/Block/.DS_Store +0 -0
  4. app/code/local/WorldPayTech/WorldAch/Block/Form.php +61 -0
  5. app/code/local/WorldPayTech/WorldAch/Block/Info.php +125 -0
  6. app/code/local/WorldPayTech/WorldAch/Helper/Data.php +36 -0
  7. app/code/local/WorldPayTech/WorldAch/Model/PaymentMethod.php +296 -0
  8. app/code/local/WorldPayTech/WorldAch/etc/.DS_Store +0 -0
  9. app/code/local/WorldPayTech/WorldAch/etc/config.xml +82 -0
  10. app/code/local/WorldPayTech/WorldAch/etc/system.xml +68 -0
  11. app/code/local/WorldPayTech/WorldPay/.DS_Store +0 -0
  12. app/code/local/WorldPayTech/WorldPay/Block/.DS_Store +0 -0
  13. app/code/local/WorldPayTech/WorldPay/Block/Form.php +193 -0
  14. app/code/local/WorldPayTech/WorldPay/Block/Info.php +140 -0
  15. app/code/local/WorldPayTech/WorldPay/Model/PaymentHelper.php +161 -0
  16. app/code/local/WorldPayTech/WorldPay/Model/PaymentMethod.php +330 -0
  17. app/code/local/WorldPayTech/WorldPay/etc/.DS_Store +0 -0
  18. app/code/local/WorldPayTech/WorldPay/etc/config.xml +76 -0
  19. app/code/local/WorldPayTech/WorldPay/etc/system.xml +188 -0
  20. app/code/local/WorldPayTech/WorldProfile/.DS_Store +0 -0
  21. app/code/local/WorldPayTech/WorldProfile/Block/.DS_Store +0 -0
  22. app/code/local/WorldPayTech/WorldProfile/Block/Form.php +193 -0
  23. app/code/local/WorldPayTech/WorldProfile/Block/Info.php +141 -0
  24. app/code/local/WorldPayTech/WorldProfile/Helper/Data.php +36 -0
  25. app/code/local/WorldPayTech/WorldProfile/Model/PaymentMethod.php +265 -0
  26. app/code/local/WorldPayTech/WorldProfile/etc/.DS_Store +0 -0
  27. app/code/local/WorldPayTech/WorldProfile/etc/config.xml +82 -0
  28. app/code/local/WorldPayTech/WorldProfile/etc/system.xml +66 -0
  29. app/design/frontend/rwd/default/template/worldpay/.DS_Store +0 -0
  30. app/design/frontend/rwd/default/template/worldpay/form/.DS_Store +0 -0
  31. app/design/frontend/rwd/default/template/worldpay/form/pp.phtml +254 -0
  32. app/design/frontend/rwd/default/template/worldpay/form/worldpayach.phtml +98 -0
  33. app/design/frontend/rwd/default/template/worldpay/form/worldpaycc.phtml +146 -0
  34. app/design/frontend/rwd/default/template/worldpay/form/worldpayprofile.phtml +73 -0
  35. app/etc/modules/WorldPayTech_WorldAch.xml +16 -0
  36. app/etc/modules/WorldPayTech_WorldPay.xml +15 -0
  37. app/etc/modules/WorldPayTech_WorldProfile.xml +16 -0
  38. package.xml +18 -0
app/code/local/WorldPayTech/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldAch/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldAch/Block/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldAch/Block/Form.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class WorldPayTech_WorldAch_Block_Form extends Mage_Payment_Block_Form
29
+ {
30
+ protected $_code = 'worldach';
31
+ protected function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->setTemplate('worldpay/form/worldpayach.phtml');
35
+ Mage::log("WorldPayTech_WorldAch_Block_Form");
36
+ }
37
+
38
+ /**
39
+ * Retrieve payment configuration object
40
+ *
41
+ * @return Mage_Payment_Model_Config
42
+ */
43
+ protected function _getConfig()
44
+ {
45
+ return Mage::getSingleton('payment/config');
46
+ }
47
+
48
+
49
+ /**
50
+ * Render block HTML
51
+ *
52
+ * @return string
53
+ */
54
+ protected function _toHtml()
55
+ {
56
+ Mage::dispatchEvent('payment_form_block_to_html_before', array(
57
+ 'block' => $this
58
+ ));
59
+ return parent::_toHtml();
60
+ }
61
+ }
app/code/local/WorldPayTech/WorldAch/Block/Info.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Credit card generic payment info
29
+ */
30
+ class WorldPayTech_WorldAch_Block_Info extends Mage_Payment_Block_Info
31
+ {
32
+ /*protected function _construct()
33
+ {
34
+ //parent::_construct();
35
+ //$this->setTemplate('payment/form/cc.phtml');
36
+ //Mage::log("PrismPayTech_PrismPay_Block_Info");
37
+
38
+ }*/
39
+
40
+
41
+ /**
42
+ * Retrieve credit card type name
43
+ *
44
+ * @return string
45
+ */
46
+
47
+ /**
48
+ * Prepare credit card related payment info
49
+ *
50
+ * @param Varien_Object|array $transport
51
+ * @return Varien_Object
52
+ */
53
+ protected function _prepareSpecificInformation($transport = null)
54
+ {
55
+ if (null !== $this->_paymentSpecificInformation) {
56
+ return $this->_paymentSpecificInformation;
57
+ }
58
+ $transport = parent::_prepareSpecificInformation($transport);
59
+ $data = array();
60
+
61
+
62
+ //print_r($this->getInfoInstance());
63
+ /*print"<pre>";
64
+ $data = $this->getRequest()->getPost('name', array());
65
+ //$result = $this->getOnepage()->savePayment($data);
66
+ //$payment->importData($data);
67
+ print_r($data);
68
+ //print_r($result);
69
+ print_r($this->getInfo());
70
+ echo "===================<br>";
71
+ print_r($transport->getData("name"));
72
+ echo "===================<br>";
73
+ print_r($transport->getData("payment"));
74
+ echo "===================<br>";
75
+ print_r($transport->getData("payment[ckname]"));
76
+ echo "===================<br>";
77
+ print_r($_REQUEST);
78
+
79
+ echo "===================<br>";
80
+
81
+ print_r($this->getMethod()->getInfoInstance()->getData("payment[ckname]"));
82
+ echo "===================";
83
+
84
+ print_r($this->getMethod()->getInfoInstance()->getData("ckname"));
85
+
86
+ print"</pre>";*/
87
+ $data[Mage::helper('payment')->__('Name')] = "********";
88
+ $data[Mage::helper('payment')->__('Routing Number')] = "********";
89
+ $data[Mage::helper('payment')->__('Account Number')] = "********";
90
+ $data[Mage::helper('payment')->__('Cheque Number')] = "********";
91
+ /*if ($ccType = $this->getCcTypeName()) {
92
+ $data[Mage::helper('payment')->__('Credit Card Type')] = $ccType;
93
+ }
94
+ if ($this->getInfo()->getCcLast4()) {
95
+ $data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
96
+ }
97
+ if (!$this->getIsSecureMode()) {
98
+ if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
99
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
100
+ }
101
+ $year = $this->getInfo()->getCcSsStartYear();
102
+ $month = $this->getInfo()->getCcSsStartMonth();
103
+ if ($year && $month) {
104
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Start Date')] = $this->_formatCardDate($year, $month);
105
+ }
106
+ }*/
107
+ //print_r("<pre>");
108
+ //print_r ($data);
109
+ //die;
110
+ //mail()
111
+ return $transport->setData(array_merge($data, $transport->getData()));
112
+ }
113
+
114
+ /**
115
+ * Format year/month on the credit card
116
+ *
117
+ * @param string $year
118
+ * @param string $month
119
+ * @return string
120
+ */
121
+ protected function _formatCardDate($year, $month)
122
+ {
123
+ return sprintf('%s/%s', sprintf('%02d', $month), $year);
124
+ }
125
+ }
app/code/local/WorldPayTech/WorldAch/Helper/Data.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class WorldPayTech_WorldAch_Helper_Data extends Mage_Payment_Helper_Data {
29
+
30
+ /**
31
+ * Zend_Log debug level
32
+ * @var unknown_type
33
+ */
34
+
35
+
36
+ }
app/code/local/WorldPayTech/WorldAch/Model/PaymentMethod.php ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Our test CC module adapter
5
+ */
6
+ class WorldPayTech_WorldAch_Model_PaymentMethod extends WorldPayTech_WorldPay_Model_PaymentHelper {
7
+
8
+ protected $_code = 'worldach';
9
+ protected $_formBlockType = 'worldach/form';
10
+ protected $_infoBlockType = 'worldach/info';
11
+
12
+ public function __construct() {
13
+ parent::__construct();
14
+ Mage::log("WorldPayTech_WorldAch_Model_PaymentMethod");
15
+
16
+ }
17
+
18
+ /**
19
+ * Here you will need to implement authorize, capture and void public methods
20
+ *
21
+ * @see examples of transaction specific public methods such as
22
+ * authorize, capture and void in Mage_Paygate_Model_Authorizenet
23
+ *
24
+ * In this function i charge credit card and mark order as completed
25
+ */
26
+ public function assignData($data)
27
+ {
28
+
29
+ // Call parent assignData
30
+ parent::assignData($data);
31
+
32
+ // Get Mage_Payment_Model_Info instance from quote
33
+ $info = $this->getInfoInstance();
34
+
35
+ // Add some arbitrary post data to the Mage_Payment_Model_Info instance
36
+ // so it is saved in the DB in the 'additional_information' field
37
+ $info->setAdditionalInformation(
38
+ 'name',
39
+ "faisalsharifshamsi");
40
+ Mage::log("Payment Method assignData ");
41
+ return $this;
42
+ }
43
+ public function authorize(Varien_Object $payment, $amount) {
44
+ $order = $payment->getOrder();
45
+ try {
46
+ Mage::log('WorldAch Authorize!');
47
+
48
+ $ckname=$_REQUEST["payment"]["ckname"];
49
+ $ckaba=$_REQUEST["payment"]["ckaba"];
50
+ $ckacct=$_REQUEST["payment"]["ckacct"];
51
+ $ckno =$_REQUEST["payment"]["ckno"];
52
+ $ckaccttype =$_REQUEST["payment"]["ckaccttype"];
53
+ $ckaccttypedesc =$_REQUEST["payment"]["ckaccttypedesc"];
54
+ $cktype =$_REQUEST["payment"]["cktype"];
55
+
56
+ $ipAddress = $_SERVER['REMOTE_ADDR'];
57
+
58
+ $totals = number_format($amount, 2, '.', '');
59
+ $fields = array(
60
+ "service" => "14",
61
+ "acctid" => $this->__accountID,
62
+ "subid" => $this->__subAccountID,
63
+ "ckname" => $ckname,
64
+ "ckaba" => $ckaba,
65
+ "ckacct" => $ckacct,
66
+ "ckno" => $ckno,
67
+ // "ckaccttype" => $ckaccttype,
68
+ "ckaccttype" => $ckaccttype,
69
+ "ckaccttypedesc" => $ckaccttypedesc,
70
+ "cktype" => $cktype,
71
+ 'ipaddress' => $_SERVER['REMOTE_ADDR'],
72
+ 'currencycode' => $order->getBaseCurrencyCode(),
73
+ 'amount' => $totals,
74
+ );
75
+
76
+
77
+
78
+ $fields_string = "<?xml version=\"1.0\"?><interface_driver><trans_catalog><transaction name=\"ach\"><inputs>";
79
+
80
+ foreach ($fields as $key => $value) {
81
+ $fields_string .= '<' . $key . '>' . $value . '</' . $key . '>';
82
+ }
83
+ $fields_string .='</inputs></transaction></trans_catalog></interface_driver>';
84
+
85
+ if ($this->__debugMode == 0) {
86
+ $data=$this->curlHelper($payment, $fields_string);
87
+
88
+ }
89
+ } catch (Exception $e) {
90
+
91
+ $payment->setStatus(self::STATUS_ERROR);
92
+ $payment->setAmount($amount);
93
+ $payment->setLastTransId($orderId);
94
+ $this->setStore($payment->getOrder()->getStoreId());
95
+ Mage::throwException($e->getMessage());
96
+ }
97
+ if ($this->__debugMode == 0) {
98
+ $xmlResponse = new SimpleXmlElement($data); //Simple way to parse xml, Magento might have an equivalent class
99
+ $outputs = $xmlResponse->trans_catalog->transaction->outputs;
100
+ }
101
+
102
+ $orderId=$order->getId();
103
+ $transactionId=$outputs->historyid;
104
+ if ($outputs->status == "Approved") {
105
+ $this->setStore($payment->getOrder()->getStoreId());
106
+ $payment->setStatus(self::STATUS_APPROVED);
107
+ $payment->setAmount($amount);
108
+ $payment->setLastTransId($orderId);
109
+
110
+ $payment->setTransactionId($transactionId);
111
+ $payment->setIsTransactionClosed(0);
112
+ $payment->setParentTransactionId($transactionId);
113
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
114
+ array(
115
+ 'status'=>"".$outputs->status."",
116
+ 'authcode'=>"".$outputs->authcode."",
117
+ "historyid"=>"".$outputs->historyid."",
118
+ "orderid"=>"".$outputs->orderid."",
119
+ "refcode"=>"".$outputs->refcode."",
120
+ "total"=>"".$outputs->total."",
121
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
122
+ "accountname"=>"".$outputs->accountname."",
123
+ "ckname"=>"".$ckname."",
124
+ "ckaba"=>"".$ckaba."",
125
+ "ckacct"=>"".$ckacct."",
126
+ "ckno"=>"".$ckno."",
127
+ "ckaccttype"=>"".$ckaccttype."",
128
+ "ckaccttypedesc"=>"".$ckaccttypedesc."",
129
+ "cktype"=>"".$cktype."",
130
+ )
131
+ );
132
+
133
+
134
+ } else {
135
+ $payment->setStatus(self::STATUS_ERROR);
136
+ $payment->setAmount($amount);
137
+ $payment->setLastTransId($orderId);
138
+ $this->setStore($payment->getOrder()->getStoreId());
139
+ if ($this->__debugMode == 1) {
140
+ Mage::throwException("XMl=" . $fields_string . "\n\nAccount=" . $this->__accountID . "\n\nSub Account=" . $this->__subAccountID . "\n\nTest Mode=" . $this->__testMode . "\n\nDebuge Mode=" . $this->__debugMode);
141
+ } else {
142
+ Mage::throwException($outputs->result);
143
+ }
144
+ }
145
+ return $this;
146
+ }
147
+
148
+ public function capture(Varien_Object $payment, $amount) {
149
+
150
+ // this function is not in used /////
151
+
152
+
153
+ }
154
+ public function validate()
155
+ {
156
+ /*
157
+ * calling parent validate function
158
+ */
159
+ //parent::validate();
160
+ Mage::log("World Profile Validate");
161
+
162
+ return $this;
163
+ }
164
+
165
+ /**
166
+ * Payment refund
167
+ *
168
+ * @param \Magento\Framework\Object $payment
169
+ * @param float $amount
170
+ * @return $this
171
+ * @throws \Magento\Framework\Model\Exception
172
+ */
173
+
174
+ public function refund(Varien_Object $payment, $amount) {
175
+ $order = $payment->getOrder();
176
+ try {
177
+ Mage::log('WorldPay Profile Refund!');
178
+
179
+
180
+ $temp_transaction_id=$payment->getLastTransId();
181
+ $dash_pos = strpos($temp_transaction_id, "-");
182
+ $transaction_id=substr($temp_transaction_id,0,$dash_pos);
183
+ if($transaction_id=="")
184
+ {
185
+ Mage::throwException("Unable to create memo , transaction id not found");
186
+ return $this;
187
+
188
+ }
189
+ $transactionData=$payment->getTransaction($transaction_id)->getData();
190
+ $order_id=@$transactionData["additional_information"]["raw_details_info"]["orderid"];
191
+ $historyid=@$transactionData["additional_information"]["raw_details_info"]["historyid"];
192
+ $refcode=@$transactionData["additional_information"]["raw_details_info"]["refcode"];
193
+
194
+
195
+ $totals = number_format($amount, 2, '.', '');
196
+ $fields = array(
197
+ "service" => "16",
198
+ "acctid" => $this->__accountID,
199
+ "subid" => $this->__subAccountID,
200
+ "historykeyid" => $historyid,
201
+ "orderkeyid" => $order_id,
202
+ 'amount' => $totals,
203
+ );
204
+
205
+
206
+
207
+ $fields_string = "<?xml version=\"1.0\"?><interface_driver><trans_catalog><transaction name=\"ach\"><inputs>";
208
+
209
+ foreach ($fields as $key => $value) {
210
+ $fields_string .= '<' . $key . '>' . $value . '</' . $key . '>';
211
+ }
212
+ $fields_string .='</inputs></transaction></trans_catalog></interface_driver>';
213
+
214
+ Mage::log('Data '.$fields_string);
215
+
216
+ if ($this->__debugMode == 0) {
217
+ $data=$this->curlHelper($payment, $fields_string);
218
+
219
+ }
220
+ } catch (Exception $e) {
221
+
222
+ $payment->setStatus(self::STATUS_ERROR);
223
+ $payment->setAmount($amount);
224
+ $payment->setLastTransId($orderId);
225
+ $this->setStore($payment->getOrder()->getStoreId());
226
+ Mage::throwException($e->getMessage());
227
+ }
228
+ $xmlResponse = new SimpleXmlElement($data); //Simple way to parse xml, Magento might have an equivalent class
229
+ $outputs = $xmlResponse->trans_catalog->transaction->outputs;
230
+
231
+
232
+ //error_log($contents);
233
+
234
+ $transactionId=$outputs->historyid;
235
+ if ($outputs->status == "Approved") {
236
+ Mage::log('Refund Request Approved');
237
+
238
+ $payment->setTransactionId($transactionId."-refund");
239
+ $payment->setIsTransactionClosed(1);
240
+ $payment->setParentTransactionId($transaction_id);
241
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
242
+ array(
243
+ 'status'=>"".$outputs->status."",
244
+ 'authcode'=>"".$outputs->authcode."",
245
+ "historyid"=>"".$outputs->historyid."",
246
+ "orderid"=>"".$outputs->orderid."",
247
+ "refcode"=>"".$outputs->refcode."",
248
+ "total"=>"".$outputs->total."",
249
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
250
+ "accountname"=>"".$outputs->accountname."",
251
+ )
252
+ );
253
+
254
+
255
+ } else {
256
+ Mage::log('Refund Request Decline');
257
+
258
+ $payment->setTransactionId($transactionId."-refund");
259
+ $payment->setIsTransactionClosed(1);
260
+ $payment->setParentTransactionId($transactionId);
261
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
262
+ array(
263
+ 'status'=>"".$outputs->status."",
264
+ 'authcode'=>"".$outputs->authcode."",
265
+ "historyid"=>"".$outputs->historyid."",
266
+ "orderid"=>"".$outputs->orderid."",
267
+ "refcode"=>"".$outputs->refcode."",
268
+ "total"=>"".$outputs->total."",
269
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
270
+ "accountname"=>"".$outputs->accountname."",
271
+ )
272
+ );
273
+ Mage::throwException($outputs->result);
274
+ }
275
+ return $this;
276
+ }
277
+
278
+ public function cancel(Varien_Object $payment) {
279
+
280
+ // void the order if canceled
281
+ Mage::log('Order: cancel!');
282
+
283
+ return $this;
284
+ }
285
+
286
+ public function void(Varien_Object $payment) {
287
+
288
+
289
+ Mage::log('Order: void!');
290
+
291
+ /* Whatever you call to void a payment in your gateway */
292
+ }
293
+
294
+ }
295
+
296
+ ?>
app/code/local/WorldPayTech/WorldAch/etc/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldAch/etc/config.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <WorldPayTech_WorldAch>
5
+ <!-- declare module's version information for database updates -->
6
+ <version>0.1.0</version>
7
+ </WorldPayTech_WorldAch>
8
+ </modules>
9
+
10
+ <global>
11
+ <!-- IMPORTANT: if you use your own namespace (i.e. CompanyName) you also have to declare blocks group for new module. See topic: http://www.magentocommerce.com/boards/viewthread/22416/#t102732 -->
12
+ <blocks>
13
+ <worldach>
14
+ <class>WorldPayTech_WorldAch_Block</class>
15
+ </worldach>
16
+ </blocks>
17
+
18
+
19
+ <!-- declare model group for new module -->
20
+ <models>
21
+ <!-- model group alias to be used in Mage::getModel('newmodule/...') -->
22
+ <worldach>
23
+ <!-- base class name for the model group -->
24
+ <class>WorldPayTech_WorldAch_Model</class>
25
+ </worldach>
26
+ </models>
27
+ <helpers>
28
+ <worldach>
29
+ <class>WorldPayTech_WorldAch_Helper</class>
30
+ </worldach>
31
+ </helpers>
32
+
33
+ <!-- declare resource setup for new module -->
34
+ <resources>
35
+ <!-- resource identifier -->
36
+ <worldach_setup>
37
+ <!-- specify that this resource is a setup resource and used for upgrades -->
38
+ <setup>
39
+ <!-- which module to look for install/upgrade files in -->
40
+ <module>WorldPayTech_WorldAch</module>
41
+ </setup>
42
+ <!-- specify database connection for this resource -->
43
+ <connection>
44
+ <!-- do not create new connection, use predefined core setup connection -->
45
+ <use>core_setup</use>
46
+ </connection>
47
+ </worldach_setup>
48
+ <worldach_write>
49
+ <connection>
50
+ <use>core_write</use>
51
+ </connection>
52
+ </worldach_write>
53
+ <worldach_read>
54
+ <connection>
55
+ <use>core_read</use>
56
+ </connection>
57
+ </worldach_read>
58
+ </resources>
59
+ </global>
60
+
61
+ <!-- declare default configuration values for this module -->
62
+ <default>
63
+ <!-- 'payment' configuration section (tab) -->
64
+ <payment>
65
+ <!-- 'newmodule' configuration group (fieldset) -->
66
+ <worldach>
67
+ <!-- by default this payment method is inactive -->
68
+ <active>0</active>
69
+ <!-- model to handle logic for this payment method -->
70
+ <model>worldach/paymentMethod</model>
71
+ <!-- order status for new orders paid by this payment method -->
72
+ <order_status>pending</order_status>
73
+ <!-- default title for payment checkout page and order view page -->
74
+ <title>WorldPay ACH</title>
75
+
76
+ <cctypes>AE,VI,MC,DI</cctypes>
77
+ <payment_action>authorize</payment_action>
78
+ <allowspecific>0</allowspecific>
79
+ </worldach>
80
+ </payment>
81
+ </default>
82
+ </config>
app/code/local/WorldPayTech/WorldAch/etc/system.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <!-- payment tab -->
5
+ <payment>
6
+ <groups>
7
+ <!-- newmodule fieldset -->
8
+ <worldach translate="label" module="worldach">
9
+ <!-- will have title 'New Module' -->
10
+ <label>WorldPayAch</label>
11
+ <!-- position between other payment methods -->
12
+ <sort_order>670</sort_order>
13
+ <!-- do not show this configuration options in store scope -->
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>0</show_in_store>
17
+ <fields>
18
+ <!-- is this payment method active for the website? -->
19
+ <active translate="label">
20
+ <!-- label for the field -->
21
+ <label>Enabled</label>
22
+ <!-- input type for configuration value -->
23
+ <frontend_type>select</frontend_type>
24
+ <!-- model to take the option values from -->
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <!-- field position -->
27
+ <sort_order>1</sort_order>
28
+ <!-- do not show this field in store scope -->
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </active>
33
+ <order_status translate="label">
34
+ <label>New order status</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
37
+ <sort_order>5</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ </order_status>
42
+ <title translate="label">
43
+ <label>Title</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>2</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
+ </title>
50
+
51
+
52
+ <sort_order translate="label">
53
+ <label>Sort Order</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>200</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>0</show_in_store>
59
+ <frontend_class>validate-number</frontend_class>
60
+ </sort_order>
61
+
62
+
63
+ </fields>
64
+ </worldach>
65
+ </groups>
66
+ </payment>
67
+ </sections>
68
+ </config>
app/code/local/WorldPayTech/WorldPay/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldPay/Block/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldPay/Block/Form.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class WorldPayTech_WorldPay_Block_Form extends Mage_Payment_Block_Form
29
+ {
30
+
31
+ protected function _construct()
32
+ {
33
+ parent::_construct();
34
+ Mage::log("PrismPayTech_PrismPay_Block_Form");
35
+ $this->setTemplate('worldpay/form/worldpaycc.phtml');
36
+ }
37
+
38
+ /**
39
+ * Retrieve payment configuration object
40
+ *
41
+ * @return Mage_Payment_Model_Config
42
+ */
43
+ protected function _getConfig()
44
+ {
45
+ return Mage::getSingleton('payment/config');
46
+ }
47
+
48
+ /**
49
+ * Retrieve availables credit card types
50
+ *
51
+ * @return array
52
+ */
53
+ public function getCcAvailableTypes()
54
+ {
55
+ $types = $this->_getConfig()->getCcTypes();
56
+ if ($method = $this->getMethod()) {
57
+ $availableTypes = $method->getConfigData('cctypes');
58
+ if ($availableTypes) {
59
+ $availableTypes = explode(',', $availableTypes);
60
+ foreach ($types as $code=>$name) {
61
+ if (!in_array($code, $availableTypes)) {
62
+ unset($types[$code]);
63
+ }
64
+ }
65
+ }
66
+ }
67
+ return $types;
68
+ }
69
+
70
+ /**
71
+ * Retrieve credit card expire months
72
+ *
73
+ * @return array
74
+ */
75
+ public function getCcMonths()
76
+ {
77
+ $months = $this->getData('cc_months');
78
+ if (is_null($months)) {
79
+ $months[0] = $this->__('Month');
80
+ $months = array_merge($months, $this->_getConfig()->getMonths());
81
+ $this->setData('cc_months', $months);
82
+ }
83
+ return $months;
84
+ }
85
+
86
+ /**
87
+ * Retrieve credit card expire years
88
+ *
89
+ * @return array
90
+ */
91
+ public function getCcYears()
92
+ {
93
+ $years = $this->getData('cc_years');
94
+ if (is_null($years)) {
95
+ $years = $this->_getConfig()->getYears();
96
+ $years = array(0=>$this->__('Year'))+$years;
97
+ $this->setData('cc_years', $years);
98
+ }
99
+ return $years;
100
+ }
101
+
102
+ /**
103
+ * Retrive has verification configuration
104
+ *
105
+ * @return boolean
106
+ */
107
+ public function hasVerification()
108
+ {
109
+ if ($this->getMethod()) {
110
+ $configData = $this->getMethod()->getConfigData('useccv');
111
+ if(is_null($configData)){
112
+ return true;
113
+ }
114
+ return (bool) $configData;
115
+ }
116
+ return true;
117
+ }
118
+
119
+ /*
120
+ * Whether switch/solo card type available
121
+ */
122
+ public function hasSsCardType()
123
+ {
124
+ $availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes'));
125
+ $ssPresenations = array_intersect(array('SS', 'SM', 'SO'), $availableTypes);
126
+ if ($availableTypes && count($ssPresenations) > 0) {
127
+ return true;
128
+ }
129
+ return false;
130
+ }
131
+
132
+ /*
133
+ * solo/switch card start year
134
+ * @return array
135
+ */
136
+ public function getSsStartYears()
137
+ {
138
+ $years = array();
139
+ $first = date("Y");
140
+
141
+ for ($index=5; $index>=0; $index--) {
142
+ $year = $first - $index;
143
+ $years[$year] = $year;
144
+ }
145
+ $years = array(0=>$this->__('Year'))+$years;
146
+ return $years;
147
+ }
148
+
149
+ /*
150
+ * solo/switch card getCutomerCardProfileArray
151
+ * @return array
152
+ */
153
+ public function getCutomerCardProfileArray()
154
+ {
155
+
156
+ //check if user login
157
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
158
+
159
+ //get customer id
160
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
161
+ $customer_id=$customerData->getId();
162
+
163
+ //echo $customer_id;
164
+ //print_r($customerData);
165
+
166
+
167
+ ///get customer card profile
168
+ $connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
169
+ $select = $connectionRead->select()
170
+ ->from('customer_profile', array('*'))
171
+ ->where('customer_id=?',$customer_id);
172
+ //->group('customer_id');
173
+ $row =$connectionRead->fetchRow($select); //return rows
174
+ return $result = $connectionRead->fetchAll($select);
175
+ }
176
+ //die;
177
+ return array();
178
+
179
+ }
180
+
181
+ /**
182
+ * Render block HTML
183
+ *
184
+ * @return string
185
+ */
186
+ protected function _toHtml()
187
+ {
188
+ Mage::dispatchEvent('payment_form_block_to_html_before', array(
189
+ 'block' => $this
190
+ ));
191
+ return parent::_toHtml();
192
+ }
193
+ }
app/code/local/WorldPayTech/WorldPay/Block/Info.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Credit card generic payment info
29
+ */
30
+ class WorldPayTech_WorldPay_Block_Info extends Mage_Payment_Block_Info
31
+ {
32
+ /*protected function _construct()
33
+ {
34
+ //parent::_construct();
35
+ //$this->setTemplate('payment/form/cc.phtml');
36
+ //Mage::log("PrismPayTech_PrismPay_Block_Info");
37
+
38
+ }*/
39
+
40
+
41
+ /**
42
+ * Retrieve credit card type name
43
+ *
44
+ * @return string
45
+ */
46
+ public function getCcTypeName()
47
+ {
48
+ $types = Mage::getSingleton('payment/config')->getCcTypes();
49
+ $ccType = $this->getInfo()->getCcType();
50
+ if (isset($types[$ccType])) {
51
+ return $types[$ccType];
52
+ }
53
+ return (empty($ccType)) ? Mage::helper('payment')->__('N/A') : $ccType;
54
+ }
55
+
56
+ /**
57
+ * Whether current payment method has credit card expiration info
58
+ *
59
+ * @return bool
60
+ */
61
+ public function hasCcExpDate()
62
+ {
63
+ return (int)$this->getInfo()->getCcExpMonth() || (int)$this->getInfo()->getCcExpYear();
64
+ }
65
+
66
+ /**
67
+ * Retrieve CC expiration month
68
+ *
69
+ * @return string
70
+ */
71
+ public function getCcExpMonth()
72
+ {
73
+ $month = $this->getInfo()->getCcExpMonth();
74
+ if ($month<10) {
75
+ $month = '0'.$month;
76
+ }
77
+ return $month;
78
+ }
79
+
80
+ /**
81
+ * Retrieve CC expiration date
82
+ *
83
+ * @return Zend_Date
84
+ */
85
+ public function getCcExpDate()
86
+ {
87
+ $date = Mage::app()->getLocale()->date(0);
88
+ $date->setYear($this->getInfo()->getCcExpYear());
89
+ $date->setMonth($this->getInfo()->getCcExpMonth());
90
+ return $date;
91
+ }
92
+
93
+ /**
94
+ * Prepare credit card related payment info
95
+ *
96
+ * @param Varien_Object|array $transport
97
+ * @return Varien_Object
98
+ */
99
+ protected function _prepareSpecificInformation($transport = null)
100
+ {
101
+ if (null !== $this->_paymentSpecificInformation) {
102
+ return $this->_paymentSpecificInformation;
103
+ }
104
+ $transport = parent::_prepareSpecificInformation($transport);
105
+ $data = array();
106
+ if ($ccType = $this->getCcTypeName()) {
107
+ $data[Mage::helper('payment')->__('Credit Card Type')] = $ccType;
108
+ }
109
+ if ($this->getInfo()->getCcLast4()) {
110
+ $data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
111
+ }
112
+ if (!$this->getIsSecureMode()) {
113
+ if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
114
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
115
+ }
116
+ $year = $this->getInfo()->getCcSsStartYear();
117
+ $month = $this->getInfo()->getCcSsStartMonth();
118
+ if ($year && $month) {
119
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Start Date')] = $this->_formatCardDate($year, $month);
120
+ }
121
+ }
122
+ //print_r("<pre>");
123
+ //print_r ($data);
124
+ //die;
125
+ //mail()
126
+ return $transport->setData(array_merge($data, $transport->getData()));
127
+ }
128
+
129
+ /**
130
+ * Format year/month on the credit card
131
+ *
132
+ * @param string $year
133
+ * @param string $month
134
+ * @return string
135
+ */
136
+ protected function _formatCardDate($year, $month)
137
+ {
138
+ return sprintf('%s/%s', sprintf('%02d', $month), $year);
139
+ }
140
+ }
app/code/local/WorldPayTech/WorldPay/Model/PaymentHelper.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Our test CC module adapter
5
+ */
6
+ class WorldPayTech_WorldPay_Model_PaymentHelper extends Mage_Paygate_Model_Authorizenet {
7
+
8
+ /**
9
+ * unique internal payment method identifier
10
+ *
11
+ * @var string [a-z0-9_]
12
+ */
13
+ protected $_code = 'worldpay';
14
+
15
+ /**
16
+ * Here are examples of flags that will determine functionality availability
17
+ * of this module to be used by frontend and backend.
18
+ *
19
+ * @see all flags and their defaults in Mage_Payment_Model_Method_Abstract
20
+ *
21
+ * It is possible to have a custom dynamic logic by overloading
22
+ * public function can* for each flag respectively
23
+ */
24
+
25
+ /**
26
+ * Is this payment method a gateway (online auth/charge) ?
27
+ */
28
+ protected $_isGateway = true;
29
+
30
+ /**
31
+ * Can authorize online?
32
+ */
33
+ protected $_canAuthorize = true;
34
+
35
+ /**
36
+ * Can capture funds online?
37
+ */
38
+ protected $_canCapture = true;
39
+
40
+ /**
41
+ * Can capture partial amounts online?
42
+ */
43
+ protected $_canCapturePartial = false;
44
+
45
+ /**
46
+ * Can refund online?
47
+ */
48
+ protected $_canRefund = true;
49
+
50
+ /**
51
+ * Can void transactions online?
52
+ */
53
+ protected $_canVoid = true;
54
+
55
+ /**
56
+ * Can use this payment method in administration panel?
57
+ */
58
+ protected $_canUseInternal = true;
59
+
60
+ /**
61
+ * Can show this payment method as an option on checkout payment page?
62
+ */
63
+ protected $_canUseCheckout = true;
64
+
65
+ /**
66
+ * Is this payment method suitable for multi-shipping checkout?
67
+ */
68
+ protected $_canUseForMultishipping = true;
69
+
70
+ /**
71
+ * Can save credit card information for future processing?
72
+ */
73
+ protected $_canRefundInvoicePartial = true;
74
+ protected $_canFetchTransactionInfo = true;
75
+ protected $_canReviewPayment = true;
76
+ protected $_formBlockType = 'worldpay/form';
77
+ protected $_infoBlockType = 'worldpay/info';
78
+ protected $_canSaveCc = false;
79
+
80
+
81
+ public $__debugMode;
82
+ public $__testMode;
83
+ public $__accountID;
84
+ public $__subAccountID;
85
+
86
+
87
+ public function __construct() {
88
+ parent::__construct();
89
+
90
+ Mage::log('PrismPay Payment Helper Class Called!');
91
+
92
+ $store = Mage::app()->getStore();
93
+ $storeId = Mage::app()->getStore()->getStoreId();
94
+ $this->__debugMode = Mage::getStoreConfig('payment/worldpay/debug', $storeId);
95
+ $this->__testMode = Mage::getStoreConfig('payment/worldpay/test', $storeId);
96
+
97
+ if($this->__testMode==1)
98
+ {
99
+ $this->__accountID="py7l4";
100
+ $this->__subAccountID="";
101
+
102
+ }else
103
+ {
104
+ $this->__accountID = Mage::getStoreConfig('payment/worldpay/account_id', $storeId);
105
+ $this->__subAccountID = Mage::getStoreConfig('payment/worldpay/sub_account_id', $storeId);
106
+ }
107
+
108
+ }
109
+
110
+
111
+ public function curlHelper(Varien_Object $payment,$xmlString)
112
+ {
113
+
114
+ $ch = curl_init();
115
+ curl_setopt($ch, CURLOPT_URL, 'https://trans.myprismpay.com/cgi-bin/ProcessXML.cgi');
116
+ curl_setopt($ch, CURLOPT_HEADER, false);
117
+ curl_setopt($ch, CURLINFO_HEADER_OUT, false);
118
+ curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/xml; charset=utf-8"));
119
+ //curl_setopt($ch, CURLOPT_USERPWD, 'myusername:mypassword');
120
+ curl_setopt($ch, CURLOPT_POST, 1);
121
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlString);
122
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
123
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
124
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
125
+
126
+ return $data = curl_exec($ch); //This value is the string returned from the bank...
127
+
128
+ if (!$data) {
129
+ throw new Exception(curl_error($ch));
130
+ }
131
+ $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
132
+ if ($httpcode && substr($httpcode, 0, 2) != "20") { //Unsuccessful post request...
133
+ throw new Exception("Returned HTTP CODE: " . $httpcode . " for this URL: " . $urlToPost);
134
+ }
135
+ curl_close($ch);
136
+
137
+ }
138
+
139
+
140
+ public function canRefund() {
141
+
142
+ return true;
143
+ }
144
+
145
+ public function canSaveCard()
146
+ {
147
+ /*if (Mage::getModel('braintree_payments/paymentmethod')->useVault() &&
148
+ (Mage::getSingleton('customer/session')->isLoggedIn() ||
149
+ Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()
150
+ == Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER)){
151
+
152
+ return true;
153
+ }*/
154
+ return true;
155
+ }
156
+
157
+
158
+
159
+ }
160
+
161
+ ?>
app/code/local/WorldPayTech/WorldPay/Model/PaymentMethod.php ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Our test CC module adapter
5
+ */
6
+ class WorldPayTech_WorldPay_Model_PaymentMethod extends WorldPayTech_WorldPay_Model_PaymentHelper {
7
+
8
+
9
+ public function __construct() {
10
+ parent::__construct();
11
+
12
+ $createQuery="CREATE TABLE IF NOT EXISTS `customer_profile` (
13
+ `id` int(11) NOT NULL AUTO_INCREMENT,
14
+ `customer_id` varchar(50) NOT NULL,
15
+ `profile_id` varchar(50) NOT NULL,
16
+ `last_4_digit` varchar(20) NOT NULL,
17
+ PRIMARY KEY (`id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
19
+ ";
20
+
21
+
22
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
23
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
24
+ $write->query($createQuery);
25
+ }
26
+
27
+ /**
28
+ * Here you will need to implement authorize, capture and void public methods
29
+ *
30
+ * @see examples of transaction specific public methods such as
31
+ * authorize, capture and void in Mage_Paygate_Model_Authorizenet
32
+ *
33
+ * In this function i charge credit card and mark order as completed
34
+ */
35
+
36
+ public function authorize(Varien_Object $payment, $amount) {
37
+ $order = $payment->getOrder();
38
+ try {
39
+ Mage::log('PrismPay CC Authorize!');
40
+
41
+
42
+ $is_applyForProfileAdd=$_REQUEST["payment"]["add_profile"];
43
+
44
+
45
+
46
+ $billingaddress = $order->getBillingAddress();
47
+ ob_start();
48
+ $regionModel = Mage::getModel('directory/region')->load($billingaddress->getData('region_id'));
49
+ $ipAddress = $_SERVER['REMOTE_ADDR'];
50
+
51
+ $totals = number_format($amount, 2, '.', '');
52
+
53
+
54
+
55
+ $fields = array(
56
+ "acctid" => $this->__accountID,
57
+ "subid" => $this->__subAccountID,
58
+ "email" => $billingaddress->getData('email'),
59
+ "phone" => $billingaddress->getData('telephone'),
60
+ 'ipaddress' => $_SERVER['REMOTE_ADDR'],
61
+ 'billaddr1' => $billingaddress->getData('street'),
62
+ 'billcity' => $billingaddress->getData('city'),
63
+ 'billstate' => $regionModel->getCode(),
64
+ 'billzip' => $billingaddress->getData('postcode'),
65
+ 'billcountry' => $billingaddress->getData('country_id'),
66
+ 'custom1' => $order->getId(),
67
+ 'ccname' => $billingaddress->getData('firstname'),
68
+ 'ccnum' => $payment->getCcNumber(),
69
+ 'expmon' => $payment->getCcExpMonth(),
70
+ 'expyear' => $payment->getCcExpYear(),
71
+ 'amount' => $totals,
72
+ 'currencycode' => $order->getBaseCurrencyCode(),
73
+ );
74
+
75
+ if($is_applyForProfileAdd=="1")
76
+ {
77
+ $fields["service"]=7;
78
+ $fields["profileactiontype"]=2;
79
+ }else
80
+ {
81
+ $fields["service"]=2;
82
+ }
83
+
84
+
85
+
86
+ $fields_string = "<?xml version=\"1.0\"?><interface_driver><trans_catalog><transaction name=\"creditcard\"><inputs>";
87
+
88
+ foreach ($fields as $key => $value) {
89
+ $fields_string .= '<' . $key . '>' . $value . '</' . $key . '>';
90
+ }
91
+ $fields_string .='</inputs></transaction></trans_catalog></interface_driver>';
92
+
93
+ if ($this->__debugMode == 0) {
94
+ $data=$this->curlHelper($payment, $fields_string);
95
+
96
+ }
97
+ } catch (Exception $e) {
98
+
99
+ $payment->setStatus(self::STATUS_ERROR);
100
+ $payment->setAmount($amount);
101
+ $payment->setLastTransId($orderId);
102
+ $this->setStore($payment->getOrder()->getStoreId());
103
+ Mage::throwException($e->getMessage());
104
+ }
105
+ if ($this->__debugMode == 0) {
106
+ $xmlResponse = new SimpleXmlElement($data); //Simple way to parse xml, Magento might have an equivalent class
107
+ $outputs = $xmlResponse->trans_catalog->transaction->outputs;
108
+ }
109
+
110
+
111
+ $contents = ob_get_contents();
112
+ ob_end_clean();
113
+ error_log($contents);
114
+
115
+ $orderId=$order->getId();
116
+ $transactionId=$outputs->historyid;
117
+ if ($outputs->status == "Approved") {
118
+ $this->setStore($payment->getOrder()->getStoreId());
119
+ $payment->setStatus(self::STATUS_APPROVED);
120
+ $payment->setAmount($amount);
121
+ $payment->setLastTransId($orderId);
122
+
123
+ //save profile id of customer in to database
124
+ $transactionData=array(
125
+ 'status'=>"".$outputs->status."",
126
+ 'authcode'=>"".$outputs->authcode."",
127
+ "historyid"=>"".$outputs->historyid."",
128
+ "orderid"=>"".$outputs->orderid."",
129
+ "refcode"=>"".$outputs->refcode."",
130
+ "total"=>"".$outputs->total."",
131
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
132
+ "accountname"=>"".$outputs->accountname."",
133
+ );
134
+ if($outputs->userprofileid!="" and $fields["service"]==7)
135
+ {
136
+
137
+
138
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
139
+ //get customer id
140
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
141
+ $customer_id=$customerData->getId();
142
+
143
+ $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
144
+ $connectionWrite->beginTransaction();
145
+
146
+ //create customer profile table if not created
147
+ $createQuery="CREATE TABLE IF NOT EXISTS 'customer_profile' (
148
+ 'id' int(11) NOT NULL AUTO_INCREMENT,
149
+ 'customer_id' varchar(50) NOT NULL,
150
+ 'profile_id' varchar(50) NOT NULL,
151
+ 'last_4_digit' varchar(20) NOT NULL,
152
+ PRIMARY KEY ('id')
153
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
154
+ //$results = $connectionWrite->fetchAll($createQuery);
155
+
156
+
157
+ $data = array();
158
+ $data['profile_id']= $outputs->userprofileid;
159
+ $data['last_4_digit']=$outputs->last4digits;
160
+ $data['customer_id']=$customer_id;
161
+ $connectionWrite->insert('customer_profile', $data);
162
+ $connectionWrite->commit();
163
+
164
+ $transactionData['profile_id']= "".$outputs->userprofileid."";
165
+ $transactionData['last_4_digit']="".$outputs->last4digits."";
166
+
167
+ }
168
+
169
+ }
170
+
171
+ $payment->setTransactionId($transactionId);
172
+ $payment->setIsTransactionClosed(0);
173
+ $payment->setParentTransactionId($transactionId);
174
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $transactionData);
175
+
176
+
177
+
178
+
179
+ } else {
180
+ $payment->setStatus(self::STATUS_ERROR);
181
+ $payment->setAmount($amount);
182
+ $payment->setLastTransId($orderId);
183
+ $this->setStore($payment->getOrder()->getStoreId());
184
+ if ($this->__debugMode == 1) {
185
+ Mage::throwException("XMl=" . $fields_string . "\n\nAccount=" . $this->__accountID . "\n\nSub Account=" . $this->__subAccountID . "\n\nTest Mode=" . $this->__testMode . "\n\nDebuge Mode=" . $this->__debugMode);
186
+ } else {
187
+ Mage::throwException($outputs->result);
188
+ }
189
+ }
190
+ return $this;
191
+ }
192
+
193
+ public function capture(Varien_Object $payment, $amount) {
194
+
195
+ // this function is not in used we charged customer credit card in authoriza function/////
196
+
197
+
198
+ }
199
+
200
+ /**
201
+ * Payment refund
202
+ *
203
+ * @param \Magento\Framework\Object $payment
204
+ * @param float $amount
205
+ * @return $this
206
+ * @throws \Magento\Framework\Model\Exception
207
+ */
208
+ public function refund(Varien_Object $payment, $amount) {
209
+ $order = $payment->getOrder();
210
+ try {
211
+ Mage::log('PrismPay CC Refund!');
212
+
213
+
214
+
215
+
216
+ $temp_transaction_id=$payment->getLastTransId();
217
+ $dash_pos = strpos($temp_transaction_id, "-");
218
+ $transaction_id=substr($temp_transaction_id,0,$dash_pos);
219
+ if($transaction_id=="")
220
+ {
221
+ Mage::throwException("Unable to create memo , transaction id not found");
222
+ return $this;
223
+
224
+ }
225
+ $transactionData=$payment->getTransaction($transaction_id)->getData();
226
+ $order_id=@$transactionData["additional_information"]["raw_details_info"]["orderid"];
227
+ $historyid=@$transactionData["additional_information"]["raw_details_info"]["historyid"];
228
+ $refcode=@$transactionData["additional_information"]["raw_details_info"]["refcode"];
229
+
230
+
231
+ $totals = number_format($amount, 2, '.', '');
232
+ $fields = array(
233
+ "service" => "4",
234
+ "acctid" => $this->__accountID,
235
+ "subid" => $this->__subAccountID,
236
+ "historykeyid" => $historyid,
237
+ "orderkeyid" => $order_id,
238
+ 'amount' => $totals,
239
+ );
240
+
241
+
242
+
243
+ $fields_string = "<?xml version=\"1.0\"?><interface_driver><trans_catalog><transaction name=\"creditcard\"><inputs>";
244
+
245
+ foreach ($fields as $key => $value) {
246
+ $fields_string .= '<' . $key . '>' . $value . '</' . $key . '>';
247
+ }
248
+ $fields_string .='</inputs></transaction></trans_catalog></interface_driver>';
249
+ Mage::log('Data '.$fields_string);
250
+ if ($this->__debugMode == 0) {
251
+ $data=$this->curlHelper($payment, $fields_string);
252
+
253
+ }
254
+ } catch (Exception $e) {
255
+
256
+ $payment->setStatus(self::STATUS_ERROR);
257
+ $payment->setAmount($amount);
258
+ $payment->setLastTransId($orderId);
259
+ $this->setStore($payment->getOrder()->getStoreId());
260
+ Mage::throwException($e->getMessage());
261
+ }
262
+ $xmlResponse = new SimpleXmlElement($data); //Simple way to parse xml, Magento might have an equivalent class
263
+ $outputs = $xmlResponse->trans_catalog->transaction->outputs;
264
+
265
+
266
+ //error_log($contents);
267
+
268
+ $transactionId=$outputs->historyid;
269
+ if ($outputs->status == "Approved") {
270
+ Mage::log('Refund Request Approved');
271
+
272
+ $payment->setTransactionId($transactionId."-refund");
273
+ $payment->setIsTransactionClosed(1);
274
+ $payment->setParentTransactionId($transaction_id);
275
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
276
+ array(
277
+ 'status'=>"".$outputs->status."",
278
+ 'authcode'=>"".$outputs->authcode."",
279
+ "historyid"=>"".$outputs->historyid."",
280
+ "orderid"=>"".$outputs->orderid."",
281
+ "refcode"=>"".$outputs->refcode."",
282
+ "total"=>"".$outputs->total."",
283
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
284
+ "accountname"=>"".$outputs->accountname."",
285
+ )
286
+ );
287
+
288
+
289
+ } else {
290
+ Mage::log('Refund Request Decline');
291
+
292
+ $payment->setTransactionId($transactionId."-refund");
293
+ $payment->setIsTransactionClosed(1);
294
+ $payment->setParentTransactionId($transactionId);
295
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
296
+ array(
297
+ 'status'=>"".$outputs->status."",
298
+ 'authcode'=>"".$outputs->authcode."",
299
+ "historyid"=>"".$outputs->historyid."",
300
+ "orderid"=>"".$outputs->orderid."",
301
+ "refcode"=>"".$outputs->refcode."",
302
+ "total"=>"".$outputs->total."",
303
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
304
+ "accountname"=>"".$outputs->accountname."",
305
+ )
306
+ );
307
+ Mage::throwException("Declined");
308
+ }
309
+ return $this;
310
+ }
311
+
312
+ public function cancel(Varien_Object $payment) {
313
+
314
+ // void the order if canceled
315
+ Mage::log('Order: cancel!');
316
+
317
+ return $this;
318
+ }
319
+
320
+ public function void(Varien_Object $payment) {
321
+
322
+
323
+ Mage::log('Order: void!');
324
+
325
+ /* Whatever you call to void a payment in your gateway */
326
+ }
327
+
328
+ }
329
+
330
+ ?>
app/code/local/WorldPayTech/WorldPay/etc/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldPay/etc/config.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <WorldPayTech_WorldPay>
5
+ <!-- declare module's version information for database updates -->
6
+ <version>0.1.0</version>
7
+ </WorldPayTech_WorldPay>
8
+ </modules>
9
+
10
+ <global>
11
+ <!-- IMPORTANT: if you use your own namespace (i.e. CompanyName) you also have to declare blocks group for new module. See topic: http://www.magentocommerce.com/boards/viewthread/22416/#t102732 -->
12
+ <blocks>
13
+ <worldpay>
14
+ <class>WorldPayTech_WorldPay_Block</class>
15
+ </worldpay>
16
+ </blocks>
17
+
18
+ <!-- declare model group for new module -->
19
+ <models>
20
+ <!-- model group alias to be used in Mage::getModel('newmodule/...') -->
21
+ <worldpay>
22
+ <!-- base class name for the model group -->
23
+ <class>WorldPayTech_WorldPay_Model</class>
24
+ </worldpay>
25
+ </models>
26
+
27
+ <!-- declare resource setup for new module -->
28
+ <resources>
29
+ <!-- resource identifier -->
30
+ <worldpay_setup>
31
+ <!-- specify that this resource is a setup resource and used for upgrades -->
32
+ <setup>
33
+ <!-- which module to look for install/upgrade files in -->
34
+ <module>WorldPayTech_WorldPay</module>
35
+ </setup>
36
+ <!-- specify database connection for this resource -->
37
+ <connection>
38
+ <!-- do not create new connection, use predefined core setup connection -->
39
+ <use>core_setup</use>
40
+ </connection>
41
+ </worldpay_setup>
42
+ <worldpay_write>
43
+ <connection>
44
+ <use>core_write</use>
45
+ </connection>
46
+ </worldpay_write>
47
+ <worldpay_read>
48
+ <connection>
49
+ <use>core_read</use>
50
+ </connection>
51
+ </worldpay_read>
52
+ </resources>
53
+ </global>
54
+
55
+ <!-- declare default configuration values for this module -->
56
+ <default>
57
+ <!-- 'payment' configuration section (tab) -->
58
+ <payment>
59
+ <!-- 'newmodule' configuration group (fieldset) -->
60
+ <worldpay>
61
+ <!-- by default this payment method is inactive -->
62
+ <active>0</active>
63
+ <!-- model to handle logic for this payment method -->
64
+ <model>worldpay/paymentMethod</model>
65
+ <!-- order status for new orders paid by this payment method -->
66
+ <order_status>pending</order_status>
67
+ <!-- default title for payment checkout page and order view page -->
68
+ <title>Credit Card (worldpay)</title>
69
+
70
+ <cctypes>AE,VI,MC,DI</cctypes>
71
+ <payment_action>authorize</payment_action>
72
+ <allowspecific>0</allowspecific>
73
+ </worldpay>
74
+ </payment>
75
+ </default>
76
+ </config>
app/code/local/WorldPayTech/WorldPay/etc/system.xml ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <!-- payment tab -->
5
+ <payment>
6
+ <groups>
7
+ <!-- newmodule fieldset -->
8
+ <worldpay translate="label" module="paygate">
9
+ <!-- will have title 'New Module' -->
10
+ <label>WorldPay</label>
11
+ <!-- position between other payment methods -->
12
+ <sort_order>670</sort_order>
13
+ <!-- do not show this configuration options in store scope -->
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>0</show_in_store>
17
+ <fields>
18
+ <!-- is this payment method active for the website? -->
19
+ <active translate="label">
20
+ <!-- label for the field -->
21
+ <label>Enabled</label>
22
+ <!-- input type for configuration value -->
23
+ <frontend_type>select</frontend_type>
24
+ <!-- model to take the option values from -->
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <!-- field position -->
27
+ <sort_order>1</sort_order>
28
+ <!-- do not show this field in store scope -->
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </active>
33
+ <order_status translate="label">
34
+ <label>New order status</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
37
+ <sort_order>5</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ </order_status>
42
+ <title translate="label">
43
+ <label>Title</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>2</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
+ </title>
50
+ <account_id translate="label">
51
+ <label>Account ID</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>3</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ </account_id>
58
+ <sub_account_id translate="label">
59
+ <label>Sub Account ID</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>4</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </sub_account_id>
66
+
67
+
68
+ <test translate="label">
69
+ <label>Test Mode</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>80</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>0</show_in_store>
76
+ </test>
77
+ <!--<cgi_url translate="label">
78
+ <label>Gateway URL</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>90</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>0</show_in_store>
84
+ </cgi_url>
85
+ <currency translate="label">
86
+ <label>Accepted Currency</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_currency</source_model>
89
+ <sort_order>100</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>0</show_in_store>
93
+ </currency>-->
94
+ <debug translate="label">
95
+ <label>Debug</label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <sort_order>110</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>0</show_in_store>
102
+ </debug>
103
+ <!--<email_customer translate="label">
104
+ <label>Email Customer</label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>adminhtml/system_config_source_yesno</source_model>
107
+ <sort_order>120</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>0</show_in_store>
111
+ </email_customer>
112
+ <merchant_email translate="label">
113
+ <label>Merchant's Email</label>
114
+ <frontend_type>text</frontend_type>
115
+ <validate>validate-email</validate>
116
+ <sort_order>130</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>0</show_in_store>
120
+ </merchant_email>-->
121
+ <cctypes translate="label">
122
+ <label>Credit Card Types</label>
123
+ <frontend_type>multiselect</frontend_type>
124
+ <source_model>paygate/authorizenet_source_cctype</source_model>
125
+ <sort_order>140</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>0</show_in_store>
129
+ </cctypes>
130
+ <!--<useccv translate="label">
131
+ <label>Credit Card Verification</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>150</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>0</show_in_store>
138
+ </useccv>-->
139
+ <allowspecific translate="label">
140
+ <label>Payment from Applicable Countries</label>
141
+ <frontend_type>allowspecific</frontend_type>
142
+ <sort_order>160</sort_order>
143
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>0</show_in_store>
147
+ </allowspecific>
148
+ <specificcountry translate="label">
149
+ <label>Payment from Specific Countries</label>
150
+ <frontend_type>multiselect</frontend_type>
151
+ <sort_order>170</sort_order>
152
+ <source_model>adminhtml/system_config_source_country</source_model>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>0</show_in_store>
156
+ </specificcountry>
157
+ <min_order_total translate="label">
158
+ <label>Minimum Order Total</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>180</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>0</show_in_store>
164
+ </min_order_total>
165
+ <max_order_total translate="label">
166
+ <label>Maximum Order Total</label>
167
+ <frontend_type>text</frontend_type>
168
+ <sort_order>190</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>0</show_in_store>
172
+ </max_order_total>
173
+ <sort_order translate="label">
174
+ <label>Sort Order</label>
175
+ <frontend_type>text</frontend_type>
176
+ <sort_order>200</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>0</show_in_store>
180
+ <frontend_class>validate-number</frontend_class>
181
+ </sort_order>
182
+
183
+ </fields>
184
+ </worldpay>
185
+ </groups>
186
+ </payment>
187
+ </sections>
188
+ </config>
app/code/local/WorldPayTech/WorldProfile/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldProfile/Block/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldProfile/Block/Form.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class WorldPayTech_WorldProfile_Block_Form extends Mage_Payment_Block_Form
29
+ {
30
+ protected $_code = 'worldprofile';
31
+ protected function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->setTemplate('worldpay/form/worldpayprofile.phtml');
35
+ Mage::log("PrismPayTech_PrismProfile_Block_Form");
36
+ }
37
+
38
+ /**
39
+ * Retrieve payment configuration object
40
+ *
41
+ * @return Mage_Payment_Model_Config
42
+ */
43
+ protected function _getConfig()
44
+ {
45
+ return Mage::getSingleton('payment/config');
46
+ }
47
+
48
+ /**
49
+ * Retrieve availables credit card types
50
+ *
51
+ * @return array
52
+ */
53
+ public function getCcAvailableTypes()
54
+ {
55
+ $types = $this->_getConfig()->getCcTypes();
56
+ if ($method = $this->getMethod()) {
57
+ $availableTypes = $method->getConfigData('cctypes');
58
+ if ($availableTypes) {
59
+ $availableTypes = explode(',', $availableTypes);
60
+ foreach ($types as $code=>$name) {
61
+ if (!in_array($code, $availableTypes)) {
62
+ unset($types[$code]);
63
+ }
64
+ }
65
+ }
66
+ }
67
+ return $types;
68
+ }
69
+
70
+ /**
71
+ * Retrieve credit card expire months
72
+ *
73
+ * @return array
74
+ */
75
+ public function getCcMonths()
76
+ {
77
+ $months = $this->getData('cc_months');
78
+ if (is_null($months)) {
79
+ $months[0] = $this->__('Month');
80
+ $months = array_merge($months, $this->_getConfig()->getMonths());
81
+ $this->setData('cc_months', $months);
82
+ }
83
+ return $months;
84
+ }
85
+
86
+ /**
87
+ * Retrieve credit card expire years
88
+ *
89
+ * @return array
90
+ */
91
+ public function getCcYears()
92
+ {
93
+ $years = $this->getData('cc_years');
94
+ if (is_null($years)) {
95
+ $years = $this->_getConfig()->getYears();
96
+ $years = array(0=>$this->__('Year'))+$years;
97
+ $this->setData('cc_years', $years);
98
+ }
99
+ return $years;
100
+ }
101
+
102
+ /**
103
+ * Retrive has verification configuration
104
+ *
105
+ * @return boolean
106
+ */
107
+ public function hasVerification()
108
+ {
109
+ if ($this->getMethod()) {
110
+ $configData = $this->getMethod()->getConfigData('useccv');
111
+ if(is_null($configData)){
112
+ return true;
113
+ }
114
+ return (bool) $configData;
115
+ }
116
+ return true;
117
+ }
118
+
119
+ /*
120
+ * Whether switch/solo card type available
121
+ */
122
+ public function hasSsCardType()
123
+ {
124
+ $availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes'));
125
+ $ssPresenations = array_intersect(array('SS', 'SM', 'SO'), $availableTypes);
126
+ if ($availableTypes && count($ssPresenations) > 0) {
127
+ return true;
128
+ }
129
+ return false;
130
+ }
131
+
132
+ /*
133
+ * solo/switch card start year
134
+ * @return array
135
+ */
136
+ public function getSsStartYears()
137
+ {
138
+ $years = array();
139
+ $first = date("Y");
140
+
141
+ for ($index=5; $index>=0; $index--) {
142
+ $year = $first - $index;
143
+ $years[$year] = $year;
144
+ }
145
+ $years = array(0=>$this->__('Year'))+$years;
146
+ return $years;
147
+ }
148
+
149
+ /*
150
+ * solo/switch card getCutomerCardProfileArray
151
+ * @return array
152
+ */
153
+ public function getCutomerCardProfileArray()
154
+ {
155
+
156
+ //check if user login
157
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
158
+
159
+ //get customer id
160
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
161
+ $customer_id=$customerData->getId();
162
+
163
+ //echo $customer_id;
164
+ //print_r($customerData);
165
+
166
+
167
+ ///get customer card profile
168
+ $connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
169
+ $select = $connectionRead->select()
170
+ ->from('customer_profile', array('*'))
171
+ ->where('customer_id=?',$customer_id);
172
+ //->group('customer_id');
173
+ $row =$connectionRead->fetchRow($select); //return rows
174
+ return $result = $connectionRead->fetchAll($select);
175
+ }
176
+ //die;
177
+ return array();
178
+
179
+ }
180
+
181
+ /**
182
+ * Render block HTML
183
+ *
184
+ * @return string
185
+ */
186
+ protected function _toHtml()
187
+ {
188
+ Mage::dispatchEvent('payment_form_block_to_html_before', array(
189
+ 'block' => $this
190
+ ));
191
+ return parent::_toHtml();
192
+ }
193
+ }
app/code/local/WorldPayTech/WorldProfile/Block/Info.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Payment
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Credit card generic payment info
29
+ */
30
+ class WorldPayTech_WorldProfile_Block_Info extends Mage_Payment_Block_Info
31
+ {
32
+ /*protected function _construct()
33
+ {
34
+ //parent::_construct();
35
+ //$this->setTemplate('payment/form/cc.phtml');
36
+ //Mage::log("PrismPayTech_PrismPay_Block_Info");
37
+
38
+ }*/
39
+
40
+
41
+ /**
42
+ * Retrieve credit card type name
43
+ *
44
+ * @return string
45
+ */
46
+ public function getCcTypeName()
47
+ {
48
+ $types = Mage::getSingleton('payment/config')->getCcTypes();
49
+ $ccType = $this->getInfo()->getCcType();
50
+ if (isset($types[$ccType])) {
51
+ return $types[$ccType];
52
+ }
53
+ return (empty($ccType)) ? Mage::helper('payment')->__('N/A') : $ccType;
54
+ }
55
+
56
+ /**
57
+ * Whether current payment method has credit card expiration info
58
+ *
59
+ * @return bool
60
+ */
61
+ public function hasCcExpDate()
62
+ {
63
+ return (int)$this->getInfo()->getCcExpMonth() || (int)$this->getInfo()->getCcExpYear();
64
+ }
65
+
66
+ /**
67
+ * Retrieve CC expiration month
68
+ *
69
+ * @return string
70
+ */
71
+ public function getCcExpMonth()
72
+ {
73
+ $month = $this->getInfo()->getCcExpMonth();
74
+ if ($month<10) {
75
+ $month = '0'.$month;
76
+ }
77
+ return $month;
78
+ }
79
+
80
+ /**
81
+ * Retrieve CC expiration date
82
+ *
83
+ * @return Zend_Date
84
+ */
85
+ public function getCcExpDate()
86
+ {
87
+ $date = Mage::app()->getLocale()->date(0);
88
+ $date->setYear($this->getInfo()->getCcExpYear());
89
+ $date->setMonth($this->getInfo()->getCcExpMonth());
90
+ return $date;
91
+ }
92
+
93
+ /**
94
+ * Prepare credit card related payment info
95
+ *
96
+ * @param Varien_Object|array $transport
97
+ * @return Varien_Object
98
+ */
99
+ protected function _prepareSpecificInformation($transport = null)
100
+ {
101
+ if (null !== $this->_paymentSpecificInformation) {
102
+ return $this->_paymentSpecificInformation;
103
+ }
104
+ $transport = parent::_prepareSpecificInformation($transport);
105
+ $data = array();
106
+ $data[Mage::helper('payment')->__('Profile Id')] = "********";
107
+ /*if ($ccType = $this->getCcTypeName()) {
108
+ $data[Mage::helper('payment')->__('Credit Card Type')] = $ccType;
109
+ }
110
+ if ($this->getInfo()->getCcLast4()) {
111
+ $data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
112
+ }
113
+ if (!$this->getIsSecureMode()) {
114
+ if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
115
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
116
+ }
117
+ $year = $this->getInfo()->getCcSsStartYear();
118
+ $month = $this->getInfo()->getCcSsStartMonth();
119
+ if ($year && $month) {
120
+ $data[Mage::helper('payment')->__('Switch/Solo/Maestro Start Date')] = $this->_formatCardDate($year, $month);
121
+ }
122
+ }*/
123
+ //print_r("<pre>");
124
+ //print_r ($data);
125
+ //die;
126
+ //mail()
127
+ return $transport->setData(array_merge($data, $transport->getData()));
128
+ }
129
+
130
+ /**
131
+ * Format year/month on the credit card
132
+ *
133
+ * @param string $year
134
+ * @param string $month
135
+ * @return string
136
+ */
137
+ protected function _formatCardDate($year, $month)
138
+ {
139
+ return sprintf('%s/%s', sprintf('%02d', $month), $year);
140
+ }
141
+ }
app/code/local/WorldPayTech/WorldProfile/Helper/Data.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adyen Payment Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Adyen
17
+ * @package Adyen_Payment
18
+ * @copyright Copyright (c) 2011 Adyen (http://www.adyen.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ /**
22
+ * @category Payment Gateway
23
+ * @package Adyen_Payment
24
+ * @author Adyen
25
+ * @property Adyen B.V
26
+ * @copyright Copyright (c) 2014 Adyen BV (http://www.adyen.com)
27
+ */
28
+ class WorldPayTech_WorldProfile_Helper_Data extends Mage_Payment_Helper_Data {
29
+
30
+ /**
31
+ * Zend_Log debug level
32
+ * @var unknown_type
33
+ */
34
+
35
+
36
+ }
app/code/local/WorldPayTech/WorldProfile/Model/PaymentMethod.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Our test CC module adapter
5
+ */
6
+ class WorldPayTech_WorldProfile_Model_PaymentMethod extends WorldPayTech_WorldPay_Model_PaymentHelper {
7
+
8
+ protected $_code = 'worldprofile';
9
+ protected $_formBlockType = 'worldprofile/form';
10
+ protected $_infoBlockType = 'worldprofile/info';
11
+
12
+ public function __construct() {
13
+ parent::__construct();
14
+ Mage::log("PrismPayTech_PrismProfile_Model_PaymentMethod");
15
+
16
+ }
17
+
18
+ /**
19
+ * Here you will need to implement authorize, capture and void public methods
20
+ *
21
+ * @see examples of transaction specific public methods such as
22
+ * authorize, capture and void in Mage_Paygate_Model_Authorizenet
23
+ *
24
+ * In this function i charge credit card and mark order as completed
25
+ */
26
+
27
+ public function authorize(Varien_Object $payment, $amount) {
28
+ $order = $payment->getOrder();
29
+ try {
30
+ Mage::log('PrismProfile Authorize!');
31
+
32
+ $temp_profile_id=explode("-",$_REQUEST["payment"]["profile_id"]);
33
+ $profile_id=$temp_profile_id[0];
34
+ $last_4_digit=$temp_profile_id[1];
35
+
36
+ $ipAddress = $_SERVER['REMOTE_ADDR'];
37
+
38
+ $totals = number_format($amount, 2, '.', '');
39
+ $fields = array(
40
+ "service" => "8",
41
+ "acctid" => $this->__accountID,
42
+ "subid" => $this->__subAccountID,
43
+ "userprofileid" => $profile_id,
44
+ "last4digits" => $last_4_digit,
45
+ 'ipaddress' => $_SERVER['REMOTE_ADDR'],
46
+ 'currencycode' => $order->getBaseCurrencyCode(),
47
+ 'amount' => $totals,
48
+ );
49
+
50
+
51
+
52
+ $fields_string = "<?xml version=\"1.0\"?><interface_driver><trans_catalog><transaction name=\"creditcard\"><inputs>";
53
+
54
+ foreach ($fields as $key => $value) {
55
+ $fields_string .= '<' . $key . '>' . $value . '</' . $key . '>';
56
+ }
57
+ $fields_string .='</inputs></transaction></trans_catalog></interface_driver>';
58
+
59
+ if ($this->__debugMode == 0) {
60
+ $data=$this->curlHelper($payment, $fields_string);
61
+
62
+ }
63
+ } catch (Exception $e) {
64
+
65
+ $payment->setStatus(self::STATUS_ERROR);
66
+ $payment->setAmount($amount);
67
+ $payment->setLastTransId($orderId);
68
+ $this->setStore($payment->getOrder()->getStoreId());
69
+ Mage::throwException($e->getMessage());
70
+ }
71
+ if ($this->__debugMode == 0) {
72
+ $xmlResponse = new SimpleXmlElement($data); //Simple way to parse xml, Magento might have an equivalent class
73
+ $outputs = $xmlResponse->trans_catalog->transaction->outputs;
74
+ }
75
+
76
+ $orderId=$order->getId();
77
+ $transactionId=$outputs->historyid;
78
+ if ($outputs->status == "Approved") {
79
+ $this->setStore($payment->getOrder()->getStoreId());
80
+ $payment->setStatus(self::STATUS_APPROVED);
81
+ $payment->setAmount($amount);
82
+ $payment->setLastTransId($orderId);
83
+
84
+ $payment->setTransactionId($transactionId);
85
+ $payment->setIsTransactionClosed(0);
86
+ $payment->setParentTransactionId($transactionId);
87
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
88
+ array(
89
+ 'status'=>"".$outputs->status."",
90
+ 'authcode'=>"".$outputs->authcode."",
91
+ "historyid"=>"".$outputs->historyid."",
92
+ "orderid"=>"".$outputs->orderid."",
93
+ "refcode"=>"".$outputs->refcode."",
94
+ "total"=>"".$outputs->total."",
95
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
96
+ "accountname"=>"".$outputs->accountname."",
97
+ "profie_id"=>"".$profile_id."",
98
+ "last4digits"=>"".$last_4_digit."",
99
+ )
100
+ );
101
+
102
+
103
+ } else {
104
+ $payment->setStatus(self::STATUS_ERROR);
105
+ $payment->setAmount($amount);
106
+ $payment->setLastTransId($orderId);
107
+ $this->setStore($payment->getOrder()->getStoreId());
108
+ if ($this->__debugMode == 1) {
109
+ Mage::throwException("XMl=" . $fields_string . "\n\nAccount=" . $this->__accountID . "\n\nSub Account=" . $this->__subAccountID . "\n\nTest Mode=" . $this->__testMode . "\n\nDebuge Mode=" . $this->__debugMode);
110
+ } else {
111
+ Mage::throwException($outputs->result);
112
+ }
113
+ }
114
+ return $this;
115
+ }
116
+
117
+ public function capture(Varien_Object $payment, $amount) {
118
+
119
+ // this function is not in used /////
120
+
121
+
122
+ }
123
+ public function validate()
124
+ {
125
+ /*
126
+ * calling parent validate function
127
+ */
128
+ //parent::validate();
129
+ Mage::log("Prism Profile Validate");
130
+
131
+ return $this;
132
+ }
133
+
134
+ /**
135
+ * Payment refund
136
+ *
137
+ * @param \Magento\Framework\Object $payment
138
+ * @param float $amount
139
+ * @return $this
140
+ * @throws \Magento\Framework\Model\Exception
141
+ */
142
+
143
+ public function refund(Varien_Object $payment, $amount) {
144
+ $order = $payment->getOrder();
145
+ try {
146
+ Mage::log('PrismPay Profile Refund!');
147
+
148
+
149
+ $temp_transaction_id=$payment->getLastTransId();
150
+ $dash_pos = strpos($temp_transaction_id, "-");
151
+ $transaction_id=substr($temp_transaction_id,0,$dash_pos);
152
+ if($transaction_id=="")
153
+ {
154
+ Mage::throwException("Unable to create memo , transaction id not found");
155
+ return $this;
156
+
157
+ }
158
+ $transactionData=$payment->getTransaction($transaction_id)->getData();
159
+ $order_id=@$transactionData["additional_information"]["raw_details_info"]["orderid"];
160
+ $historyid=@$transactionData["additional_information"]["raw_details_info"]["historyid"];
161
+ $refcode=@$transactionData["additional_information"]["raw_details_info"]["refcode"];
162
+
163
+
164
+ $totals = number_format($amount, 2, '.', '');
165
+ $fields = array(
166
+ "service" => "4",
167
+ "acctid" => $this->__accountID,
168
+ "subid" => $this->__subAccountID,
169
+ "historykeyid" => $historyid,
170
+ "orderkeyid" => $order_id,
171
+ 'amount' => $totals,
172
+ );
173
+
174
+
175
+
176
+ $fields_string = "<?xml version=\"1.0\"?><interface_driver><trans_catalog><transaction name=\"creditcard\"><inputs>";
177
+
178
+ foreach ($fields as $key => $value) {
179
+ $fields_string .= '<' . $key . '>' . $value . '</' . $key . '>';
180
+ }
181
+ $fields_string .='</inputs></transaction></trans_catalog></interface_driver>';
182
+
183
+ Mage::log('Data '.$fields_string);
184
+
185
+ if ($this->__debugMode == 0) {
186
+ $data=$this->curlHelper($payment, $fields_string);
187
+
188
+ }
189
+ } catch (Exception $e) {
190
+
191
+ $payment->setStatus(self::STATUS_ERROR);
192
+ $payment->setAmount($amount);
193
+ $payment->setLastTransId($orderId);
194
+ $this->setStore($payment->getOrder()->getStoreId());
195
+ Mage::throwException($e->getMessage());
196
+ }
197
+ $xmlResponse = new SimpleXmlElement($data); //Simple way to parse xml, Magento might have an equivalent class
198
+ $outputs = $xmlResponse->trans_catalog->transaction->outputs;
199
+
200
+
201
+ //error_log($contents);
202
+
203
+ $transactionId=$outputs->historyid;
204
+ if ($outputs->status == "Approved") {
205
+ Mage::log('Refund Request Approved');
206
+
207
+ $payment->setTransactionId($transactionId."-refund");
208
+ $payment->setIsTransactionClosed(1);
209
+ $payment->setParentTransactionId($transaction_id);
210
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
211
+ array(
212
+ 'status'=>"".$outputs->status."",
213
+ 'authcode'=>"".$outputs->authcode."",
214
+ "historyid"=>"".$outputs->historyid."",
215
+ "orderid"=>"".$outputs->orderid."",
216
+ "refcode"=>"".$outputs->refcode."",
217
+ "total"=>"".$outputs->total."",
218
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
219
+ "accountname"=>"".$outputs->accountname."",
220
+ )
221
+ );
222
+
223
+
224
+ } else {
225
+ Mage::log('Refund Request Decline');
226
+
227
+ $payment->setTransactionId($transactionId."-refund");
228
+ $payment->setIsTransactionClosed(1);
229
+ $payment->setParentTransactionId($transactionId);
230
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
231
+ array(
232
+ 'status'=>"".$outputs->status."",
233
+ 'authcode'=>"".$outputs->authcode."",
234
+ "historyid"=>"".$outputs->historyid."",
235
+ "orderid"=>"".$outputs->orderid."",
236
+ "refcode"=>"".$outputs->refcode."",
237
+ "total"=>"".$outputs->total."",
238
+ "merchantordernumber"=>"".$outputs->merchantordernumber."",
239
+ "accountname"=>"".$outputs->accountname."",
240
+ )
241
+ );
242
+ Mage::throwException($outputs->result);
243
+ }
244
+ return $this;
245
+ }
246
+
247
+ public function cancel(Varien_Object $payment) {
248
+
249
+ // void the order if canceled
250
+ Mage::log('Order: cancel!');
251
+
252
+ return $this;
253
+ }
254
+
255
+ public function void(Varien_Object $payment) {
256
+
257
+
258
+ Mage::log('Order: void!');
259
+
260
+ /* Whatever you call to void a payment in your gateway */
261
+ }
262
+
263
+ }
264
+
265
+ ?>
app/code/local/WorldPayTech/WorldProfile/etc/.DS_Store ADDED
Binary file
app/code/local/WorldPayTech/WorldProfile/etc/config.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <WorldPayTech_WorldProfile>
5
+ <!-- declare module's version information for database updates -->
6
+ <version>0.1.0</version>
7
+ </WorldPayTech_WorldProfile>
8
+ </modules>
9
+
10
+ <global>
11
+ <!-- IMPORTANT: if you use your own namespace (i.e. CompanyName) you also have to declare blocks group for new module. See topic: http://www.magentocommerce.com/boards/viewthread/22416/#t102732 -->
12
+ <blocks>
13
+ <worldprofile>
14
+ <class>WorldPayTech_WorldProfile_Block</class>
15
+ </worldprofile>
16
+ </blocks>
17
+
18
+
19
+ <!-- declare model group for new module -->
20
+ <models>
21
+ <!-- model group alias to be used in Mage::getModel('newmodule/...') -->
22
+ <worldprofile>
23
+ <!-- base class name for the model group -->
24
+ <class>WorldPayTech_WorldProfile_Model</class>
25
+ </worldprofile>
26
+ </models>
27
+ <helpers>
28
+ <worldprofile>
29
+ <class>WorldPayTech_WorldProfile_Helper</class>
30
+ </worldprofile>
31
+ </helpers>
32
+
33
+ <!-- declare resource setup for new module -->
34
+ <resources>
35
+ <!-- resource identifier -->
36
+ <worldprofile_setup>
37
+ <!-- specify that this resource is a setup resource and used for upgrades -->
38
+ <setup>
39
+ <!-- which module to look for install/upgrade files in -->
40
+ <module>WorldPayTech_WorldProfile</module>
41
+ </setup>
42
+ <!-- specify database connection for this resource -->
43
+ <connection>
44
+ <!-- do not create new connection, use predefined core setup connection -->
45
+ <use>core_setup</use>
46
+ </connection>
47
+ </worldprofile_setup>
48
+ <worldprofile_write>
49
+ <connection>
50
+ <use>core_write</use>
51
+ </connection>
52
+ </worldprofile_write>
53
+ <worldprofile_read>
54
+ <connection>
55
+ <use>core_read</use>
56
+ </connection>
57
+ </worldprofile_read>
58
+ </resources>
59
+ </global>
60
+
61
+ <!-- declare default configuration values for this module -->
62
+ <default>
63
+ <!-- 'payment' configuration section (tab) -->
64
+ <payment>
65
+ <!-- 'newmodule' configuration group (fieldset) -->
66
+ <worldprofile>
67
+ <!-- by default this payment method is inactive -->
68
+ <active>0</active>
69
+ <!-- model to handle logic for this payment method -->
70
+ <model>worldprofile/paymentMethod</model>
71
+ <!-- order status for new orders paid by this payment method -->
72
+ <order_status>pending</order_status>
73
+ <!-- default title for payment checkout page and order view page -->
74
+ <title>CreditCard Profile</title>
75
+
76
+ <cctypes>AE,VI,MC,DI</cctypes>
77
+ <payment_action>authorize</payment_action>
78
+ <allowspecific>0</allowspecific>
79
+ </worldprofile>
80
+ </payment>
81
+ </default>
82
+ </config>
app/code/local/WorldPayTech/WorldProfile/etc/system.xml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <!-- payment tab -->
5
+ <payment>
6
+ <groups>
7
+ <!-- newmodule fieldset -->
8
+ <worldprofile translate="label" module="worldprofile">
9
+ <!-- will have title 'New Module' -->
10
+ <label>WorldPayProfile</label>
11
+ <!-- position between other payment methods -->
12
+ <sort_order>670</sort_order>
13
+ <!-- do not show this configuration options in store scope -->
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>0</show_in_store>
17
+ <fields>
18
+ <!-- is this payment method active for the website? -->
19
+ <active translate="label">
20
+ <!-- label for the field -->
21
+ <label>Enabled</label>
22
+ <!-- input type for configuration value -->
23
+ <frontend_type>select</frontend_type>
24
+ <!-- model to take the option values from -->
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <!-- field position -->
27
+ <sort_order>1</sort_order>
28
+ <!-- do not show this field in store scope -->
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </active>
33
+ <order_status translate="label">
34
+ <label>New order status</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
37
+ <sort_order>5</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ </order_status>
42
+ <title translate="label">
43
+ <label>Title</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>2</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
+ </title>
50
+ <sort_order translate="label">
51
+ <label>Sort Order</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>200</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ <frontend_class>validate-number</frontend_class>
58
+ </sort_order>
59
+
60
+
61
+ </fields>
62
+ </worldprofile>
63
+ </groups>
64
+ </payment>
65
+ </sections>
66
+ </config>
app/design/frontend/rwd/default/template/worldpay/.DS_Store ADDED
Binary file
app/design/frontend/rwd/default/template/worldpay/form/.DS_Store ADDED
Binary file
app/design/frontend/rwd/default/template/worldpay/form/pp.phtml ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $cardProfileArray=array();
29
+ //$_code="prismpay";
30
+ $_code=$this->getMethodCode();
31
+ //die;
32
+ //$cardProfileArray=$this->getCutomerCardProfileArray();
33
+ //print"<pre>";
34
+ //print_r($cardProfileArray);
35
+ ?>
36
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
37
+ <?php /*
38
+ <li>
39
+ <div class="input-box">
40
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
41
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->escapeHtml($this->getInfoData('cc_owner')) ?>" />
42
+ </div>
43
+ </li>
44
+ */ ?>
45
+ <li>
46
+ <div class="input-box">
47
+ <input type="radio" id="<?php echo $_code ?>_tran_type" name="payment[tran_type]" class="<?php echo $_code ?>_tran_type" value="creditcard" checked />
48
+ <a href="#"><?php echo $this->__('Transaction with New CreditCard Number') ?></a>
49
+ </div>
50
+ </li>
51
+ <li>
52
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
53
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
54
+ <div class="input-box">
55
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select" title="<?php echo $this->__('Credit Card Type') ?>">
56
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
57
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
58
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
59
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
60
+ <?php endforeach ?>
61
+ </select>
62
+ </div>
63
+ </li>
64
+ <li>
65
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
66
+ <div class="input-box">
67
+ <input type="text" pattern="\d*" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
68
+ </div>
69
+ </li>
70
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
71
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
72
+ <div class="input-box">
73
+ <div class="v-fix">
74
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
75
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
76
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
77
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
78
+ <?php endforeach ?>
79
+ </select>
80
+ </div>
81
+ <div class="v-fix">
82
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
83
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
84
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
85
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
86
+ <?php endforeach ?>
87
+ </select>
88
+ </div>
89
+ </div>
90
+ </li>
91
+
92
+ <?php echo $this->getChildHtml() ?>
93
+ <?php if($this->hasVerification()): ?>
94
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
95
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
96
+ <div class="input-box">
97
+ <div class="v-fix">
98
+ <input type="text" pattern="\d*" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
99
+ </div>
100
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
101
+ </div>
102
+ </li>
103
+ <?php endif; ?>
104
+ <li>
105
+ <div class="input-box">
106
+ <input type="checkbox" id="<?php echo $_code ?>_add_profile" name="payment[add_profile]" value="1" class="required" />
107
+ <a href="#"><?php echo $this->__('Create my profile, Learn more about it?') ?></a>
108
+ </div>
109
+ </li>
110
+ <?php if (count($cardProfileArray) > 0): ?>
111
+ <li>
112
+ <div class="input-box" align="center">
113
+ <h3>OR</h3>
114
+ <hr style="width:10px color:#eee;">
115
+ </div>
116
+ </li>
117
+
118
+ <li>
119
+ <div class="input-box">
120
+ <input type="radio" id="<?php echo $_code ?>_tran_type" name="payment[tran_type]" class="<?php echo $_code ?>_tran_type" value="profile"/>
121
+ <a href="#"><?php echo $this->__('Transaction with Saved CreditCard Number') ?></a>
122
+ </div>
123
+ </li>
124
+ <li>
125
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
126
+ <label for="<?php echo $_code ?>_profile_id" class="required"><em>*</em><?php echo $this->__('Use Saved Card Number') ?></label>
127
+ <div class="input-box">
128
+ <?php $_profile_id = $this->getInfoData('profile_id') ?>
129
+ <select id="<?php echo $_code ?>_profile_id" name="payment[profile_id]" class="required-entry">
130
+ <?php foreach ($this->getCutomerCardProfileArray() as $k=>$v): ?>
131
+ <option value="<?php echo $v['profile_id']."-".$v["last_4_digit"] ?>"<?php if($k==$_profile_id): ?> selected="selected"<?php endif ?>>xxxx-xxxx-xxxx-<?php echo $v["last_4_digit"] ?></option>
132
+ <?php endforeach ?>
133
+ </select>
134
+ </div>
135
+ </li>
136
+ <?php endif; ?>
137
+ <?php if ($this->hasSsCardType()): ?>
138
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
139
+ <ul class="inner-form">
140
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
141
+ <li>
142
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
143
+ <span class="input-box">
144
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
145
+ </span>
146
+ </li>
147
+
148
+ <li>
149
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
150
+ <div class="input-box">
151
+ <div class="v-fix">
152
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
153
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
154
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
155
+ <?php endforeach ?>
156
+ </select>
157
+ </div>
158
+ <div class="v-fix">
159
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
160
+ <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
161
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
162
+ <?php endforeach ?>
163
+ </select>
164
+ </div>
165
+ </div>
166
+ </li>
167
+ <li class="adv-container">&nbsp;</li>
168
+ </ul>
169
+ <script type="text/javascript">
170
+ //<![CDATA[
171
+ var SSChecked<?php echo $_code ?> = function() {
172
+ var elm = $('<?php echo $_code ?>_cc_type');
173
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
174
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
175
+ } else {
176
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
177
+ }
178
+ };
179
+
180
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
181
+ SSChecked<?php echo $_code ?>();
182
+
183
+
184
+
185
+ //]]>
186
+ </script>
187
+ </li>
188
+ <?php endif; ?>
189
+
190
+ </ul>
191
+ <script type="text/javascript">
192
+
193
+
194
+ var tran_type=$$(".<?php echo $_code ?>_tran_type");
195
+ var creditcard=tran_type[0];
196
+ var profile=tran_type[1];
197
+ $(creditcard).observe('click', respondToClick);
198
+ $(profile).observe('click', respondToClick);
199
+ function respondToClick(event) {
200
+
201
+ if(creditcard.checked==true)
202
+ {
203
+ processForCCFeilds();
204
+
205
+ }else if(profile.checked==true)
206
+ {
207
+
208
+ processForProfileFeilds();
209
+ }
210
+ }
211
+
212
+ function removeValidationFromField(fieldName,classes)
213
+ {
214
+ $('<?php echo $_code ?>'+fieldName).removeAttribute('class');
215
+ $('<?php echo $_code ?>'+fieldName).setAttribute('class',classes);
216
+ $('<?php echo $_code ?>'+fieldName).siblings()[0].remove();
217
+ }
218
+ function addValidationFromField(fieldName,classes)
219
+ {
220
+ $('<?php echo $_code ?>'+fieldName).removeAttribute('class');
221
+ $('<?php echo $_code ?>'+fieldName).setAttribute('class', classes);
222
+ }
223
+ function processForProfileFeilds()
224
+ {
225
+ removeValidationFromField("_cc_number");
226
+ removeValidationFromField("_cc_type");
227
+ removeValidationFromField("_cc_cid");
228
+ removeValidationFromField("_expiration");
229
+ removeValidationFromField("_expiration_yr");
230
+
231
+ addValidationFromField("_profile_id","required-entry")
232
+
233
+ }
234
+ function processForCCFeilds()
235
+ {
236
+ addValidationFromField("_cc_number","input-text validate-cc-number validate-cc-type")
237
+ addValidationFromField("_cc_type","required-entry validate-cc-type-select")
238
+ addValidationFromField("_cc_cid","input-text cvv required-entry validate-cc-cvn")
239
+ addValidationFromField("_expiration","month validate-cc-exp required-entry")
240
+ addValidationFromField("_expiration_yr","year required-entry")
241
+
242
+
243
+ removeValidationFromField("_profile_id","")
244
+ //removeValidationFromField("_profile_id");
245
+
246
+ }
247
+
248
+
249
+ //call default
250
+ processForCCFeilds();
251
+
252
+
253
+ </script>
254
+
app/design/frontend/rwd/default/template/worldpay/form/worldpayach.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_code=$this->getMethodCode();
30
+ ?>
31
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
32
+
33
+ <li>
34
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
35
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Name') ?></label>
36
+ <div class="input-box">
37
+ <input type="text" pattern="\d*" id="<?php echo $_code ?>_ckname" name="payment[ckname]" title="<?php echo $this->__('Name') ?>" class="required-entry input-text" value="" />
38
+ </div>
39
+ </li>
40
+ <li>
41
+ <label for="<?php echo $_code ?>_ckaba" class="required"><em>*</em><?php echo $this->__('Rounting Number') ?></label>
42
+ <div class="input-box">
43
+ <input type="text" pattern="\d*" id="<?php echo $_code ?>_ckaba" name="payment[ckaba]" title="<?php echo $this->__('Rounting Number') ?>" class="required-entry input-text" value="" />
44
+ </div>
45
+ </li>
46
+ <li>
47
+ <label for="<?php echo $_code ?>_ckacct" class="required"><em>*</em><?php echo $this->__('Account Number') ?></label>
48
+ <div class="input-box">
49
+ <input type="text" pattern="\d*" id="<?php echo $_code ?>_ckacct" name="payment[ckacct]" title="<?php echo $this->__('Account Number') ?>" class="required-entry input-text" value="" />
50
+ </div>
51
+ </li>
52
+ <li>
53
+ <label for="<?php echo $_code ?>_ckno" class="required"><em>*</em><?php echo $this->__('Cheque Number') ?></label>
54
+ <div class="input-box">
55
+ <input type="text" pattern="\d*" id="<?php echo $_code ?>_ckno" name="payment[ckno]" title="<?php echo $this->__('Cheque Number') ?>" class="required-entry input-text" value="" />
56
+ </div>
57
+ </li>
58
+
59
+
60
+ <li>
61
+ <label for="<?php echo $_code ?>_ckaccttypedesc" class="required"><em>*</em><?php echo $this->__('Account Type Description') ?></label>
62
+ <div class="input-box">
63
+ <select id="<?php echo $_code ?>_ckaccttypedesc" name="payment[ckaccttypedesc]" title="<?php echo $this->__('Account Type Description') ?>" class="required-entry" >
64
+ <option value="personal">Personal</option>
65
+ <option value="business">Business</option>
66
+ </select>
67
+ </div>
68
+ </li>
69
+ <li>
70
+ <label for="<?php echo $_code ?>_ckaccttype" class="required"><em>*</em><?php echo $this->__('Account Type') ?></label>
71
+ <div class="input-box">
72
+ <select id="<?php echo $_code ?>_ckaccttype" name="payment[ckaccttype]" title="<?php echo $this->__('Account Type') ?>" class="required-entry" >
73
+ <option value="1">Checking Account</option>
74
+ <option value="2">Savings Account</option>
75
+ </select>
76
+ </div>
77
+ </li>
78
+
79
+ <li>
80
+ <label for="<?php echo $_code ?>_cktype" class="required"><em>*</em><?php echo $this->__('Cheque Type') ?></label>
81
+ <div class="input-box">
82
+ <select id="<?php echo $_code ?>_cktype" name="payment[cktype]" title="<?php echo $this->__('Cheque Type') ?>" class="required-entry" >
83
+ <option value="ARC">ARC - Accounts Receivable Check Conversion</option>
84
+ <option value="BOC">BOC - Back-Office Conversion</option>
85
+ <option value="C21">C21 - Check 21</option>
86
+ <option value="CCD">CCD - Cash Concentration or Disbursement</option>
87
+ <option value="POP">POP - Point-of-Purchase Check Conversion</option>
88
+ <option value="PPD">PPD - Prearranged Payment and Deposit</option>
89
+ <option value="TEL">TEL - Telephone Authorized Entry</option>
90
+ <option value="WEB">WEB - Internet Authorized Entry</option>
91
+ </select>
92
+ </div>
93
+ </li>
94
+
95
+
96
+
97
+ </ul>
98
+
app/design/frontend/rwd/default/template/worldpay/form/worldpaycc.phtml ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_code=$this->getMethodCode();
29
+ ?>
30
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
31
+ <?php /*
32
+ <li>
33
+ <div class="input-box">
34
+ <label for="<?php echo $_code ?>_cc_owner" class="required"><em>*</em><?php echo $this->__('Name on Card') ?></label>
35
+ <input type="text" title="<?php echo $this->__('Name on Card') ?>" class="input-text required-entry" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" value="<?php echo $this->escapeHtml($this->getInfoData('cc_owner')) ?>" />
36
+ </div>
37
+ </li>
38
+ */ ?>
39
+ <li>
40
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
41
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
42
+ <div class="input-box">
43
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select" title="<?php echo $this->__('Credit Card Type') ?>">
44
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
45
+ <?php $_ccType = $this->getInfoData('cc_type') ?>
46
+ <?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
47
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
48
+ <?php endforeach ?>
49
+ </select>
50
+ </div>
51
+ </li>
52
+ <li>
53
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
54
+ <div class="input-box">
55
+ <input type="text" pattern="\d*" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
56
+ </div>
57
+ </li>
58
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
59
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
60
+ <div class="input-box">
61
+ <div class="v-fix">
62
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
63
+ <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
64
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
65
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
66
+ <?php endforeach ?>
67
+ </select>
68
+ </div>
69
+ <div class="v-fix">
70
+ <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
71
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
72
+ <?php foreach ($this->getCcYears() as $k=>$v): ?>
73
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
74
+ <?php endforeach ?>
75
+ </select>
76
+ </div>
77
+ </div>
78
+ </li>
79
+ <?php echo $this->getChildHtml() ?>
80
+ <?php if($this->hasVerification()): ?>
81
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
82
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
83
+ <div class="input-box">
84
+ <div class="v-fix">
85
+ <input type="text" pattern="\d*" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
86
+ </div>
87
+ <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
88
+ </div>
89
+ </li>
90
+ <?php endif; ?>
91
+ <li>
92
+ <div class="input-box">
93
+ <input type="checkbox" id="<?php echo $_code ?>_add_profile" name="payment[add_profile]" value="1" class="required" />
94
+ <b><?php echo $this->__('Create my profile, Learn more about it?') ?></b>
95
+ </div>
96
+ </li>
97
+ <?php if ($this->hasSsCardType()): ?>
98
+ <li id="<?php echo $_code ?>_cc_type_ss_div">
99
+ <ul class="inner-form">
100
+ <li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
101
+ <li>
102
+ <label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
103
+ <span class="input-box">
104
+ <input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
105
+ </span>
106
+ </li>
107
+
108
+ <li>
109
+ <label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
110
+ <div class="input-box">
111
+ <div class="v-fix">
112
+ <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
113
+ <?php foreach ($this->getCcMonths() as $k=>$v): ?>
114
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
115
+ <?php endforeach ?>
116
+ </select>
117
+ </div>
118
+ <div class="v-fix">
119
+ <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
120
+ <?php foreach ($this->getSsStartYears() as $k=>$v): ?>
121
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
122
+ <?php endforeach ?>
123
+ </select>
124
+ </div>
125
+ </div>
126
+ </li>
127
+ <li class="adv-container">&nbsp;</li>
128
+ </ul>
129
+ <script type="text/javascript">
130
+ //<![CDATA[
131
+ var SSChecked<?php echo $_code ?> = function() {
132
+ var elm = $('<?php echo $_code ?>_cc_type');
133
+ if (['SS','SM','SO'].indexOf(elm.value) != -1) {
134
+ $('<?php echo $_code ?>_cc_type_ss_div').show();
135
+ } else {
136
+ $('<?php echo $_code ?>_cc_type_ss_div').hide();
137
+ }
138
+ };
139
+
140
+ Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
141
+ SSChecked<?php echo $_code ?>();
142
+ //]]>
143
+ </script>
144
+ </li>
145
+ <?php endif; ?>
146
+ </ul>
app/design/frontend/rwd/default/template/worldpay/form/worldpayprofile.phtml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ Mage::log("Html:PrismProfile");
30
+
31
+ $cardProfileArray=array();
32
+ $_code=$this->getMethodCode();
33
+ $cardProfileArray=$this->getCutomerCardProfileArray();
34
+ //print"<pre>";
35
+ //print_r($cardProfileArray);
36
+
37
+
38
+ if(count($cardProfileArray)==0)
39
+ {?>
40
+ <script>
41
+ $("p_method_worldprofile").up("dt").hide();
42
+ </script>
43
+
44
+ <?php } ?>
45
+
46
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
47
+ <?php if (count($cardProfileArray) > 0): ?>
48
+
49
+
50
+ <li>
51
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
52
+ <label for="<?php echo $_code ?>_profile_id" class="required"><em>*</em><?php echo $this->__('Use Saved CreditCard Profie Id') ?></label>
53
+ <div class="input-box">
54
+ <?php $_profile_id = $this->getInfoData('profile_id') ?>
55
+ <select id="<?php echo $_code ?>_profile_id" name="payment[profile_id]" class="required-entry">
56
+ <?php foreach ($this->getCutomerCardProfileArray() as $k=>$v): ?>
57
+ <option value="<?php echo $v['profile_id']."-".$v["last_4_digit"] ?>"<?php if($k==$_profile_id): ?> selected="selected"<?php endif ?>>xxxx-xxxx-xxxx-<?php echo $v["last_4_digit"] ?></option>
58
+ <?php endforeach ?>
59
+ </select>
60
+ </div>
61
+ </li>
62
+ <?php else: ?>
63
+ <li>
64
+ <div class="input-box" align="center">
65
+ <h3><?php echo $this->__("you haven't any save profile") ?></h3>
66
+ <hr style="width:10px color:#eee;">
67
+ </div>
68
+ </li>
69
+
70
+ <?php endif;?>
71
+
72
+ </ul>
73
+
app/etc/modules/WorldPayTech_WorldAch.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <!-- declare CompanyName_NewModule module -->
4
+ <WorldPayTech_WorldAch>
5
+ <!-- this is an active module -->
6
+ <active>true</active>
7
+ <!-- this module will be located in app/code/local code pool -->
8
+ <codePool>local</codePool>
9
+ <!-- specify dependencies for correct module loading order -->
10
+ <depends>
11
+ <Mage_Payment />
12
+ </depends>
13
+ </WorldPayTech_WorldAch>
14
+
15
+ </modules>
16
+ </config>
app/etc/modules/WorldPayTech_WorldPay.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <!-- declare CompanyName_NewModule module -->
4
+ <WorldPayTech_WorldPay>
5
+ <!-- this is an active module -->
6
+ <active>true</active>
7
+ <!-- this module will be located in app/code/local code pool -->
8
+ <codePool>local</codePool>
9
+ <!-- specify dependencies for correct module loading order -->
10
+ <depends>
11
+ <Mage_Payment />
12
+ </depends>
13
+ </WorldPayTech_WorldPay>
14
+ </modules>
15
+ </config>
app/etc/modules/WorldPayTech_WorldProfile.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <!-- declare CompanyName_NewModule module -->
4
+ <WorldPayTech_WorldProfile>
5
+ <!-- this is an active module -->
6
+ <active>true</active>
7
+ <!-- this module will be located in app/code/local code pool -->
8
+ <codePool>local</codePool>
9
+ <!-- specify dependencies for correct module loading order -->
10
+ <depends>
11
+ <Mage_Payment />
12
+ </depends>
13
+ </WorldPayTech_WorldProfile>
14
+
15
+ </modules>
16
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>worldpayzaq12wsx</name>
4
+ <version>1.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>WorldPay License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>WorldPay Payment GateWay</summary>
10
+ <description>WorldPay Payment GateWay</description>
11
+ <notes>compatible with 1.9</notes>
12
+ <authors><author><name>faisal</name><user>faisalshamsi</user><email>faisalsharifshamsi@gmail.com</email></author></authors>
13
+ <date>2015-01-08</date>
14
+ <time>11:23:01</time>
15
+ <contents><target name="magelocal"><dir name="WorldPayTech"><dir name="WorldAch"><dir name="Block"><file name="Form.php" hash="09f36e1fcbca210c0c0d051ee8c2eb8e"/><file name="Info.php" hash="0467a5ce61e19094a681b56a381e6735"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Helper"><file name="Data.php" hash="eb3746c14752eebd4fa182bee93b4cac"/></dir><dir name="Model"><file name="PaymentMethod.php" hash="44663a8bfb705d79e9f80297df3866e1"/></dir><dir name="etc"><file name="config.xml" hash="998644efeb571005975cb0d8073304aa"/><file name="system.xml" hash="6336987bf75a16b11abfa7e1fdceff49"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="af50a4425771801f820d6ded226aa813"/></dir><dir name="WorldPay"><dir name="Block"><file name="Form.php" hash="fc71b8e5de5b8631cc48d3cc1fab7627"/><file name="Info.php" hash="a87b42eb5945174255c73dcec93dcf5f"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><file name="PaymentHelper.php" hash="753b2a1e334d0675cc1f2550237b0038"/><file name="PaymentMethod.php" hash="f00d9d294be392d0db9e53b5560ea9f8"/></dir><dir name="etc"><file name="config.xml" hash="c9e0ec089af031ab75a99c8ef754446d"/><file name="system.xml" hash="72f2b4a287b6eb524398c28e32aba0ea"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="31b6e6a024d9565b47e296158b5df99f"/></dir><dir name="WorldProfile"><dir name="Block"><file name="Form.php" hash="c3d4a47588b12616e76eef3ddcb3b988"/><file name="Info.php" hash="23ae669bcf08a4b254f76a1198653eec"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Helper"><file name="Data.php" hash="e4343805ef9e19742bf82878e372b9d3"/></dir><dir name="Model"><file name="PaymentMethod.php" hash="dd28ae8db7e789e1481ea887ce7bea02"/></dir><dir name="etc"><file name="config.xml" hash="7edafa53af910709ac960b1861622301"/><file name="system.xml" hash="14a64961d8f7bc661ad3510632f5ca54"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="af50a4425771801f820d6ded226aa813"/></dir><file name=".DS_Store" hash="507f613e3c8cfcad4ad9a11d9b255e5b"/></dir></target><target name="mageetc"><dir name="modules"><file name="WorldPayTech_WorldAch.xml" hash="d106ddc2bc8d4a551df766f383d7b891"/><file name="WorldPayTech_WorldPay.xml" hash="d1c22c594dcc5d6c857b48b32d7aa2be"/><file name="WorldPayTech_WorldProfile.xml" hash="ca4f2243b031273a329ce6af65138719"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="template"><dir name="worldpay"><dir name="form"><file name="pp.phtml" hash="822a5fe4c95f73cc099d56db13505c90"/><file name="worldpayach.phtml" hash="283d8ce341d5fcf1c27d6fedc5390b75"/><file name="worldpaycc.phtml" hash="6374d7127b941da03269dde0c6646cdd"/><file name="worldpayprofile.phtml" hash="7660ec72770b79f5f1aa392103ee725f"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="2f9d746d60a61cab6c45482c4c139375"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.5.5</max></php></required></dependencies>
18
+ </package>