/** * Create payment_processor type. * * @param array $params * Associative array of property name/value pairs to insert in new payment_processor type. * * @return array */ function civicrm_api3_payment_processor_type_create($params) { if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) { return civicrm_api3_create_error('Invalid value for payment_processor type ID'); } $paymentProcessorType = CRM_Financial_BAO_PaymentProcessorType::create($params); $relType = array(); _civicrm_api3_object_to_array($paymentProcessorType, $relType[$paymentProcessorType->id]); return civicrm_api3_create_success($relType, $params, 'PaymentProcessorType', 'create', $paymentProcessorType); }
/** * Check method del() */ public function testDel() { $params = array('name' => 'Test_Del_Payment_Processor', 'title' => 'Test Del Payment Processor', 'billing_mode' => 1, 'is_active' => 1); $defaults = array(); $paymentProcessor = CRM_Financial_BAO_PaymentProcessorType::create($params); CRM_Financial_BAO_PaymentProcessorType::del($paymentProcessor->id); $params = array('id' => $paymentProcessor->id); $result = CRM_Financial_BAO_PaymentProcessorType::retrieve($params, $defaults); $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.'); }