Exemplo n.º 1
0
 public function callback()
 {
     $options = array('merchant' => $this->config->get('oplata_merchant'), 'secretkey' => $this->config->get('oplata_secretkey'));
     if ($_POST['order_status'] == Oplata::ORDER_DECLINED) {
         exit('Order declined');
     }
     $paymentInfo = Oplata::isPaymentValid($options, $_POST);
     if ($paymentInfo === true) {
         list($order_id, ) = explode(Oplata::ORDER_SEPARATOR, $_POST['order_id']);
         $this->load->model('checkout/order');
         $order_info = $this->model_checkout_order->getOrder($order_id);
         $this->model_checkout_order->confirm($order_id, $this->config->get('oplata_order_status_id'));
         echo "OK";
         //            $this->msg['message'] = "Thank you for shopping with us. Your account has been charged and your transaction is successful.";
         //            $this->msg['class'] = 'woocommerce-message';
     } else {
         //            $this->msg['class'] = 'error';
         //            $this->msg['message'] = $paymentInfo;
         echo $paymentInfo;
     }
 }
Exemplo n.º 2
0
if (!(require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php")) {
    die('prolog_before.php not found!');
}
if (CModule::IncludeModule('sale')) {
    $ordArray = explode("_", $_POST['order_id']);
    $ORDER_ID = $ordArray[1];
    $User_ID = $ordArray[2];
    $arOrder = CSaleOrder::GetByID($ORDER_ID);
    $payID = $arOrder['PAY_SYSTEM_ID'];
    $temp = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $payID));
    $payData = $temp->Fetch();
    include $_SERVER['DOCUMENT_ROOT'] . $payData['ACTION_FILE'] . "/oplata.cls.php";
    $oplataOpt = array();
    $b = unserialize($payData['PARAMS']);
    foreach ($b as $k => $v) {
        $oplataOpt[$k] = $v['VALUE'];
    }
    $oplata = new Oplata();
    $oplataResult = $oplata->isPaymentValid($oplataOpt, $_REQUEST);
    if ($_REQUEST['order_status'] == Oplata::ORDER_DECLINED) {
        $answer = 'declined';
    } elseif ($oplataResult === true) {
        $answer = 'OK';
    } else {
        $answer = $oplataResult;
    }
    $arFields = array("STATUS_ID" => $answer == 'OK' ? "P" : "N", "PAYED" => $answer == 'OK' ? "Y" : "N", "PS_STATUS" => $answer == 'OK' ? "Y" : "N", "PS_STATUS_CODE" => $_POST['order_status'], "PS_STATUS_DESCRIPTION" => $_POST['order_status'] . " " . $payID . " " . ($answer != 'OK' ? $_REQUEST['response_description'] : ''), "PS_STATUS_MESSAGE" => " - ", "PS_SUM" => $_POST['amount'], "PS_CURRENCY" => $_POST['currency'], "PS_RESPONSE_DATE" => date("d.m.Y H:i:s"));
    CSaleOrder::Update($ORDER_ID, $arFields);
    echo $answer;
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";