function listPaymentMethods() { global $toC_Json; $records = array(); foreach (osC_Payment_Admin::getInstalledModules() as $key => $value) { $records[] = array('id' => $key, 'text' => $value); } $response = array(EXT_JSON_READER_ROOT => $records); echo $toC_Json->encode($response); }
function updatePaymentMethod($payment_code, $pay_with_store_credit) { global $osC_Database; $payment_method = ''; foreach (osC_Payment_Admin::getInstalledModules() as $key => $value) { if ($key == $payment_code) { $payment_method = $value; } } $this->setUseStoreCredit($pay_with_store_credit); $this->setBillingMethod(array('id' => $payment_code, 'title' => $payment_method)); $this->updateOrderTotal(); $Qupdate = $osC_Database->query('update :table_orders set payment_method = :payment_method, payment_module = :payment_module where orders_id = :orders_id'); $Qupdate->bindTable(':table_orders', TABLE_ORDERS); $Qupdate->bindValue(':payment_method', implode(',', $this->getCartBillingMethods())); $Qupdate->bindValue(':payment_module', implode(',', $this->getCartBillingModules())); $Qupdate->bindInt(':orders_id', $this->_order_id); $Qupdate->setLogging($_SESSION['module'], $this->_order_id); $Qupdate->execute(); if (!$osC_Database->isError()) { return true; } return false; }