| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * PayPal driver for Omnipay PHP payment library | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @link      https://github.com/hiqdev/omnipay-paypal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @package   omnipay-paypal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @license   MIT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | namespace Omnipay\PayPal\Message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * PayPal Abstract Request. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 16 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  | abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |     protected $zeroAmountAllowed = false; | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |     protected $mainEndpoint = 'https://www.paypal.com/cgi-bin/webscr'; | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     protected $testEndpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; | 
            
                                                                        
                            
            
                                    
            
            
                | 23 | 2 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public function getEndpoint() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 2 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         return $this->getTestMode() ? $this->testEndpoint : $this->mainEndpoint; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 27 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |      * Get the merchant purse. | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |      * @return string merchant purse - email associated with the merchant account. | 
            
                                                                        
                            
            
                                    
            
            
                | 33 | 6 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     public function getPurse() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 | 6 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         return $this->getParameter('purse'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 37 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |      * Set the purse. | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |      * @param string $value merchant purse - email associated with the merchant account. | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |      * @return self | 
            
                                                                        
                            
            
                                    
            
            
                | 44 | 15 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     public function setPurse($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 15 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         return $this->setParameter('purse', $value); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |      * Get the merchant secret. Actually not used. | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |      * @return string merchant secret | 
            
                                                                        
                            
            
                                    
            
            
                | 54 | 1 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     public function getSecret() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 1 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         return $this->getParameter('secret'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 58 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |      * Set the merchant secret. Actually not used. | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |      * @param string $value merchant secret | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |      * @return self | 
            
                                                                        
                            
            
                                    
            
            
                | 65 | 15 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     public function setSecret($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 15 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         return $this->setParameter('secret', $value); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |      * Get the sum excluding fee. | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |      * @return string sum excluding fee | 
            
                                                                        
                            
            
                                    
            
            
                | 75 | 1 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     public function getSum() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 1 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         return $this->getParameter('sum') ?: $this->getAmount(); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |      * Set the sum excluding fee. | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |      * @param string $value sum excluding fee | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |      * @return self | 
            
                                                                        
                            
            
                                    
            
            
                | 86 | 2 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     public function setSum($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 2 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         return $this->setParameter('sum', $value); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 90 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 91 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 92 |  |  |  |