| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * it under the terms of the GNU Lesser General Public License as published by | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * GNU Lesser General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * You should have received a copy of the GNU Lesser General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * PHP version 5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * @category  Payone | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @package   Payone_Magento2_Plugin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * @author    FATCHIP GmbH <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @copyright 2003 - 2016 Payone GmbH | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @license   <http://www.gnu.org/licenses/> GNU Lesser General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * @link      http://www.payone.de | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | namespace Payone\Core\Model\Api\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use Magento\Quote\Api\Data\AddressInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use Payone\Core\Model\Source\AddressCheckType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use Payone\Core\Model\Source\CreditratingCheckType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  * Class for the PAYONE Server API request "consumerscore" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | class Consumerscore extends AddressRequest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * Object of CheckedAddresses resource | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @var \Payone\Core\Model\ResourceModel\CheckedAddresses | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     protected $addressesChecked; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * @param \Payone\Core\Helper\Shop                          $shopHelper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * @param \Payone\Core\Helper\Environment                   $environmentHelper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param \Payone\Core\Helper\Api                           $apiHelper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @param \Payone\Core\Model\ResourceModel\ApiLog           $apiLog | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @param \Payone\Core\Helper\Customer                      $customerHelper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * @param \Payone\Core\Model\ResourceModel\CheckedAddresses $addressesChecked | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 55 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |     public function __construct( | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |         \Payone\Core\Helper\Shop $shopHelper, | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         \Payone\Core\Helper\Environment $environmentHelper, | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |         \Payone\Core\Helper\Api $apiHelper, | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |         \Payone\Core\Model\ResourceModel\ApiLog $apiLog, | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |         \Payone\Core\Helper\Customer $customerHelper, | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |         \Payone\Core\Model\ResourceModel\CheckedAddresses $addressesChecked | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |     ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |         parent::__construct($shopHelper, $environmentHelper, $apiHelper, $apiLog, $customerHelper); | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |         $this->addressesChecked = $addressesChecked; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * Check enabled status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     protected function isCheckEnabled() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         if (!$this->shopHelper->getConfigParam('enabled', 'creditrating', 'payone_protect')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * Get check type for combined address checks but enforce 'Boniversum Person' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * if the configured credit rating check type is 'Boniversum VERITA' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     protected function getCombinedAdressCheckType() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         $creditRatingCheckType = $this->shopHelper->getConfigParam('type', 'creditrating', 'payone_protect'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         if ($creditRatingCheckType == CreditratingCheckType::BONIVERSUM_VERITA) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |             return AddressCheckType::BONIVERSUM_PERSON; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         return $this->shopHelper->getConfigParam('addresscheck', 'creditrating', 'payone_protect'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * Send request "addresscheck" to PAYONE server API | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * @param  AddressInterface $oAddress | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * @param  string $sGender | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      * @param  string $sBirthday | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      * @return array|bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     public function sendRequest(AddressInterface $oAddress, $sGender = null, $sBirthday = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         if (!$this->isCheckEnabled() || $oAddress->getCountryId() != 'DE') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |             return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         $sType = $this->shopHelper->getConfigParam('type', 'creditrating', 'payone_protect'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         $this->addParameter('request', 'consumerscore'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |         $this->addParameter('mode', $this->shopHelper->getConfigParam('mode', 'creditrating', 'payone_protect')); //Operationmode live or test | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         $this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); //ID of PayOne Sub-Account | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         $this->addParameter('addresschecktype', $this->getCombinedAdressCheckType()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         $this->addParameter('consumerscoretype', $sType); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         $this->addParameter('language', $this->shopHelper->getLocale()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         if ($sType == CreditratingCheckType::BONIVERSUM_VERITA && $sGender !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |             $this->addParameter('gender', $sGender); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         if ($sType == CreditratingCheckType::BONIVERSUM_VERITA && $sBirthday !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |             $this->addParameter('birthday', $sBirthday); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $this->addAddress($oAddress); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         if ($this->addressesChecked->wasAddressCheckedBefore($oAddress, $sType,true) === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             $aResponse = $this->send(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |             if (isset($aResponse['score']) && $aResponse['score'] === 'U') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |                 $unknownDefault = $this->shopHelper->getConfigParam('unknown_value', 'creditrating', 'payone_protect'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |                 $aResponse['score'] = empty($unknownDefault) ? 'G' : $unknownDefault; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |             if ($aResponse['status'] == 'VALID') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |                 $this->addressesChecked->addCheckedAddress($oAddress, $aResponse, $sType,true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             return $aResponse; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 141 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 142 |  |  |  | 
            
                        
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths