Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Centinel_Adminhtml_Centinel_IndexController
  • Mage_Centinel_Block_Adminhtml_Validation
  • Mage_Centinel_Block_Adminhtml_Validation_Form
  • Mage_Centinel_Block_Authentication
  • Mage_Centinel_Block_Authentication_Complete
  • Mage_Centinel_Block_Authentication_Start
  • Mage_Centinel_Block_Logo
  • Mage_Centinel_Helper_Data
  • Mage_Centinel_IndexController
  • Mage_Centinel_Model_Api
  • Mage_Centinel_Model_Config
  • Mage_Centinel_Model_Observer
  • Mage_Centinel_Model_Service
  • Mage_Centinel_Model_Session
  • Mage_Centinel_Model_State_Jcb
  • Mage_Centinel_Model_State_Mastercard
  • Mage_Centinel_Model_State_Visa
  • Mage_Centinel_Model_StateAbstract
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Centinel
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Abstract Validation State Model for Mastercard
 29:  */
 30: class Mage_Centinel_Model_State_Mastercard extends Mage_Centinel_Model_StateAbstract
 31: {
 32:     /**
 33:      * Analyse lookup`s results. If it has require params for authenticate, return true
 34:      *
 35:      * @return bool
 36:      */
 37:     public function isAuthenticateAllowed()
 38:     {
 39:         return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag());
 40:     }
 41: 
 42:     /**
 43:      * Analyse authenticate`s results. If authenticate is successful return true and false if it failure
 44:      * Result depends from flag self::getIsModeStrict()
 45:      *
 46:      * @return bool
 47:      */
 48:     public function isAuthenticateSuccessful()
 49:     {
 50:         $paResStatus = $this->getAuthenticatePaResStatus();
 51:         $eciFlag = $this->getAuthenticateEciFlag();
 52:         $xid = $this->getAuthenticateXid();
 53:         $cavv = $this->getAuthenticateCavv();
 54:         $errorNo = $this->getAuthenticateErrorNo();
 55:         $signatureVerification = $this->getAuthenticateSignatureVerification();
 56: 
 57:         //Test cases 1-4, 10
 58:         if ($this->_isLookupStrictSuccessful()) {
 59: 
 60:            if ($paResStatus == 'Y' && $eciFlag == '02' && $xid != '' && $cavv != '' && $errorNo == '0') {
 61:                 //Test case 1
 62:                 if ($signatureVerification == 'Y') {
 63:                     return true;
 64:                 }
 65:                 //Test case 2
 66:                 if ($signatureVerification == 'N') {
 67:                     return false;
 68:                 }
 69:             }
 70: 
 71:             //Test case 3
 72:             if ($paResStatus == 'N' && $signatureVerification == 'Y' &&  $eciFlag == '01' &&
 73:                 $xid != '' && $cavv == '' && $errorNo == '0') {
 74:                 return false;
 75:             }
 76: 
 77:             //Test case 4
 78:             if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '01' &&
 79:                 $xid != '' && $cavv == '' && $errorNo == '0') {
 80:                 if ($this->getIsModeStrict()) {
 81:                     return false;
 82:                 } else {
 83:                     return true;
 84:                 }
 85:             }
 86: 
 87:             //Test case 10
 88:             if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '01' &&
 89:                 $xid == '' && $cavv == '' && $errorNo == '1050'
 90:             ) {
 91:                 return false;
 92:             }
 93: 
 94:         }
 95: 
 96:         //Test cases 5-9
 97:         if (!$this->getIsModeStrict() && $this->_isLookupSoftSuccessful()) {
 98:             if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '' &&
 99:                 $xid == '' && $cavv == '' && $errorNo == '0') {
100:                 return true;
101:             } elseif ($paResStatus == false && $signatureVerification == false && $eciFlag == false &&
102:                 $xid == false && $cavv == false && $errorNo == false) {
103:                 return true;
104:             }
105:         }
106: 
107:         return false;
108:     }
109: 
110:     /**
111:      * Analyse lookup`s results. If lookup is strict successful return true
112:      *
113:      * @return bool
114:      */
115:     protected function _isLookupStrictSuccessful()
116:     {
117:         //Test cases 1-4, 10
118:         if ($this->getLookupEnrolled() == 'Y' &&
119:             $this->getLookupAcsUrl() != '' &&
120:             $this->getLookupPayload() != '' &&
121:             $this->getLookupErrorNo() == '0') {
122:             return true;
123:         }
124:         return false;
125:     }
126: 
127:     /**
128:      * Analyse lookup`s results. If lookup is soft successful return true
129:      *
130:      * @return bool
131:      */
132:     protected function _isLookupSoftSuccessful()
133:     {
134:         $acsUrl = $this->getLookupAcsUrl();
135:         $payload = $this->getLookupPayload();
136:         $errorNo = $this->getLookupErrorNo();
137:         $enrolled = $this->getLookupEnrolled();
138: 
139:         //Test cases 6,7
140:         if ($acsUrl == '' && $payload == '' && $errorNo == '0' && ($enrolled == 'N' || $enrolled == 'U')) {
141:             return true;
142:         }
143: 
144:         //Test case 5
145:         if ($enrolled == '' && $acsUrl == '' && $payload == '' && $errorNo == 'Timeout number') {
146:             return true;
147:         }
148: 
149:         //Test cases 8,9
150:         if ($enrolled == 'U' && $acsUrl == '' && $payload == '' && $errorNo == '1001') {
151:             return true;
152:         }
153: 
154:         return false;
155:     }
156: }
157: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0