| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Ipag\Classes\Services; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Ipag\Classes\Contracts\Populable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Ipag\Classes\Util\ObjectUtil; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use stdClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | final class TransactionResponseService implements Populable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |      * @var ObjectUtil | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     private $objectUtil; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * @param stdClass $response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |      * @return stdClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     public function populate(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         $transaction = $this->transaction($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         $transaction->creditCard = $this->creditCard($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         if (isset($response->id_assinatura)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |             $transaction->subscription = $this->subscription($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         return $transaction; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |     private function getObjectUtil() | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |         if (is_null($this->objectUtil)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |             $this->objectUtil = new ObjectUtil(); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |         return $this->objectUtil; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     private function transaction(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $transaction = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $transaction->id = $this->getObjectUtil()->getProperty($response, 'id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         $transaction->tid = $this->getObjectUtil()->getProperty($response, 'id_transacao'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         $transaction->authId = $this->getObjectUtil()->getProperty($response, 'autorizacao_id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $transaction->amount = $this->getObjectUtil()->getProperty($response, 'valor'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $transaction->acquirer = $this->getObjectUtil()->getProperty($response, 'operadora'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $transaction->acquirerMessage = $this->getObjectUtil()->getProperty($response, 'operadora_mensagem'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         $transaction->urlAuthentication = $this->getObjectUtil()->getProperty($response, 'url_autenticacao'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $transaction->urlCallback = $this->getObjectUtil()->getProperty($response, 'url_retorno'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $transaction->createAt = $this->getObjectUtil()->getProperty($response, 'criado_em'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $transaction->payment = $this->payment($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $transaction->order = $this->order($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $transaction->customer = $this->customer($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $transaction->antifraud = $this->antifraud($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $transaction->splitRules = $this->splitRules($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $transaction->pix = $this->pix($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $transaction->error = $this->getObjectUtil()->getProperty($response, 'code'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $transaction->errorMessage = $this->getObjectUtil()->getProperty($response, 'message'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $transaction->history = $this->history($response); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         return $transaction; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     private function payment(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $payment = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         $payment->status = $this->getObjectUtil()->getProperty($response, 'status_pagamento'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         $payment->message = $this->getObjectUtil()->getProperty($response, 'mensagem_transacao'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         return $payment; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     private function order(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         $order = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         $order->orderId = $this->getObjectUtil()->getProperty($response, 'num_pedido'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         return $order; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     private function customer(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         $customer = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         $customer_params = property_exists($response, 'cliente') ? $response->cliente : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         if (!empty($customer_params)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             $customer->name = $this->getObjectUtil()->getProperty($customer_params, 'nome'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |             $customer->email = $this->getObjectUtil()->getProperty($customer_params, 'email'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             $customer->phone = $this->getObjectUtil()->getProperty($customer_params, 'telefone'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |             $customer->cpfCnpj = $this->getObjectUtil()->getProperty($customer_params, 'cnpj_cnpj'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |             $customer_address = property_exists($customer_params, 'endereco') ? $customer_params->endereco : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             if (!empty($customer_address)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |                 $address = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |                 $address->street = $this->getObjectUtil()->getProperty($customer_address, 'logradouro'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |                 $address->number = $this->getObjectUtil()->getProperty($customer_address, 'numero'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |                 $address->complement = $this->getObjectUtil()->getProperty($customer_address, 'complemento'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                 $address->district = $this->getObjectUtil()->getProperty($customer_address, 'bairro'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |                 $address->city = $this->getObjectUtil()->getProperty($customer_address, 'cidade'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |                 $address->state = $this->getObjectUtil()->getProperty($customer_address, 'estado'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |                 $address->zipCode = $this->getObjectUtil()->getProperty($customer_address, 'cep'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |                 $customer->address = $address; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         return $customer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     private function history(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         $histories = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         $histories_params = property_exists($response, 'historicos') ? $response->historicos : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         if (!empty($histories_params)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |             foreach ($histories_params as $history_params) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |                 $history = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |                 $history->amount = $this->getObjectUtil()->getProperty($history_params, 'valor'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |                 $history->operationType = $this->getObjectUtil()->getProperty($history_params, 'tipo'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |                 $history->status = $this->getObjectUtil()->getProperty($history_params, 'status'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                 $history->responseCode = $this->getObjectUtil()->getProperty($history_params, 'codigo_resposta'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |                 $history->responseMessage = $this->getObjectUtil()->getProperty($history_params, 'mensagem_resposta'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                 $history->authorizationCode = $this->getObjectUtil()->getProperty($history_params, 'codigo_autorizacao'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |                 $history->authorizationId = $this->getObjectUtil()->getProperty($history_params, 'id_autorizacao'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                 $history->authorizationNsu = $this->getObjectUtil()->getProperty($history_params, 'nsu_autorizacao'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |                 $history->createdAt = $this->getObjectUtil()->getProperty($history_params, 'criado_em'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |                 $histories[] = $history; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         return $histories; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     private function splitRules(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         $splitRules = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         $split_rules = property_exists($response, 'split_rules') ? $response->split_rules : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         if (!empty($split_rules)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             foreach ($split_rules as $split_rule) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |                 $splitRule = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |                 $splitRule->rule = $this->getObjectUtil()->getProperty($split_rule, 'rule'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |                 $splitRule->seller_id = $this->getObjectUtil()->getProperty($split_rule, 'recipient'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |                 $splitRule->ipag_id = $this->getObjectUtil()->getProperty($split_rule, 'ipag_id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |                 $splitRule->amount = $this->getObjectUtil()->getProperty($split_rule, 'amount'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |                 $splitRule->percentage = $this->getObjectUtil()->getProperty($split_rule, 'percentage'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |                 $splitRule->liable = $this->getObjectUtil()->getProperty($split_rule, 'liable'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |                 $splitRule->charge_processing_fee = $this->getObjectUtil()->getProperty($split_rule, 'charge_processing_fee'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |                 $splitRules[] = $splitRule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |         return $splitRules; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     private function creditCard(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |         $creditCard = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |         if (isset($response->token)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |             $creditCard->token = $this->getObjectUtil()->getProperty($response, 'token'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |             $creditCard->last4 = $this->getObjectUtil()->getProperty($response, 'last4'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |             $creditCard->expiryMonth = $this->getObjectUtil()->getProperty($response, 'mes'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |             $creditCard->expiryYear = $this->getObjectUtil()->getProperty($response, 'ano'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         $card = property_exists($response, 'cartao') ? $response->cartao : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         if (!empty($card)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |             $creditCard->holder = $this->getObjectUtil()->getProperty($card, 'titular'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             $creditCard->number = $this->getObjectUtil()->getProperty($card, 'numero'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             $creditCard->expiry = $this->getObjectUtil()->getProperty($card, 'vencimento'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             $creditCard->brand = $this->getObjectUtil()->getProperty($card, 'bandeira'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         return $creditCard; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     private function subscription(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |         $subscription = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |         $subscription->id = $this->getObjectUtil()->getProperty($response, 'id_assinatura'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |         $subscription->profileId = $this->getObjectUtil()->getProperty($response, 'profile_id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |         return $subscription; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |     private function pix(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         $pix = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         $pix->link = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         $pix->qrCode = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         $pix_params = property_exists($response, 'pix') ? $response->pix : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         if (!empty($pix_params)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |             $pix->link = $this->getObjectUtil()->getProperty($pix_params, 'link'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |             $pix->qrCode = $this->getObjectUtil()->getProperty($pix_params, 'qrcode'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         return $pix; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     private function antifraud(stdClass $response) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |         $antifraud = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         $antifraud->score = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         $antifraud->status = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         $antifraud->message = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         $antifraude_params = property_exists($response, 'antifraude') ? $response->antifraude : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |         if (!empty($antifraude_params)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |             $antifraud->score = $this->getObjectUtil()->getProperty($antifraude_params, 'score'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |             $antifraud->status = $this->getObjectUtil()->getProperty($antifraude_params, 'status'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |             $antifraud->message = strip_tags((string) $this->getObjectUtil()->getProperty($antifraude_params, 'message')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |         return $antifraud; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 218 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 219 |  |  |  |