payfort_payment - Version 1.0.1

Version Notes

Payfort Payment Gateway first release 0.0.2

Download this release

Release Info

Developer Moe Ghashim
Extension payfort_payment
Version 1.0.1
Comparing to
See all releases


Code changes from version 0.0.2 to 1.0.1

app/code/community/Payfort/Pay/controllers/PaymentController.php CHANGED
@@ -109,18 +109,14 @@ class Payfort_Pay_PaymentController extends Mage_Core_Controller_Front_Action {
109
 
110
  }
111
 
112
- /*$error = false;
113
- $status = "pending";
114
- //die('Transaction Pending');
115
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING, true, 'Transaction is pending on Payfort Team for approval/acceptance');
116
- $order->save();*/
117
-
118
  $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
119
 
120
  if($response_status != 9 && $response_status != 5) {
121
- $response_message = $this->__($response_status_message);
122
- $this->renderResponse($response_message);
123
- return false;
 
 
124
  }
125
 
126
  switch($response_type):
@@ -128,7 +124,6 @@ class Payfort_Pay_PaymentController extends Mage_Core_Controller_Front_Action {
128
  /** trying to create invoice * */
129
  try {
130
  if (!$order->canInvoice()):
131
- //Mage::throwException(Mage::helper('core')->__('cannot create invoice !'));
132
  //Mage::throwException(Mage::helper('core')->__('cannot create an invoice !'));
133
  $response_message = $this->__('Error: cannot create an invoice !');
134
  $this->renderResponse($response_message);
@@ -170,37 +165,42 @@ class Payfort_Pay_PaymentController extends Mage_Core_Controller_Front_Action {
170
  $response_message = $this->__('Unknown response status.');
171
  }
172
 
173
- $this->renderResponse($response_message);
 
 
174
  return;
175
  break;
176
  case 'decline':
177
  // There is a problem in the response we got
178
  $this->cancelAction();
179
- //Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
180
- $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
181
- $this->renderResponse($response_message);
182
- return false;
 
183
  break;
184
  case 'exception':
185
  // There is a problem in the response we got
186
  $this->cancelAction();
187
- //Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
188
- $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
189
- $this->renderResponse($response_message);
190
- return false;
 
191
  break;
192
  case 'cancel':
193
  // There is a problem in the response we got
194
  $this->cancelAction();
195
- //Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
196
- $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
197
- $this->renderResponse($response_message);
198
- return false;
 
199
  break;
200
  default:
201
  $response_message = $this->__('Response Unknown');
202
  $this->renderResponse($response_message);
203
- return false;
204
  break;
205
  endswitch;
206
 
@@ -212,7 +212,7 @@ class Payfort_Pay_PaymentController extends Mage_Core_Controller_Front_Action {
212
  $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
213
  if ($order->getId()) {
214
  // Flag the order as 'cancelled' and save it
215
- $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Gateway has declined the payment.')->save();
216
  }
217
  }
218
  }
109
 
110
  }
111
 
 
 
 
 
 
 
112
  $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
113
 
114
  if($response_status != 9 && $response_status != 5) {
115
+ // $response_message = $this->__($response_status_message);
116
+ // $this->renderResponse($response_message);
117
+ // return false;
118
+ if($response_type != 'decline')
119
+ $response_type = 'decline';
120
  }
121
 
122
  switch($response_type):
124
  /** trying to create invoice * */
125
  try {
126
  if (!$order->canInvoice()):
 
127
  //Mage::throwException(Mage::helper('core')->__('cannot create an invoice !'));
128
  $response_message = $this->__('Error: cannot create an invoice !');
129
  $this->renderResponse($response_message);
165
  $response_message = $this->__('Unknown response status.');
166
  }
167
 
168
+ // $this->renderResponse($response_message);
169
+ // Mage::getSingleton('checkout/session')->setSuccessMessage($response_status_message);
170
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
171
  return;
172
  break;
173
  case 'decline':
174
  // There is a problem in the response we got
175
  $this->cancelAction();
176
+ // $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
177
+ Mage::getSingleton('checkout/session')->setErrorMessage($response_status_message);
178
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
179
+ // $this->renderResponse($response_message);
180
+ return;
181
  break;
182
  case 'exception':
183
  // There is a problem in the response we got
184
  $this->cancelAction();
185
+ // $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
186
+ Mage::getSingleton('checkout/session')->setErrorMessage($response_status_message);
187
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
188
+ // $this->renderResponse($response_message);
189
+ return;
190
  break;
191
  case 'cancel':
192
  // There is a problem in the response we got
193
  $this->cancelAction();
194
+ // $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
195
+ Mage::getSingleton('checkout/session')->setErrorMessage($response_status_message);
196
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
197
+ // $this->renderResponse($response_message);
198
+ return;
199
  break;
200
  default:
201
  $response_message = $this->__('Response Unknown');
202
  $this->renderResponse($response_message);
203
+ return;
204
  break;
205
  endswitch;
206
 
212
  $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
213
  if ($order->getId()) {
214
  // Flag the order as 'cancelled' and save it
215
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Payfort has declined the payment.')->save();
216
  }
217
  }
218
  }
app/code/community/Payfort/Pay/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Payfort_Pay>
5
- <version>0.0.1</version>
6
  </Payfort_Pay>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Payfort_Pay>
5
+ <version>1.0.1</version>
6
  </Payfort_Pay>
7
  </modules>
8
  <global>
app/design/frontend/base/default/template/payfort/pay/redirect.phtml CHANGED
@@ -15,6 +15,12 @@ $total = round($_order->getBaseGrandTotal(), 2);
15
 
16
  $language = Mage::getStoreConfig('payment/payfort/language');
17
  $currency = Mage::getStoreConfig('payment/payfort/currency');
 
 
 
 
 
 
18
 
19
  if($language == 'no_language') {
20
  $language = Mage::app()->getLocale()->getLocaleCode();
@@ -72,7 +78,7 @@ foreach ($items as $item) {
72
  <div class="center wrapper">
73
  <div id="logo" class="center"></div>
74
  <p class="center title"><?php echo $this->__('Redirecting to Payfort ...') ?></p>
75
- <form name="payfortpaymentform" id="payfortpaymentform" method="post" action="https://secure.payfort.com/ncol/test/orderstandard.asp" id="form1" name="form1">
76
  <!-- general parameters -->
77
  <input type="hidden" name="PSPID" value="<?php echo $merchant_affiliation_name ?>">
78
  <input type="hidden" name="ORDERID" value="<?php echo $orderId ?>">
15
 
16
  $language = Mage::getStoreConfig('payment/payfort/language');
17
  $currency = Mage::getStoreConfig('payment/payfort/currency');
18
+ $sandbox_mode = Mage::getStoreConfig('payment/payfort/sandbox_mode');
19
+
20
+ $gateway_post_URL = 'https://secure.payfort.com/ncol/prod/orderstandard.asp';
21
+
22
+ if($sandbox_mode)
23
+ $gateway_post_URL = 'https://secure.payfort.com/ncol/test/orderstandard.asp';
24
 
25
  if($language == 'no_language') {
26
  $language = Mage::app()->getLocale()->getLocaleCode();
78
  <div class="center wrapper">
79
  <div id="logo" class="center"></div>
80
  <p class="center title"><?php echo $this->__('Redirecting to Payfort ...') ?></p>
81
+ <form name="payfortpaymentform" id="payfortpaymentform" method="post" action="<?php echo $gateway_post_URL; ?>" id="form1" name="form1">
82
  <!-- general parameters -->
83
  <input type="hidden" name="PSPID" value="<?php echo $merchant_affiliation_name ?>">
84
  <input type="hidden" name="ORDERID" value="<?php echo $orderId ?>">
app/design/frontend/base/default/template/payfort/pay/response.phtml CHANGED
@@ -8,7 +8,7 @@
8
  <script type="text/javascript">
9
  (function(){
10
  setTimeout(function(){
11
- document.location.href = '<?php echo Mage::getBaseUrl() ?>';
12
  }, 5000);
13
  })();
14
  </script>
8
  <script type="text/javascript">
9
  (function(){
10
  setTimeout(function(){
11
+ document.location.href = '<?php echo Mage::getBaseUrl() . 'checkout/onepage/success'; ?>';
12
  }, 5000);
13
  })();
14
  </script>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>payfort_payment</name>
4
- <version>0.0.2</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
@@ -9,9 +9,12 @@
9
  <summary>This extension will allow your customers to use Payfort payment gateway.</summary>
10
  <description>This extension adds (Payfort Payment Gateway) option to your store payment methods. Upon adding this extension to your store, your customers will be able to complete payment through Payfort Gateway. This extension is customizable as you can configure it to meet your needs. Additionally, it allows you to add the requirements settings for your Payfort merchant account.</description>
11
  <notes>Payfort Payment Gateway first release 0.0.2</notes>
12
- <authors><author><name>Moe</name><user>Ghashim</user><email>moe@shopgo.me</email></author></authors>
13
- <date>2013-09-06</date>
14
- <time>21:02:11</time>
 
 
 
15
  <contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payfort"><file name="layout.phtml" hash="7949696b79643341359508a6d6d64921"/><dir name="pay"><file name="redirect.phtml" hash="d83e6c96e318cfa82720fb9290f3efe4"/><file name="response.phtml" hash="11d9417ffb22e1cafcb266b4585a5c6e"/></dir></dir></dir><dir name="layout"><dir name="payfort"><file name="payfort.xml" hash="e76ce8855e50afeb1188d0db5a240f2d"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="payfort"><dir name="img"><file name="payfort_logo.png" hash="0667a5f51fe189ede6184fc1aff10466"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Payfort"><dir name="Pay"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Currencyoptions.php" hash="9db473b306b6184457643b8d215d5deb"/><file name="Languageoptions.php" hash="8eaebfd095436b0077200107b11d558d"/><file name="Shaoptions.php" hash="f7bb4923b485253d4236ef28f7bfad98"/></dir></dir></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Group.php" hash="b4f2ae57336f0a415a517d8cd5d5cb32"/><file name="Payment.php" hash="821e14eda2c84847b4486814c1311ebe"/></dir></dir></dir></dir><file name="Note.php" hash="6b7c2a2cd0cdc32abb74ba1304338ebc"/></dir><dir name="Helper"><file name="Data.php" hash="77e47b554e7119e2b5901b528df25604"/></dir><dir name="Model"><file name="Pay.php" hash="a04390520c7b3d087caafd05830bd231"/><dir name="Service"><file name="Quote.php" hash="7fea0b61ba93444686a3591af6325a35"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="b281c357f541ab9f1bb0b18db269c9cc"/></dir><dir name="etc"><file name="config.xml" hash="52c886413f5a7bbf32d6607437dc805e"/><file name="system.xml" hash="c8d9b028bbd7a7f90ab3aaa56d3f8407"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payfort_Pay.xml" hash="de239e211cd7a03877a2482c22975280"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>payfort_payment</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
9
  <summary>This extension will allow your customers to use Payfort payment gateway.</summary>
10
  <description>This extension adds (Payfort Payment Gateway) option to your store payment methods. Upon adding this extension to your store, your customers will be able to complete payment through Payfort Gateway. This extension is customizable as you can configure it to meet your needs. Additionally, it allows you to add the requirements settings for your Payfort merchant account.</description>
11
  <notes>Payfort Payment Gateway first release 0.0.2</notes>
12
+ <authors>
13
+ <author><name>ShopGo</name><user>ShopGo</user><email>support@shopgo.me</email></author>
14
+ <author><name>Ali</name><user>Halabyah</user><email>ali@shopgo.me</email></author>
15
+ </authors>
16
+ <date>2014-10-28</date>
17
+ <time>17:03:11</time>
18
  <contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payfort"><file name="layout.phtml" hash="7949696b79643341359508a6d6d64921"/><dir name="pay"><file name="redirect.phtml" hash="d83e6c96e318cfa82720fb9290f3efe4"/><file name="response.phtml" hash="11d9417ffb22e1cafcb266b4585a5c6e"/></dir></dir></dir><dir name="layout"><dir name="payfort"><file name="payfort.xml" hash="e76ce8855e50afeb1188d0db5a240f2d"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="payfort"><dir name="img"><file name="payfort_logo.png" hash="0667a5f51fe189ede6184fc1aff10466"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Payfort"><dir name="Pay"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Currencyoptions.php" hash="9db473b306b6184457643b8d215d5deb"/><file name="Languageoptions.php" hash="8eaebfd095436b0077200107b11d558d"/><file name="Shaoptions.php" hash="f7bb4923b485253d4236ef28f7bfad98"/></dir></dir></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Group.php" hash="b4f2ae57336f0a415a517d8cd5d5cb32"/><file name="Payment.php" hash="821e14eda2c84847b4486814c1311ebe"/></dir></dir></dir></dir><file name="Note.php" hash="6b7c2a2cd0cdc32abb74ba1304338ebc"/></dir><dir name="Helper"><file name="Data.php" hash="77e47b554e7119e2b5901b528df25604"/></dir><dir name="Model"><file name="Pay.php" hash="a04390520c7b3d087caafd05830bd231"/><dir name="Service"><file name="Quote.php" hash="7fea0b61ba93444686a3591af6325a35"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="b281c357f541ab9f1bb0b18db269c9cc"/></dir><dir name="etc"><file name="config.xml" hash="52c886413f5a7bbf32d6607437dc805e"/><file name="system.xml" hash="c8d9b028bbd7a7f90ab3aaa56d3f8407"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payfort_Pay.xml" hash="de239e211cd7a03877a2482c22975280"/></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>