public function validSend($data)
 {
     $this->load->model('localisation/zone');
     $order_id = $this->session->data['order_id'];
     $ambient = $this->config->get('braspag_billet_ambient');
     $param = array();
     $param['merchantId'] = $this->config->get('braspag_billet_merchant_id');
     $param['orderId'] = $data['order_id'];
     $param['customerName'] = $data['firstname'] . ' ' . $data['lastname'] . ' - ' . $data['cpf_cnpj'] . ' - ' . $data['payment_address_1'] . ', ' . $data['payment_number_home'] . ', ' . $data['payment_neighborhood'] . ' - ' . $data['payment_city'] . '/' . $data['payment_zone'];
     $param['amount'] = number_format((double) $data['total'], 2, ',', '.');
     $year = date("Y");
     $month = date("m");
     $day = date("d");
     $date_maturity = strftime("%d/%m/%Y", mktime(0, 0, 0, $month, $day + $this->config->get('braspag_billet_maturity'), $year));
     $param['paymentMethod'] = $this->config->get('braspag_billet_bank_billet');
     $param['instructions'] = $this->config->get('braspag_billet_intructions');
     $param['emails'] = $data['email'];
     $param['expirationDate'] = substr($date_maturity, 0, 6) . substr($date_maturity, 8, 2);
     $soap_options = array('trace' => 1, 'exceptions' => 0);
     if ($ambient == 0) {
         $client = new SoapClient('https://homologacao.pagador.com.br/webservices/pagador/Boleto.asmx?wsdl', $soap_options);
     } else {
         $client = new SoapClient('https://pagador.com.br/webservices/pagador/Boleto.asmx?wsdl', $soap_options);
     }
     $response = $client->CreateBoleto($param);
     $amount_return = $response->CreateBoletoResult->amount;
     $expiration_date_return = $response->CreateBoletoResult->expirationDate;
     $url_return = $response->CreateBoletoResult->url;
     $boleto_number_return = $response->CreateBoletoResult->boletoNumber;
     $code_return = $response->CreateBoletoResult->returnCode;
     $status_return = $response->CreateBoletoResult->status;
     $insert = "INSERT INTO " . DB_PREFIX . "transaction_braspag_billet SET order_id = '" . $this->session->data['order_id'] . "', date_added = NOW() ";
     if (isset($expiration_date_return)) {
         $insert .= " , expirationDate = '" . $expiration_date_return . "'";
     }
     if (isset($url_return)) {
         $insert .= " , url = '" . $url_return . "'";
         $this->session->data['url'] = $url_return;
     }
     if (isset($boleto_number_return)) {
         $insert .= " , boletoNumber = '" . $boleto_number_return . "'";
     }
     if (isset($code_return)) {
         $insert .= " , returnCode = '" . $code_return . "'";
     }
     if (isset($amount_return)) {
         $insert .= " , amount = '" . $amount_return . "'";
     }
     if (isset($status_return)) {
         $insert .= " , status = '" . $status_return . "'";
     }
     $this->db->query($insert);
     return true;
 }