本文整理汇总了PHP中OrderHistory类的典型用法代码示例。如果您正苦于以下问题:PHP OrderHistory类的具体用法?PHP OrderHistory怎么用?PHP OrderHistory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrderHistory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
}
}
示例2: 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!");
}
}
示例3: canceledOrderForError
private function canceledOrderForError()
{
$history = new OrderHistory();
$history->id_order = (int) $this->pagSeguro->currentOrder;
$history->changeIdOrderState(6, (int) $this->pagSeguro->currentOrder);
$history->save();
}
示例4: 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;
}
示例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: 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);
}
}
示例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: canceledOrderForErro
function canceledOrderForErro($pag_seguro)
{
$currentOrder = (int) $pag_seguro->currentOrder;
$history = new OrderHistory();
$history->id_order = $currentOrder;
$history->changeIdOrderState(6, $currentOrder);
$history->save();
}
示例9: 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;
}
示例10: 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);
}
示例11: 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);
}
}
示例12: 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);
}
示例13: 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);
}
示例14: postProcess
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
// Log requests from Privat API side in Debug mode.
if (Configuration::get('PRIVAT24_DEBUG_MODE')) {
$logger = new FileLogger();
$logger->setFilename(_PS_ROOT_DIR_ . '/log/' . $this->module->name . '_' . date('Ymd_His') . '_response.log');
$logger->logError($_POST);
}
$payment = array();
parse_str(Tools::getValue('payment'), $payment);
$hash = sha1(md5(Tools::getValue('payment') . $this->module->merchant_password));
if ($payment && $hash === Tools::getValue('signature')) {
if ($payment['state'] == 'ok') {
$state = Configuration::get('PRIVAT24_WAITINGPAYMENT_OS');
$cart_id = (int) $payment['order'];
$order = new Order(Order::getOrderByCartId($cart_id));
if (!Validate::isLoadedObject($order)) {
PrestaShopLogger::addLog('Privat24: cannot get order by cart id ' . $cart_id, 3);
die;
}
if ($order->getCurrentState() != $state) {
PrestaShopLogger::addLog(sprintf('Privat24: order id %s current state %s !== expected state %s', $order->id, $order->getCurrentState(), $state), 3);
die;
}
// Check paid currency and paid amount.
$id_currency = Currency::getIdByIsoCode($payment['ccy']);
if (!$id_currency) {
PrestaShopLogger::addLog(sprintf('Privat24: order id %s cannot get currency id by iso code: %s', $order->id, $payment['ccy']), 3);
die;
}
if ($order->id_currency != $id_currency) {
PrestaShopLogger::addLog(sprintf('Privat 24: order id %s, order currency id %s does not match with %s', $order->id, $order->id_currency, $id_currency), 3);
die;
}
if ((double) $order->total_paid != (double) $payment['amt']) {
PrestaShopLogger::addLog(sprintf('Privat 24: order id %s order total paid %s does not match %s', $order->id, $order->total_paid, $payment['amt']), 3);
die;
}
$order_history = new OrderHistory();
$order_history->id_order = $order->id;
$order_history->changeIdOrderState(_PS_OS_PAYMENT_, $order->id);
$order_history->addWithemail();
$this->setPaymentTransaction($order, $payment);
$this->module->paymentNotify($order, $payment);
PrestaShopLogger::addLog(sprintf('Privat24 payment accepted: order id: %s, amount: %s, ref: %s', $order->id, $payment['amt'], $payment['ref']), 1);
} else {
PrestaShopLogger::addLog(sprintf('Privat24 payment failed: state: %s, order: %s, ref: %s', $payment['state'], $payment['order'], $payment['ref']), 3, null, null, null, true);
}
} else {
PrestaShopLogger::addLog('Privat24: Payment callback bad signature.', 3, null, null, null, true);
}
die;
}
示例15: 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);
}