예제 #1
0
 private function callSAR($authorizationHTTP, $mode, $paramsSAR)
 {
     $connector = new TodoPago\Sdk($authorizationHTTP, $mode);
     $paydata_comercial = $paramsSAR['comercio'];
     $paydata_operation = $paramsSAR['operacion'];
     $this->logger->info("params SAR: " . json_encode($paramsSAR));
     $rta_first_step = $connector->sendAuthorizeRequest($paydata_comercial, $paydata_operation);
     if ($rta_first_step["StatusCode"] == 702) {
         $this->logger->debug("Reintento");
         $rta_first_step = $connector->sendAuthorizeRequest($paydata_comercial, $paydata_operation);
     }
     $this->logger->info("response SAR: " . json_encode($rta_first_step));
     if ($rta_first_step["StatusCode"] == -1) {
         $query = $this->model_todopago_transaccion->recordFirstStep($this->order_id, $paramsSAR, $rta_first_step, $rta_first_step['RequestKey'], $rta_first_step['PublicRequestKey']);
         $this->logger->debug('query recordFiersStep(): ' . $query);
         $this->model_checkout_order->update($this->order_id, $this->config->get('todopago_order_status_id_pro'), "TODO PAGO: " . $rta_first_step['StatusMessage']);
         header('Location: ' . $rta_first_step['URL_Request']);
         //$this->redirect($rta_first_step['URL_Request']);
     } else {
         $query = $this->model_todopago_transaccion->recordFirstStep($this->order_id, $paramsSAR, $rta_first_step);
         $this->logger->debug('query recordFirstStep(): ' . $query);
         $this->model_checkout_order->update($this->order_id, $this->config->get('todopago_order_status_id_rech'), "TODO PAGO: " . $rta_first_step['StatusMessage']);
         $this->redirect($this->config->get('config_url') . "index.php?route=payment/todopago/url_error&Order=" . $this->order_id);
     }
 }