3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM payment processor types.
15 * @package CiviCRM_APIv3
19 * Create payment_processor type.
21 * @param array $params
22 * Associative array of property name/value pairs to insert in new payment_processor type.
26 function civicrm_api3_payment_processor_type_create($params) {
27 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'PaymentProcessorType');
31 * Adjust Metadata for Create action.
33 * The metadata is used for setting defaults, documentation & validation.
35 * @param array $params
36 * Array of parameters determined by getfields.
38 function _civicrm_api3_payment_processor_type_create_spec(&$params) {
39 $params['billing_mode']['api.required'] = 1;
40 $params['class_name']['api.required'] = 1;
41 $params['is_active']['api.default'] = 1;
42 $params['is_recur']['api.default'] = FALSE;
43 $params['name']['api.required'] = 1;
44 $params['title']['api.required'] = 1;
45 $params['payment_instrument_id']['api.default'] = 'Credit Card';
49 * Get all payment_processor types.
51 * @param array $params
55 function civicrm_api3_payment_processor_type_get($params) {
56 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
60 * Delete a payment_processor type delete.
62 * @param array $params
67 function civicrm_api3_payment_processor_type_delete($params) {
68 if ($params['id'] != NULL && !CRM_Utils_Rule
::integer($params['id'])) {
69 return civicrm_api3_create_error('Invalid value for payment processor type ID');
72 $payProcTypeBAO = new CRM_Financial_BAO_PaymentProcessorType();
73 $result = $payProcTypeBAO->del($params['id']);
75 return civicrm_api3_create_error('Could not delete payment processor type');
77 return civicrm_api3_create_success($result, $params, 'PaymentProcessorType', 'delete', $payProcTypeBAO);