function processPayment() { $errors = \GC::checkOrder(); if (count($errors) > 0) { echo json_encode(['errors' => $errors]); return false; } else { $payment = ['order_id' => \GC::getAttribute('id'), 'amount' => \GC::getGrandTotal(), 'status' => 'processed', 'payment_module' => 'Cod', 'description' => lang('charge_on_delivery')]; \CI::Orders()->savePaymentInfo($payment); $orderId = \GC::submitOrder(); //send the order ID echo json_encode(['orderId' => $orderId]); return false; } }
public function submitOrder() { $errors = \GC::checkOrder(); if (\GC::getGrandTotal() > 0) { $errors['payment'] = lang('error_choose_payment'); } if (count($errors) > 0) { echo json_encode(['errors' => $errors]); return false; } else { $payment = ['order_id' => \GC::getAttribute('id'), 'amount' => \GC::getGrandTotal(), 'status' => 'processed', 'payment_module' => '', 'description' => lang('no_payment_needed')]; \CI::Orders()->savePaymentInfo($payment); $orderId = \GC::submitOrder(); //send the order ID echo json_encode(['orderId' => $orderId]); return false; } }