| 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\ComputopPayuCeeSinglePaymentTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Generated\Shared\Transfer\CustomerTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Generated\Shared\Transfer\QuoteTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Spryker\Shared\Shipment\ShipmentConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Spryker\Yves\Router\Router\Router; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use SprykerEco\Shared\Computop\ComputopConfig as ComputopSharedConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use SprykerEco\Yves\Computop\Mapper\Init\AbstractMapper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use SprykerEco\Yves\Computop\Plugin\Router\ComputopRouteProviderPlugin; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  | class PayuCeeSingleMapper extends AbstractMapper | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |     protected const SHIPMENT_ARTICLE_NAME = 'Shipment'; | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     protected const ONE_ITEM_AMOUNT = 1; | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |      * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |      * @return \Generated\Shared\Transfer\ComputopPayuCeeSinglePaymentTransfer | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |     public function createComputopPaymentTransfer(QuoteTransfer $quoteTransfer): ComputopPayuCeeSinglePaymentTransfer | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |         /** @var \Generated\Shared\Transfer\ComputopPayuCeeSinglePaymentTransfer $computopPaymentTransfer */ | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |         $computopPaymentTransfer = parent::createComputopPaymentTransfer($quoteTransfer); | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |         $computopPaymentTransfer->setMac( | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |             $this->computopApiService->generateEncryptedMac($this->createRequestTransfer($computopPaymentTransfer)) | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |         $computopPaymentTransfer->setOrderDesc( | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |             $this->computopApiService->getDescriptionValue($quoteTransfer->getItems()->getArrayCopy()) | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |         if ($quoteTransfer->getItems()->count()) { | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |             $computopPaymentTransfer->setArticleList( | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |                 $this->getArticleList($quoteTransfer->getItems(), $quoteTransfer->getExpenses()) | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |         if ($quoteTransfer->getCustomer()) { | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |             $this->setCustomerData($computopPaymentTransfer, $quoteTransfer->getCustomer()); | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |         $computopPaymentTransfer->setCapture( | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |             $this->getCaptureType(ComputopSharedConfig::PAYMENT_METHOD_PAYU_CEE_SINGLE) | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |         $computopPaymentTransfer->setLanguage(mb_strtoupper($this->store->getCurrentLanguage())); | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         return $computopPaymentTransfer; | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |      * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |      * @return \Generated\Shared\Transfer\ComputopPayuCeeSinglePaymentTransfer | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     protected function createTransferWithUnencryptedValues(QuoteTransfer $quoteTransfer): ComputopPayuCeeSinglePaymentTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $computopPaymentTransfer = new ComputopPayuCeeSinglePaymentTransfer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $computopPaymentTransfer->setTransId($this->generateTransId($quoteTransfer)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         $computopPaymentTransfer->setUrlSuccess( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             $this->router->generate(ComputopRouteProviderPlugin::PAYU_CEE_SINGLE_SUCCESS, [], Router::ABSOLUTE_URL) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 75 |  |  |         return $computopPaymentTransfer; | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |      * @param \Generated\Shared\Transfer\ItemTransfer[]|\ArrayObject $items | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |      * @param \Generated\Shared\Transfer\ExpenseTransfer[]|\ArrayObject $expenseList | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |      * @return string | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     protected function getArticleList($items, $expenseList): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $out = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             $out[] = implode(',', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |                 str_replace([',', '+', '-'], ' ', $item->getName()), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |                 $item->getUnitPrice(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |                 $item->getQuantity(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         $out[] = implode(',', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             static::SHIPMENT_ARTICLE_NAME, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             $this->getDeliveryCosts($expenseList), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             static::ONE_ITEM_AMOUNT, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 102 |  |  |         return implode('+', $out); | 
            
                                                                        
                            
            
                                    
            
            
                | 103 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |      * @param \Generated\Shared\Transfer\ExpenseTransfer[]|\ArrayObject $expenseList | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |      * @return int | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |     protected function getDeliveryCosts($expenseList): int | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |         foreach ($expenseList as $expense) { | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |             if ($expense->getType() === ShipmentConfig::SHIPMENT_EXPENSE_TYPE) { | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |                 return $expense->getSumGrossPrice(); | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 118 |  |  |         return 0; | 
            
                                                                        
                            
            
                                    
            
            
                | 119 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 121 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 122 |  |  |      * @param \Generated\Shared\Transfer\ComputopPayuCeeSinglePaymentTransfer $paymentTransfer | 
            
                                                                        
                            
            
                                    
            
            
                | 123 |  |  |      * @param \Generated\Shared\Transfer\CustomerTransfer $customer | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     private function setCustomerData(ComputopPayuCeeSinglePaymentTransfer $paymentTransfer, CustomerTransfer $customer): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         $paymentTransfer->setFirstName($customer->getFirstName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         $paymentTransfer->setLastName($customer->getLastName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         $paymentTransfer->setEmail($customer->getEmail()); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 132 |  |  |         $paymentTransfer->setPhone($customer->getPhone()); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 133 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 134 |  |  | } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 135 |  |  |  | 
            
                        
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