Version Notes
Version 1.0 iPayby Payment Module
Download this release
Release Info
Developer | SCNet |
Extension | SCNet_iPayBy |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Scnet/Ipayby/Helper/Data.php +21 -0
- app/code/community/Scnet/Ipayby/Model/CreditCard.php +321 -0
- app/code/community/Scnet/Ipayby/Model/Observer.php +28 -0
- app/code/community/Scnet/Ipayby/Model/ResponseParser.php +54 -0
- app/code/community/Scnet/Ipayby/etc/config.xml +51 -0
- app/code/community/Scnet/Ipayby/etc/system.xml +182 -0
- app/etc/modules/Scnet_Ipayby.xml +11 -0
- package.xml +18 -0
app/code/community/Scnet/Ipayby/Helper/Data.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category
|
16 |
+
* @package Scnet_Ipayby
|
17 |
+
* @copyright www.scnet.com.au
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Scnet_Ipayby_Helper_Data extends Mage_Core_Helper_Data {
|
21 |
+
}
|
app/code/community/Scnet/Ipayby/Model/CreditCard.php
ADDED
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category
|
16 |
+
* @package Scnet_Ipayby
|
17 |
+
* @copyright www.scnet.com.au
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Scnet_Ipayby_Model_CreditCard extends Mage_Payment_Model_Method_Cc {
|
21 |
+
|
22 |
+
protected $_code = 'scnet_ipayby';
|
23 |
+
|
24 |
+
protected $_isGateway = true;
|
25 |
+
protected $_canOrder = false;
|
26 |
+
protected $_canAuthorize = true;
|
27 |
+
protected $_canCapture = true;
|
28 |
+
protected $_canCapturePartial = false;
|
29 |
+
protected $_canRefund = false;
|
30 |
+
protected $_canRefundInvoicePartial = false;
|
31 |
+
protected $_canVoid = false;
|
32 |
+
protected $_canUseInternal = true;
|
33 |
+
protected $_canUseCheckout = true;
|
34 |
+
protected $_canUseForMultishipping = true;
|
35 |
+
protected $_isInitializeNeeded = false;
|
36 |
+
protected $_canFetchTransactionInfo = false;
|
37 |
+
protected $_canReviewPayment = false;
|
38 |
+
protected $_canCreateBillingAgreement = false;
|
39 |
+
protected $_canManageRecurringProfiles = false;
|
40 |
+
|
41 |
+
// do not save the credit cart
|
42 |
+
protected $_canSaveCc = false;
|
43 |
+
|
44 |
+
public function capture(Varien_Object $payment, $amount) {
|
45 |
+
|
46 |
+
$_url = $this->_getServerUrl();
|
47 |
+
$_xml = $this->_generatePaymentXml($this->_prepareParams($amount));
|
48 |
+
|
49 |
+
try {
|
50 |
+
$_res = $this->_connectServer($_url, $_xml);
|
51 |
+
}catch(Exception $e) {
|
52 |
+
throw Mage::Exception('Mage_Payment_Model_Info', $this->getConfigData('error_message'));
|
53 |
+
}
|
54 |
+
|
55 |
+
if(!$_res->isSuccessful()) {
|
56 |
+
throw Mage::Exception('Mage_Payment_Model_Info', $this->getConfigData('error_message'));
|
57 |
+
}
|
58 |
+
|
59 |
+
$_result = $_res->getPaymentResult();
|
60 |
+
|
61 |
+
if('Approved' != $_result->getData('summaryResponseCode')) {
|
62 |
+
$_error = $_result->getData('summaryResponseCode') . ' - The transaction has failed with - ' . $_result->getData('responseCode');
|
63 |
+
throw Mage::Exception('Mage_Payment_Model_Info', $_error);
|
64 |
+
}
|
65 |
+
|
66 |
+
$payment->setStatus(self::STATUS_SUCCESS)
|
67 |
+
->setStatusDescription($_result->getData('responseText'))
|
68 |
+
->setTransactionId($_result->getData('orderNumber'))
|
69 |
+
->setIsTransactionClosed(0)
|
70 |
+
->setSuTransactionId($_result->getData('orderNumber'))
|
71 |
+
->setLastTransId($_result->getData('orderNumber'))
|
72 |
+
;
|
73 |
+
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
|
77 |
+
protected function _getServerUrl() {
|
78 |
+
if($this->getConfigData('live_mode') == 1) {
|
79 |
+
return $this->getConfigData('live_server_url');
|
80 |
+
}
|
81 |
+
return $this->getConfigData('test_server_url');
|
82 |
+
}
|
83 |
+
|
84 |
+
protected function _prepareParams($amount) {
|
85 |
+
$_billAdd = $this->_getBillingAddress();
|
86 |
+
$_street = $_billAdd->getStreet();
|
87 |
+
|
88 |
+
$_allItems = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
|
89 |
+
$_tmpNames = array();
|
90 |
+
foreach($_allItems as $_item) {
|
91 |
+
$_tmpNames[] = $_item->getProduct()->getName() . '(' . $_item->getTotalQty() . ')';
|
92 |
+
}
|
93 |
+
|
94 |
+
$_params = array(
|
95 |
+
'arg0' => $this->getConfigData('merchant_id'),
|
96 |
+
'arg1' => $this->getConfigData('password'),
|
97 |
+
'arg2' => $this->_getCcNumber(),
|
98 |
+
'arg3' => str_pad($this->_getCcExpMonth(), 2, 0, STR_PAD_LEFT) . substr($this->_getCcExpYear(), -2),
|
99 |
+
'arg4' => $this->_getCcCid(),
|
100 |
+
'arg5' => $amount,
|
101 |
+
'arg6' => $this->_getCcOwner(),
|
102 |
+
'arg7' => $this->_getCurrencyCode(),
|
103 |
+
'arg8' => $this->_getOrderId(),
|
104 |
+
'arg9' => NULL,
|
105 |
+
'arg10' => NULL,
|
106 |
+
'arg11' => Mage::app()->getStore()->getFrontendName(),
|
107 |
+
'arg12' => implode(', ', $_tmpNames),
|
108 |
+
'arg13' => implode(' ', array($_billAdd->getFirstname(), $_billAdd->getLastname())),
|
109 |
+
'arg14' => $_street[0],
|
110 |
+
'arg15' => $_street[1],
|
111 |
+
'arg16' => $_billAdd->getPostcode(),
|
112 |
+
'arg17' => $_billAdd->getTelephone(),
|
113 |
+
'arg18' => NULL,
|
114 |
+
'arg19' => NULL,
|
115 |
+
'arg20' => $this->getConfigData('merchat_abn'),
|
116 |
+
'arg21' => 'N',
|
117 |
+
'arg22' => $_billAdd->getCity(),
|
118 |
+
'arg23' => $_billAdd->getCountry(),
|
119 |
+
// 'arg24' => NULL,
|
120 |
+
// 'arg25' => NULL,
|
121 |
+
// 'arg26' => NULL,
|
122 |
+
'arg27' => $this->_getRealIpAddr(),
|
123 |
+
);
|
124 |
+
if($this->getConfigData('merchant_notification') == 1 && $this->getConfigData('merchant_email')) {
|
125 |
+
$_params['arg9'] = $this->getConfigData('merchant_email');
|
126 |
+
$_params['arg10'] = $this->_getCustomerEmail();
|
127 |
+
}
|
128 |
+
return $_params;
|
129 |
+
}
|
130 |
+
|
131 |
+
protected function _generatePaymentXml($elements) {
|
132 |
+
$_xml = '<?xml version="1.0" encoding="utf-8"?>
|
133 |
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ipay.scnet/" xmlns:scn="https://www.scnet.com.au/ipayby/ipaybyws">
|
134 |
+
<soapenv:Header />
|
135 |
+
<soapenv:Body>
|
136 |
+
<ser:performTransaction>' . $this->_toSimpleFlatXml($elements) . '</ser:performTransaction>
|
137 |
+
</soapenv:Body>
|
138 |
+
</soapenv:Envelope>'
|
139 |
+
;
|
140 |
+
return $_xml;
|
141 |
+
}
|
142 |
+
|
143 |
+
protected function _connectServer($_url, $_xml) {
|
144 |
+
$_headers = array(
|
145 |
+
'Content-type: text/xml; charset=utf-8',
|
146 |
+
'Content-length: ' . strlen($_xml),
|
147 |
+
);
|
148 |
+
$_httpClient = new Varien_Http_Client($_url);
|
149 |
+
$_httpClient->setHeaders($_headers);
|
150 |
+
$_httpClient->setRawData($_xml);
|
151 |
+
|
152 |
+
$this->_debug(array('requestedUrl'=>$_url, 'requestedXml'=>$_xml));
|
153 |
+
|
154 |
+
try {
|
155 |
+
$_response = $_httpClient->request(Varien_Http_Client::POST);
|
156 |
+
}catch(Exception $e) {
|
157 |
+
$this->_debug(array('Error' => $e->getMessage()));
|
158 |
+
throw $e;
|
159 |
+
}
|
160 |
+
|
161 |
+
$this->_debug(array('responsedXml'=>$_response->getRawBody()));
|
162 |
+
|
163 |
+
return $this->_getXmlObject($_response->getRawBody());
|
164 |
+
}
|
165 |
+
|
166 |
+
protected function _getXmlObject($_xml) {
|
167 |
+
try {
|
168 |
+
$_xmlObject = Mage::getModel('Scnet_Ipayby/ResponseParser', $_xml);
|
169 |
+
}catch(Exception $e) {
|
170 |
+
$this->_debug(array('Error'=>$e->getMessage()));
|
171 |
+
throw $e;
|
172 |
+
}
|
173 |
+
return $_xmlObject;
|
174 |
+
}
|
175 |
+
|
176 |
+
protected function _isPublicIP($value) {
|
177 |
+
return (count(explode('.', $value)) == 4 && !preg_match('~^((0|10|172\.16|192\.168|169\.254|255|127\.0)\.)~', $value));
|
178 |
+
}
|
179 |
+
|
180 |
+
protected function _getRealIpAddr() {
|
181 |
+
$_check = array(
|
182 |
+
'HTTP_X_FORWARDED_FOR',
|
183 |
+
'HTTP_CLIENT_IP',
|
184 |
+
'HTTP_X_CLUSTER_CLIENT_IP',
|
185 |
+
'HTTP_FORWARDED_FOR',
|
186 |
+
);
|
187 |
+
foreach($_check as $_key) {
|
188 |
+
if(isset($_SERVER[$_key])) {
|
189 |
+
$ips = explode(',', $_SERVER[$_key]);
|
190 |
+
if(isset($ips[0]) && $this->_isPublicIP($ips[0])) {
|
191 |
+
return $ips[0];
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
return $_SERVER['REMOTE_ADDR'];
|
196 |
+
}
|
197 |
+
|
198 |
+
protected function _toSimpleFlatXml($elements){
|
199 |
+
$_xml = NULL;
|
200 |
+
foreach($elements as $k => $v) {
|
201 |
+
$v = is_array($v) ? $this->_toSimpleFlatXml($v) : $this->_xmlspecialchars($v);
|
202 |
+
$_xml .= '<' . $k . '>' . $v . '</' . $k . '>';
|
203 |
+
}
|
204 |
+
return $_xml;
|
205 |
+
}
|
206 |
+
|
207 |
+
protected function _xmlspecialchars($text) {
|
208 |
+
return str_replace(''', ''', htmlspecialchars($text, ENT_QUOTES));
|
209 |
+
}
|
210 |
+
|
211 |
+
protected function _getCcOwner() {
|
212 |
+
$info = $this->getInfoInstance();
|
213 |
+
if ($this->_isPlaceOrder()) {
|
214 |
+
return $info->getOrder()->getPayment()->getCcOwner();
|
215 |
+
} else {
|
216 |
+
return $info->getCcOwner();
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
protected function _getCcNumber() {
|
221 |
+
$info = $this->getInfoInstance();
|
222 |
+
if ($this->_isPlaceOrder()) {
|
223 |
+
return $info->getOrder()->getPayment()->getCcNumber();
|
224 |
+
} else {
|
225 |
+
return $info->getCcNumber();
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
protected function _getCcExpMonth() {
|
230 |
+
$info = $this->getInfoInstance();
|
231 |
+
if ($this->_isPlaceOrder()) {
|
232 |
+
return $info->getOrder()->getPayment()->getCcExpMonth();
|
233 |
+
} else {
|
234 |
+
return $info->getCcExpMonth();
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
protected function _getCcExpYear() {
|
239 |
+
$info = $this->getInfoInstance();
|
240 |
+
if ($this->_isPlaceOrder()) {
|
241 |
+
return $info->getOrder()->getPayment()->getCcExpYear();
|
242 |
+
} else {
|
243 |
+
return $info->getCcExpYear();
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
protected function _getCcCid() {
|
248 |
+
$info = $this->getInfoInstance();
|
249 |
+
if ($this->_isPlaceOrder()) {
|
250 |
+
return $info->getOrder()->getPayment()->getCcCid();
|
251 |
+
} else {
|
252 |
+
return $info->getCcCid();
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
protected function _getOrderId(){
|
257 |
+
$info = $this->getInfoInstance();
|
258 |
+
if ($this->_isPlaceOrder()) {
|
259 |
+
return $info->getOrder()->getIncrementId();
|
260 |
+
} else {
|
261 |
+
if (!$info->getQuote()->getReservedOrderId()) {
|
262 |
+
$info->getQuote()->reserveOrderId();
|
263 |
+
}
|
264 |
+
return $info->getQuote()->getReservedOrderId();
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
protected function _getAmount() {
|
269 |
+
$info = $this->getInfoInstance();
|
270 |
+
if ($this->_isPlaceOrder()) {
|
271 |
+
return (double)$info->getOrder()->getQuoteBaseGrandTotal();
|
272 |
+
} else {
|
273 |
+
return (double)$info->getQuote()->getBaseGrandTotal();
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
protected function _getCustomerEmail() {
|
278 |
+
$info = $this->getInfoInstance();
|
279 |
+
if ($this->_isPlaceOrder()) {
|
280 |
+
return $info->getOrder()->getCustomerEmail();
|
281 |
+
} else {
|
282 |
+
return $info->getQuote()->getCustomerEmail();
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
protected function _getBillingAddress() {
|
287 |
+
$info = $this->getInfoInstance();
|
288 |
+
if ($this->_isPlaceOrder()) {
|
289 |
+
return $info->getOrder()->getBillingAddress();
|
290 |
+
} else {
|
291 |
+
return $info->getQuote()->getBillingAddress();
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
protected function _getBillingCountryCode() {
|
296 |
+
$info = $this->getInfoInstance();
|
297 |
+
if ($this->_isPlaceOrder()) {
|
298 |
+
return $info->getOrder()->getBillingAddress()->getCountryId();
|
299 |
+
} else {
|
300 |
+
return $info->getQuote()->getBillingAddress()->getCountryId();
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
protected function _getCurrencyCode(){
|
305 |
+
$info = $this->getInfoInstance();
|
306 |
+
if ($this->_isPlaceOrder()) {
|
307 |
+
return $info->getOrder()->getBaseCurrencyCode();
|
308 |
+
} else {
|
309 |
+
return $info->getQuote()->getBaseCurrencyCode();
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
protected function _isPlaceOrder() {
|
314 |
+
$info = $this->getInfoInstance();
|
315 |
+
if ($info instanceof Mage_Sales_Model_Quote_Payment) {
|
316 |
+
return false;
|
317 |
+
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
|
318 |
+
return true;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
app/code/community/Scnet/Ipayby/Model/Observer.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category
|
16 |
+
* @package Scnet_Ipayby
|
17 |
+
* @copyright www.scnet.com.au
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Scnet_Ipayby_Model_Observer {
|
21 |
+
|
22 |
+
public function paymentSpecificInformation($observer) {
|
23 |
+
$_transport = $observer->getTransport();
|
24 |
+
if($observer->getPayment()->getLastTransId()) {
|
25 |
+
$_transport->setData('TID', $observer->getPayment()->getLastTransId());
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Scnet/Ipayby/Model/ResponseParser.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category
|
16 |
+
* @package Scnet_Ipayby
|
17 |
+
* @copyright www.scnet.com.au
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
class Scnet_Ipayby_Model_ResponseParser extends Varien_Simplexml_Element {
|
21 |
+
|
22 |
+
public function isSuccessful() {
|
23 |
+
$_result = (array)$this->children('http://schemas.xmlsoap.org/soap/envelope/');
|
24 |
+
if(!isset($_result['Body'])) {
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
$_error = $_result['Body']->Fault->children();
|
28 |
+
return !count($_error);
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getError() {
|
32 |
+
$_ret = new Varien_Object();
|
33 |
+
$_result = (array)$this->children('http://schemas.xmlsoap.org/soap/envelope/');
|
34 |
+
if(isset($_result['Body'])) {
|
35 |
+
$_ret->setData($_result['Body']->Fault->asArray());
|
36 |
+
}
|
37 |
+
return $_ret;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getPaymentResult() {
|
41 |
+
$_res = new Varien_Object();
|
42 |
+
foreach($this->children('http://schemas.xmlsoap.org/soap/envelope/') as $_child) {
|
43 |
+
if('Body' == $_child->getName()) {
|
44 |
+
foreach($_child->children('http://service.ipay.scnet/') as $_childchild) {
|
45 |
+
$_tmp = $_childchild->asArray();
|
46 |
+
if(isset($_tmp['return'])) {
|
47 |
+
$_res->setData($_tmp['return']);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
return $_res;
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Scnet/Ipayby/etc/config.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<config>
|
3 |
+
<global>
|
4 |
+
<models>
|
5 |
+
<Scnet_Ipayby>
|
6 |
+
<class>Scnet_Ipayby_Model</class>
|
7 |
+
</Scnet_Ipayby>
|
8 |
+
</models>
|
9 |
+
<blocks>
|
10 |
+
<Scnet_Ipayby>
|
11 |
+
<class>Scnet_Ipayby_Block</class>
|
12 |
+
</Scnet_Ipayby>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<Scnet_Ipayby>
|
16 |
+
<class>Scnet_Ipayby_Helper</class>
|
17 |
+
</Scnet_Ipayby>
|
18 |
+
</helpers>
|
19 |
+
<events>
|
20 |
+
<payment_info_block_prepare_specific_information>
|
21 |
+
<observers>
|
22 |
+
<Scnet_Ipayby>
|
23 |
+
<class>Scnet_Ipayby/observer</class>
|
24 |
+
<method>paymentSpecificInformation</method>
|
25 |
+
</Scnet_Ipayby>
|
26 |
+
</observers>
|
27 |
+
</payment_info_block_prepare_specific_information>
|
28 |
+
</events>
|
29 |
+
</global>
|
30 |
+
<default>
|
31 |
+
<payment>
|
32 |
+
<scnet_ipayby>
|
33 |
+
<group>offline</group>
|
34 |
+
<model>Scnet_Ipayby/CreditCard</model>
|
35 |
+
<payment_action>authorize_capture</payment_action>
|
36 |
+
<active>0</active>
|
37 |
+
<title>SCNet iPayBy</title>
|
38 |
+
<order_status>pending</order_status>
|
39 |
+
<live_mode>0</live_mode>
|
40 |
+
<allowspecific>0</allowspecific>
|
41 |
+
<merchant_notification>0</merchant_notification>
|
42 |
+
<live_server_url>https://www.scnet.com.au/ipayby/ipaybyws?WSDL</live_server_url>
|
43 |
+
<test_server_url>https://www.scnet.com.au/ipayby/ipaybyws?WSDL</test_server_url>
|
44 |
+
<merchant_id>SCNet_Cert6</merchant_id>
|
45 |
+
<password>testSCNet</password>
|
46 |
+
<cctypes>AE,VI,MC,DI</cctypes>
|
47 |
+
<error_message>This payment method is currently unavailable. If you would like to pay using this payment method, please contact us.</error_message>
|
48 |
+
</scnet_ipayby>
|
49 |
+
</payment>
|
50 |
+
</default>
|
51 |
+
</config>
|
app/code/community/Scnet/Ipayby/etc/system.xml
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<scnet_ipayby translate="label" module="Scnet_Ipayby">
|
7 |
+
<label>SCNet iPayBy</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>10</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label">
|
24 |
+
<label>Title</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>20</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</title>
|
31 |
+
<order_status translate="label">
|
32 |
+
<label>New Order Status</label>
|
33 |
+
<frontend_type>select</frontend_type>
|
34 |
+
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
35 |
+
<sort_order>30</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>0</show_in_store>
|
39 |
+
</order_status>
|
40 |
+
<live_mode translate="label">
|
41 |
+
<label>Live Mode</label>
|
42 |
+
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
+
<sort_order>40</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
</live_mode>
|
49 |
+
<live_server_url translate="label">
|
50 |
+
<label>Production URL</label>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<sort_order>41</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>0</show_in_store>
|
56 |
+
</live_server_url>
|
57 |
+
<test_server_url translate="label">
|
58 |
+
<label>Test URL</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>42</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</test_server_url>
|
65 |
+
<merchant_id translate="label">
|
66 |
+
<label>Merchant ID</label>
|
67 |
+
<frontend_type>text</frontend_type>
|
68 |
+
<sort_order>43</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>0</show_in_store>
|
72 |
+
</merchant_id>
|
73 |
+
<password translate="label">
|
74 |
+
<label>Password</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>44</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>0</show_in_store>
|
80 |
+
</password>
|
81 |
+
<cctypes translate="label">
|
82 |
+
<label>Credit Card Types</label>
|
83 |
+
<frontend_type>multiselect</frontend_type>
|
84 |
+
<source_model>adminhtml/system_config_source_payment_cctype</source_model>
|
85 |
+
<sort_order>45</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>0</show_in_store>
|
89 |
+
<can_be_empty>1</can_be_empty>
|
90 |
+
</cctypes>
|
91 |
+
<merchant_notification translate="label">
|
92 |
+
<label>Merchant Notification</label>
|
93 |
+
<frontend_type>select</frontend_type>
|
94 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
95 |
+
<sort_order>46</sort_order>
|
96 |
+
<show_in_default>1</show_in_default>
|
97 |
+
<show_in_website>1</show_in_website>
|
98 |
+
<show_in_store>0</show_in_store>
|
99 |
+
</merchant_notification>
|
100 |
+
<merchant_email translate="label">
|
101 |
+
<label>Merchant Notification Email</label>
|
102 |
+
<frontend_type>text</frontend_type>
|
103 |
+
<sort_order>47</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>1</show_in_website>
|
106 |
+
<show_in_store>0</show_in_store>
|
107 |
+
</merchant_email>
|
108 |
+
<merchat_abn translate="label">
|
109 |
+
<label>ABN</label>
|
110 |
+
<frontend_type>text</frontend_type>
|
111 |
+
<comment>If using this option, a TAX INVOICE header will appear on the email sent and the GST will be calculated automatically on the email. Use this if you do not want to send a separate invoice to the customer.</comment>
|
112 |
+
<sort_order>48</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>1</show_in_website>
|
115 |
+
<show_in_store>0</show_in_store>
|
116 |
+
</merchat_abn>
|
117 |
+
<allowspecific translate="label">
|
118 |
+
<label>Payment from Applicable Countries</label>
|
119 |
+
<frontend_type>allowspecific</frontend_type>
|
120 |
+
<sort_order>90</sort_order>
|
121 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>0</show_in_store>
|
125 |
+
</allowspecific>
|
126 |
+
<specificcountry translate="label">
|
127 |
+
<label>Payment from Specific Countries</label>
|
128 |
+
<frontend_type>multiselect</frontend_type>
|
129 |
+
<sort_order>91</sort_order>
|
130 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
<can_be_empty>1</can_be_empty>
|
135 |
+
</specificcountry>
|
136 |
+
<min_order_total translate="label">
|
137 |
+
<label>Minimum Order Total</label>
|
138 |
+
<frontend_type>text</frontend_type>
|
139 |
+
<sort_order>92</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<show_in_store>0</show_in_store>
|
143 |
+
</min_order_total>
|
144 |
+
<max_order_total translate="label">
|
145 |
+
<label>Maximum Order Total</label>
|
146 |
+
<frontend_type>text</frontend_type>
|
147 |
+
<sort_order>93</sort_order>
|
148 |
+
<show_in_default>1</show_in_default>
|
149 |
+
<show_in_website>1</show_in_website>
|
150 |
+
<show_in_store>0</show_in_store>
|
151 |
+
</max_order_total>
|
152 |
+
<error_message translate="label">
|
153 |
+
<label>Error message</label>
|
154 |
+
<frontend_type>textarea</frontend_type>
|
155 |
+
<sort_order>94</sort_order>
|
156 |
+
<show_in_default>1</show_in_default>
|
157 |
+
<show_in_website>1</show_in_website>
|
158 |
+
<show_in_store>1</show_in_store>
|
159 |
+
</error_message>
|
160 |
+
<sort_order translate="label">
|
161 |
+
<label>Sort Order</label>
|
162 |
+
<frontend_type>text</frontend_type>
|
163 |
+
<sort_order>100</sort_order>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<show_in_store>0</show_in_store>
|
167 |
+
</sort_order>
|
168 |
+
<debug translate="label">
|
169 |
+
<label>Debug Mode</label>
|
170 |
+
<frontend_type>select</frontend_type>
|
171 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
172 |
+
<sort_order>101</sort_order>
|
173 |
+
<show_in_default>1</show_in_default>
|
174 |
+
<show_in_website>1</show_in_website>
|
175 |
+
<show_in_store>0</show_in_store>
|
176 |
+
</debug>
|
177 |
+
</fields>
|
178 |
+
</scnet_ipayby>
|
179 |
+
</groups>
|
180 |
+
</payment>
|
181 |
+
</sections>
|
182 |
+
</config>
|
app/etc/modules/Scnet_Ipayby.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Scnet_Ipayby>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
<depends><Mage_Payment /></depends>
|
9 |
+
</Scnet_Ipayby>
|
10 |
+
</modules>
|
11 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>SCNet_iPayBy</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>SCNet iPayBy Payment Gateway</summary>
|
10 |
+
<description>SCNet iPayBy Payment Gateway</description>
|
11 |
+
<notes>Version 1.0 iPayby Payment Module</notes>
|
12 |
+
<authors><author><name>SCNet</name><user>oraclerob</user><email>support@scnet.com.au</email></author></authors>
|
13 |
+
<date>2011-11-05</date>
|
14 |
+
<time>06:11:04</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Scnet"><dir name="Ipayby"><dir name="Helper"><file name="Data.php" hash="d6397ee1ae45bbe37864a72fa1023f5c"/></dir><dir name="Model"><file name="CreditCard.php" hash="5979de61f62f5351c39199a062db1417"/><file name="Observer.php" hash="c1f8b0be0f415bb103d775bd7f6bb8d8"/><file name="ResponseParser.php" hash="dc95564aeba3ccb9f9fbd68ee9073c90"/></dir><dir name="etc"><file name="config.xml" hash="b1b405b11023c9dfa9f951db3d6c96d8"/><file name="system.xml" hash="8760c6ca102295d4aba55a3e39e7af8e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Scnet_Ipayby.xml" hash="bf1018cd9dc74b53586f595e64149dc0"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Payment</name><channel>core</channel><min>0.7.0</min><max></max></package></required></dependencies>
|
18 |
+
</package>
|