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


PHP Order::setCurrentState方法代码示例

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


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

示例1: validation

 /**
  * @brief Validate a payment, verify if everything is right
  */
 public function validation()
 {
     if (!isset($_POST['sign']) && !isset($_POST['signature'])) {
         Logger::AddLog('[Payulatam] the signature is missing.', 2, null, null, null, true);
     } else {
         $token = isset($_POST['sign']) ? $_POST['sign'] : $_POST['signature'];
     }
     if (!isset($_POST['reference_sale']) && !isset($_POST['referenceCode'])) {
         Logger::AddLog('[Payulatam] the reference is missing.', 2, null, null, null, true);
     } else {
         $ref = isset($_POST['reference_sale']) ? $_POST['reference_sale'] : $_POST['referenceCode'];
     }
     if (!isset($_POST['value']) && !isset($_POST['amount'])) {
         Logger::AddLog('[Payulatam] the amount is missing.', 2, null, null, null, true);
     } else {
         $amount = isset($_POST['value']) ? $_POST['value'] : $_POST['amount'];
     }
     if (!isset($_POST['merchant_id']) && !isset($_POST['merchantId'])) {
         Logger::AddLog('[Payulatam] the merchantId is missing.', 2, null, null, null, true);
     } else {
         $merchantId = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : $_POST['merchantId'];
     }
     if (!isset($_POST['lap_state']) && !isset($_POST['state_pol'])) {
         Logger::AddLog('[Payulatam] the lap_state is missing.', 2, null, null, null, true);
     } else {
         $statePol = isset($_POST['lap_state']) ? $_POST['lap_state'] : $_POST['state_pol'];
     }
     $idCart = substr($ref, 6 + strlen(Configuration::get('PS_SHOP_NAME')));
     $this->context->cart = new Cart((int) $idCart);
     if (!$this->context->cart->OrderExists()) {
         Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have any order created', 2, null, null, null, true);
         return false;
     }
     if (Validate::isLoadedObject($this->context->cart)) {
         $id_orders = Db::getInstance()->ExecuteS('SELECT `id_order` FROM `' . _DB_PREFIX_ . 'orders` WHERE `id_cart` = ' . (int) $this->context->cart->id . '');
         foreach ($id_orders as $val) {
             $order = new Order((int) $val['id_order']);
             if ($this->context->cart->getOrderTotal() != $amount) {
                 Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have the correct amount expected during payment validation', 2, null, null, null, true);
             } else {
                 $currency = new Currency((int) $this->context->cart->id_currency);
                 if ($token == md5(Configuration::get('PAYU_API_KEY') . '~' . Tools::safeOutput(Configuration::get('PAYU_MERCHANT_ID')) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '~' . (double) $this->context->cart->getOrderTotal() . '~' . $currency->iso_code . '~' . $statePol)) {
                     if ($statePol == 7) {
                         $order->setCurrentState((int) Configuration::get('PAYU_WAITING_PAYMENT'));
                     } else {
                         if ($statePol == 4) {
                             $order->setCurrentState((int) Configuration::get('PS_OS_PAYMENT'));
                         } else {
                             $order->setCurrentState((int) Configuration::get('PS_OS_ERROR'));
                             Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' has been rejected by PayU state pol=' . (int) $statePol, 2, null, null, null, true);
                         }
                     }
                 } else {
                     Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' has an incorrect token given from payU during payment validation', 2, null, null, null, true);
                 }
             }
             if (_PS_VERSION_ >= 1.5) {
                 $payment = $order->getOrderPaymentCollection();
                 if (isset($payment[0])) {
                     $payment[0]->transaction_id = pSQL($ref);
                     $payment[0]->save();
                 }
             }
         }
     } else {
         Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' was not found during the payment validation step', 2, null, null, null, true);
     }
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:71,代码来源:payulatam.php

示例2: updateOrder

 public function updateOrder(ShopgateOrder $order)
 {
     $shopgateOrder = PSShopgateOrder::instanceByOrderNumber($order->getOrderNumber());
     if (!Validate::isLoadedObject($shopgateOrder)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_ORDER_NOT_FOUND, 'Order not found', true);
     }
     $order_states = array();
     if ($order->getUpdatePayment() && $order->getIsPaid()) {
         array_push($order_states, $this->getOrderStateId('PS_OS_PAYMENT'));
     }
     if ($order->getUpdateShipping() && !$order->getIsShippingBlocked()) {
         array_push($order_states, $this->getOrderStateId('PS_OS_PREPARATION'));
     }
     if (count($order_states)) {
         $ps_order = new Order($shopgateOrder->id_order);
         foreach ($order_states as $id_order_state) {
             if (version_compare(_PS_VERSION_, '1.4.1.0', '<')) {
                 $history = new OrderHistory();
                 $history->id_order = (int) $shopgateOrder->id_order;
                 $history->changeIdOrderState((int) $id_order_state, (int) $shopgateOrder->id_order);
             } else {
                 $ps_order->setCurrentState($id_order_state);
             }
         }
     }
     return array('external_order_id' => $shopgateOrder->id_order, 'external_order_number' => $shopgateOrder->id_order);
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:27,代码来源:PSShopgatePlugin.php

示例3: confirm


//.........这里部分代码省略.........
                                         // Check KCC Path
                                         if (!(is_null($kccPath) || $kccPath == '')) {
                                             // The cache file is needed for validation
                                             $tbk_cache_path = $tbk_log_path . '.cache';
                                             $tbk_cache = fopen($tbk_cache_path, 'w+');
                                             // Write all the vars to cache
                                             foreach ($_POST as $tbk_key => $tbk_value) {
                                                 fwrite($tbk_cache, "{$tbk_key}={$tbk_value}&");
                                             }
                                             fclose($tbk_cache);
                                             $logger("Cache file created");
                                             // Execute the CGI Check Script
                                             $logger("Start CGI Verification Process");
                                             if (KCC_USE_EXEC) {
                                                 $logger("Verify Using Exec");
                                                 // Store the result in $tbk_result
                                                 // executing the script with the log cache file
                                                 // as param
                                                 $command = $kccPath . KCC_CGI_CHECK . ' ' . $tbk_cache_path;
                                                 exec($command, $tbk_result);
                                             } else {
                                                 // Use perl
                                                 // TODO: Implement Perl Someday
                                                 $logger("Verify Using Perl");
                                             }
                                             // Check the result
                                             $logger("Checking the CGI Result");
                                             if (isset($tbk_result[0]) && $tbk_result[0] == KCC_VERIFICATION_OK) {
                                                 // Verification OK
                                                 // Change the order status
                                                 $logger("Transbank Verification Complete");
                                                 $current_state = $order->current_state;
                                                 try {
                                                     $order->setCurrentState($order_state_completed);
                                                     $logger("Order State Was Changed From ({$current_state}) to ({$order->current_state})");
                                                 } catch (Exception $e) {
                                                     $logger($e->getMessage());
                                                 }
                                                 // Last Check
                                                 if ($order->current_state == $order_state_completed) {
                                                     $result = KCC_ACCEPTED_RESULT;
                                                     $logger("Order state is Completed");
                                                     $isDone = true;
                                                 } else {
                                                     $result = KCC_REJECTED_RESULT;
                                                     $logger("Order State is not Completed.");
                                                 }
                                             } else {
                                                 $logger("Failed CGI Verification " . json_encode($tbk_result));
                                             }
                                         } else {
                                             $logger("KCC Path not Found");
                                         }
                                     } else {
                                         $logger("Session and Post Vars are different");
                                         $logger("Session Total : {$tbk_session_total_amount}");
                                         $logger("TBK Total: {$tbk_total_amount}");
                                         $logger("Session Order: {$tbk_session_order_id}");
                                         $logger("TBK Order Id: {$tbk_order_id}");
                                     }
                                 } else {
                                     $logger("{$tbk_log_path} does not contains valid data");
                                 }
                             } else {
                                 $logger("{$tbk_log_path} does not exist");
                             }
开发者ID:Paguila,项目名称:prestashop-webpay,代码行数:67,代码来源:validate.php

示例4: ManageUrlSys


//.........这里部分代码省略.........
             KwixoLogger::insertLogKwixo(__METHOD__ . ' : ' . __LINE__, 'URLSys : id_cart = ' . $id_cart . (!Order::getOrderByCartId($id_cart) ? '' : ' | id_order = ' . Order::getOrderByCartId($id_cart)) . ' | tag = ' . $tag);
         } else {
             KwixoLogger::insertLogKwixo(__METHOD__ . ' : ' . __LINE__, 'URLSys : order false');
         }
         switch ($tag) {
             //Give up payment, tag sent after 1 hour
             case 0:
                 KwixoLogger::insertLogKwixo(__METHOD__ . ' : ' . __LINE__, 'URLSys abandon après 1h : id_cart = ' . $id_cart . (!Order::getOrderByCartId($id_cart) ? '' : ' | id_order = ' . Order::getOrderByCartId($id_cart)) . ' | tag = ' . $tag);
                 break;
                 //Accepted payment
             //Accepted payment
             case 1:
             case 13:
             case 14:
             case 10:
                 //Retrieve score if present
                 $score = Tools::getValue('Score', false);
                 //if order current state in cancelled or waiting or under control or credit status, status updated
                 if ($id_order === false || in_array($order->getCurrentState(), array((int) _PS_OS_CANCELED_, (int) Configuration::get('KW_OS_WAITING'), (int) Configuration::get('KW_OS_CREDIT'), (int) Configuration::get('KW_OS_CONTROL')))) {
                     if ($score == 'positif') {
                         $psosstatus = (int) Configuration::get('KW_OS_PAYMENT_GREEN');
                     } elseif ($score == 'negatif') {
                         $psosstatus = (int) Configuration::get('KW_OS_PAYMENT_RED');
                     } else {
                         $psosstatus = (int) _PS_OS_PAYMENT_;
                     }
                 }
                 break;
                 //Payment refused
             //Payment refused
             case 2:
                 if (!in_array($order->getCurrentState(), array((int) Configuration::get('KW_OS_PAYMENT_GREEN'), (int) Configuration::get('KW_OS_PAYMENT_RED'), (int) Configuration::get('KW_OS_CONTROL'), (int) Configuration::get('KW_OS_CREDIT')))) {
                     $psosstatus = (int) _PS_OS_CANCELED_;
                 }
                 break;
                 //order under control
             //order under control
             case 3:
                 //if order current state in cancelled or waiting or credit status, status updated
                 if ($id_order === false || in_array($order->getCurrentState(), array((int) _PS_OS_CANCELED_, (int) Configuration::get('KW_OS_WAITING'), (int) Configuration::get('KW_OS_CREDIT')))) {
                     $psosstatus = (int) Configuration::get('KW_OS_CONTROL');
                 }
                 break;
                 //order on waiting status
             //order on waiting status
             case 4:
                 if ($id_order === false) {
                     $psosstatus = (int) Configuration::get('KW_OS_WAITING');
                 }
                 break;
                 //order under credit status
             //order under credit status
             case 6:
                 //if order current state in cancelled or waiting, status updated
                 if ($id_order === false || in_array($order->getCurrentState(), array((int) _PS_OS_CANCELED_, (int) Configuration::get('KW_OS_WAITING')))) {
                     $psosstatus = (int) Configuration::get('KW_OS_CREDIT');
                 }
                 break;
                 //payment refused
             //payment refused
             case 11:
             case 12:
                 //if order current state in cancelled or waiting, status updated
                 if ($id_order === false || in_array($order->getCurrentState(), array((int) _PS_OS_CANCELED_, (int) Configuration::get('KW_OS_WAITING'), (int) Configuration::get('KW_OS_CREDIT'), (int) Configuration::get('KW_OS_CONTROL')))) {
                     $psosstatus = (int) _PS_OS_CANCELED_;
                 }
                 break;
                 //payment cancelled
             //payment cancelled
             case 101:
                 $psosstatus = (int) _PS_OS_CANCELED_;
                 break;
                 //delivery done
             //delivery done
             case 100:
                 if ($id_order === false || !in_array($order->getCurrentState(), array((int) _PS_OS_DELIVERED_, (int) _PS_OS_PREPARATION_, (int) _PS_OS_SHIPPING_, (int) _PS_OS_PAYMENT_))) {
                     $psosstatus = (int) _PS_OS_PAYMENT_;
                 }
                 break;
             default:
                 break;
                 KwixoLogger::insertLogKwixo(__METHOD__ . ' : ' . __LINE__, 'Appel URLSys : id_cart = ' . $id_cart . (!Order::getOrderByCartId($id_cart) ? '' : ' | id_order = ' . Order::getOrderByCartId($id_cart)) . ' | tag = ' . $tag);
         }
     }
     //Validate order and update status
     if (isset($psosstatus)) {
         if ($id_order === false) {
             $feedback = 'Order Create';
             $payment->validateOrder((int) $cart->id, $psosstatus, $amount, $payment->displayName, $feedback, NULL, $cart->id_currency);
             $id_order = Order::getOrderByCartId($cart->id);
             $payment->manageKwixoOrder($id_order, $tag, $transactionID, $id_cart, 'urlsys');
             if ($cookie->id_cart == (int) $cookie->last_id_cart) {
                 unset($cookie->id_cart);
             }
         } else {
             //update order history
             $order->setCurrentState($psosstatus);
         }
     }
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:101,代码来源:KwixoUrlSysFrontController.php

示例5: manageKwixoTagline

 /**
  *
  * Get the last Kwixo tag for an order and return the correct payment status
  * 
  * @param TaglineResponse $tag
  * @param Order $order
  * @param string $tid
  * 
  */
 function manageKwixoTagline($tag, $order, $tid)
 {
     $id_order = $order->id;
     if ($tag->hasError()) {
         KwixoLogger::insertLogKwixo(__METHOD__ . " : " . __LINE__, "Appel Tagline sur commande kwixo {$id_order} échoué : " . $tag->getError());
     } else {
         //get kwixo tag and kwixo score
         $kwixo_tag = $tag->getTagValue();
         $kwixo_score = $tag->getScore();
         KwixoLogger::insertLogKwixo(__METHOD__ . ' : ' . __LINE__, 'Appel Tagline : id_order = ' . $id_order . ' | tag = ' . $kwixo_tag);
         //insert or update kwixo order for tagline action
         $this->manageKwixoOrder($id_order, $kwixo_tag, $tid, '', 'tagline');
         if (in_array($order->getCurrentState(), array((int) Configuration::get('KW_OS_WAITING'), (int) Configuration::get('KW_OS_CREDIT'), (int) Configuration::get('KW_OS_CONTROL')))) {
             switch ($kwixo_tag) {
                 //order canceled
                 case 2:
                     if (!in_array($order->getCurrentState(), array((int) Configuration::get('KW_OS_PAYMENT_GREEN'), (int) Configuration::get('KW_OS_PAYMENT_RED'), (int) Configuration::get('KW_OS_CONTROL'), (int) Configuration::get('KW_OS_CREDIT')))) {
                         $psosstatus = (int) _PS_OS_CANCELED_;
                     }
                     break;
                     //order under kwixo control
                 //order under kwixo control
                 case 3:
                     $psosstatus = (int) Configuration::get('KW_OS_CONTROL');
                     break;
                 case 4:
                     //if current state is diffrent of kwixo under control
                     if (!in_array($order->getCurrentState(), array((int) Configuration::get('KW_OS_CONTROL')))) {
                         $psosstatus = (int) Configuration::get('KW_OS_WAITING');
                     } else {
                         return false;
                     }
                     break;
                     //order under credit waiting
                 //order under credit waiting
                 case 6:
                     $psosstatus = (int) Configuration::get('KW_OS_CREDIT');
                     break;
                     //order on valid status
                 //order on valid status
                 case 1:
                 case 13:
                 case 14:
                 case 10:
                     if ($kwixo_score == 'positif') {
                         $psosstatus = (int) Configuration::get('KW_OS_PAYMENT_GREEN');
                     } elseif ($kwixo_score == 'negatif') {
                         $psosstatus = (int) Configuration::get('KW_OS_PAYMENT_RED');
                     } else {
                         $psosstatus = (int) _PS_OS_PAYMENT_;
                     }
                     break;
                     //order on payment refused
                 //order on payment refused
                 case 0:
                 case 11:
                 case 12:
                 case 101:
                     $psosstatus = (int) _PS_OS_CANCELED_;
                     break;
                     //order on delivery done
                 //order on delivery done
                 case 100:
                     $psosstatus = (int) _PS_OS_PAYMENT_;
                     break;
                 default:
                     break;
             }
             //return the correct payment status
             if ($order->getCurrentState() != $psosstatus) {
                 //update order history
                 $order->setCurrentState($psosstatus);
             }
         }
     }
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:85,代码来源:kwixo.php

示例6: changeStatusOrder

 private function changeStatusOrder()
 {
     try {
         $order = new Order((int) $this->order_id);
         Context::getContext()->cart = new Cart($order->id_cart);
         // to avoid conflict with giftcard module
         $order->setCurrentState((int) $this->new_status);
     } catch (Exception $e) {
         $this->file_logger->logMessageCall('change_status_order: exception = ' . $e->getMessage(), $this->file_logger->level);
         return array('error' => $e->getMessage());
     }
     return array('success' => 'true');
 }
开发者ID:pacxs,项目名称:pacxscom,代码行数:13,代码来源:mobassistantconnector.php

示例7: validationws

 public function validationws()
 {
     require_once _PS_MODULE_DIR_ . 'payulatam/config.php';
     $conf = new ConfPayu();
     $keysPayu = $conf->keys();
     $currency_iso_code = '';
     if ($conf->isTest()) {
         $currency_iso_code = 'USD';
     } else {
         $currency_iso_code = $params[9]['currency'];
     }
     if (!isset($_POST['sign']) && !isset($_POST['signature'])) {
         Logger::AddLog('[Payulatam] the signature is missing.', 2, null, null, null, true);
     } else {
         $token = isset($_POST['sign']) ? $_POST['sign'] : $_POST['signature'];
     }
     if (!isset($_POST['reference_sale']) && !isset($_POST['referenceCode'])) {
         Logger::AddLog('[Payulatam] the reference is missing.', 2, null, null, null, true);
     } else {
         $ref = isset($_POST['reference_sale']) ? $_POST['reference_sale'] : $_POST['referenceCode'];
     }
     if (!isset($_POST['value']) && !isset($_POST['amount'])) {
         Logger::AddLog('[Payulatam] the amount is missing.', 2, null, null, null, true);
     } else {
         $amount = isset($_POST['value']) ? $_POST['value'] : $_POST['amount'];
     }
     if (!isset($_POST['merchant_id']) && !isset($_POST['merchantId'])) {
         Logger::AddLog('[Payulatam] the merchantId is missing.', 2, null, null, null, true);
     } else {
         $merchantId = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : $_POST['merchantId'];
     }
     if (!isset($_POST['lap_state']) && !isset($_POST['state_pol'])) {
         Logger::AddLog('[Payulatam] the lap_state is missing.', 2, null, null, null, true);
     } else {
         $statePol = isset($_POST['lap_state']) ? $_POST['lap_state'] : $_POST['state_pol'];
     }
     $idCart = explode('_', $ref)[2];
     $this->context->cart = new Cart((int) $idCart);
     $total_order = $this->context->cart->getOrderTotal();
     if (!$this->context->cart->OrderExists()) {
         Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have any order created', 2, null, null, null, true);
         return false;
     }
     if (Validate::isLoadedObject($this->context->cart)) {
         $id_orders = Db::getInstance()->ExecuteS('SELECT `id_order` FROM `' . _DB_PREFIX_ . 'orders` WHERE `id_cart` = ' . (int) $this->context->cart->id . '');
         foreach ($id_orders as $val) {
             $order = new Order((int) $val['id_order']);
             if ($this->context->cart->getOrderTotal() != $amount) {
                 Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have the correct amount expected during payment validation.' . $keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '~' . number_format((double) $this->context->cart->getOrderTotal(), 2, '.', '') . '~' . $currency->iso_code . '~' . $statePol . "---" . $amount, 2, null, null, null, true);
             } else {
                 $currency = new Currency((int) $this->context->cart->id_currency);
                 if ($token == md5($keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '_' . $conf->get_intentos($this->context->cart->id) . '~' . number_format((double) $total_order, 2, '.', '') . '~' . $currency_iso_code . '~' . $statePol) || $token == md5($keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '_' . $conf->get_intentos($this->context->cart->id) . '~' . number_format((double) $total_order, 1, '.', '') . '~' . $currency_iso_code . '~' . $statePol) || $token == md5($keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '_' . $conf->get_intentos($this->context->cart->id) . '~' . number_format((double) $total_order, 0, '.', '') . '~' . $currency_iso_code . '~' . $statePol)) {
                     // CUANDO SE ENVIAN # ENTEROS EN EL PAGO A PAYU, ESTE RETORNA 1 DECIMAL, CUANDO SE ENVIAN DECIMALES, PAYU RETORNA 2 DECIMALES. SE VALIDA TAMBIEN SIN DECIMALES EVG GPB
                     if ($statePol == 7) {
                         if ($order->getCurrentState() != (int) Configuration::get('PAYU_WAITING_PAYMENT')) {
                             $order->setCurrentState((int) Configuration::get('PAYU_WAITING_PAYMENT'));
                         }
                     } else {
                         if ($statePol == 4) {
                             if ($order->getCurrentState() != (int) Configuration::get('PS_OS_PAYMENT')) {
                                 $order->setCurrentState((int) Configuration::get('PS_OS_PAYMENT'));
                             }
                         } else {
                             if ($order->getCurrentState() != (int) Configuration::get('PS_OS_ERROR')) {
                                 $order->setCurrentState((int) Configuration::get('PS_OS_ERROR'));
                             }
                             Logger::AddLog('[PayU] (payulatam) The shopping card ' . (int) $idCart . ' has been rejected by PayU state pol=' . (int) $statePol, 2, null, null, null, true);
                         }
                     }
                 } else {
                     Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' has an incorrect token given from payU during payment validation.' . $keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '~' . number_format((double) $total_order, 2, '.', '') . '~' . $currency->iso_code . '~' . $statePol . "--" . number_format((double) $total_order, 1, '.', '') . "--" . $token, 2, null, null, null, true);
                 }
             }
             if (_PS_VERSION_ >= 1.5) {
                 $payment = $order->getOrderPaymentCollection();
                 if (isset($payment[0])) {
                     $payment[0]->transaction_id = pSQL("payU_" . md5(Configuration::get('PS_SHOP_NAME')) . "_" . $idCart);
                     $payment[0]->save();
                 }
             }
         }
     } else {
         Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' was not found during the payment validation step', 2, null, null, null, true);
     }
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:85,代码来源:payulatam.php

示例8: initOrderingContent

 public function initOrderingContent()
 {
     // list order id by created providers
     $supply_order_created = array();
     $this->show_toolbar = true;
     $this->display = 'ordering';
     if ($this->is_1_6) {
         $this->initPageHeaderToolbar();
     }
     $this->initToolbar();
     $datas = $this->getDataGeneration();
     if (!empty($datas['data_return'])) {
         //get default currencie
         $id_default_currency = Configuration::get('PS_CURRENCY_DEFAULT');
         // get default id lang
         $id_default_lang = Configuration::get('PS_LANG_DEFAULT');
         foreach ($datas['data_return'] as $id_supplier => $products_info) {
             // Get provider datas
             $supplier = new Supplier((int) $id_supplier);
             // get warehouse datas, delivery date and tax for the provider order
             $id_warehouse_data = Tools::getValue('id_warehouse');
             $date_delivery_expected_data = Tools::getValue('date_delivery_expected');
             $tax_rate_data = Tools::getValue('tax_rate');
             $tax_rate_data = $tax_rate_data[$id_supplier];
             // id warehouse
             $id_warehouse = $id_warehouse_data[$id_supplier];
             // delivery date
             $date_delivery_expected = $date_delivery_expected_data[$id_supplier];
             // create the provider order
             $supply_order = new SupplyOrder();
             $supply_order->reference = ErpSupplyOrderClasses::getNextSupplyOrderReference();
             $supply_order->id_supplier = $id_supplier;
             $supply_order->supplier_name = $supplier->name;
             $supply_order->id_warehouse = $id_warehouse;
             $supply_order->id_currency = $id_default_currency;
             $supply_order->id_lang = $id_default_lang;
             $supply_order->id_supply_order_state = 1;
             $supply_order->id_ref_currency = (int) Currency::getDefaultCurrency()->id;
             $supply_order->date_delivery_expected = $date_delivery_expected;
             // if recording is ok, create the order lines
             if ($supply_order->add()) {
                 // get the provider id order
                 $id_supply_order = $this->getLastIdSupplyOrder();
                 $supply_order_created[] = $id_supply_order;
                 // Ajout de son historique
                 // add historical
                 $history = new SupplyOrderHistory();
                 $history->id_supply_order = $id_supply_order;
                 $history->id_state = 3;
                 $history->id_employee = (int) $this->context->employee->id;
                 $history->employee_firstname = pSQL($this->context->employee->firstname);
                 $history->employee_lastname = pSQL($this->context->employee->lastname);
                 $history->save();
                 // Create entries for provider order
                 if (!empty($products_info)) {
                     $i = 0;
                     foreach ($products_info as $item) {
                         if (!isset($item['product_id'])) {
                             continue;
                         }
                         $supply_order_detail = new SupplyOrderDetail();
                         $supply_order_detail->id_supply_order = $id_supply_order;
                         $supply_order_detail->id_currency = (int) Currency::getDefaultCurrency()->id;
                         $supply_order_detail->id_product = $item['product_id'];
                         $supply_order_detail->id_product_attribute = $item['product_attribute_id'];
                         $supply_order_detail->reference = $item['product_reference'];
                         $supply_order_detail->supplier_reference = $item['product_supplier_reference'];
                         $supply_order_detail->name = $item['product_name'];
                         $supply_order_detail->ean13 = $item['product_ean13'];
                         $supply_order_detail->upc = $item['product_upc'];
                         $supply_order_detail->quantity_expected = $item['total_product_quantity'];
                         $supply_order_detail->exchange_rate = 1;
                         $supply_order_detail->unit_price_te = $item['unit_price_tax_excl'];
                         $supply_order_detail->tax_rate = $tax_rate_data[$i];
                         $supply_order_detail->save();
                         // Get the supply order created
                         $id_supply_order_detail = $this->getLastIdSupplyOrderDetail();
                         // Record the relation between provider order and customer order
                         if (!empty($item)) {
                             foreach ($item['concerned_id_order_detail'] as $customer_link) {
                                 $supply_order_customer = new ErpSupplyOrderCustomer();
                                 $supply_order_customer->id_customer = $customer_link['id_customer'];
                                 $supply_order_customer->id_order_detail = $customer_link['id_order_detail'];
                                 $supply_order_customer->id_supply_order_detail = $id_supply_order_detail;
                                 $supply_order_customer->id_supply_order = $id_supply_order;
                                 $supply_order_customer->save();
                             }
                         }
                         $i++;
                     }
                     // Rerecording provider order data to update totals
                     $supply_order->save();
                 }
             }
         }
         // update provider order status
         if (!empty($datas['order_to_change_state'])) {
             foreach ($datas['order_to_change_state'] as $id_order) {
                 $order_change_state = new Order((int) $id_order);
                 $order_change_state->setCurrentState($this->generate_order_state_to, (int) $this->context->employee->id);
//.........这里部分代码省略.........
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:101,代码来源:AdminGenerateSupplyOrdersController.php

示例9: paymentConfirmation

 /**
  * Setup the smarty variables for the confirmation form. Also if the form
  * is submitted do the desired actions (close token, order etc.)
  *
  * @return array (if not redirected)
  */
 public function paymentConfirmation($token)
 {
     $this->_checkBeforeSend();
     $tokenRow = $this->_canUseToken((int) $token);
     if (empty($token) || !$tokenRow) {
         $this->_redirectToCardForm();
     }
     // check to see if some details on cart have changed in the meanwhile
     if ($amountOfCartHasChanged = $this->_tokenDetailsHaveChanged($tokenRow)) {
         $updateAmountOnCart = $this->_updateDetailsOfToken($token);
         if ($updateAmountOnCart) {
             Tools::redirect(Context::getContext()->link->getModuleLink($this->name, 'confirm', array('token' => $token, 'msg' => 410), true));
         } else {
             $this->_redirectToCardForm();
         }
     }
     $cart = Context::getContext()->cart;
     $customer = new Customer($cart->id_customer);
     $currency = new Currency($cart->id_currency);
     $params = array('amountInteger' => (int) Tools::ps_round($cart->getOrderTotal() * 100), 'amount' => (double) $cart->getOrderTotal(), 'form_action' => Context::getContext()->link->getModuleLink($this->name, 'confirm', array('token' => $token), true), 'cart' => $cart, 'customer' => $customer, 'tokenRow' => $tokenRow);
     if (1 || Tools::isSubmit('submitConfirm')) {
         //Set the API key
         try {
             Everypay\Everypay::setApiKey($this->sk);
         } catch (Exception $e) {
             $params['message'] = $e->getMessage();
             $params['status'] = self::ERRORNEOUS;
             $this->_closeToken($params);
             Tools::redirect(Context::getContext()->link->getPageLink('order', true, NULL, "step=3"));
         }
         $evPayParams = array('token' => $tokenRow['crd_token'], 'currency' => strtoupper($currency->iso_code));
         if (!empty($tokenRow['save_customer']) && $this->configuration['EVERYPAY_CUSTOMER_MODE'] && !empty($tokenRow['crd_token'])) {
             $evPayParams = array_merge($evPayParams, array('create_customer' => 1));
             $evCusUpdateParams = array('full_name' => $customer->firstname . ' ' . $customer->lastname, 'description' => Context::getContext()->shop->name . ' - ' . $this->l('Customer') . '#' . $customer->id, 'email' => $customer->email);
         } elseif (!empty($tokenRow['save_customer']) && !$this->configuration['EVERYPAY_CUSTOMER_MODE'] && !empty($tokenRow['crd_token'])) {
             $params['message'] = $this->l('The save card option got disabled during a payment proccess');
             $params['status'] = self::ERRORNEOUS;
             $this->_closeToken($params);
             $this->_redirectToCardForm();
         } elseif (!is_null($tokenRow['id_customer_token']) && !empty($tokenRow['cus_token']) && $this->configuration['EVERYPAY_CUSTOMER_MODE']) {
             $evPayParams['token'] = $tokenRow['cus_token'];
         } elseif (!is_null($tokenRow['id_customer_token']) && !empty($tokenRow['cus_token']) && !$this->configuration['EVERYPAY_CUSTOMER_MODE']) {
             $params['message'] = $this->l('The save card option got disabled during a payment proccess');
             $params['status'] = self::ERRORNEOUS;
             $this->_closeToken($params);
             $this->_redirectToCardForm();
         }
         try {
             $evPayParams = array_merge($evPayParams, array('payee_email' => $customer->email, 'amount' => $params['amountInteger'], 'description' => Context::getContext()->shop->name . ' - ' . $this->l('Cart') . ' #' . $cart->id . ' - ' . Tools::displayPrice($cart->getOrderTotal()), 'capture' => 0));
             $evPayment = Everypay\Payment::create($evPayParams);
             //now update the customer if necessary
             if (isset($evCusUpdateParams) && isset($evPayment->customer->token)) {
                 try {
                     $evCustomer = Everypay\Customer::update($evPayment->customer->token, $evCusUpdateParams);
                     $evPayParams['token'] = $evCustomer->token;
                 } catch (Exception $e) {
                     //we didnt manage to update the customer details
                     // no big deal
                 }
             }
             //error with the payment
             if (isset($evPayment->error)) {
                 $params['message'] = $evPayment->error->message;
                 $params['status'] = self::ERRORNEOUS;
                 $this->_closeToken($params);
                 $this->_redirectToCardForm(415);
                 exit;
             }
         } catch (Exception $e) {
             $params['message'] = $e->getMessage();
             $params['status'] = self::ERRORNEOUS;
             $this->_closeToken($params);
             $this->_redirectToCardForm(415);
             exit;
         }
         $mailVars = array();
         $validateOrder = $this->validateOrder($cart->id, self::ORDER_STATUS_CAPTURE_PENDING, $params['amount'], $this->displayName, NULL, $mailVars, $params['cart']->id_currency, false, $params['customer']->secure_key);
         if ($validateOrder) {
             $params['id_order'] = $this->currentOrder;
             $params['status'] = self::SUCCESS;
             $params['pmt_token'] = $evPayment->token;
             $params['message'] = 'Success on ' . date('d/m/Y H:i:s');
             if (!is_null($tokenRow['save_customer']) && $this->configuration['EVERYPAY_CUSTOMER_MODE']) {
                 $id_customer_token = $this->_insertCardCustomer($evPayment->customer);
                 if ($id_customer_token) {
                     $params['id_customer_token'] = $id_customer_token;
                 }
             }
             $_closeToken = $this->_closeToken($params);
             $order = new Order((int) $this->currentOrder);
             //capture or die
             try {
                 $evCapture = Everypay\Payment::capture($evPayment->token);
                 $order->setCurrentState(Configuration::get('PS_OS_PAYMENT'));
//.........这里部分代码省略.........
开发者ID:everypay,项目名称:everypay_prestashop_1_6_x,代码行数:101,代码来源:everypaypayments.php

示例10: processOrderStateChange

 protected function processOrderStateChange($new_order_state, array $payload, \Payin7\Models\OrderModel $order, &$message, &$code)
 {
     $ret = true;
     $message = null;
     $code = null;
     switch ($new_order_state) {
         case 'cancel':
             /** @var OrderCore $orderm */
             /** @noinspection PhpUndefinedClassInspection */
             $orderm = new Order($order->getOrderId());
             if (ValidateCore::isLoadedObject($orderm)) {
                 $state = $orderm->current_state;
                 if ($state == $this->module->getConfigIdOrderStatePending()) {
                     // temporarily disable updating history back to Payin7
                     $this->module->setHistoryUpdateEnabled(false);
                     $orderm->setCurrentState($this->module->getConfigIdOrderStateCancelled());
                     // reenable history
                     $this->module->setHistoryUpdateEnabled(true);
                     $message = 'Local order state set to (1): ' . $this->module->getConfigIdOrderStateCancelled();
                 }
             } else {
                 $message = 'Local order could not be loaded (2)';
                 $ret = false;
             }
             break;
         case 'active':
             $is_verified = isset($payload['is_verified']) ? (bool) $payload['is_verified'] : false;
             $is_paid = isset($payload['is_paid']) ? (bool) $payload['is_paid'] : false;
             // update the order state
             if (!$order->getPayin7OrderAccepted()) {
                 $order->setPayin7OrderAccepted(true);
                 $order->savePayin7Data();
             }
             if ($is_verified && $is_paid) {
                 /** @var OrderCore $orderm */
                 /** @noinspection PhpUndefinedClassInspection */
                 $orderm = new Order($order->getOrderId());
                 $state = $orderm->current_state;
                 if ($state == $this->module->getConfigIdOrderStatePending()) {
                     // temporarily disable updating history back to Payin7
                     $this->module->setHistoryUpdateEnabled(false);
                     $orderm->setCurrentState($this->module->getConfigIdOrderStateAccepted());
                     // reenable history
                     $this->module->setHistoryUpdateEnabled(true);
                     $message = 'Local order state set to (2): ' . $this->module->getConfigIdOrderStateAccepted();
                 }
             } else {
                 $message = 'Order not verified / paid';
                 $ret = false;
             }
             break;
     }
     return $ret;
 }
开发者ID:payin7-payments,项目名称:payin7-prestashop,代码行数:54,代码来源:notify.php

示例11: hookAdminOrder

 public function hookAdminOrder($params)
 {
     $order = new Order((int) $params['id_order']);
     $msg = null;
     if ($this->name != $order->module) {
         return;
     }
     $cart = new Cart($order->id_cart);
     $currency = new Currency($order->id_currency);
     if (Tools::isSubmit('submitMasterPaymentRefund')) {
         $amount = (double) Tools::getValue('amount', 0);
         if ($amount > 0 && $amount <= $order->total_paid) {
             require_once dirname(__FILE__) . '/lib/api.php';
             $api = new MasterPaymentApi();
             $api->merchantName = Configuration::get('MP_MERCHANT_NAME');
             $api->secretKey = Configuration::get('MP_SECRET_KEY');
             $api->basketValue = $amount * 100;
             $api->txId = self::encodeTxID($cart);
             $comment = Tools::getValue('comment', '');
             $status = $api->refundRequest($comment);
             if ($status == MasterPaymentApi::STATUS_REFUNDED) {
                 // Update order state
                 $order->setCurrentState(Configuration::get('PS_OS_REFUND'), $this->context->employee->id);
                 // Add refund amount message
                 $msg = new Message();
                 $msg->message = $comment . ' - ' . $this->l('Refund amount') . ': ' . Tools::displayPrice($amount, $currency);
                 $msg->id_order = $order->id;
                 $msg->id_customer = $cart->id_customer;
                 $msg->private = true;
                 $msg->add();
                 // Redirect to order
                 Tools::redirectAdmin('#');
             } else {
                 $msg = '<p class="error">' . $comment . '</p>';
             }
         } else {
             $msg = '<p class="error">' . $this->l('Ivalid amount') . '</p>';
         }
     }
     $this->tplAssign('msg', $msg);
     $this->tplAssign('order', $order);
     $this->tplAssign('amount', Tools::ps_round($order->total_paid, 2));
     $this->tplAssign('currency', $currency);
     $this->_html .= $this->tplDisplay('adminOrder');
     return $this->_html;
 }
开发者ID:pedalracer,项目名称:free_modules_1.5,代码行数:46,代码来源:masterpayment.php

示例12: updateOrder

 /**
  * @param ShopgateOrder $order
  *
  * @return array
  * @throws ShopgateLibraryException
  */
 public function updateOrder(ShopgateOrder $order)
 {
     $paymentModel = new ShopgatePayment($this->getModule());
     $shopgateOrderItem = ShopgateOrderPrestashop::loadByOrderNumber($order->getOrderNumber());
     if (!Validate::isLoadedObject($shopgateOrderItem)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_ORDER_NOT_FOUND, 'Order not found #' . $order->getOrderNumber(), true);
     }
     /** @var OrderCore $coreOrder */
     $coreOrder = new Order($shopgateOrderItem->id_order);
     /**
      * get order states
      */
     $changedStates = $paymentModel->getOrderStateId($order, false);
     /**
      * apply changed states
      */
     foreach ($changedStates as $changedState) {
         $coreOrder->setCurrentState($changedState);
     }
     $shopgateOrderItem->updateFromOrder($order);
     $shopgateOrderItem->save();
     return array('external_order_id' => $shopgateOrderItem->id_order, 'external_order_number' => $shopgateOrderItem->id_order);
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:29,代码来源:Json.php

示例13: updatePendyngOrdesConfirmation

 public function updatePendyngOrdesConfirmation()
 {
     $orders_pendyng = $this->getPendyngOrdesConfirmation();
     foreach ($orders_pendyng as $key) {
         $order = new Order((int) $key['id_order']);
         $statePol = $this->getStatePolBymessagePol($key['message']);
         if ($statePol == 7) {
             if ($order->getCurrentState() != (int) Configuration::get('PAYU_OS_PENDING')) {
                 $order->setCurrentState((int) Configuration::get('PAYU_OS_PENDING'));
             }
         } else {
             if ($statePol == 4) {
                 if ($order->getCurrentState() != (int) Configuration::get('PS_OS_PAYMENT')) {
                     $order->setCurrentState((int) Configuration::get('PS_OS_PAYMENT'));
                 }
             } else {
                 if ($order->getCurrentState() != (int) Configuration::get('PS_OS_ERROR')) {
                     $order->setCurrentState((int) Configuration::get('PS_OS_ERROR'));
                 }
             }
         }
         if (_PS_VERSION_ >= 1.5) {
             $payment = $order->getOrderPaymentCollection();
             if (isset($payment[0])) {
                 $payment[0]->transaction_id = pSQL("payU_farmalisto_" . $key['id_cart']);
                 $payment[0]->save();
             }
         }
         echo '<br>Order: ' . $key['id_order'];
     }
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:31,代码来源:SondaPayu.php

示例14: changeOrderStateByInvipayPaymentId

 public function changeOrderStateByInvipayPaymentId($paymentData)
 {
     $inviPayPaymentId = $paymentData->getPaymentId();
     $inviPayStatus = $paymentData->getStatus();
     $request = new InvipayPaymentRequest(InvipayPaymentRequest::getIdByPaymentId($inviPayPaymentId));
     $request->payment_status = $inviPayStatus;
     $request->save();
     $config = $this->loadConfiguration();
     Context::getContext()->controller->module->displayName = $config['PAYMENT_METHOD_TITLE'];
     $order = new Order($request->id_order);
     $order->setCurrentState(Configuration::get(constant('InvipaypaygateHelper::ORDER_STATUS_PAYMENT_' . $inviPayStatus)));
     $order->save();
 }
开发者ID:invipay,项目名称:invipay-prestashop,代码行数:13,代码来源:Helper.php

示例15: ajaxProcessPayOrder

 public function ajaxProcessPayOrder()
 {
     $id_order = Tools::getValue('id_order');
     $order = new Order($id_order);
     $id_order_detail = Tools::getValue('id_order_detail');
     $order_detail = new AphOrderDetail($id_order_detail);
     $order_detail->id_order = $id_order;
     $order_detail->product_quantity = 0;
     $res = $order_detail->update();
     $order_payment = new OrderPayment();
     $order_payment->order_reference = $order->reference;
     $order_payment->id_currency = (int) Context::getContext()->currency->id;
     $order_payment->amount = $products_total_price;
     $order_payment->payment_method = $order->payment;
     $order_payment->conversion_rate = $order->conversion_rate;
     $order_payment->add();
     $order_details = AphOrderDetail::getList($id_order);
     if ($res && !empty($order_details) && is_array($order_details)) {
         $empty_detail = 0;
         foreach ($order_details as &$order_detail) {
             if ((int) $order_detail['product_quantity'] < 1) {
                 $empty_detail++;
             }
         }
         if ($empty_detail == sizeof($order_details)) {
             $order = new Order($id_order);
             $order->setCurrentState(Configuration::get('APH_RESERVATION_DELETED_STATUS'), (int) Context::getContext()->employee->id);
         }
     }
     die(Tools::jsonEncode(array('result' => $res)));
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:31,代码来源:AdminAphCalendarController.php


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