Version Notes
1.1.1.0
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Mage_Ogone_Official |
| Version | 1.1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.0.0 to 1.1.1.0
app/code/core/Mage/Ogone/Model/Api.php
CHANGED
|
@@ -29,7 +29,14 @@
|
|
| 29 |
*/
|
| 30 |
class Mage_Ogone_Model_Api extends Mage_Payment_Model_Method_Abstract
|
| 31 |
{
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
protected $_formBlockType = 'ogone/form';
|
| 34 |
protected $_infoBlockType = 'ogone/info';
|
| 35 |
protected $_config = null;
|
| 29 |
*/
|
| 30 |
class Mage_Ogone_Model_Api extends Mage_Payment_Model_Method_Abstract
|
| 31 |
{
|
| 32 |
+
/**
|
| 33 |
+
* Ogone payment method code
|
| 34 |
+
*
|
| 35 |
+
* @var string
|
| 36 |
+
*/
|
| 37 |
+
const PAYMENT_CODE = 'ogone';
|
| 38 |
+
|
| 39 |
+
protected $_code = self::PAYMENT_CODE;
|
| 40 |
protected $_formBlockType = 'ogone/form';
|
| 41 |
protected $_infoBlockType = 'ogone/info';
|
| 42 |
protected $_config = null;
|
app/code/core/Mage/Ogone/controllers/ApiController.php
CHANGED
|
@@ -80,11 +80,21 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 80 |
$api = $this->_getApi();
|
| 81 |
$api->debugData(array('result' => $params));
|
| 82 |
|
| 83 |
-
$
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
if (
|
| 88 |
$this->_getCheckout()->addError($this->__('The hash is not valid'));
|
| 89 |
return false;
|
| 90 |
}
|
|
@@ -108,7 +118,11 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 108 |
$order = Mage::getModel('sales/order');
|
| 109 |
$order->loadByIncrementId($lastIncrementId);
|
| 110 |
if ($order->getId()) {
|
| 111 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
$order->save();
|
| 113 |
|
| 114 |
$this->_getApi()->debugOrder($order);
|
|
@@ -209,6 +223,9 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 209 |
{
|
| 210 |
$params = $this->getRequest()->getParams();
|
| 211 |
$order = $this->_getOrder();
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
$this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
|
| 214 |
|
|
@@ -246,15 +263,27 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 246 |
$status = $this->getRequest()->getParam('STATUS');
|
| 247 |
try{
|
| 248 |
if ($status == Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING) {
|
| 249 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
$order->save();
|
| 251 |
}elseif ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 252 |
if ($status == Mage_Ogone_Model_Api::OGONE_AUTHORIZED) {
|
| 253 |
if ($order->getStatus() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 254 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
}
|
| 256 |
} else {
|
| 257 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
}
|
| 259 |
|
| 260 |
if (!$order->getInvoiceCollection()->getSize()) {
|
|
@@ -291,13 +320,21 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 291 |
$status = $this->getRequest()->getParam('STATUS');
|
| 292 |
try {
|
| 293 |
if ($status == Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING) {
|
| 294 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
} else {
|
| 296 |
//to send new order email only when state is pending payment
|
| 297 |
if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 298 |
$order->sendNewOrderEmail();
|
| 299 |
}
|
| 300 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
}
|
| 302 |
$order->save();
|
| 303 |
$this->_redirect('checkout/onepage/success');
|
|
@@ -351,6 +388,9 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 351 |
{
|
| 352 |
$params = $this->getRequest()->getParams();
|
| 353 |
$order = $this->_getOrder();
|
|
|
|
|
|
|
|
|
|
| 354 |
|
| 355 |
$exception = '';
|
| 356 |
switch($params['STATUS']) {
|
|
@@ -372,7 +412,10 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 372 |
//to send new order email only when state is pending payment
|
| 373 |
if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 374 |
$order->sendNewOrderEmail();
|
| 375 |
-
$order->setState(
|
|
|
|
|
|
|
|
|
|
| 376 |
} else {
|
| 377 |
$order->addStatusToHistory(Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS, $exception);
|
| 378 |
}
|
|
@@ -454,6 +497,10 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 454 |
protected function _cancelOrder($status, $comment='')
|
| 455 |
{
|
| 456 |
$order = $this->_getOrder();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 457 |
try{
|
| 458 |
$order->cancel();
|
| 459 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, $status, $comment);
|
|
@@ -466,6 +513,17 @@ class Mage_Ogone_ApiController extends Mage_Core_Controller_Front_Action
|
|
| 466 |
return $this;
|
| 467 |
}
|
| 468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 469 |
/**
|
| 470 |
* @deprecated after 1.4.2.0-beta1
|
| 471 |
* @see Mage_Ogone_Model_Api::$_inShortMap
|
| 80 |
$api = $this->_getApi();
|
| 81 |
$api->debugData(array('result' => $params));
|
| 82 |
|
| 83 |
+
$hashValidationResult = false;
|
| 84 |
+
if ($api->getConfig()->getShaInCode()) {
|
| 85 |
+
$referenceHash = $api->getHash(
|
| 86 |
+
$params,
|
| 87 |
+
$api->getConfig()->getShaInCode(),
|
| 88 |
+
Mage_Ogone_Model_Api::HASH_DIR_IN,
|
| 89 |
+
(int)$api->getConfig()->getConfigData('shamode'),
|
| 90 |
+
$api->getConfig()->getConfigData('hashing_algorithm')
|
| 91 |
+
);
|
| 92 |
+
if ($params['SHASIGN'] == $referenceHash) {
|
| 93 |
+
$hashValidationResult = true;
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
|
| 97 |
+
if (!$hashValidationResult) {
|
| 98 |
$this->_getCheckout()->addError($this->__('The hash is not valid'));
|
| 99 |
return false;
|
| 100 |
}
|
| 118 |
$order = Mage::getModel('sales/order');
|
| 119 |
$order->loadByIncrementId($lastIncrementId);
|
| 120 |
if ($order->getId()) {
|
| 121 |
+
$order->setState(
|
| 122 |
+
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
|
| 123 |
+
Mage_Ogone_Model_Api::PENDING_OGONE_STATUS,
|
| 124 |
+
Mage::helper('ogone')->__('Start Ogone Processing')
|
| 125 |
+
);
|
| 126 |
$order->save();
|
| 127 |
|
| 128 |
$this->_getApi()->debugOrder($order);
|
| 223 |
{
|
| 224 |
$params = $this->getRequest()->getParams();
|
| 225 |
$order = $this->_getOrder();
|
| 226 |
+
if (!$this->_isOrderValid($order)) {
|
| 227 |
+
return;
|
| 228 |
+
}
|
| 229 |
|
| 230 |
$this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());
|
| 231 |
|
| 263 |
$status = $this->getRequest()->getParam('STATUS');
|
| 264 |
try{
|
| 265 |
if ($status == Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING) {
|
| 266 |
+
$order->setState(
|
| 267 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
| 268 |
+
Mage_Ogone_Model_Api::WAITING_AUTHORIZATION,
|
| 269 |
+
Mage::helper('ogone')->__('Authorization Waiting from Ogone')
|
| 270 |
+
);
|
| 271 |
$order->save();
|
| 272 |
}elseif ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 273 |
if ($status == Mage_Ogone_Model_Api::OGONE_AUTHORIZED) {
|
| 274 |
if ($order->getStatus() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 275 |
+
$order->setState(
|
| 276 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
| 277 |
+
Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS,
|
| 278 |
+
Mage::helper('ogone')->__('Processed by Ogone')
|
| 279 |
+
);
|
| 280 |
}
|
| 281 |
} else {
|
| 282 |
+
$order->setState(
|
| 283 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
| 284 |
+
Mage_Ogone_Model_Api::PROCESSED_OGONE_STATUS,
|
| 285 |
+
Mage::helper('ogone')->__('Processed by Ogone')
|
| 286 |
+
);
|
| 287 |
}
|
| 288 |
|
| 289 |
if (!$order->getInvoiceCollection()->getSize()) {
|
| 320 |
$status = $this->getRequest()->getParam('STATUS');
|
| 321 |
try {
|
| 322 |
if ($status == Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING) {
|
| 323 |
+
$order->setState(
|
| 324 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
| 325 |
+
Mage_Ogone_Model_Api::WAITING_AUTHORIZATION,
|
| 326 |
+
Mage::helper('ogone')->__('Authorization Waiting from Ogone')
|
| 327 |
+
);
|
| 328 |
} else {
|
| 329 |
//to send new order email only when state is pending payment
|
| 330 |
if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 331 |
$order->sendNewOrderEmail();
|
| 332 |
}
|
| 333 |
+
$order->setState(
|
| 334 |
+
Mage_Sales_Model_Order::STATE_PROCESSING,
|
| 335 |
+
Mage_Ogone_Model_Api::PROCESSED_OGONE_STATUS,
|
| 336 |
+
Mage::helper('ogone')->__('Processed by Ogone')
|
| 337 |
+
);
|
| 338 |
}
|
| 339 |
$order->save();
|
| 340 |
$this->_redirect('checkout/onepage/success');
|
| 388 |
{
|
| 389 |
$params = $this->getRequest()->getParams();
|
| 390 |
$order = $this->_getOrder();
|
| 391 |
+
if (!$this->_isOrderValid($order)) {
|
| 392 |
+
return;
|
| 393 |
+
}
|
| 394 |
|
| 395 |
$exception = '';
|
| 396 |
switch($params['STATUS']) {
|
| 412 |
//to send new order email only when state is pending payment
|
| 413 |
if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
|
| 414 |
$order->sendNewOrderEmail();
|
| 415 |
+
$order->setState(
|
| 416 |
+
Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS,
|
| 417 |
+
$exception
|
| 418 |
+
);
|
| 419 |
} else {
|
| 420 |
$order->addStatusToHistory(Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS, $exception);
|
| 421 |
}
|
| 497 |
protected function _cancelOrder($status, $comment='')
|
| 498 |
{
|
| 499 |
$order = $this->_getOrder();
|
| 500 |
+
if (!$this->_isOrderValid($order)) {
|
| 501 |
+
return;
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
try{
|
| 505 |
$order->cancel();
|
| 506 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, $status, $comment);
|
| 513 |
return $this;
|
| 514 |
}
|
| 515 |
|
| 516 |
+
/**
|
| 517 |
+
* Check order payment method
|
| 518 |
+
*
|
| 519 |
+
* @param Mage_Sales_Model_Order $order
|
| 520 |
+
* @return bool
|
| 521 |
+
*/
|
| 522 |
+
protected function _isOrderValid($order)
|
| 523 |
+
{
|
| 524 |
+
return Mage_Ogone_Model_Api::PAYMENT_CODE == $order->getPayment()->getMethodInstance()->getCode();
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
/**
|
| 528 |
* @deprecated after 1.4.2.0-beta1
|
| 529 |
* @see Mage_Ogone_Model_Api::$_inShortMap
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Mage_Ogone_Official</name>
|
| 4 |
-
<version>1.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Official Ogone Payment Services Integration Module</summary>
|
| 10 |
<description>This extension provides Ogone payment services integration.</description>
|
| 11 |
-
<notes>1.1.
|
| 12 |
<authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
|
| 13 |
-
<date>2011-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecore"><dir name="Mage"><dir name="Ogone"><dir name="Block"><file name="Form.php" hash="d832b82739cb9dcd46c438e6abcaae65"/><file name="Info.php" hash="896f785dc32091c06f801339694c2a03"/><file name="Paypage.php" hash="75f9e9528dbb1dad1088bb069f06e428"/><file name="Placeform.php" hash="f49a9ebd234ae19baa0f34bc84c822f5"/></dir><dir name="Helper"><file name="Data.php" hash="122f72c739f9cb78914a74be1a07c70e"/></dir><dir name="Model"><dir name="Api"><file name="Debug.php" hash="3e2406e2124fa1d6b213cfcd02fd0770"/></dir><file name="Api.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
-
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Mage_Ogone_Official</name>
|
| 4 |
+
<version>1.1.1.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Official Ogone Payment Services Integration Module</summary>
|
| 10 |
<description>This extension provides Ogone payment services integration.</description>
|
| 11 |
+
<notes>1.1.1.0</notes>
|
| 12 |
<authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
|
| 13 |
+
<date>2011-04-26</date>
|
| 14 |
+
<time>18:29:27</time>
|
| 15 |
+
<contents><target name="magecore"><dir name="Mage"><dir name="Ogone"><dir name="Block"><file name="Form.php" hash="d832b82739cb9dcd46c438e6abcaae65"/><file name="Info.php" hash="896f785dc32091c06f801339694c2a03"/><file name="Paypage.php" hash="75f9e9528dbb1dad1088bb069f06e428"/><file name="Placeform.php" hash="f49a9ebd234ae19baa0f34bc84c822f5"/></dir><dir name="Helper"><file name="Data.php" hash="122f72c739f9cb78914a74be1a07c70e"/></dir><dir name="Model"><dir name="Api"><file name="Debug.php" hash="3e2406e2124fa1d6b213cfcd02fd0770"/></dir><file name="Api.php" hash="6d64956104d91931b7879747f212ed5a"/><file name="Config.php" hash="aec4a5fad447ee27f9b7adfe4085215c"/><dir name="Mysql4"><dir name="Api"><file name="Debug.php" hash="775433d48a54f52fe4a5042b8d68f800"/></dir></dir><dir name="Source"><file name="PaymentAction.php" hash="17392706787569cb0613c1416a2b456c"/><file name="Pmlist.php" hash="3a82f936ff59f028a934f2d0c4c674f9"/><file name="Template.php" hash="856e06072413996cbc5a6e4c29354d3f"/></dir></dir><dir name="controllers"><file name="ApiController.php" hash="c39157bcc57d3ccbce9b6eb326369862"/></dir><dir name="etc"><file name="config.xml" hash="2eb85a878b4bd617835deee1fe704e26"/><file name="system.xml" hash="9c34a2545d8a054922911872e1db97cc"/></dir><dir name="sql"><dir name="ogone_setup"><file name="mysql4-install-0.0.1.php" hash="f901e9b9392660d6cbd135bfd29933ed"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Ogone.xml" hash="db23212bbb05f2425c9138757ec69938"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ogone.xml" hash=""/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="ogone"><file name="info.phtml" hash="6e19fe6b7fe56fedcf730f6d609a6b32"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_Ogone.csv" hash="11bb0c46d75ba42de323c0189791c063"/></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.1.0</min><max>1.6.0.0</max></package></required></dependencies>
|
| 18 |
</package>
|
