本文整理汇总了PHP中Orders::createAttachedOrders方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::createAttachedOrders方法的具体用法?PHP Orders::createAttachedOrders怎么用?PHP Orders::createAttachedOrders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orders
的用法示例。
在下文中一共展示了Orders::createAttachedOrders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fb
$orderModel->flags = '';
}
// if flags == NULL then save() will not work!
}
//$order->updated = date("Y-m-d H:i:s");
if (!$orderModel->save(true, null, false)) {
//this should never happen. just log the error, email the team and assume its all good for the customer
fb($orderModel->getErrors());
}
Event::setEvents($orderModel->order_id, 8, false);
//update recurring_next
$sql = "UPDATE `orders_products`\n JOIN `products` USING(`product_id`)\n SET `orders_products`.`recurring_next` = DATE_ADD(NOW(), INTERVAL `products`.`subscription_days` DAY)\n WHERE FIND_IN_SET('recurring', `orders_products`.`flags`)>0\n AND `orders_products`.`order_id`=?i";
$msql->query($sql, $orderModel->order_id);
if ($orderModel->billing_cycle == 0) {
$o = clone $orderModel;
Orders::createAttachedOrders($o);
}
// NEED TO UPDATE THE GATEWAY LIMITS AND STATUS. WOULD BE BENEFICIAL IS THIS WERE SOMEHOW AN ASYNCHRONOUS FUNCTION CALL
//if(!$this->order->isFlag('test')) {
//$pg = new ProfileGateways('ProfileGateway');
//$o = clone $this->order;
//$pg->processGatewayRoutingByOrder($o);
//unset($o);
//}
} else {
// DECLINED
$orderModel->status = 'error';
//delete the pay flag
$orderModel->removeFlags('pay');
if ($orderModel->billing_cycle > 0) {
$orderModel->addFlags('retry');
示例2: finalizeOrder
public static function finalizeOrder($orderID)
{
$modelOrder = Order::model()->findByPk((int) $orderID);
if (!$modelOrder) {
return false;
}
//Check status
$modelAttempt = new Attempt();
$modelAttempt->getLastOrderAttempt($modelOrder->order_id, Attempt::DEBIT_TYPE);
if (in_array($modelAttempt->status, array(Attempt::SUCCESS_STATUS, Attempt::DECLINED_STATUS))) {
return true;
}
$payment = new PaymentAPI();
$response = $payment->updateStatusAttempt($modelAttempt);
if ($response->attemptStatus == 'success') {
$modelOrder->status = Order::STATUS_OK;
$modelOrder->removeFlags(Order::FlAG_PAY);
$modelOrder->addFlags(Order::FlAG_PAID);
$modelOrder->payment_total = $modelAttempt->amount;
$modelOrder->save();
Event::setEvents($modelOrder->order_id, 8, false);
//update recurring_next
$sql = "UPDATE `orders_products`\n JOIN `products` USING(`product_id`)\n SET `orders_products`.`recurring_next` = DATE_ADD(NOW(), INTERVAL `products`.`subscription_days` DAY)\n WHERE FIND_IN_SET('recurring', `orders_products`.`flags`)>0\n AND `orders_products`.`order_id`=?i";
self::$_msql->query($sql, $modelOrder->order_id);
if ($modelOrder->billing_cycle == 0) {
// Delete order prospect
Prospects::deleteProspectOkOrder($modelOrder->order_id);
Orders::createAttachedOrders($modelOrder);
// Fire Pixel
$cloneOrder = clone $modelOrder;
Pixel::firePixelPb($cloneOrder);
unset($cloneOrder);
}
} elseif ($response->attemptStatus == 'declined') {
$modelOrder->status = Order::STATUS_ERROR;
$modelOrder->removeFlags(Order::FlAG_PAY);
$modelOrder->save();
// Delete order prospect
Prospects::deleteProspectOkOrder($modelOrder->order_id);
}
}