public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
 {
     $returnValue = null;
     if (parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key)) {
         $returnValue = $this->currentOrder;
     }
     return $returnValue;
 }
    public function validateOrderPay($id_cart, $id_order_state, $amount_paid, $extraCosts, $payment_method = 'Unknown', $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
    {
        $statusPending = Configuration::get('PAYNL_WAIT');
        $statusPaid = Configuration::get('PAYNL_SUCCESS');
        // Als er nog geen order van dit cartid is, de order valideren.
        $orderId = Order::getOrderByCartId($id_cart);
        if ($orderId == false) {
            if ($id_order_state == $statusPaid) {
                if ($extraCosts != 0) {
                    $id_order_state_tmp = $statusPending;
                } else {
                    $id_order_state_tmp = $statusPaid;
                }
            } else {
                $id_order_state_tmp = $id_order_state;
            }
            $result = parent::validateOrder($id_cart, $id_order_state_tmp, $amount_paid, $payment_method, $message, $extra_vars, $currency_special, $dont_touch_amount, $secure_key, $shop);
            $orderId = $this->currentOrder;
            if ($extraCosts == 0 && $id_order_state_tmp == $statusPaid) {
                //Als er geen extra kosten zijn, en de order staat op betaald zijn we klaar
                return $result;
            }
        }
        if ($orderId && $id_order_state == $statusPaid) {
            $order = new Order($orderId);
            $shippingCost = $order->total_shipping;
            $newShippingCosts = $shippingCost + $extraCosts;
            $extraCostsExcl = round($extraCosts / (1 + 21 / 100), 2);
            if ($extraCosts != 0) {
                //als de order extra kosten heeft, moeten deze worden toegevoegd.
                $order->total_shipping = $newShippingCosts;
                $order->total_shipping_tax_excl = $order->total_shipping_tax_excl + $extraCostsExcl;
                $order->total_shipping_tax_incl = $newShippingCosts;
                $order->total_paid_tax_excl = $order->total_paid_tax_excl + $extraCostsExcl;
                $order->total_paid_tax_incl = $order->total_paid_real = $order->total_paid = $order->total_paid + $extraCosts;
            }
            $result = $order->addOrderPayment($amount_paid, $payment_method, $extra_vars['transaction_id']);
            if (number_format($order->total_paid_tax_incl, 2) !== number_format($amount_paid, 2)) {
                $id_order_state = Configuration::get('PS_OS_ERROR');
            }
            //paymentid ophalen
            $orderPayment = OrderPayment::getByOrderId($order->id);
            $history = new OrderHistory();
            $history->id_order = (int) $order->id;
            $history->changeIdOrderState((int) $id_order_state, $order, $orderPayment);
            $res = Db::getInstance()->getRow('
			SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date`
			FROM `' . _DB_PREFIX_ . 'orders`
			WHERE `id_order` = ' . (int) $order->id);
            $order->invoice_date = $res['invoice_date'];
            $order->invoice_number = $res['invoice_number'];
            $order->delivery_date = $res['delivery_date'];
            $order->delivery_number = $res['delivery_number'];
            $order->update();
            $history->addWithemail();
        }
        return $result;
    }
Exemplo n.º 3
0
 function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false)
 {
     if (!$this->active) {
         return;
     }
     parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars);
 }
Exemplo n.º 4
0
 public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
 {
     if (!$this->active) {
         return;
     }
     // Set transaction details if pcc is defiend in PaymentModule class_exists
     if (isset($this->pcc)) {
         $this->pcc->transaction_id = isset($extraVars['transaction_id']) ? $extraVars['transaction_id'] : '';
     }
     parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
     if (array_key_exists('transaction_id', $extraVars) and array_key_exists('payment_status', $extraVars)) {
         $this->_saveTransaction($id_cart, $extraVars);
     }
 }
Exemplo n.º 5
0
 public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $message = null, $transaction = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
 {
     if ($this->active) {
         // Set transaction details if pcc is defined in PaymentModule class_exists
         if (isset($this->pcc)) {
             $this->pcc->transaction_id = isset($transaction['transaction_id']) ? $transaction['transaction_id'] : '';
         }
         if (version_compare(_PS_VERSION_, '1.5', '<')) {
             parent::validateOrder((int) $id_cart, (int) $id_order_state, (double) $amount_paid, $payment_method, $message, $transaction, $currency_special, $dont_touch_amount, $secure_key);
         } else {
             parent::validateOrder((int) $id_cart, (int) $id_order_state, (double) $amount_paid, $payment_method, $message, $transaction, $currency_special, $dont_touch_amount, $secure_key, $shop);
         }
         if (count($transaction) > 0) {
             PayPalOrder::saveOrder((int) $this->currentOrder, $transaction);
         }
         $this->setPayPalAsConfigured();
     }
 }
Exemplo n.º 6
0
 public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
 {
     if (!$this->active) {
         return;
     }
     $this->_validateErrors = array();
     $currency = $this->getCurrency();
     $cart = new Cart(intval($id_cart));
     $cart_currency = $_SESSION['params1']['cart']->id_currency;
     $cart_total = $_SESSION['params1']['cart']->getOrderTotal(true, 3);
     $cart->id_currency = $cart_currency;
     $amountPaid = $cart_total;
     $id_lang = $_SESSION['params1']['cart']->id_lang;
     $subject = 'CCAvenue Payment Status';
     $template = 'payment_success';
     $firstname = $_SESSION['params1']['cookie']->customer_firstname;
     $lastname = $_SESSION['params1']['cookie']->customer_lastname;
     $Order_Id = $id_cart;
     $date_added = $_SESSION['params1']['cookie']->date_add;
     $payment_method = $paymentMethod;
     $total = $cart_total;
     $to = $_SESSION['params1']['cookie']->email;
     $templateVars = array('{firstname}' => $firstname, '{lastname}' => $lastname, '{Order_Id}' => $Order_Id, '{date_added}' => $date_added, '{payment_method}' => $payment_method, '{total}' => $total);
     $ccavenue_payment_success_mail = trim(Configuration::get('CCAVENUE_PAYMENT_SUCCESS_MAIL'));
     //$ccavenue_payment_success_mail = 0;
     $payment_status = '';
     if (isset($extraVars['payment_status'])) {
         $payment_status = $extraVars['payment_status'];
     }
     if ($ccavenue_payment_success_mail && $id_order_state == '2') {
         Mail::Send($id_lang, $template, $subject, $templateVars, $to, NULL, NULL, NULL, NULL, NULL, _PS_MODULE_DIR_ . $this->name . '/mails/');
     }
     $cart->save();
     parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, true, $secure_key);
 }
Exemplo n.º 7
0
 function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special, $dont_touch_amount = false)
 {
     if (!$this->active) {
         return;
     }
     $currency = $this->getCurrency();
     $cart = new Cart(intval($id_cart));
     $cart->id_currency = $currency->id;
     $cart->save();
     parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, true);
 }
Exemplo n.º 8
0
 public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
 {
     if (!$this->active) {
         return;
     }
     parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
     if (array_key_exists('transaction_id', $extraVars) and array_key_exists('payment_status', $extraVars)) {
         $this->_saveTransaction($id_cart, $extraVars);
     }
 }
Exemplo n.º 9
0
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        $return = curl_exec($ch);
        curl_close($ch);
        $msg = json_decode($return);
        if (!$msg->hasErrors) {
            die(json_encode(array('hasErrors' => false)));
        }
        die(json_encode(array('hasErrors' => true, 'msg' => $msg->msg)));
    }
    die(json_encode(array('hasErrors' => true, 'msg' => '找不到定单!')));
}
if (array_key_exists('carttoorder', $_GET)) {
    if (isset($_GET['id_cart'])) {
        $id_order = Db::getInstance()->getValue('SELECT id_order FROM ' . _DB_PREFIX_ . 'order WHERE id_cart=' . intval($_GET['id_cart']));
        if ($id_order) {
            die(json_encode(array('hasErrors' => true, 'msg' => '该购物车定单已存在!')));
        }
        $cart = new Cart((int) $_GET['id_cart']);
        if (Validate::isLoadedObject($cart)) {
            $id_module = 0;
            $payment = new PaymentModule();
            if ($payment->validateOrder($cart, $id_module, 2)) {
                die(json_encode(array('hasErrors' => false)));
            }
            die(json_encode(array('hasErrors' => true, 'msg' => '生顾定单失败!')));
        }
        die(json_encode(array('hasErrors' => true, 'msg' => '购物车无效!')));
    }
    die(json_encode(array('hasErrors' => true, 'msg' => '找不到购物车!')));
}
Exemplo n.º 10
0
 public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $response_message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
 {
     if (!$this->active) {
         return;
     }
     parent::validateOrder((int) $id_cart, (int) $id_order_state, (double) $amount_paid, $payment_method, $response_message, $extra_vars, $currency_special, true, false, null);
 }
Exemplo n.º 11
0
 public function processPayment()
 {
     if (!$this->active) {
         return;
     }
     $order_id = $_POST['ORDERID'];
     global $smarty, $cart, $cookie;
     $responseMsg = '';
     if (isset($_POST['RESPCODE']) && $_POST['RESPCODE'] == "01") {
         $secret_key = Configuration::get('Paytm_SECRET_KEY');
         $bool = "FALSE";
         $paramList = $_POST;
         $checksum_recv = $_POST['CHECKSUMHASH'];
         $bool = verifychecksum_e($paramList, $secret_key, $checksum_recv);
         $extra_vars['transaction_id'] = $_POST['TXNID'];
         if ($bool == "TRUE") {
             $customer = new Customer((int) $cart->id_customer);
             parent::validateOrder((int) $order_id, Configuration::get('Paytm_ID_ORDER_SUCCESS'), $_POST['TXNAMOUNT'], $this->displayName, null, $extra_vars, null, true, $cart->secure_key, null);
             $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
             $order = new Order($result['id_order']);
             $order->addOrderPayment($_POST['TXNAMOUNT'], null, $_POST['TXNID']);
         } else {
             parent::validateOrder((int) $order_id, Configuration::get('Paytm_ID_ORDER_FAILED'), $_POST['TXNAMOUNT'], $this->displayName, NULL, $extra_vars, '', false, $cart->secure_key);
             $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
             $order = new Order($result['id_order']);
             $order->addOrderPayment($_POST['TXNAMOUNT'], null, $_POST['TXNID']);
         }
     } else {
         parent::validateOrder((int) $order_id, Configuration::get('Paytm_ID_ORDER_FAILED'), $_POST['TXNAMOUNT'], $this->displayName, NULL, $extra_vars, '', false, $cart->secure_key);
         $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
         $order = new Order($result['id_order']);
         $order->addOrderPayment($_POST['TXNAMOUNT'], null, $_POST['TXNID']);
     }
     $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
     Tools::redirectLink(__PS_BASE_URI__ . 'order-detail.php?id_order=' . $result['id_order']);
 }