コード例 #1
0
 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     // we don't use shopping cart again
     // $cart = $this->context->cart;
     // var_dump($cart);
     // $veritrans_notification = new VeritransNotification();
     // $transaction = $this->getTransaction($veritrans_notification->orderId);
     // $order_id = $veritrans_notification->orderId;
     // $token_merchant = $transaction['token_merchant'];
     // $customer = new Customer($transaction['id_customer']);
     // error_log($transaction);
     // error_log($customer);
     // $cart = new Cart($transaction['id_cart']);
     // var_dump($cart);
     // $currency = new Currency($transaction['id_currency']);
     // var_dump($currency);
     // $total = (float)$cart->getOrderTotal(true, Cart::BOTH);
     // var_dump($total);
     // $mailVars = array(
     //   '{merchant_id}' => Configuration::get('MERCHANT_ID'),
     //   '{merchant_hash}' => nl2br(Configuration::get('MERCHANT_HASH'))
     // );
     /** Validating order*/
     // if ($veritrans_notification->status != 'fatal')
     // {
     //   if($token_merchant == $veritrans_notification->TOKEN_MERCHANT)
     //   {
     //     $history = new OrderHistory();
     //     $history->id_order = (int)$veritrans_notification->orderId;
     //     if ($veritrans_notification->mStatus == 'success')
     //     {
     //       // $this->module->validateOrder($cart->id, Configuration::get('VN_PAYMENT_SUCCESS_STATUS_MAP'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
     //       $history->changeIdOrderState(Configuration::get('VN_PAYMENT_SUCCESS_STATUS_MAP'), (int)$veritrans_notification->orderId);
     //       // $status = "Payment Success";
     //       // $this->validate($this->module->currentOrder, $veritrans_notification->orderId, $status);
     //       echo 'validation success';
     //     }
     //     elseif ($veritrans_notification->mStatus == 'failure')
     //     {
     //       // $this->module->validateOrder($cart->id, Configuration::get('VN_PAYMENT_FAILURE_STATUS_MAP'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
     //       $history->changeIdOrderState(Configuration::get('VN_PAYMENT_SUCCESS_FAILURE_MAP'), (int)$veritrans_notification->orderId);
     //       // $status = "Payment Error";
     //       // $this->validate($this->module->currentOrder, $veritrans_notification->orderId, $status);
     //       echo 'validation failed';
     //     }
     //     else
     //     {
     //       echo 'other<br/>';
     //     }
     //   }
     //   else
     //   {
     //     echo 'no transaction<br/>';
     //   }
     // }
     // exit;
     $veritransBni = new VeritransBni();
     $veritransBni->execNotification();
 }
コード例 #2
0
<?php

$useSSL = true;
$root_dir = str_replace('modules/veritransbni', '', dirname($_SERVER['SCRIPT_FILENAME']));
include_once $root_dir . '/config/config.inc.php';
include_once $root_dir . '/modules/veritransbni/veritransbni.php';
function getTransaction($request_id)
{
    $sql = 'SELECT *
      FROM `' . _DB_PREFIX_ . 'vt_transaction`
      WHERE `request_id` = \'' . $request_id . '\'';
    $result = Db::getInstance()->getRow($sql);
    return $result;
}
function validate($id_transaction, $id_order, $order_status)
{
    $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'vt_validation`
      (`id_order`, `id_transaction`, `order_status`)
      VALUES (' . (int) $id_transaction . ',
          ' . (int) $id_order . ',
          \'' . $order_status . '\')';
    Db::getInstance()->Execute($sql);
}
$veritransBni = new VeritransBni();
$veritransBni->execNotification();
コード例 #3
0
<?php

$useSSL = true;
$root_dir = str_replace('modules/veritransbni', '', dirname($_SERVER['SCRIPT_FILENAME']));
include_once $root_dir . '/config/config.inc.php';
$controller = new FrontController();
if (Tools::usingSecureMode()) {
    $useSSL = $controller->ssl = true;
}
$controller->init();
include_once $root_dir . '/modules/veritransbni/veritransbni.php';
if (!$cookie->isLogged(true)) {
    Tools::redirect('authentication.php?back=order.php');
} elseif (!Customer::getAddressesTotalById((int) $cookie->id_customer)) {
    Tools::redirect('address.php?back=order.php?step=1');
}
$veritransBni = new VeritransBni();
$keys = $veritransBni->execValidation($cart);
$veritrans_api_version = Configuration::get('VN_API_VERSION');
$veritrans_payment_method = Configuration::get('VN_PAYMENT_TYPE');
if ($keys['errors']) {
    var_dump($keys['errors']);
    exit;
} else {
    if ($veritrans_api_version == 2 && $veritrans_payment_method == 'vtweb') {
        Tools::redirectLink($keys['redirect_url']);
    } else {
        if ($veritrans_api_version == 2 && $veritrans_payment_method == 'vtdirect') {
        }
    }
}
コード例 #4
0
 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     $cart = $this->context->cart;
     $veritransbni = new VeritransBni();
     $keys = $veritransbni->execValidation($cart);
     // if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active)
     //  Tools::redirect('index.php?controller=order&step=1');
     // // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
     // $authorized = false;
     // foreach (Module::getPaymentModules() as $module)
     //  if ($module['name'] == 'veritransbni')
     //  {
     //    $authorized = true;
     //    break;
     //  }
     // if (!$authorized)
     //  die($this->module->l('This payment method is not available.', 'validation'));
     // $customer = new Customer($cart->id_customer);
     //   if (!Validate::isLoadedObject($customer))
     //    Tools::redirect('index.php?controller=order&step=1');
     //    $usd = Configuration::get('VN_KURS');
     //   $cf = Configuration::get('VN_CONVENIENCE_FEE') * 0.01;
     //   $veritrans = new Veritrans();
     //   $url = Veritrans_Config::PAYMENT_REDIRECT_URL;
     //   $shipping_cost = $cart->getTotalShippingCost();
     //   $currency = $this->context->currency;
     //   $total = $cart->getOrderTotal(true, Cart::BOTH);
     //   $mailVars = array(
     //    '{merchant_id}' => Configuration::get('MERCHANT_ID'),
     //    '{merchant_hash}' => nl2br(Configuration::get('MERCHANT_HASH'))
     //   );
     //   $billing_address = new Address($cart->id_address_invoice);
     //   $delivery_address = new Address($cart->id_address_delivery);
     //   $veritrans->version = Configuration::get('VN_API_VERSION');
     //   $veritrans->environment = Configuration::get('VN_ENVIRONMENT');
     //   $veritrans->payment_type = Configuration::get('VN_PAYMENT_TYPE') == 'vtdirect' ? Veritrans_Config::VN_DIRECT : Veritrans_Config::VN_WEB;
     //   $veritrans->merchant_id = Configuration::get('VN_MERCHANT_ID');
     //   $veritrans->merchant_hash_key = Configuration::get('VN_MERCHANT_HASH');
     //   $veritrans->client_key = Configuration::get('VN_CLIENT_KEY');
     //   $veritrans->server_key = Configuration::get('VN_SERVER_KEY');
     //   $veritrans->enable_3d_secure = Configuration::get('VN_3D_SECURE');
     //   $veritrans->force_sanitization = true;
     //   // Billing Address
     //   $veritrans->first_name = $billing_address->firstname;
     //   $veritrans->last_name = $billing_address->lastname;
     //   $veritrans->address1 = $billing_address->address1;
     //   $veritrans->address2 = $billing_address->address2;
     //   $veritrans->city = $billing_address->city;
     //   $veritrans->country_code = $billing_address->id_country;
     //   $veritrans->postal_code = $billing_address->postcode;
     //   $veritrans->phone = $billing_address->phone_mobile;
     //   $veritrans->email = $customer->email;
     //   if($this->context->cart->isVirtualCart()) {
     //    $veritrans->required_shipping_address = 0;
     //    $veritrans->billing_different_with_shipping = 0;
     //   } else {
     //    $veritrans->required_shipping_address = 1;
     //    if ($cart->id_address_delivery != $cart->id_address_invoice)
     //    {
     //      $veritrans->billing_different_with_shipping = 1;
     //      $veritrans->shipping_first_name = $delivery_address->firstname;
     //      $veritrans->shipping_last_name = $delivery_address->lastname;
     //      $veritrans->shipping_address1 = $delivery_address->address1;
     //      $veritrans->shipping_address2 = $delivery_address->address2;
     //      $veritrans->shipping_city = $delivery_address->city;
     //      $veritrans->shipping_country_code = $delivery_address->id_country;
     //      $veritrans->shipping_postal_code = $delivery_address->postcode;
     //      $veritrans->shipping_phone = $delivery_address->phone_mobile;
     //    } else
     //    {
     //      $veritrans->billing_different_with_shipping = 0;
     //    }
     //   }
     //   $items = $this->addCommodities($cart, $shipping_cost, $usd);
     //   // convert the currency
     //   $cart_currency = new Currency($cart->id_currency);
     //   if ($cart_currency->iso_code != 'IDR')
     //   {
     //    // check whether if the IDR is installed or not
     //    if (Currency::exists('IDR', null))
     //    {
     //      // use default rate
     //      $conversion_func = function($input) use($cart_currency) { return Tools::convertPriceFull($input, $cart_currency, new Currency(Currency::getIdByIsoCode('IDR'))); };
     //    } else
     //    {
     //      // use rate
     //      $conversion_func = function($input) { return $input * intval(Configuration::get('VN_KURS')); };
     //    }
     //    foreach ($items as &$item) {
     //      $item['price'] = intval(round(call_user_func($conversion_func, $item['price'])));
     //    }
     //   }
     //   $veritrans->items = $items;
     //   $this->module->validateOrder($cart->id, Configuration::get('VN_ORDER_STATE_ID'), $cart->getOrderTotal(true, Cart::BOTH), $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
     //   $veritrans->order_id = $this->module->currentOrder;
     $veritrans_api_version = Configuration::get('VN_API_VERSION');
     $veritrans_payment_method = Configuration::get('VN_PAYMENT_TYPE');
     if (array_key_exists('errors', $keys)) {
         if ($keys['errors']) {
             var_dump($keys['errors']);
             exit;
         }
     }
     if ($veritrans_api_version == 2 && $veritrans_payment_method == 'vtweb') {
         if ($keys['isWarning']) {
             Tools::redirectLink('index.php?fc=module&module=veritransbni&controller=warning&redirlink=' . $keys['redirect_url'] . '&message=' . $keys['message']);
         }
         Tools::redirectLink($keys['redirect_url']);
     } else {
         if ($veritrans_api_version == 2 && $veritrans_payment_method == 'vtdirect') {
         }
     }
 }
コード例 #5
0
<?php

$useSSL = true;
$root_dir = str_replace('modules/veritransbni', '', dirname($_SERVER['SCRIPT_FILENAME']));
include_once $root_dir . '/config/config.inc.php';
include_once $root_dir . '/header.php';
include_once $root_dir . '/modules/veritransbni/veritransbni.php';
if (!$cookie->isLogged(true)) {
    Tools::redirect('authentication.php?back=order.php');
} elseif (!Customer::getAddressesTotalById((int) $cookie->id_customer)) {
    Tools::redirect('address.php?back=order.php?step=1');
}
$veritransbni = new VeritransBni();
echo $veritransbni->execPayment($cart);
include_once $root_dir . '/footer.php';