function create(&$params) { $processor = new CRM_Core_DAO_PaymentProcessor(); $processor->copyValues($params); $processor->save(); return $processor; }
function updatePaymentProcessor(&$values, $domainID, $test) { $dao = new CRM_Core_DAO_PaymentProcessor(); $dao->id = $test ? $this->_testID : $this->_id; $dao->domain_id = $domainID; $dao->is_test = $test; $dao->is_default = CRM_Utils_Array::value('is_default', $values, 0); $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0); $dao->name = $values['name']; $dao->description = $values['description']; $dao->payment_processor_type = $values['payment_processor_type']; foreach ($this->_fields as $field) { $fieldName = $test ? "test_{$field['name']}" : $field['name']; $dao->{$field['name']} = trim(CRM_Utils_Array::value($fieldName, $values)); if (empty($dao->{$field['name']})) { $dao->{$field['name']} = 'null'; } } // also copy meta fields from the info DAO $dao->is_recur = $this->_ppDAO->is_recur; $dao->billing_mode = $this->_ppDAO->billing_mode; $dao->class_name = $this->_ppDAO->class_name; $dao->payment_type = $this->_ppDAO->payment_type; $dao->save(); }