function updateOrder($order_id, $result, $data, $pg_plugin, $status, $items, $customer) { $table = $this->getTable('Order'); $table->load($order_id); //amount_paid $table->amount_paid = $table->amount_paid + $data['total_paid_amt']; //processor $table->processor = $data['processor']; $warning = ''; $type = 'process_order'; //status if ($table->amount_paid >= $table->amount) { $table->status = $status; $type = 'complete_order'; } else { if ($table->amount_paid > 0 && $table->amount_paid < $table->amount) { $warning = JText::_('COM_DIGICOM_PAYMENT_FROUD_CASE_PAYMENT_MANUPULATION'); $table->status = 'Pending'; } else { $table->status = $status; } } if ($type == 'complete_order') { DigiComSiteHelperLicense::updateLicenses($order_id, $table->number_of_products, $items, $customer, $type); } $comment = array(); $comment[] = $table->comment; $comment[] = isset($result['comment']) ? $result['comment'] : ''; $table->comment = implode("\n", $comment); $orderparams = json_decode($table->params); $orderparams->paymentinfo = array(); $orderparams->paymentinfo[] = $pg_plugin; $orderparams->paymentinfo[] = $result; $orderparams->paymentinfo[] = $data; $orderparams->warning = $warning; $table->params = json_encode($orderparams); $table->store(); //triggere email $config = JFactory::getConfig(); $tzoffset = $config->get('offset'); $now = date('Y-m-d H:i:s', time() + $tzoffset); $now = strtotime($now); $this->dispatchMail($order_id, $table->amount_paid, $table->number_of_products, $now, $items, $customer, $type, $status); return true; }
public function updateLicensesStatus($orderid, $type) { $order = $this->getOrder($orderid); $items = $order->products; $customer_id = $order->userid; $number_of_products = count($items); DigiComSiteHelperLicense::updateLicenses($orderid, $number_of_products, $items, $customer_id, $type); }