function _recollect_data($order)
{
    global $todopagoTransaccion;
    $config = getTpConfig();
    $order_id = $order->fields['orders_id'];
    if (empty($config)) {
        return $config;
    }
    if ($order_id !== null && $todopagoTransaccion->_getStep($order_id) == TodopagoTransaccion::SECOND_STEP) {
        $config['order_id'] = $order_id;
        $logger = loggerFactory::createLogger(true, $config['ambiente'], getCustomerId($order), $order_id);
        $logger->info("second step");
        $logger->debug('todoPagoConfig: ' . json_encode($config));
        if (empty($config['ambiente'])) {
            $logger->error("FALTA CONFIGURAR PLUGIN TODOPAGO");
            showError();
        }
        $modo = $config["ambiente"] . "_";
        $http_header = json_decode($config["authorization"], 1);
        $http_header["user_agent"] = 'PHPSoapClient';
        $security_code = isset($config[$modo . "security"]) ? $config[$modo . "security"] : '';
        $merchant = isset($config[$modo . "merchant"]) ? $config[$modo . "merchant"] : '';
        $connector = new Sdk($http_header, $config["ambiente"] == 'test' ? 'test' : 'prod');
        $optionsGS = array('MERCHANT' => $config[$modo . "merchant"], 'OPERATIONID' => $order_id);
        $transaction = $todopagoTransaccion->getTransaction($order_id);
        $requestKey = $transaction['request_key'];
        $answerKey = $_GET['Answer'];
        $optionsGAA = array('Security' => $security_code, 'Merchant' => $merchant, 'RequestKey' => $requestKey, 'AnswerKey' => $answerKey);
        return compact('connector', 'optionsGS', 'optionsGAA', 'logger', 'config');
    }
    $logger->warn("No se puede entrar al second step porque ya se ha registrado una entrada exitosa en la tabla todopago_transaccion o el Order id no ha llegado correctamente");
    showError();
}
function _recollect_data($order_id)
{
    global $customer_id, $todopagoTransaccion, $todoPagoConfig;
    $todoPagoConfig = tep_db_query('SELECT * FROM todo_pago_configuracion');
    $todoPagoConfig = tep_db_fetch_array($todoPagoConfig);
    if ($todoPagoConfig['ambiente'] == "test") {
        $mode = "test";
        $security = $todoPagoConfig['test_security'];
        $merchant = $todoPagoConfig['test_merchant'];
    } else {
        $mode = "prod";
        $security = $todoPagoConfig['production_security'];
        $merchant = $todoPagoConfig['production_merchant'];
    }
    $logger = loggerFactory::createLogger(true, $mode, $customer_id, $order_id);
    $logger->debug('todoPagoConfig: ' . json_encode($todoPagoConfig));
    if ($order_id !== null && $todopagoTransaccion->_getStep($order_id) == TodopagoTransaccion::SECOND_STEP) {
        $logger->info("second step");
        $auth = json_decode($todoPagoConfig['authorization'], 1);
        $http_header = array('Authorization' => $auth['Authorization'], 'user_agent' => 'PHPSoapClient');
        $transaction = $todopagoTransaccion->getTransaction($order_id);
        $requestKey = $transaction['request_key'];
        $answerKey = $_GET['Answer'];
        $optionsGAA = array('Security' => $security, 'Merchant' => $merchant, 'RequestKey' => $requestKey, 'AnswerKey' => $answerKey);
        return array('authorization' => $auth, 'mode' => $mode, 'params' => $optionsGAA, 'logger' => $logger);
    }
    $logger->warn("No se puede entrar al second step porque ya se ha registrado una entrada exitosa en la tabla todopago_transaccion o el Order id no ha llegado correctamente");
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
    return false;
}
示例#3
0
 public function __construct($registry)
 {
     parent::__construct($registry);
     $this->logger = loggerFactory::createLogger();
 }
<?php

chdir('../../../../');
require 'includes/application_top.php';
require_once DIR_FS_CATALOG . "/includes/modules/payment/todopagoplugin/includes/TodoPago/lib/Sdk.php";
require_once DIR_FS_CATALOG . '/includes/modules/payment/todopagoplugin/includes/Logger/loggerFactory.php';
$orderId = $_REQUEST["order_id"];
$sql = "select * from todo_pago_configuracion";
$res = tep_db_query($sql);
if ($row = tep_db_fetch_array($res)) {
    $modo = $row["ambiente"] . "_";
    $logger = loggerFactory::createLogger(true, substr($modo, 0, 4), 0, $orderId);
    $logger->info("get Status");
    $wsdl = json_decode($row[$modo . "wsdl"], 1);
    $http_header = json_decode($row["authorization"], 1);
    $http_header["user_agent"] = 'PHPSoapClient';
    define('END_POINT', $row[$modo . "endpoint"]);
    $connector = new TodoPago\Sdk($http_header, substr($modo, 0, 4));
    $optionsGS = array('MERCHANT' => $row[$modo . "merchant"], 'OPERATIONID' => $orderId);
    $logger->info("params getStatus: " . json_encode($optionsGS));
    $status = $connector->getStatus($optionsGS);
    $rta = '';
    $refunds = $status['Operations']['REFUNDS'];
    $refounds = $status['Operations']['refounds'];
    $auxArray = array("refound" => $refounds, "REFUND" => $refunds);
    if ($refunds != null) {
        $aux = 'REFUND';
        $auxColection = 'REFUNDS';
    } else {
        $aux = 'refound';
        $auxColection = 'refounds';
示例#5
0
 private function setLoggerForPayment()
 {
     $this->load->model('checkout/order');
     $this->order = $this->model_checkout_order->getOrder($this->order_id);
     $this->logger->debug("order_info: " . json_encode($this->order));
     $mode = $this->get_mode() == "test" ? "test" : "prod";
     $this->logger = loggerFactory::createLogger(true, $mode, $this->order['customer_id'], $this->order['order_id']);
 }
示例#6
0
 protected function boot()
 {
     global $insert_id;
     $this->todoPagoConfig = $this->get_tp_configuracion();
     $this->tplogger = loggerFactory::createLogger(true, $this->todoPagoConfig['ambiente'], $this->getCustomerId(), $insert_id);
     $this->todopagoTransaccion->createRegister($insert_id);
 }
 private function prepare_order()
 {
     global $order, $insert_id, $customer_id;
     $order->id = $insert_id;
     $this->todoPagoConfig = $this->_get_tp_configuracion();
     $this->logger = loggerFactory::createLogger(true, $this->todoPagoConfig['mode'], $customer_id, $order->id);
     $this->todopagoTransaccion->createRegister($insert_id);
 }