| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * InterKassa driver for the Omnipay PHP payment processing library | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @link      https://github.com/hiqdev/omnipay-interkassa | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @package   omnipay-interkassa | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license   MIT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | namespace Omnipay\InterKassa\Message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * Class PurchaseRequest. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 15 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | class PurchaseRequest extends AbstractRequest | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |      * {@inheritdoc} | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 3 |  |     public function getData() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 3 |  |         $this->validate('checkoutId', 'amount', 'currency', 'description', 'transactionId'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         $return = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 3 |  |             'ik_co_id'          => $this->getCheckoutId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 | 3 |  |             'ik_am'             => $this->getAmount(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 3 |  |             'ik_pm_no'          => $this->getTransactionId(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 3 |  |             'ik_desc'           => $this->getDescription(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 | 3 |  |             'ik_cur'            => $this->getCurrency(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 3 |  |         if ($ik_pnd_u = $this->getReturnUrl()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 3 |  |             $return['ik_pnd_u'] = $ik_pnd_u; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 3 |  |             if ($ik_pnd_m = $this->getReturnMethod()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 3 |  |                 $return['ik_pnd_m'] = $ik_pnd_m; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 3 |  |         if ($ik_suc_u = $this->getReturnUrl()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 | 3 |  |             $return['ik_suc_u'] = $ik_suc_u; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 | 3 |  |             if ($ik_suc_m = $this->getReturnMethod()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 3 |  |                 $return['ik_suc_m'] = $ik_suc_m; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 3 |  |         if ($ik_fal_u = $this->getCancelUrl()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 3 |  |             $return['ik_fal_u'] = $ik_fal_u; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 3 |  |             if ($ik_fal_m = $this->getCancelMethod()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 | 3 |  |                 $return['ik_fal_m'] = $ik_fal_m; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 3 |  |         if ($ik_ia_u = $this->getNotifyUrl()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 3 |  |             $return['ik_ia_u'] = $ik_ia_u; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 3 |  |             if ($ik_ia_m = $this->getNotifyMethod()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 3 |  |                 $return['ik_ia_m'] = $ik_ia_m; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 3 |  |         if ($signKey = $this->getSignKey()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 3 |  |             $return['ik_sign'] = $this->calculateSign($return, $signKey); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 3 |  |         return $return; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 70 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |      * {@inheritdoc} | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |      * @param mixed $data | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |      * @return PurchaseResponse | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 2 |  |     public function sendData($data) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 | 2 |  |         return $this->response = new PurchaseResponse($this, $data); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 81 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 82 |  |  |  |