本文整理汇总了PHP中OrderHistory::changeIdOrderState方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderHistory::changeIdOrderState方法的具体用法?PHP OrderHistory::changeIdOrderState怎么用?PHP OrderHistory::changeIdOrderState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderHistory
的用法示例。
在下文中一共展示了OrderHistory::changeIdOrderState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processPayment
public function processPayment($result, $orderId)
{
$gopay = new Gopay();
$gpErrors = "";
$history = new OrderHistory();
$history->id_order = $orderId;
if ($result["code"] == GopayHelper::WAITING) {
$gpErrors = $result["description"];
} else {
if ($result["code"] == GopayHelper::PAYMENT_DONE) {
if ($history->getLastOrderState($orderId)->id == intval(_PS_OS_GOPAY_)) {
$history->changeIdOrderState(intval(_PS_OS_PAYMENT_), intval($orderId));
$history->addWithemail();
}
} else {
if ($result["code"] == GopayHelper::CANCELED || $result["code"] == GopayHelper::TIMEOUTED) {
if ($history->getLastOrderState($orderId)->id == intval(_PS_OS_GOPAY_)) {
$history->changeIdOrderState(intval(_PS_OS_CANCELED_), $orderId);
$history->addWithemail();
}
$gpErrors = $result["description"];
}
}
}
return $gpErrors;
}
示例2: updateStatus
public function updateStatus(&$resp)
{
$this->log_on = Configuration::get('YA_P2P_LOGGING_ON');
if ($resp->status == 'success') {
$cart = $this->context->cart;
if ($cart->id > 0) {
if ($cart->orderExists()) {
$ord = new Order((int) Order::getOrderByCartId($cart->id));
$id_order = $ord->id;
} else {
$ord = $this->module->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), $cart->getOrderTotal(true, Cart::BOTH), $this->module->displayName . " Банковская карта", null, array(), null, false, $cart->secure_key);
$id_order = $this->module->currentOrder;
}
if ($ord) {
$history = new OrderHistory();
$history->id_order = $id_order;
$history->changeIdOrderState(Configuration::get('PS_OS_PAYMENT'), $id_order);
$history->addWithemail(true);
}
}
if ($this->log_on) {
$this->module->logSave('payment_card: #' . $this->module->currentOrder . ' ' . $this->module->l('Order success'));
}
Tools::redirect($this->context->link->getPageLink('order-confirmation') . '&id_cart=' . $this->context->cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $this->context->cart->secure_key);
}
}
示例3: TransactionNotification
function TransactionNotification($notificationCode)
{
ob_clean();
global $cookie;
$credentials = new PagSeguroAccountCredentials(Configuration::get("PAGSEGURO_BUSINESS"), Configuration::get("PAGSEGURO_TOKEN"));
try {
$transaction = PagSeguroNotificationService::checkTransaction($credentials, $notificationCode);
$id_transaction = $transaction->getCode();
$id_status = $transaction->getStatus()->getValue();
$order_state = Configuration::get("PAGSEGURO_STATUS_{$id_status}");
$orderState = new OrderState($order_state);
$status = $orderState->name[$cookie->id_lang];
$id_order = Db::getInstance()->getValue("SELECT id_order FROM " . _DB_PREFIX_ . "pagseguro_order WHERE id_transaction = '{$id_transaction}'");
$order = new Order(intval($id_order));
/** ENVIO DO EMAIL * */
$pagseguro = new pagseguro();
$idCustomer = $order->id_customer;
$idLang = $order->id_lang;
$customer = new Customer(intval($idCustomer));
$mailVars = array('{email}' => Configuration::get('PS_SHOP_EMAIL'), '{firstname}' => stripslashes($customer->firstname), '{lastname}' => stripslashes($customer->lastname), '{terceiro}' => stripslashes($pagseguro->displayName), '{id_order}' => stripslashes($pagseguro->currentOrder), '{status}' => stripslashes($status));
$pagseguro->enviar($mailVars, 'pagseguro', $status, $pagseguro->displayName, $idCustomer, $idLang, $customer->email, 'modules/pagseguro/mails/');
/** /ENVIO DO EMAIL * */
$extraVars = array();
$history = new OrderHistory();
$history->id_order = intval($id_order);
$history->changeIdOrderState(intval($order_state), intval($id_order));
$history->addWithemail(true, $extraVars);
die("Sucesso!");
} catch (PagSeguroServiceException $e) {
file_put_contents(dirname(__FILE__) . "/error.log", var_export($e, true));
die("Error!");
}
}
示例4: canceledOrderForError
private function canceledOrderForError()
{
$history = new OrderHistory();
$history->id_order = (int) $this->pagSeguro->currentOrder;
$history->changeIdOrderState(6, (int) $this->pagSeguro->currentOrder);
$history->save();
}
示例5: postProcess
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
$oplata = new Oplata();
if ($_POST['order_status'] == OplataCls::ORDER_DECLINED) {
$this->errors[] = Tools::displayError('Order declined');
}
$settings = array('merchant_id' => $oplata->getOption('merchant'), 'secret_key' => $oplata->getOption('secret_key'));
$isPaymentValid = OplataCls::isPaymentValid($settings, $_POST);
if ($isPaymentValid !== true) {
$this->errors[] = Tools::displayError($isPaymentValid);
}
$cart = $this->context->cart;
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
Tools::redirect('index.php?controller=order&step=1');
}
$customer = new Customer($cart->id_customer);
if (!Validate::isLoadedObject($customer)) {
Tools::redirect('index.php?controller=order&step=1');
}
if (empty($this->errors)) {
list($orderId, ) = explode(OplataCls::ORDER_SEPARATOR, $_POST['order_id']);
$history = new OrderHistory();
$history->id_order = $orderId;
$history->changeIdOrderState((int) Configuration::get('PS_OS_PAYMENT'), $orderId);
$history->addWithemail(true, array('order_name' => $orderId));
Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
}
}
示例6: postProcess
public function postProcess()
{
parent::postProcess();
if (Tools::isSubmit('markAsReceived')) {
$idOrder = (int) Tools::getValue('id_order');
$order = new Order($idOrder);
if (Validate::isLoadedObject($order)) {
if ($order->getCurrentState() == 15) {
$new_history = new OrderHistory();
$new_history->id_order = (int) $order->id;
$new_history->changeIdOrderState(16, $order);
// 16: Ready for Production
//var_dump($order,$new_history);
$myfile = fopen(PS_PRODUCT_IMG_PATH . "/orders/" . $order->reference . ".txt", "w") or die("Unable to open file!");
$txt = "Order Confirmed\n Order Reference: " . $order->reference;
fwrite($myfile, $txt);
fclose($myfile);
$new_history->addWithemail(true);
}
$this->context->smarty->assign('receipt_confirmation', true);
} else {
$this->_errors[] = Tools::displayError('Error: Invalid order number');
}
}
}
示例7: postProcess
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (empty($_POST)) {
$fap = json_decode(file_get_contents("php://input"));
$_POST = array();
foreach ($fap as $key => $val) {
$_POST[$key] = $val;
}
}
try {
if ($_POST['order_status'] == FondyCls::ORDER_DECLINED) {
exit('Order declined');
}
$fondy = new Fondy();
$settings = array('merchant_id' => $fondy->getOption('merchant'), 'secret_key' => $fondy->getOption('secret_key'));
$isPaymentValid = FondyCls::isPaymentValid($settings, $_POST);
if ($isPaymentValid !== true) {
exit($isPaymentValid);
}
list($orderId, ) = explode(FondyCls::ORDER_SEPARATOR, $_POST['order_id']);
$history = new OrderHistory();
$history->id_order = $orderId;
$id_order_state = _PS_OS_PAYMENT_;
$history->changeIdOrderState(intval($id_order_state), intval($orderId));
$history->addWithemail(true, "");
exit('OK');
} catch (Exception $e) {
exit(get_class($e) . ': ' . $e->getMessage());
}
}
示例8: 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;
}
示例9: 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]');
}
示例10: canceledOrderForErro
function canceledOrderForErro($pag_seguro)
{
$currentOrder = (int) $pag_seguro->currentOrder;
$history = new OrderHistory();
$history->id_order = $currentOrder;
$history->changeIdOrderState(6, $currentOrder);
$history->save();
}
示例11: validateOrderPay
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;
}
示例12: 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);
}
示例13: 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);
}
示例14: changeOrderStatus
public static function changeOrderStatus($id_order, $id_new_state)
{
$new_history = new OrderHistory();
$new_history->id_order = (int) $id_order;
$new_history->changeIdOrderState((int) $id_new_state, $id_order, true);
if (!$new_history->addWithemail(true)) {
ShiptomyidLog::addLog('Error changing order_state to #' . $id_new_state, $id_order);
}
}
示例15: postProcess
public function postProcess()
{
parent::postProcess();
//ИД заказа
$ordernumber = Tools::getValue('InvId');
//Сумма заказа
$amount = Tools::getValue('OutSum');
$signature = md5($amount . ':' . $ordernumber . ':' . Configuration::get('robokassa_password2'));
//Проверка подписи
if (strtoupper($signature) != Tools::getValue('SignatureValue')) {
robokassa::validateAnsver($this->module->l('Invalid signature'));
}
if (Configuration::get('robokassa_postvalidate')) {
$cart = new Cart((int) $ordernumber);
//Проверка существования заказа
if (!Validate::isLoadedObject($cart)) {
robokassa::validateAnsver($this->module->l('Cart does not exist'));
}
$total_to_pay = $cart->getOrderTotal(true, Cart::BOTH);
$currency_rub = new Currency(Currency::getIdByIsoCode('RUB'));
if ($cart->id_currency != $currency_rub->id) {
$currency = new Currency($cart->id_currency);
$total_to_pay = $total_to_pay / $currency->conversion_rate * $currency_rub->conversion_rate;
}
$total_to_pay = number_format($total_to_pay, 2, '.', '');
//Проверка суммы заказа
if ($amount != $total_to_pay) {
robokassa::validateAnsver($this->module->l('Incorrect payment summ'));
}
$this->module->validateOrder((int) $cart->id, Configuration::get('PS_OS_PAYMENT'), $cart->getOrderTotal(true, Cart::BOTH), $this->module->displayName, NULL, array(), NULL, false, $cart->secure_key);
} else {
$order = new Order((int) $ordernumber);
//Проверка существования заказа
if (!Validate::isLoadedObject($order)) {
robokassa::validateAnsver($this->module->l('Order does not exist'));
}
$total_to_pay = $order->total_paid;
$currency_rub = new Currency(Currency::getIdByIsoCode('RUB'));
if ($order->id_currency != $currency_rub->id) {
$currency = new Currency($order->id_currency);
$total_to_pay = $total_to_pay / $currency->conversion_rate * $currency_rub->conversion_rate;
}
$total_to_pay = number_format($total_to_pay, 2, '.', '');
//Проверка суммы заказа
if ($amount != $total_to_pay) {
robokassa::validateAnsver($this->module->l('Incorrect payment summ'));
}
//Меняем статус заказа
$history = new OrderHistory();
$history->id_order = $ordernumber;
$history->changeIdOrderState(Configuration::get('PS_OS_PAYMENT'), $ordernumber);
$history->addWithemail(true);
}
die('OK' . $ordernumber);
}