| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Generated\Shared\Transfer\AddressTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Generated\Shared\Transfer\CustomerTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Generated\Shared\Transfer\PaypalExpressSuccessResponseTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Generated\Shared\Transfer\QuoteTransfer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class PaypalResponseMapper implements PaypalResponseMapperInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     protected const KEY_NONCE = 'nonce'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     protected const KEY_DETAILS = 'details'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     protected const KEY_EMAIL = 'email'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     protected const KEY_FIRST_NAME = 'firstName'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     protected const KEY_LAST_NAME = 'lastName'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     protected const KEY_PAYER_ID = 'payerId'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     protected const KEY_SHIPPING_ADDRESS = 'shippingAddress'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     protected const KEY_RECIPIENT_NAME = 'recipientName'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     protected const KEY_LINE1 = 'line1'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     protected const KEY_CITY = 'city'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     protected const KEY_STATE = 'state'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     protected const KEY_POSTAL_CODE = 'postalCode'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     protected const KEY_COUNTRY_CODE = 'countryCode'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * @param array $payload | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @return PaypalExpressSuccessResponseTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     public function mapSuccessResponseToPaypalExpressSuccessResponseTransfer(array $payload): PaypalExpressSuccessResponseTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         $transfer = new PaypalExpressSuccessResponseTransfer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $transfer->setNonce($payload[static::KEY_NONCE] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $transfer->setEmail($payload[static::KEY_DETAILS][static::KEY_EMAIL] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $transfer->setFirstName($payload[static::KEY_DETAILS][static::KEY_FIRST_NAME] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         $transfer->setLastName($payload[static::KEY_DETAILS][static::KEY_LAST_NAME] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         $transfer->setPayerId($payload[static::KEY_DETAILS][static::KEY_PAYER_ID] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $transfer->setRecipientName($payload[static::KEY_SHIPPING_ADDRESS][static::KEY_RECIPIENT_NAME] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $transfer->setLine1($payload[static::KEY_SHIPPING_ADDRESS][static::KEY_LINE1] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $transfer->setCity($payload[static::KEY_SHIPPING_ADDRESS][static::KEY_CITY] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $transfer->setState($payload[static::KEY_SHIPPING_ADDRESS][static::KEY_STATE] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         $transfer->setPostalCode($payload[static::KEY_SHIPPING_ADDRESS][static::KEY_POSTAL_CODE] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $transfer->setCountryCode($payload[static::KEY_SHIPPING_ADDRESS][static::KEY_COUNTRY_CODE] ?? null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         return $transfer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param PaypalExpressSuccessResponseTransfer $paypalExpressSuccessResponseTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @param QuoteTransfer $quoteTransfer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * @return QuoteTransfer | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 55 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |     public function mapPaypalExpressSuccessResponseTransferToQuoteTransfer( | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |         PaypalExpressSuccessResponseTransfer $paypalExpressSuccessResponseTransfer, | 
            
                                                        
            
                                    
            
            
                | 58 |  |  |         QuoteTransfer $quoteTransfer | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |     ): QuoteTransfer { | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |         //Nonce, payerId | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |         $customerTransfer = $quoteTransfer->getCustomer() ?? new CustomerTransfer(); | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |         $shippingAddressTransfer = $quoteTransfer->getShippingAddress() ?? new AddressTransfer(); | 
            
                                                        
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 64 |  |  |         $quoteTransfer->setCustomer($customerTransfer); | 
            
                                                        
            
                                    
            
            
                | 65 |  |  |         $quoteTransfer->setShippingAddress($shippingAddressTransfer); | 
            
                                                        
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 67 |  |  |         $quoteTransfer->getCustomer()->setEmail($paypalExpressSuccessResponseTransfer->getEmail()); | 
            
                                                        
            
                                    
            
            
                | 68 |  |  |         $quoteTransfer->getCustomer()->setFirstName($paypalExpressSuccessResponseTransfer->getFirstName()); | 
            
                                                        
            
                                    
            
            
                | 69 |  |  |         $quoteTransfer->getCustomer()->setLastName($paypalExpressSuccessResponseTransfer->getLastName()); | 
            
                                                        
            
                                    
            
            
                | 70 |  |  |         $quoteTransfer->getShippingAddress()->setFirstName($paypalExpressSuccessResponseTransfer->getFirstName()); | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |         $quoteTransfer->getShippingAddress()->setLastName($paypalExpressSuccessResponseTransfer->getLastName()); | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |         $quoteTransfer->getShippingAddress()->setEmail($paypalExpressSuccessResponseTransfer->getEmail()); | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |         $quoteTransfer->getShippingAddress()->setAddress1($paypalExpressSuccessResponseTransfer->getLine1()); | 
            
                                                        
            
                                    
            
            
                | 74 |  |  |         $quoteTransfer->getShippingAddress()->setCity($paypalExpressSuccessResponseTransfer->getCity()); | 
            
                                                        
            
                                    
            
            
                | 75 |  |  |         $quoteTransfer->getShippingAddress()->setCity($paypalExpressSuccessResponseTransfer->getCity()); | 
            
                                                        
            
                                    
            
            
                | 76 |  |  |         $quoteTransfer->getShippingAddress()->setState($paypalExpressSuccessResponseTransfer->getState()); | 
            
                                                        
            
                                    
            
            
                | 77 |  |  |         $quoteTransfer->getShippingAddress()->setZipCode($paypalExpressSuccessResponseTransfer->getPostalCode()); | 
            
                                                        
            
                                    
            
            
                | 78 |  |  |         $quoteTransfer->getShippingAddress()->setZipCode($paypalExpressSuccessResponseTransfer->getPostalCode()); | 
            
                                                        
            
                                    
            
            
                | 79 |  |  |         $quoteTransfer->setBillingSameAsShipping(true); | 
            
                                                        
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 81 |  |  |         //TODO: Get country code | 
            
                                                        
            
                                    
            
            
                | 82 |  |  | //        $quoteTransfer->getShippingAddress()->setCountry($paypalExpressSuccessResponseTransfer->getPostalCode()); | 
            
                                                        
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 84 |  |  |         return $quoteTransfer; | 
            
                                                        
            
                                    
            
            
                | 85 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 86 |  |  | } | 
            
                        
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