当前位置: 首页>>代码示例>>PHP>>正文


PHP OrderHistory::add方法代码示例

本文整理汇总了PHP中OrderHistory::add方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderHistory::add方法的具体用法?PHP OrderHistory::add怎么用?PHP OrderHistory::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OrderHistory的用法示例。


在下文中一共展示了OrderHistory::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: refund

 public function refund($order_id)
 {
     $this->log_identifier = time();
     if (!$this->util->isPaymillOrder($order_id)) {
         return false;
     }
     $data = $this->getTransactionData($order_id);
     try {
         $result = $this->refund->create(array('transactionId' => $data['transaction'], 'params' => array('amount' => number_format($data['total_paid'], 2) * 100)));
         $return_value = isset($result['response_code']) && $result['response_code'] === 20000;
         $this->log('Refund resulted in ' . (string) $return_value, var_export($result, true));
         $db = Db::getInstance();
         $db->execute('UPDATE `' . _DB_PREFIX_ . 'pigmbh_paymill_transactiondata` SET `refund`=1 WHERE `id`=' . pSQL($order_id));
     } catch (Exception $exception) {
         $this->log('Refund exception ', var_export($exception->getMessage(), true));
         $return_value = false;
     }
     if ($return_value) {
         $new_order_state = Configuration::get('PS_OS_REFUND');
         $order = new Order($order_id);
         $history = new OrderHistory();
         $history->id_order = (int) $order->id;
         $history->changeIdOrderState($new_order_state, (int) $order->id);
         //order status=3
         $history->add(true);
     }
     return $return_value;
 }
开发者ID:SiWe0401,项目名称:paymill-prestashop,代码行数:28,代码来源:orderActionService.php

示例2: initContent

 public function initContent()
 {
     $order_id = (int) Tools::getValue('merchantReference');
     Logger::addLog('Adyen module: incoming notification for id_order ' . $order_id);
     if ($this->validateNotificationCredential()) {
         $psp_reference = (string) Tools::getValue('pspReference');
         $event_code = (string) Tools::getValue('eventCode');
         $auth_result = (string) Tools::getValue('authResult');
         $payment_method = (string) Tools::getValue('paymentMethod');
         $success = (string) Tools::getValue('success');
         $event_data = !empty($event_code) ? $event_code : $auth_result;
         // check if notification is already executed on server based on psp_reference and event_code
         if ((int) $order_id > 0 && !$this->isDuplicate($psp_reference, $event_code)) {
             // save notification to table so notification is handled only once
             Db::getInstance()->insert('adyen_event_data', array('psp_reference' => pSQL($psp_reference), 'adyen_event_code' => pSQL($event_code), 'adyen_event_result' => pSQL($event_data), 'id_order' => (int) $order_id, 'payment_method' => pSQL($payment_method), 'created_at' => date('Y-m-d H:i:s')));
             // get the order
             $order = new Order($order_id);
             $history = new OrderHistory();
             $history->id_order = (int) $order->id;
             if (strcmp($success, 'false') == 0 || $success == '' || $event_code == 'CANCELLATION') {
                 // failed if post value success is false or not filled in
                 $history->changeIdOrderState((int) Configuration::get('ADYEN_STATUS_CANCELLED'), (int) $order->id);
                 $history->add();
                 Logger::addLog('Adyen module: status for id_order ' . $order->id . ' is changed to cancelled');
             } else {
                 // if success is not false then check if eventCode is AUTHORISATION so that order status is accepted
                 if ($event_code == 'AUTHORISATION') {
                     $history->changeIdOrderState((int) Configuration::get('ADYEN_STATUS_AUTHORIZED'), (int) $order->id);
                     $history->add();
                     Logger::addLog('Adyen module: status for id_order ' . $order->id . ' is changed to authorized');
                 } else {
                     Logger::addLog('Adyen module: status for id_order ' . $order->id . ' is ' . $event_code . ' and is ignored');
                 }
             }
         } else {
             Logger::addLog('Adyen module: incoming notification ignored because it is already handled for id_order ' . $order_id);
         }
     } else {
         Logger::addLog('Adyen module: invalid credential for incoming notification of id_order ' . $order_id, 4);
         // unauthorized
         header('HTTP/1.1 401 Unauthorized', true, 401);
         exit;
     }
     // always return accepted
     die('[accepted]');
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:46,代码来源:notification.php

示例3: updateStatus

 private function updateStatus($orderId, $statusId)
 {
     $order_state_id = $this->getStatus($statusId);
     $history = new OrderHistory();
     $history->id_order = $orderId;
     $history->id_order_state = $order_state_id;
     $history->changeIdOrderState($order_state_id, $orderId);
     $history->add(true);
 }
开发者ID:payu-br,项目名称:bcash-prestashop-transparente,代码行数:9,代码来源:notification.php

示例4: addSyspayOrderHistory

function addSyspayOrderHistory($id_order, $order_state, $use_existings_payment = false)
{
    $history = new OrderHistory();
    $history->id_order = $id_order;
    $history->id_employee = (int) Configuration::get('SYSPAY_EMPLOYEE');
    $history->changeIdOrderState($order_state, $id_order, $use_existings_payment);
    $history->id_order_state = $order_state;
    $history->add(true);
}
开发者ID:antho-girard,项目名称:syspay,代码行数:9,代码来源:ems.php

示例5: updateOrder

function updateOrder($orderId, $response)
{
    $order_state_id = (int) Configuration::get('PS_OS_BCASH_CANCELLED');
    if ($response->transactionStatusId == 6) {
        $order_state_id = (int) Configuration::get('PS_OS_BCASH_REFUNDED');
    }
    $history = new OrderHistory();
    $history->id_order = $orderId;
    $history->id_order_state = $order_state_id;
    $history->changeIdOrderState($order_state_id, $orderId);
    $history->add(true);
}
开发者ID:payu-br,项目名称:bcash-prestashop-transparente,代码行数:12,代码来源:ServiceCancelation.php

示例6: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     // if customer press "back" from VTweb, they'll be redirected to re-order link in order to put back their order into shopping cart (normally, their shopping cart is emptied before redirected to VTWeb, so re-order is needed to make sure they have their order back in shopping cart).
     $this->display_column_left = false;
     $this->display_column_right = false;
     parent::initContent();
     global $smarty;
     if (null !== Tools::getValue('order_id') && '' !== Tools::getValue('order_id')) {
         $order_id = Tools::getValue('order_id');
     }
     // set order status in backend to be failure
     $history = new OrderHistory();
     $history->id_order = $order_id;
     $history->changeIdOrderState(Configuration::get('VI_PAYMENT_FAILURE_STATUS_MAP'), $order_id);
     $history->add(true);
     //
     $cart = $this->context->cart;
     $status = 'back';
     $this->context->smarty->assign(array('status' => $status, 'order_id' => $order_id, 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/'));
     $this->setTemplate('notification.tpl');
 }
开发者ID:rizdaprasetya,项目名称:vtweb-prestashop-OfflineInstallment,代码行数:24,代码来源:back.php

示例7: validateOrder

 public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown', $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
 {
     $this->context->cart = new Cart($id_cart);
     $this->context->customer = new Customer($this->context->cart->id_customer);
     $this->context->language = new Language($this->context->cart->id_lang);
     $this->context->shop = $shop ? $shop : new Shop($this->context->cart->id_shop);
     ShopUrl::resetMainDomainCache();
     $id_currency = $currency_special ? (int) $currency_special : (int) $this->context->cart->id_currency;
     $this->context->currency = new Currency($id_currency, null, $this->context->shop->id);
     if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
         $context_country = $this->context->country;
     }
     $order_status = new OrderState((int) $id_order_state, (int) $this->context->language->id);
     if (!Validate::isLoadedObject($order_status)) {
         throw new PrestaShopException('Can\'t load Order status');
     }
     if (!$this->active) {
         die(Tools::displayError());
     }
     // Does order already exists ?
     if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false) {
         if ($secure_key !== false && $secure_key != $this->context->cart->secure_key) {
             die(Tools::displayError());
         }
         // For each package, generate an order
         $delivery_option_list = $this->context->cart->getDeliveryOptionList();
         $package_list = $this->context->cart->getPackageList();
         $cart_delivery_option = $this->context->cart->getDeliveryOption();
         // If some delivery options are not defined, or not valid, use the first valid option
         foreach ($delivery_option_list as $id_address => $package) {
             if (!isset($cart_delivery_option[$id_address]) || !array_key_exists($cart_delivery_option[$id_address], $package)) {
                 foreach ($package as $key => $val) {
                     $cart_delivery_option[$id_address] = $key;
                     break;
                 }
             }
         }
         $order_list = array();
         $order_detail_list = array();
         do {
             $reference = Order::generateReference();
         } while (Order::getByReference($reference)->count());
         $this->currentOrderReference = $reference;
         $order_creation_failed = false;
         $cart_total_paid = (double) Tools::ps_round((double) $this->context->cart->getOrderTotal(true, Cart::BOTH), 2);
         foreach ($cart_delivery_option as $id_address => $key_carriers) {
             foreach ($delivery_option_list[$id_address][$key_carriers]['carrier_list'] as $id_carrier => $data) {
                 foreach ($data['package_list'] as $id_package) {
                     // Rewrite the id_warehouse
                     $package_list[$id_address][$id_package]['id_warehouse'] = (int) $this->context->cart->getPackageIdWarehouse($package_list[$id_address][$id_package], (int) $id_carrier);
                     $package_list[$id_address][$id_package]['id_carrier'] = $id_carrier;
                 }
             }
         }
         // Make sure CarRule caches are empty
         CartRule::cleanCache();
         $cart_rules = $this->context->cart->getCartRules();
         foreach ($cart_rules as $cart_rule) {
             if (($rule = new CartRule((int) $cart_rule['obj']->id)) && Validate::isLoadedObject($rule)) {
                 if ($error = $rule->checkValidity($this->context, true, true)) {
                     $this->context->cart->removeCartRule((int) $rule->id);
                     if (isset($this->context->cookie) && isset($this->context->cookie->id_customer) && $this->context->cookie->id_customer && !empty($rule->code)) {
                         if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
                             Tools::redirect('index.php?controller=order-opc&submitAddDiscount=1&discount_name=' . urlencode($rule->code));
                         }
                         Tools::redirect('index.php?controller=order&submitAddDiscount=1&discount_name=' . urlencode($rule->code));
                     } else {
                         $rule_name = isset($rule->name[(int) $this->context->cart->id_lang]) ? $rule->name[(int) $this->context->cart->id_lang] : $rule->code;
                         $error = Tools::displayError(sprintf('CartRule ID %1s (%2s) used in this cart is not valid and has been withdrawn from cart', (int) $rule->id, $rule_name));
                         PrestaShopLogger::addLog($error, 3, '0000002', 'Cart', (int) $this->context->cart->id);
                     }
                 }
             }
         }
         foreach ($package_list as $id_address => $packageByAddress) {
             foreach ($packageByAddress as $id_package => $package) {
                 $order = new Order();
                 $order->product_list = $package['product_list'];
                 if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
                     $address = new Address($id_address);
                     $this->context->country = new Country($address->id_country, $this->context->cart->id_lang);
                     //						if (!$this->context->country->active)
                     //							throw new PrestaShopException('The delivery address country is not active.');
                 }
                 $carrier = null;
                 if (!$this->context->cart->isVirtualCart() && isset($package['id_carrier'])) {
                     $carrier = new Carrier($package['id_carrier'], $this->context->cart->id_lang);
                     $order->id_carrier = (int) $carrier->id;
                     $id_carrier = (int) $carrier->id;
                 } else {
                     $order->id_carrier = 0;
                     $id_carrier = 0;
                 }
                 $order->id_customer = (int) $this->context->cart->id_customer;
                 $order->id_address_invoice = (int) $this->context->cart->id_address_invoice;
                 $order->id_address_delivery = (int) $id_address;
                 $order->id_currency = $this->context->currency->id;
                 $order->id_lang = (int) $this->context->cart->id_lang;
                 $order->id_cart = (int) $this->context->cart->id;
                 $order->reference = $reference;
//.........这里部分代码省略.........
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:101,代码来源:PaymentModule.php

示例8: setOrderStatus

 /**
  * @param $order_id
  * @param $status
  * @return OrderHistory
  */
 public function setOrderStatus($order_id, $status)
 {
     $status_id = (int) $this->statuses[$status];
     $history = new OrderHistory();
     $history->id_order = $order_id;
     $history->id_order_state = $status_id;
     $history->changeIdOrderState($status_id, $order_id);
     if ($this->getConfigValue('MOLLIE_MAIL_WHEN_' . strtoupper($status))) {
         $history->addWithemail();
     } else {
         $history->add();
     }
     return $history;
 }
开发者ID:javolero,项目名称:Prestashop,代码行数:19,代码来源:mollie.php

示例9: execNotification

 public function execNotification()
 {
     $veritrans = new Veritrans_Config();
     Veritrans_Config::$isProduction = Configuration::get('VN_ENVIRONMENT') == 'production' ? true : false;
     Veritrans_Config::$serverKey = Configuration::get('VN_SERVER_KEY');
     $veritrans_notification = new Veritrans_Notification();
     $history = new OrderHistory();
     $history->id_order = (int) $veritrans_notification->order_id;
     //Validating order
     //if ($veritrans_notification->isVerified())
     //{
     //$history->id_order = (int)$veritrans_notification->order_id;
     //error_log('notif verified');
     //error_log('message notif: '.(int)$veritrans_notification->order_id);
     $order_id_notif = (int) $veritrans_notification->order_id;
     if ($veritrans_notification->transaction_status == 'capture') {
         if ($veritrans_notification->fraud_status == 'accept') {
             $history->changeIdOrderState(Configuration::get('VN_PAYMENT_SUCCESS_STATUS_MAP'), $order_id_notif);
             echo 'Valid success notification accepted.';
         } else {
             if ($veritrans_notification->fraud_status == 'challenge') {
                 $history->changeIdOrderState(Configuration::get('VN_PAYMENT_CHALLENGE_STATUS_MAP'), $order_id_notif);
                 echo 'Valid challenge notification accepted.';
             }
         }
     } else {
         if ($veritrans_notification->transaction_status == 'settlement') {
             if ($veritrans_notification->payment_type != 'credit_card') {
                 $history->changeIdOrderState(Configuration::get('VN_PAYMENT_SUCCESS_STATUS_MAP'), $order_id_notif);
                 echo 'Valid success notification accepted.';
             } else {
                 echo 'Credit card settlement notification accepted.';
             }
         } else {
             if ($veritrans_notification->transaction_status == 'pending') {
                 $history->changeIdOrderState(Configuration::get('VN_PAYMENT_CHALLENGE_STATUS_MAP'), $order_id_notif);
                 echo 'Pending notification accepted.';
             } else {
                 if ($veritrans_notification->transaction_status == 'cancel') {
                     $history->changeIdOrderState(Configuration::get('VN_PAYMENT_FAILURE_STATUS_MAP'), $order_id_notif);
                     echo 'Pending notification accepted.';
                 } else {
                     $history->changeIdOrderState(Configuration::get('VN_PAYMENT_FAILURE_STATUS_MAP'), $order_id_notif);
                     echo 'Valid failure notification accepted';
                 }
             }
         }
     }
     $history->add(true);
     //}
     exit;
 }
开发者ID:harrypujianto,项目名称:vtweb-prestashop-BNIInstallment,代码行数:52,代码来源:veritransbni.php

示例10: cancelOrder

 public function cancelOrder($order_id)
 {
     $order = new Order($order_id);
     $history = new OrderHistory();
     $history->id_order = (int) $order->id;
     $history->changeIdOrderState((int) Configuration::get('ADYEN_STATUS_CANCELLED'), (int) $order->id);
     $history->add();
     Logger::addLog('Adyen module: order cancceled with id_order ' . $order_id);
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:9,代码来源:adyen.php

示例11: hipayValidateOrder

function hipayValidateOrder($cart = null, $orderState = _PS_OS_ERROR_)
{
    echo '-fnVO';
    $hipay = new HiPay_Tpp();
    $customer = new Customer((int) $cart->id_customer);
    if ($orderState == 'skip') {
        // Simply log the callback
        $msg = new Message();
        $message = $hipay->l('HiPay - Callback initiated');
        $message .= ' - ' . $hipay->l('Transaction_reference : ') . $_POST['transaction_reference'];
        $message .= ' - ' . $hipay->l('State : ') . $_POST['state'];
        $message .= ' - ' . $hipay->l('Status : ') . $_POST['status'];
        $message .= ' - ' . $hipay->l('Message : ') . $_POST['message'];
        $message .= ' - ' . $hipay->l('data : ') . $_POST['cdata1'];
        $message = strip_tags($message, '<br>');
        if (Validate::isCleanHtml($message)) {
            $msg->message = $message;
            $msg->id_order = intval($order->id);
            $msg->private = 1;
            $msg->add();
        }
        HipayLogger::addLog($hipay->l('Callback process', 'hipay'), HipayLogger::ERROR, 'hipayValidateOrder status skip - cid : ' . (int) $_POST['order']->id);
        die;
        return;
    }
    if ($orderState == '124') {
        // NOTE only status 124 present, because logically, status 124 needs to be processed BEFORE status 125 can be send.
        // 124 = If orderstate is refund requested, we don't add a new order but only the log
        // 125 = If orderstate is refund approved, we don't add a new order but only the log
        hipayUpdateOrder($cart, $orderState);
        return;
    }
    HipayLogger::addLog($hipay->l('Callback paiement starting', 'hipay'), HipayLogger::NOTICE, 'Cart id : ' . $cart->id . ' - Order state : ' . $orderState);
    $id_cart = $cart->id;
    $id_order_state = $orderState;
    $amount_paid = $_POST['captured_amount'];
    $message = $hipay->l('Transaction Reference:') . ' ' . $_POST['transaction_reference'] . '
                ' . $hipay->l('State:') . ' ' . $_POST['state'] . '
                ' . $hipay->l('Status:') . ' ' . $_POST['status'] . '
                ' . $hipay->l('Message:') . ' ' . $_POST['message'] . '
                ' . $hipay->l('Data:') . ' ' . $_POST['cdata1'] . '
                ' . $hipay->l('orderState:') . ' ' . $orderState . '
                ' . $hipay->l('Payment mean:') . ' ' . $_POST['payment_product'] . '
                ' . $hipay->l('Payment has began at:') . ' ' . $_POST['date_created'] . '
                ' . $hipay->l('Payment received at:') . ' ' . $_POST['date_authorized'] . '
                ' . $hipay->l('authorization Code:') . ' ' . $_POST['authorization_code'] . '
                ' . $hipay->l('Currency:') . ' ' . $_POST['currency'] . '
                ' . $hipay->l('Customer IP address:') . ' ' . $_POST['ip_address'];
    /**
     * Validate an order in database
     * Function called from a payment module
     *
     * @param integer $id_cart
     *        	Value
     * @param integer $id_order_state
     *        	Value
     * @param float $amount_paid
     *        	Amount really paid by customer (in the default currency)
     * @param string $payment_method
     *        	Payment method (eg. 'Credit card')
     * @param string $message
     *        	Message to attach to order
     */
    // Local Cards update
    $local_card_name = '';
    // Initialize to empty string
    if ($_POST['payment_product'] != '') {
        // Add the card name
        $local_card_name = ' via ' . (string) ucwords($_POST['payment_product']);
        // Retrieve xml list
        if (file_exists(_PS_ROOT_DIR_ . '/modules/' . $hipay->name . '/special_cards.xml')) {
            $local_cards = simplexml_load_file(_PS_ROOT_DIR_ . '/modules/' . $hipay->name . '/special_cards.xml');
            // If cards exists
            if (isset($local_cards)) {
                // If cards count > 0
                if (count($local_cards)) {
                    // Go through each card
                    foreach ($local_cards as $key => $value) {
                        // If card code value = payment_product value
                        if ((string) $value->code == trim($_POST['payment_product'])) {
                            // Add the card name
                            $local_card_name = ' via ' . (string) $value->name;
                        }
                    }
                }
            }
        }
    }
    $secure_key = $customer->secure_key;
    if ($secure_key == null) {
        // If secure key is null force a secure key
        $secure_key = md5(uniqid(rand(), true));
    }
    // If captured amount is zero, capture amount to be paid to prevent errors
    // Then update to actual captured amount when order has been created.
    $update_order_payment = false;
    if ($amount_paid <= 0) {
        $amount_paid = $_POST['authorized_amount'];
        $update_order_payment = true;
    }
//.........这里部分代码省略.........
开发者ID:hipay,项目名称:hipay-fullservice-sdk-prestashop,代码行数:101,代码来源:validation_process.php

示例12: cancelOrder

 private function cancelOrder()
 {
     $order_id = (int) $this->module->currentOrder;
     $order_state_id = (int) Configuration::get('PS_OS_BCASH_CANCELLED');
     $history = new OrderHistory();
     $history->id_order = $order_id;
     $history->id_order_state = $order_state_id;
     $history->changeIdOrderState($order_state_id, $order_id);
     $history->add(true);
 }
开发者ID:payu-br,项目名称:bcash-prestashop-transparente,代码行数:10,代码来源:validation.php

示例13: changeOrderState

 public function changeOrderState($id_order, $id_order_state)
 {
     $order_state = new OrderState((int) $id_order_state);
     $order = new Order((int) $id_order);
     $current_order_state = $order->getCurrentOrderState();
     if (!Validate::isLoadedObject($order_state)) {
         //throw new Exception($this->l('The new order status is invalid.'));
         return false;
     } elseif (!Validate::isLoadedObject($order)) {
         //throw new Exception($this->l('The order is invalid.'));
         return false;
     } else {
         if ($current_order_state->id != $order_state->id) {
             // Create new OrderHistory
             $history = new OrderHistory();
             $history->id_order = $order->id;
             if (isset($this->context->employee->id)) {
                 $history->id_employee = (int) $this->context->employee->id;
             }
             $use_existings_payment = false;
             if (!$order->hasInvoice()) {
                 $use_existings_payment = true;
             }
             $history->changeIdOrderState((int) $id_order_state, $order, $use_existings_payment);
             $history->add(true);
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:silbersaiten,项目名称:mediafinanz,代码行数:31,代码来源:mediafinanz.php

示例14: changeStatusOrder

function changeStatusOrder($order_exist, $id_order, $orderState, $order, $callback_arr = '')
{
    $bool = false;
    //LOG
    HipayLog('--------------- Début changeStatusOrder');
    if ($order_exist && $id_order) {
        //LOG
        HipayLog('--------------- oderexist && id_order');
        if ((int) $order->getCurrentState() != (int) $orderState && !controleIfStatushistoryExist($id_order, _PS_OS_PAYMENT_, $orderState)) {
            //LOG
            HipayLog('--------------- statut différent');
            $order_history = new OrderHistory();
            //LOG
            HipayLog('--------------- order_history init');
            $order_history->id_order = $id_order;
            //LOG
            HipayLog('--------------- order_id init');
            $order_history->changeIdOrderState($orderState, $id_order, true);
            //LOG
            HipayLog('--------------- changeIdOrderState(' . $orderState . ',' . $id_order . ')');
            $order_history->add();
            //LOG
            HipayLog('--------------- statut changé = ' . $orderState);
            $bool = true;
        }
        if (!empty($callback_arr) && isset($callback_arr['status']) && $callback_arr['status'] == HIPAY_STATUS_CAPTURED) {
            $hipay = new HiPay_Tpp();
            // historise le callback sous forme de message
            $message = $hipay->l('HiPay - Callback initiated') . "<br>";
            $message .= ' - ' . $hipay->l('Transaction_reference : ') . $callback_arr['transaction_reference'] . "<br>";
            $message .= ' - ' . $hipay->l('State : ') . $callback_arr['state'] . "<br>";
            $message .= ' - ' . $hipay->l('Status : ') . $callback_arr['status'] . "<br>";
            $message .= ' - ' . $hipay->l('Message : ') . $callback_arr['message'] . "<br>";
            $message .= ' - ' . $hipay->l('Amount : ') . $callback_arr['authorized_amount'] . "<br>";
            $message = strip_tags($message, '<br>');
            if (Validate::isCleanHtml($message)) {
                $msg = new Message();
                $msg->message = $message;
                $msg->id_order = (int) $order->id;
                $msg->private = 1;
                $msg->add();
            }
        }
        // Init / MAJ de la ligne message HIPAY_CAPTURE
        addHipayCaptureMessage($callback_arr, $order->id);
        //LOG
        HipayLog('--------------- statut est le même');
        // Controle if it's again a partially captured and inferior to the total order
        //LOG
        HipayLog('--------------- Controle si status 117 et amount > amount captured');
        if (!empty($callback_arr) && isset($callback_arr['status']) && $callback_arr['status'] == HIPAY_STATUS_CAPTURE_REQUESTED && $callback_arr['captured_amount'] < $callback_arr['authorized_amount']) {
            //LOG
            HipayLog('--------------- captured_amount (' . $callback_arr['captured_amount'] . ') est < à authorized_amount (' . $callback_arr['authorized_amount'] . ')');
            $bool = true;
        }
        return $bool;
    }
    //LOG
    HipayLog('--------------- pas de changement de statut car pas de commande');
    return $bool;
}
开发者ID:hipay,项目名称:hipay-fullservice-sdk-prestashop,代码行数:61,代码来源:validation.php

示例15: execNotification

 public function execNotification()
 {
     $veritrans = new Veritrans_Config();
     Veritrans_Config::$isProduction = Configuration::get('VT_ENVIRONMENT') == 'production' ? true : false;
     Veritrans_Config::$serverKey = Configuration::get('VT_SERVER_KEY');
     $veritrans_notification = new Veritrans_Notification();
     $history = new OrderHistory();
     $history->id_order = (int) $veritrans_notification->order_id;
     error_log('message notif');
     error_log(print_r($veritrans_notification, TRUE));
     error_log('==============================================');
     // check if order history already been updated to payment success, then save to array $order_history.
     $order_id_notif = (int) $veritrans_notification->order_id;
     $order = new Order($order_id_notif);
     $order_histories = $order->getHistory($this->context->language->id, Configuration::get('VT_PAYMENT_SUCCESS_STATUS_MAP'));
     // if (empty($order_histories))
     // 	error_log("not found in DB");
     // error_log(print_r($order_histories,true));
     // print_r($order_histories,true);
     //Validating order
     //if ($veritrans_notification->isVerified())
     //{
     //$history->id_order = (int)$veritrans_notification->order_id;
     //error_log('notif verified');
     //error_log('message notif: '.(int)$veritrans_notification->order_id);
     if ($veritrans_notification->transaction_status == 'capture') {
         if ($veritrans_notification->fraud_status == 'accept') {
             // if order history !contains payment accepted, then update DB. Else, don't update DB
             if (empty($order_histories)) {
                 $history->changeIdOrderState(Configuration::get('VT_PAYMENT_SUCCESS_STATUS_MAP'), $order_id_notif);
                 echo 'Valid success notification accepted.';
             } else {
                 error_log("########## Transaction has already been updated to success status once, no need to update again");
             }
         } else {
             if ($veritrans_notification->fraud_status == 'challenge') {
                 $history->changeIdOrderState(Configuration::get('VT_PAYMENT_CHALLENGE_STATUS_MAP'), $order_id_notif);
                 echo 'Valid challenge notification accepted.';
             }
         }
     } else {
         if ($veritrans_notification->transaction_status == 'settlement') {
             if ($veritrans_notification->payment_type != 'credit_card') {
                 // if order history !contains payment accepted, then update DB. Else, don't update DB
                 if (empty($order_histories)) {
                     $history->changeIdOrderState(Configuration::get('VT_PAYMENT_SUCCESS_STATUS_MAP'), $order_id_notif);
                     echo 'Valid success notification accepted.';
                 } else {
                     error_log("########## Transaction has already been updated to success status once, no need to update again");
                 }
             } else {
                 echo 'Credit card settlement notification accepted.';
             }
         } else {
             if ($veritrans_notification->transaction_status == 'pending') {
                 $history->changeIdOrderState(Configuration::get('VT_PAYMENT_CHALLENGE_STATUS_MAP'), $order_id_notif);
                 echo 'Pending notification accepted.';
             } else {
                 if ($veritrans_notification->transaction_status == 'cancel') {
                     $history->changeIdOrderState(Configuration::get('VT_PAYMENT_FAILURE_STATUS_MAP'), $order_id_notif);
                     echo 'Pending notification accepted.';
                 } else {
                     if ($veritrans_notification->transaction_status == 'expire') {
                         $history->changeIdOrderState(Configuration::get('VT_PAYMENT_FAILURE_STATUS_MAP'), $order_id_notif);
                         echo 'Expire notification accepted.';
                     } else {
                         $history->changeIdOrderState(Configuration::get('VT_PAYMENT_FAILURE_STATUS_MAP'), $order_id_notif);
                         echo 'Valid failure notification accepted';
                     }
                 }
             }
         }
     }
     try {
         $history->add(true);
     } catch (Exception $e) {
         echo 'Order history not added: ' . $e->getMessage();
         exit;
     }
     //}
     exit;
 }
开发者ID:rizdaprasetya,项目名称:vtweb-prestashop,代码行数:82,代码来源:veritranspay.php


注:本文中的OrderHistory::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。