/** * This saves the paypal settings from the plugin->paypal setting page * * @return json success value true/false */ public function updateJsonAction() { // get the parameters passed from the form submit // look at edit.js->RM.Pages.Functions.plugins_paypal_save for the params // passed here. $id = $this->_getParam('id'); $account = $this->_getParam('account'); $sandbox = $this->_getParam('sandbox'); $default = $this->_getParam('default'); // Create the paypal object, RM_PayPal extends RM_Model so we can use // methods that this inherits such as find, save to update the DB. $paypalObj = new RM_PayPal(); // find the current record from the DB $details = $paypalObj->find($id)->current(); $status = 'true'; // set this true the if we have a problem we set it false // if our current record has not been found return false and don't carry // on with the update if (!$details) { $status = 'false'; } else { $details->account = $account; $details->sandbox = $sandbox; $details->defaultplugin = $default; $result = $details->save(); if ($result != '1') { $status = 'false'; } } // return a state to the GUI so that the saving message is removed etc. // look edit.js->RM.Pages.Functions.plugins_paypal_save for the success, // failure handling return array('data' => array('success' => $status)); }
/** * get the paypal config * * @return array */ private function _getConfig() { $paypalObj = new RM_PayPal(); $value = $paypalObj->getSettings()->toArray(); return $value[0]; }