本文整理汇总了PHP中OrderHistory::addWithEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderHistory::addWithEmail方法的具体用法?PHP OrderHistory::addWithEmail怎么用?PHP OrderHistory::addWithEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderHistory
的用法示例。
在下文中一共展示了OrderHistory::addWithEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOrderAs
/**
* Set order as paid or canceled
*
* @param integer $state
* @param integer $order_id
* @param float $order_total
* @param string $barcode
*
* @return void
*/
private static function setOrderAs($state, $order_id, $order_total = null, $barcode = null)
{
$return = false;
try {
$order = new Order((int) $order_id);
if (!is_null($order_total) && !is_null($barcode)) {
$order->addOrderPayment($order_total, 'CashWay', $barcode);
$order->setInvoice(true);
}
$history = new OrderHistory();
$history->id_order = (int) $order->id;
$history->changeIdOrderState((int) $state, $order);
$history->addWithEmail(true);
$return = true;
} catch (Exception $e) {
\CashWay\Log::error($e->getMessage());
}
return $return;
}
示例2: dirname
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
if (!defined('_PS_VERSION_')) {
exit;
}
// To configure, add webhook in account storename.com/modules/conektaefectivo/notification.php
$body = Tools::file_get_contents('php://input');
$event_json = Tools::jsonDecode($body);
if ($event_json->type == 'charge.paid') {
$charge = $event_json->data->object;
$reference_id = (int) $charge->reference_id;
$id_order = Order::getOrderByCartId($reference_id);
$order = new Order($id_order);
$order_fields = $order->getFields();
$currency_payment = Currency::getPaymentCurrencies(Module::getModuleIdByName('conektaprestashop'), $order_fields['id_shop']);
$total_order_amount = (int) $order->getOrdersTotalPaid();
$str_total_order_amount = (string) $total_order_amount;
$format_total_order_amount = str_pad($str_total_order_amount, strlen($str_total_order_amount) + 2, '0', STR_PAD_RIGHT);
if ($currency_payment[0]['iso_code'] === $charge->currency) {
if ($format_total_order_amount == $charge->amount) {
$orderHistory = new OrderHistory();
$orderHistory->id_order = $order;
$orderHistory->changeIdOrderState(Configuration::get('PS_OS_PAYMENT'), $order);
$orderHistory->addWithEmail();
Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'conekta_transaction SET status = "paid" WHERE id_order = ' . pSQL($reference_id) . '');
}
}
}
header('HTTP/1.1 200 OK');
exit;