Version Notes
* Store ID is now used as subaccount ID
* Customer ID stored in custom field 1
* Website name stored in custom field 2
* Repack to fix an issue with Magento 1.7.0.2 that was creating a folder instead of a config file
Download this release
Release Info
Developer | PayToo Corp. |
Extension | Paytoo_GoPayToo |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- app/code/local/Paytoo/GoPayToo/Block/Form.php +1 -1
- app/code/local/Paytoo/GoPayToo/Block/Info.php +1 -1
- app/code/local/Paytoo/GoPayToo/Block/Redirect.php +1 -1
- app/code/local/Paytoo/GoPayToo/Helper/Data.php +1 -1
- app/code/local/Paytoo/GoPayToo/Model/Checkout.php +21 -10
- app/code/local/Paytoo/GoPayToo/Model/Observer.php +2 -2
- app/code/local/Paytoo/GoPayToo/controllers/NotificationController.php +27 -21
- app/code/local/Paytoo/GoPayToo/controllers/RedirectController.php +1 -1
- app/code/local/Paytoo/GoPayToo/etc/config.xml +2 -2
- app/code/local/Paytoo/GoPayToo/etc/system.xml +1 -1
- app/design/frontend/base/default/template/gopaytoo/form.phtml +1 -1
- app/design/frontend/base/default/template/gopaytoo/info.phtml +1 -1
- app/etc/modules/Paytoo_GoPayToo.xml +34 -0
- package.xml +8 -5
app/code/local/Paytoo/GoPayToo/Block/Form.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/code/local/Paytoo/GoPayToo/Block/Info.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/code/local/Paytoo/GoPayToo/Block/Redirect.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/code/local/Paytoo/GoPayToo/Helper/Data.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/code/local/Paytoo/GoPayToo/Model/Checkout.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
@@ -49,7 +49,7 @@ class Paytoo_GoPayToo_Model_Checkout extends Mage_Payment_Model_Method_Abstract
|
|
49 |
|
50 |
//get purchase routine URL
|
51 |
public function getUrl() {
|
52 |
-
return ($this->getDemo()) ? 'https://
|
53 |
}
|
54 |
|
55 |
//get checkout language
|
@@ -229,20 +229,30 @@ class Paytoo_GoPayToo_Model_Checkout extends Mage_Payment_Model_Method_Abstract
|
|
229 |
$gopaytooFields['currency'] = $order->getOrderCurrencyCode(); // USD
|
230 |
$gopaytooFields['order_ref'] = $order_id;
|
231 |
$gopaytooFields['order_description'] = Mage::helper('gopaytoo')->__('Order #%s on %s', $order_id, Mage::app()->getWebsite()->getName());
|
232 |
-
|
233 |
-
$gopaytooFields['sub_account_id'] =
|
234 |
-
$
|
235 |
-
$
|
|
|
|
|
236 |
$gopaytooFields['custom_field3'] = '';
|
237 |
$gopaytooFields['custom_field4'] = '';
|
238 |
$gopaytooFields['custom_field5'] = '';
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
$gopaytooFields['lang'] = $this->getLanguage();
|
241 |
$gopaytooFields['completed_url'] = Mage::getUrl('gopaytoo/redirect/success', array('_secure' => true));
|
242 |
$gopaytooFields['cancelled_url'] = Mage::getUrl('gopaytoo/redirect/cancel', array('_secure' => true));
|
243 |
$gopaytooFields['rejected_url'] = Mage::getUrl('gopaytoo/redirect/reject', array('_secure' => true));;
|
244 |
$gopaytooFields['esign_url'] = Mage::getUrl('gopaytoo/redirect/esign', array('_secure' => true));;
|
245 |
-
|
246 |
$gopaytooFields['user']['email'] = $order->getData('customer_email');
|
247 |
$gopaytooFields['user']['firstname'] = $b->getFirstname();
|
248 |
$gopaytooFields['user']['lastname'] = $b->getLastname();
|
@@ -252,6 +262,7 @@ class Paytoo_GoPayToo_Model_Checkout extends Mage_Payment_Model_Method_Abstract
|
|
252 |
$gopaytooFields['user']['country'] = $b->getCountry();
|
253 |
$gopaytooFields['user']['state'] = ($gopaytooFields['user']['country']=='US') ? $b->getRegion() : '';
|
254 |
$gopaytooFields['user']['cellphone'] = $b->getTelephone();
|
|
|
255 |
|
256 |
if ($a) {
|
257 |
$gopaytooFields['shipping']['firstname'] = $a->getFirstname();
|
@@ -266,13 +277,13 @@ class Paytoo_GoPayToo_Model_Checkout extends Mage_Payment_Model_Method_Abstract
|
|
266 |
$gopaytooFields['shipping']['weight'] = $weight;
|
267 |
$gopaytooFields['shipping']['method'] = $ship_method;
|
268 |
}
|
269 |
-
|
270 |
$gopaytooFields['recurring']['enabled'] = 'no';
|
271 |
$gopaytooFields['recurring']['amount'] = '';
|
272 |
$gopaytooFields['recurring']['cycles'] = '';
|
273 |
$gopaytooFields['recurring']['periodicity'] = '';
|
274 |
$gopaytooFields['recurring']['start_date'] = '';
|
275 |
-
|
276 |
// Calculate/Set the hash keys
|
277 |
$hashKey = Mage::getStoreConfig('payment/gopaytoo/secret_word');
|
278 |
$hash = md5($gopaytooFields['merchant_id'].$gopaytooFields['amount'].$gopaytooFields['currency'].$gopaytooFields['order_ref'].$hashKey);
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
49 |
|
50 |
//get purchase routine URL
|
51 |
public function getUrl() {
|
52 |
+
return ($this->getDemo()) ? 'https://go.paytoo.info/gateway' : 'https://go.paytoo.com/gateway';
|
53 |
}
|
54 |
|
55 |
//get checkout language
|
229 |
$gopaytooFields['currency'] = $order->getOrderCurrencyCode(); // USD
|
230 |
$gopaytooFields['order_ref'] = $order_id;
|
231 |
$gopaytooFields['order_description'] = Mage::helper('gopaytoo')->__('Order #%s on %s', $order_id, Mage::app()->getWebsite()->getName());
|
232 |
+
|
233 |
+
$gopaytooFields['sub_account_id'] = Mage::app()->getStore()->getId();
|
234 |
+
$is_guest = $order->getData('customer_is_guest');
|
235 |
+
$customer_id = (!empty($is_guest) && $is_guest=='1') ? 0 : $order->getData('customer_id');
|
236 |
+
$gopaytooFields['custom_field1'] = $customer_id;
|
237 |
+
$gopaytooFields['custom_field2'] = Mage::app()->getWebsite()->getName();
|
238 |
$gopaytooFields['custom_field3'] = '';
|
239 |
$gopaytooFields['custom_field4'] = '';
|
240 |
$gopaytooFields['custom_field5'] = '';
|
241 |
+
|
242 |
+
/*
|
243 |
+
echo "Website ID: " . Mage::app()->getWebsite()->getId() . "<br/>";
|
244 |
+
echo "Website Name: " . Mage::app()->getWebsite()->getName() . "<br/>";
|
245 |
+
echo "Store ID: " . Mage::app()->getStore()->getId() . "<br/>";
|
246 |
+
echo "Store Name: ".Mage::app()->getStore()->getName(). "<br/>";
|
247 |
+
echo "Store code: ". Mage::app()->getStore()->getCode()."<br/>";
|
248 |
+
*/
|
249 |
+
|
250 |
$gopaytooFields['lang'] = $this->getLanguage();
|
251 |
$gopaytooFields['completed_url'] = Mage::getUrl('gopaytoo/redirect/success', array('_secure' => true));
|
252 |
$gopaytooFields['cancelled_url'] = Mage::getUrl('gopaytoo/redirect/cancel', array('_secure' => true));
|
253 |
$gopaytooFields['rejected_url'] = Mage::getUrl('gopaytoo/redirect/reject', array('_secure' => true));;
|
254 |
$gopaytooFields['esign_url'] = Mage::getUrl('gopaytoo/redirect/esign', array('_secure' => true));;
|
255 |
+
|
256 |
$gopaytooFields['user']['email'] = $order->getData('customer_email');
|
257 |
$gopaytooFields['user']['firstname'] = $b->getFirstname();
|
258 |
$gopaytooFields['user']['lastname'] = $b->getLastname();
|
262 |
$gopaytooFields['user']['country'] = $b->getCountry();
|
263 |
$gopaytooFields['user']['state'] = ($gopaytooFields['user']['country']=='US') ? $b->getRegion() : '';
|
264 |
$gopaytooFields['user']['cellphone'] = $b->getTelephone();
|
265 |
+
$gopaytooFields['user']['birthday'] = $order->getData('customer_dob');
|
266 |
|
267 |
if ($a) {
|
268 |
$gopaytooFields['shipping']['firstname'] = $a->getFirstname();
|
277 |
$gopaytooFields['shipping']['weight'] = $weight;
|
278 |
$gopaytooFields['shipping']['method'] = $ship_method;
|
279 |
}
|
280 |
+
|
281 |
$gopaytooFields['recurring']['enabled'] = 'no';
|
282 |
$gopaytooFields['recurring']['amount'] = '';
|
283 |
$gopaytooFields['recurring']['cycles'] = '';
|
284 |
$gopaytooFields['recurring']['periodicity'] = '';
|
285 |
$gopaytooFields['recurring']['start_date'] = '';
|
286 |
+
|
287 |
// Calculate/Set the hash keys
|
288 |
$hashKey = Mage::getStoreConfig('payment/gopaytoo/secret_word');
|
289 |
$hash = md5($gopaytooFields['merchant_id'].$gopaytooFields['amount'].$gopaytooFields['currency'].$gopaytooFields['order_ref'].$hashKey);
|
app/code/local/Paytoo/GoPayToo/Model/Observer.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
@@ -27,7 +27,7 @@ class Paytoo_GoPayToo_Model_Observer {
|
|
27 |
|
28 |
if ($refund == '1') {
|
29 |
$sandbox = Mage::getStoreConfig('payment/gopaytoo/demo');
|
30 |
-
$url = ($sandbox=='1') ? 'https://www.paytoo.info/api/merchant?wsdl' : 'https://
|
31 |
|
32 |
$creditmemo = $payment->getCreditmemo()->getOrder()->getData();
|
33 |
$creditmemo_amount = $payment->getCreditmemo()->getData();
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
27 |
|
28 |
if ($refund == '1') {
|
29 |
$sandbox = Mage::getStoreConfig('payment/gopaytoo/demo');
|
30 |
+
$url = ($sandbox=='1') ? 'https://www.paytoo.info/api/merchant?wsdl' : 'https://go.paytoo.com/api/merchant?wsdl';
|
31 |
|
32 |
$creditmemo = $payment->getCreditmemo()->getOrder()->getData();
|
33 |
$creditmemo_amount = $payment->getCreditmemo()->getData();
|
app/code/local/Paytoo/GoPayToo/controllers/NotificationController.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
@@ -23,8 +23,9 @@ class Paytoo_GoPayToo_NotificationController extends Mage_Core_Controller_Front_
|
|
23 |
|
24 |
public function indexAction() {
|
25 |
$request = $_POST['MerchantApiResponse']['PaytooRequest'];
|
|
|
26 |
$hash = $_POST['MerchantApiResponse']['hash'];
|
27 |
-
|
28 |
/*
|
29 |
IPN: array (
|
30 |
'request_id' => '10187',
|
@@ -39,7 +40,7 @@ IPN: array (
|
|
39 |
'tr_requested_currency' => 'USD',
|
40 |
'tr_change_rate' => '',
|
41 |
'hash' => '70e0e8afc5cf6e5db0fb0af518774577',
|
42 |
-
'MerchantApiResponse' =>
|
43 |
array (
|
44 |
'status' => 'OK',
|
45 |
'request_id' => '10187',
|
@@ -51,7 +52,7 @@ IPN: array (
|
|
51 |
'info' => NULL,
|
52 |
'phone_number' => NULL,
|
53 |
'w_number' => NULL,
|
54 |
-
'PaytooRequest' =>
|
55 |
array (
|
56 |
'request_id' => '10187',
|
57 |
'tr_id' => '21310',
|
@@ -90,7 +91,7 @@ IPN: array (
|
|
90 |
'lastname' => NULL,
|
91 |
'email' => NULL,
|
92 |
),
|
93 |
-
'PaytooTransaction' =>
|
94 |
array (
|
95 |
'tr_id' => '21310',
|
96 |
'tr_type' => 'creditcard2merchant',
|
@@ -123,7 +124,7 @@ IPN: array (
|
|
123 |
'tr_status_msg' => NULL,
|
124 |
'pay_infos' => '13962045',
|
125 |
),
|
126 |
-
'PaytooAccount' =>
|
127 |
array (
|
128 |
'user_id' => '10343',
|
129 |
'wallet' => '02416039',
|
@@ -175,17 +176,17 @@ IPN: array (
|
|
175 |
),
|
176 |
)
|
177 |
*/
|
178 |
-
|
179 |
if (empty($request) || empty($request['request_id']) || empty($request['ref_id']) || empty($request['amount']) || empty($request['status']) || empty($hash)) {
|
180 |
die("Missing parameters");
|
181 |
return ;
|
182 |
}
|
183 |
-
|
184 |
$order = Mage::getModel('sales/order');
|
185 |
$order->loadByIncrementId($request['ref_id']);
|
186 |
$invoice_on_fraud = Mage::getStoreConfig('payment/gopaytoo/invoice_on_fraud');
|
187 |
$invoice_on_order = Mage::getStoreConfig('payment/gopaytoo/invoice_on_order');
|
188 |
-
|
189 |
$hashKey = Mage::getStoreConfig('payment/gopaytoo/secret_word');
|
190 |
$myhash = md5($request['request_id'].$request['amount'].$request['currency'].$request['status'].$hashKey);
|
191 |
|
@@ -194,7 +195,12 @@ IPN: array (
|
|
194 |
$order->save();
|
195 |
return ;
|
196 |
}
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
198 |
if ($request['status']=='cancelled' || $request['status']=='rejected' || $request['status']=='error' || $request['status']=='expired') {
|
199 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->addStatusHistoryComment('Payment rejected or cancelled.')->save();
|
200 |
if (!empty($request['status_infos']))
|
@@ -202,7 +208,7 @@ IPN: array (
|
|
202 |
$order->save();
|
203 |
return ;
|
204 |
}
|
205 |
-
|
206 |
if ($request['status']=='accepted') {
|
207 |
// Pending for signature
|
208 |
if($order->canHold()) {
|
@@ -213,7 +219,7 @@ IPN: array (
|
|
213 |
}
|
214 |
return ;
|
215 |
}
|
216 |
-
|
217 |
if ($request['status']=='chargeback' || $request['status']=='unpaid') {
|
218 |
// Chargeback or Unpaid notification
|
219 |
// TODO: do something automatically
|
@@ -223,7 +229,7 @@ IPN: array (
|
|
223 |
$order->save();
|
224 |
return ;
|
225 |
}
|
226 |
-
|
227 |
if ($request['status']=='refunded') {
|
228 |
// Refund notification
|
229 |
// TODO: do something automatically
|
@@ -232,7 +238,7 @@ IPN: array (
|
|
232 |
$order->addStatusHistoryComment($request['status_infos']);
|
233 |
$order->save();
|
234 |
}
|
235 |
-
|
236 |
if ($request['status']!='completed') {
|
237 |
$order->addStatusHistoryComment("Invalid IPN status: ".$request['status']." - not treated");
|
238 |
if (!empty($request['status_infos']))
|
@@ -243,8 +249,8 @@ IPN: array (
|
|
243 |
|
244 |
// Below this it is only 'completed' payment notification
|
245 |
$order->setData('ext_order_id', $request['request_id']);
|
246 |
-
$order->save();
|
247 |
-
|
248 |
$expected_amount = $order->getBaseGrandTotal();
|
249 |
if ($expected_amount != $request['amount']) {
|
250 |
//TODO: check currency
|
@@ -252,7 +258,7 @@ IPN: array (
|
|
252 |
$order->save();
|
253 |
return ;
|
254 |
}
|
255 |
-
|
256 |
$payment = $order->getPayment();
|
257 |
|
258 |
$payment->setTransactionId($request['request_id'])
|
@@ -263,14 +269,14 @@ IPN: array (
|
|
263 |
->registerCaptureNotification($request['amount']);
|
264 |
|
265 |
$order->save();
|
266 |
-
|
267 |
$order->sendNewOrderEmail();
|
268 |
-
|
269 |
$state = $order->getState();
|
270 |
if ($state!=Mage_Sales_Model_Order::STATE_PROCESSING) {
|
271 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
|
272 |
}
|
273 |
-
|
274 |
/*
|
275 |
if ($invoice_on_order == '1') {
|
276 |
try {
|
@@ -293,7 +299,7 @@ IPN: array (
|
|
293 |
}
|
294 |
}
|
295 |
*/
|
296 |
-
|
297 |
}
|
298 |
}
|
299 |
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
23 |
|
24 |
public function indexAction() {
|
25 |
$request = $_POST['MerchantApiResponse']['PaytooRequest'];
|
26 |
+
$account = $_POST['MerchantApiResponse']['PaytooAccount'];
|
27 |
$hash = $_POST['MerchantApiResponse']['hash'];
|
28 |
+
|
29 |
/*
|
30 |
IPN: array (
|
31 |
'request_id' => '10187',
|
40 |
'tr_requested_currency' => 'USD',
|
41 |
'tr_change_rate' => '',
|
42 |
'hash' => '70e0e8afc5cf6e5db0fb0af518774577',
|
43 |
+
'MerchantApiResponse' =>
|
44 |
array (
|
45 |
'status' => 'OK',
|
46 |
'request_id' => '10187',
|
52 |
'info' => NULL,
|
53 |
'phone_number' => NULL,
|
54 |
'w_number' => NULL,
|
55 |
+
'PaytooRequest' =>
|
56 |
array (
|
57 |
'request_id' => '10187',
|
58 |
'tr_id' => '21310',
|
91 |
'lastname' => NULL,
|
92 |
'email' => NULL,
|
93 |
),
|
94 |
+
'PaytooTransaction' =>
|
95 |
array (
|
96 |
'tr_id' => '21310',
|
97 |
'tr_type' => 'creditcard2merchant',
|
124 |
'tr_status_msg' => NULL,
|
125 |
'pay_infos' => '13962045',
|
126 |
),
|
127 |
+
'PaytooAccount' =>
|
128 |
array (
|
129 |
'user_id' => '10343',
|
130 |
'wallet' => '02416039',
|
176 |
),
|
177 |
)
|
178 |
*/
|
179 |
+
|
180 |
if (empty($request) || empty($request['request_id']) || empty($request['ref_id']) || empty($request['amount']) || empty($request['status']) || empty($hash)) {
|
181 |
die("Missing parameters");
|
182 |
return ;
|
183 |
}
|
184 |
+
|
185 |
$order = Mage::getModel('sales/order');
|
186 |
$order->loadByIncrementId($request['ref_id']);
|
187 |
$invoice_on_fraud = Mage::getStoreConfig('payment/gopaytoo/invoice_on_fraud');
|
188 |
$invoice_on_order = Mage::getStoreConfig('payment/gopaytoo/invoice_on_order');
|
189 |
+
|
190 |
$hashKey = Mage::getStoreConfig('payment/gopaytoo/secret_word');
|
191 |
$myhash = md5($request['request_id'].$request['amount'].$request['currency'].$request['status'].$hashKey);
|
192 |
|
195 |
$order->save();
|
196 |
return ;
|
197 |
}
|
198 |
+
|
199 |
+
// Set external customer ID and request ID for reference
|
200 |
+
$order->setData('ext_order_id', $request['request_id'] );
|
201 |
+
$order->setData('ext_customer_id', $account['user_id']);
|
202 |
+
$order->save();
|
203 |
+
|
204 |
if ($request['status']=='cancelled' || $request['status']=='rejected' || $request['status']=='error' || $request['status']=='expired') {
|
205 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->addStatusHistoryComment('Payment rejected or cancelled.')->save();
|
206 |
if (!empty($request['status_infos']))
|
208 |
$order->save();
|
209 |
return ;
|
210 |
}
|
211 |
+
|
212 |
if ($request['status']=='accepted') {
|
213 |
// Pending for signature
|
214 |
if($order->canHold()) {
|
219 |
}
|
220 |
return ;
|
221 |
}
|
222 |
+
|
223 |
if ($request['status']=='chargeback' || $request['status']=='unpaid') {
|
224 |
// Chargeback or Unpaid notification
|
225 |
// TODO: do something automatically
|
229 |
$order->save();
|
230 |
return ;
|
231 |
}
|
232 |
+
|
233 |
if ($request['status']=='refunded') {
|
234 |
// Refund notification
|
235 |
// TODO: do something automatically
|
238 |
$order->addStatusHistoryComment($request['status_infos']);
|
239 |
$order->save();
|
240 |
}
|
241 |
+
|
242 |
if ($request['status']!='completed') {
|
243 |
$order->addStatusHistoryComment("Invalid IPN status: ".$request['status']." - not treated");
|
244 |
if (!empty($request['status_infos']))
|
249 |
|
250 |
// Below this it is only 'completed' payment notification
|
251 |
$order->setData('ext_order_id', $request['request_id']);
|
252 |
+
$order->save();
|
253 |
+
|
254 |
$expected_amount = $order->getBaseGrandTotal();
|
255 |
if ($expected_amount != $request['amount']) {
|
256 |
//TODO: check currency
|
258 |
$order->save();
|
259 |
return ;
|
260 |
}
|
261 |
+
|
262 |
$payment = $order->getPayment();
|
263 |
|
264 |
$payment->setTransactionId($request['request_id'])
|
269 |
->registerCaptureNotification($request['amount']);
|
270 |
|
271 |
$order->save();
|
272 |
+
|
273 |
$order->sendNewOrderEmail();
|
274 |
+
|
275 |
$state = $order->getState();
|
276 |
if ($state!=Mage_Sales_Model_Order::STATE_PROCESSING) {
|
277 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
|
278 |
}
|
279 |
+
|
280 |
/*
|
281 |
if ($invoice_on_order == '1') {
|
282 |
try {
|
299 |
}
|
300 |
}
|
301 |
*/
|
302 |
+
|
303 |
}
|
304 |
}
|
305 |
|
app/code/local/Paytoo/GoPayToo/controllers/RedirectController.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/code/local/Paytoo/GoPayToo/etc/config.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
* @category PayToo Corp.
|
18 |
-
* @package GoPayToo (
|
19 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
@@ -24,7 +24,7 @@
|
|
24 |
<config>
|
25 |
<modules>
|
26 |
<Paytoo_GoPayToo>
|
27 |
-
<version>1.0.
|
28 |
</Paytoo_GoPayToo>
|
29 |
</modules>
|
30 |
<global>
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
* @category PayToo Corp.
|
18 |
+
* @package GoPayToo (go.paytoo.com)
|
19 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
24 |
<config>
|
25 |
<modules>
|
26 |
<Paytoo_GoPayToo>
|
27 |
+
<version>1.0.2</version>
|
28 |
</Paytoo_GoPayToo>
|
29 |
</modules>
|
30 |
<global>
|
app/code/local/Paytoo/GoPayToo/etc/system.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
* @category PayToo Corp.
|
18 |
-
* @package GoPayToo (
|
19 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
15 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
*
|
17 |
* @category PayToo Corp.
|
18 |
+
* @package GoPayToo (go.paytoo.com)
|
19 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
*/
|
app/design/frontend/base/default/template/gopaytoo/form.phtml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/design/frontend/base/default/template/gopaytoo/info.phtml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
-
* @package GoPayToo (
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
* @category PayToo Corp.
|
17 |
+
* @package GoPayToo (go.paytoo.com)
|
18 |
* @copyright Copyright (c) 2013 PayToo Corp.
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
app/etc/modules/Paytoo_GoPayToo.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* Magento
|
6 |
+
*
|
7 |
+
* NOTICE OF LICENSE
|
8 |
+
*
|
9 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
11 |
+
* It is also available through the world-wide-web at this URL:
|
12 |
+
* http://opensource.org/licenses/osl-3.0.php
|
13 |
+
* If you did not receive a copy of the license and are unable to
|
14 |
+
* obtain it through the world-wide-web, please send an email
|
15 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
16 |
+
*
|
17 |
+
* @category PayToo Corp.
|
18 |
+
* @package GoPayToo (go.paytoo.com)
|
19 |
+
* @copyright Copyright (c) 2013 PayToo Corp.
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Paytoo_GoPayToo>
|
27 |
+
<active>true</active>
|
28 |
+
<codePool>local</codePool>
|
29 |
+
<depends>
|
30 |
+
<Mage_Payment />
|
31 |
+
</depends>
|
32 |
+
</Paytoo_GoPayToo>
|
33 |
+
</modules>
|
34 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Paytoo_GoPayToo</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,14 @@
|
|
9 |
<summary>PayToo Payment Gateway - Accept Credit Cards and PayToo wallet payment with your GoPayToo merchant account</summary>
|
10 |
<description>This OFFICIAL extension from PayToo Corp. utilizes GoPayToo gateway, API and instant notifications to provide you with the ability to do all of your sales management from Magento.
|
11 |
It has been extensivly tested, is used by many GoPayToo merchants and is updated with each Magento community release.</description>
|
12 |
-
<notes
|
|
|
|
|
|
|
13 |
<authors><author><name>PayToo Corp.</name><user>paytoo</user><email>rd@paytoo.com</email></author></authors>
|
14 |
-
<date>
|
15 |
-
<time>
|
16 |
-
<contents><target name="magelocal"><dir name="Paytoo"><dir name="GoPayToo"><dir name="Block"><file name="Form.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Paytoo_GoPayToo</name>
|
4 |
+
<version>1.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>PayToo Payment Gateway - Accept Credit Cards and PayToo wallet payment with your GoPayToo merchant account</summary>
|
10 |
<description>This OFFICIAL extension from PayToo Corp. utilizes GoPayToo gateway, API and instant notifications to provide you with the ability to do all of your sales management from Magento.
|
11 |
It has been extensivly tested, is used by many GoPayToo merchants and is updated with each Magento community release.</description>
|
12 |
+
<notes>* Store ID is now used as subaccount ID
|
13 |
+
* Customer ID stored in custom field 1
|
14 |
+
* Website name stored in custom field 2
|
15 |
+
* Repack to fix an issue with Magento 1.7.0.2 that was creating a folder instead of a config file</notes>
|
16 |
<authors><author><name>PayToo Corp.</name><user>paytoo</user><email>rd@paytoo.com</email></author></authors>
|
17 |
+
<date>2014-02-18</date>
|
18 |
+
<time>11:44:02</time>
|
19 |
+
<contents><target name="magelocal"><dir name="Paytoo"><dir name="GoPayToo"><dir name="Block"><file name="Form.php" hash="cc2e3e4aeede9db061b10e3be4955bf4"/><file name="Info.php" hash="a30ba03920e3d7bbadb2c60f4d5e2d68"/><file name="Redirect.php" hash="f3c8f1a21e808114cb2e043c22ba649e"/></dir><dir name="Helper"><file name="Data.php" hash="c7789b8a5bb806b0527ece2b51d7c137"/></dir><dir name="Model"><file name="Checkout.php" hash="491cfee8c2d2f831a0847f6cb977799f"/><file name="Observer.php" hash="5070fecf6eaf8e2e1c585155f8805dea"/></dir><dir name="controllers"><file name="NotificationController.php" hash="358a6c5751e863df07ab1228ef296ea0"/><file name="RedirectController.php" hash="f5747d81c0a097130c6921fb93627caa"/></dir><dir name="etc"><file name="config.xml" hash="5ae2d14c85d6a42c43d86db2b3cf904b"/><file name="system.xml" hash="87c1e061c42a81b480ef1dd48efdc0ff"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="gopaytoo"><file name="form.phtml" hash="b029b235805a63eeb617a0c888ee93b8"/><file name="info.phtml" hash="b0327f478a5f76fb16c5e7f9418f4de1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paytoo_GoPayToo.xml" hash="90ac43ac969478529565cc606a766f5b"/></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|