| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * MIT License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | namespace SprykerEco\Yves\Computop\Mapper\Init\PostPlace; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Generated\Shared\Transfer\ComputopPayPalExpressPaymentTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Generated\Shared\Transfer\CustomerTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Generated\Shared\Transfer\QuoteTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Spryker\Yves\Router\Router\Router; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use SprykerEco\Shared\Computop\ComputopConfig as ComputopSharedConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use SprykerEco\Shared\Computop\Config\ComputopApiConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use SprykerEco\Yves\Computop\Mapper\Init\AbstractMapper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use SprykerEco\Yves\Computop\Plugin\Router\ComputopRouteProviderPlugin; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | class PayPalExpressMapper extends AbstractMapper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * @return \Generated\Shared\Transfer\ComputopPayPalExpressPaymentTransfer | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 25 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |     public function createComputopPaymentTransfer(QuoteTransfer $quoteTransfer) | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |         $quoteTransfer->setCustomer(new CustomerTransfer()); | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |         /** @var \Generated\Shared\Transfer\ComputopPayPalExpressPaymentTransfer $computopPaymentTransfer */ | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |         $computopPaymentTransfer = parent::createComputopPaymentTransfer($quoteTransfer); | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |         $computopPaymentTransfer->setPayPalMethod($this->config->getPayPalMethod()); | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |         $computopPaymentTransfer->setMac( | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |             $this->computopApiService->generateEncryptedMac( | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |                 $this->createRequestTransfer($computopPaymentTransfer) | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |             ) | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |         $decryptedValues = $this->computopApiService->getEncryptedArray( | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |             $this->getDataSubArray($computopPaymentTransfer), | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |             $this->config->getBlowfishPassword() | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |         $computopPaymentTransfer->setData($decryptedValues[ComputopApiConfig::DATA]); | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |         $computopPaymentTransfer->setLen($decryptedValues[ComputopApiConfig::LENGTH]); | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |         return $computopPaymentTransfer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @return \Generated\Shared\Transfer\ComputopPayPalExpressPaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     protected function createTransferWithUnencryptedValues(QuoteTransfer $quoteTransfer): ComputopPayPalExpressPaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $computopPaymentTransfer = new ComputopPayPalExpressPaymentTransfer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $computopPaymentTransfer->setCapture( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             $this->getCaptureType(ComputopSharedConfig::PAYMENT_METHOD_PAY_PAL_EXPRESS) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $computopPaymentTransfer->setTransId($this->generateTransId($quoteTransfer)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $computopPaymentTransfer->setTxType($this->config->getPayPalTxType()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $computopPaymentTransfer->setUrlSuccess( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             $this->router->generate(ComputopRouteProviderPlugin::ROUTE_NAME_PAY_PAL_EXPRESS_PLACE_ORDER, [], Router::ABSOLUTE_URL) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $computopPaymentTransfer->setOrderDesc( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |             $this->computopApiService->getDescriptionValue($quoteTransfer->getItems()->getArrayCopy()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         $this->mapAddressFromQuoteToComputopPayPalPayment($quoteTransfer, $computopPaymentTransfer); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         return $computopPaymentTransfer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      * @param \Generated\Shared\Transfer\ComputopPayPalPaymentTransfer $computopPayPalPaymentTransfer | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      * @return \Generated\Shared\Transfer\ComputopPayPalPaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     protected function mapAddressFromQuoteToComputopPayPalPayment( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         QuoteTransfer $quoteTransfer, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         ComputopPayPalExpressPaymentTransfer $computopPayPalPaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     ): ComputopPayPalExpressPaymentTransfer { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         $addressTransfer = $quoteTransfer->getBillingSameAsShipping() ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |             $quoteTransfer->getBillingAddress() : $quoteTransfer->getShippingAddress(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         if (!$addressTransfer) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |             return $computopPayPalPaymentTransfer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         $computopPayPalPaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             ->setFirstName($addressTransfer->getFirstName()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             ->setLastName($addressTransfer->getLastName()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             ->setAddressStreet($addressTransfer->getAddress1()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             ->setAddressStreet2($addressTransfer->getAddress2()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             ->setAddressCity($addressTransfer->getCity()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |             ->setAddressState($addressTransfer->getState()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |             ->setAddressZip($addressTransfer->getZipCode()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             ->setAddressCountryCode($addressTransfer->getIso2Code()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             ->setPhone($addressTransfer->getPhone()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         return $computopPayPalPaymentTransfer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * @param \Generated\Shared\Transfer\ComputopPayPalExpressPaymentTransfer $computopPayPalPaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     protected function getDataSubArray(ComputopPayPalExpressPaymentTransfer $computopPayPalPaymentTransfer): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         $dataSubArray[ComputopApiConfig::TRANS_ID] = $computopPayPalPaymentTransfer->getTransId(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         $dataSubArray[ComputopApiConfig::AMOUNT] = $computopPayPalPaymentTransfer->getAmount(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         $dataSubArray[ComputopApiConfig::CURRENCY] = $computopPayPalPaymentTransfer->getCurrency(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         $dataSubArray[ComputopApiConfig::CAPTURE] = $computopPayPalPaymentTransfer->getCapture(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         $dataSubArray[ComputopApiConfig::TX_TYPE] = $computopPayPalPaymentTransfer->getTxType(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         $dataSubArray[ComputopApiConfig::PAY_PAL_METHOD] = $computopPayPalPaymentTransfer->getPayPalMethod(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         $dataSubArray[ComputopApiConfig::ORDER_DESC] = $computopPayPalPaymentTransfer->getOrderDesc(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         $dataSubArray[ComputopApiConfig::URL_SUCCESS] = $computopPayPalPaymentTransfer->getUrlSuccess(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         $dataSubArray[ComputopApiConfig::URL_NOTIFY] = $computopPayPalPaymentTransfer->getUrlNotify(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         $dataSubArray[ComputopApiConfig::URL_FAILURE] = $computopPayPalPaymentTransfer->getUrlFailure(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $dataSubArray[ComputopApiConfig::RESPONSE] = $computopPayPalPaymentTransfer->getResponse(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $dataSubArray[ComputopApiConfig::MAC] = $computopPayPalPaymentTransfer->getMac(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |         return $dataSubArray; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 130 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 131 |  |  |  | 
            
                        
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