| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Dizatech\Transaction\Drivers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | // use Dizatech\PasargadIpg\PasargadIpg; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Dizatech\SadadIpg\SadadIpg; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Dizatech\Transaction\Abstracts\Driver; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | // use stdClass; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | class Sadad extends Driver | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |     public function init($amount, $orderId, $callbackUrl, $detail = []) | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |         // Create new transaction | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |         $transaction = $this->createNewTransaction($orderId, $amount); | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |         // Create object from Sadad Driver | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |         $class = new SadadIpg($this->getInformation()); | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |         $result = $class->requestPayment( | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |             amount: $amount, | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |             order_id: $transaction->id, | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |             redirect_url: $callbackUrl | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |         if (!isset($detail['auto_redirect']) || $detail['auto_redirect'] == true) { | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |             echo "<form action='https://sadad.shaparak.ir/VPG/Purchase' id='sadad_redirect_form' style='display: none;'> | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |                 <input type='text' name='token' value='{$result->token}'> | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |                 <button type='submit'>Send</button> | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |             </form> | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |             <script>window.addEventListener('load', function () {document.getElementById('sadad_redirect_form').submit()})</script>"; | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |             exit; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |         return $result; | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     public function verify($request) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $class = new SadadIpg($this->getInformation()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         if (isset($request['ResCode']) && $request['ResCode'] == 0 && isset($request['token'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             $result = $class->verify(token: $request['token']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             if ($result->status == 'success') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |                 $this->updateTransactionData($request['OrderId'], ['status' => 'successful', 'ref_no' => $result->ref_no]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                 $result->message = 'پرداخت با خطا مواجه شد.'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |                 $this->updateTransactionData($request['OrderId'], ['status' => 'failed']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $this->updateTransactionData($request['OrderId'], ['status' => 'failed']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         return (object)[ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             'status'        => 'error', | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 58 |  |  |             'message'       => 'پرداخت با خطا مواجه شد.', | 
            
                                                                        
                                                                
            
                                    
            
            
                | 59 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 61 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |  | 
            
                        
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