public function validar_pago($array) { if (is_array($array)) { $datos['api_version'] = $array['api_version']; $datos['receiver_id'] = $array['receiver_id']; $datos['notification_id'] = $array['notification_id']; $datos['subject'] = $array['subject']; $datos['amount'] = $array['amount']; $datos['currency'] = $array['currency']; $datos['custom'] = $array['custom']; $datos['transaction_id'] = $array['transaction_id']; $datos['payer_email'] = $array['payer_email']; $datos['notification_signature'] = $array['notification_signature']; //HACEMOS LA CADENA DE VERIFICACION $cadena = ""; foreach ($array as $key => $value) { $cadena .= $key . "=" . urlencode($value) . "&"; } $cadena = substr($cadena, 0, -1); // Usamos CURL para hacer POST HTTP $ch = curl_init("https://khipu.com/api/1.2/verifyPaymentNotification"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $cadena); $response = curl_exec($ch); curl_close($ch); if ($response == 'VERIFIED') { $db = new db_core(); $in['confirmado'] = 1; $in['preconfirmado'] = 1; $in['estado'] = 1; $in['codigo_khipu'] = $array['notification_id']; $where['token_transaccion'] = $array['transaction_id']; $db->update('inversion_proyecto', $in, $where); } } }
public function complete_account($data) { $db = new db_core(); $in['nombre'] = $data->nombre; $in['rut'] = $data->rut; $in['telefono'] = $data->telefono; $in['domicilio'] = $data->domicilio; $in['ciudad'] = $data->ciudad; $in['complete'] = 1; $in['lastname_mother'] = $data->lastname_mother; $in['lastname_father'] = $data->lastname_father; $in['numero_domicilio'] = $data->numero_domicilio; $in['numero_depto'] = $data->numero_depto; $in['edificio'] = $data->edificio; $in['comuna'] = $data->comuna; $where['id_user'] = $this->get_user($_SESSION['token_user']); $db->update('users', $in, $where); $this->returnData(array("status" => 0)); }
public function mod_bank($opt) { $dbo = new db_core(); $valores['banco'] = $this->get_banco($opt->banco); $valores['tipo_de_cuenta'] = $opt->tipo; $valores['numero_cuenta_banco'] = $opt->numero; $where['id_cuenta'] = $opt->id_cuenta; $dbo->update('cuentas_bancarias', $valores, $where); $listado = array(); $bancos[0] = $dbo->db_query("SELECT * FROM cuentas_bancarias WHERE id_user='******'token_user']) . "'"); while ($bancos[1] = mysql_fetch_array($bancos[0])) { $total = $dbo->num_one("SELECT DISTINCT id_proyecto FROM inversion_proyecto WHERE id_cuenta_bancaria='" . $bancos[1]['id_cuenta'] . "' WHERE estado='1'"); $item['id_bank'] = $bancos[1]['id_cuenta']; $item['name'] = utf8_encode($bancos[1]['banco'] . " - Cta: " . $bancos[1]['numero_cuenta_banco'] . " (" . $total . " Invesiones activas)"); $listado[] = (object) $item; } $this->returnData(array("status" => 0, "data" => json_encode($listado))); }