Esempio n. 1
0
 static function _setOrderStatusPaid($controller, $order, $key_pl)
 {
     $paidStatus = 'Processing';
     if (!is_null($controller->getKrcoConfigValue($key_pl, 'order_paid_status'))) {
         $paidStatus = $controller->getKrcoConfigValue($key_pl, 'order_paid_status');
     }
     $order->setOrderStatus($paidStatus);
     $ordersDb = $controller->getKrcoConfigValue($key_pl, 'db_orders');
     if (!$ordersDb) {
         throw new Exception('Unknown order type.');
     }
     $id = $order->getLongId();
     $controller->{$ordersDb}->updateOrder($order);
     $memberObj = $controller->getSingleObject('members', 'getMemberById', array($order->getMemberId()));
     if ($callback = $controller->getKrcoConfigValue('cart', 'callback_order_paid')) {
         $callback($controller, $order, $memberObj);
     }
     $controller->raiseSystemEvent('member_purchase', array('member' => $memberObj, 'order' => $order));
     if ($key_pl == 'subscribe') {
         Helper_Subscription::updateSubscriptionOfOrder($controller, $order);
     }
     $orderId = $order->getLongId();
     Helper_Krco::sendOrderEmailStatusChanged($controller, "Order {$orderId} Status Report: {$paidStatus}", 'email/order_processed', $order);
 }
Esempio n. 2
0
 static function subscriptionToArr($controller, $sub)
 {
     $end_timestamp = Helper_Subscription::getExpiryTimeOfSubscription($sub);
     $next_end_timestamp = Helper_Subscription::getExpiryTimeOfSubscription($sub, 1);
     $arr = array('first_name' => $sub->getFirstName(), 'last_name' => $sub->getLastName(), 'subscription_id' => $sub->getLongId(), 'product_name' => $sub->getProduct(), 'start_timestamp' => strtotime($sub->getStartDate()), 'end_timestamp' => $end_timestamp, 'next_end_timestamp' => $next_end_timestamp, 'expiry_status' => self::_getExpiryStatus($controller, $end_timestamp), 'hash' => Helper_Objects::generateSubscriptionValidator($controller, $sub), 'is_subscription_archived' => (bool) $sub->getIsSubscriptionArchived());
     return $arr;
 }