Avoid CiviCRM running full drupal cache flush, as this results in CiviCRM clobbering...
[civicrm-core.git] / api / v3 / PaymentProcessor.php
index 2aa529cfa5637dd2b95ac6dc1e247320e5e1577f..e7718589d95218664ffe61ceeb18ab084c39f6e3 100644 (file)
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_payment_processor_create($params) {
+  if (empty($params['id']) && empty($params['payment_instrument_id'])) {
+    $params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', array(
+      'id' => $params['payment_processor_type_id'],
+      'return' => 'payment_instrument_id',
+    ));
+  }
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
@@ -62,7 +69,7 @@ function _civicrm_api3_payment_processor_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   API result Array
+ *   API result array
  */
 function civicrm_api3_payment_processor_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -75,8 +82,31 @@ function civicrm_api3_payment_processor_delete($params) {
  *   Array of name/value pairs.
  *
  * @return array
- *   details of found PaymentProcessor
+ *   API result array
  */
 function civicrm_api3_payment_processor_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
+
+
+/**
+ * Set default getlist parameters.
+ *
+ * @see _civicrm_api3_generic_getlist_defaults
+ *
+ * @param array $request
+ *
+ * @return array
+ */
+function _civicrm_api3_payment_processor_getlist_defaults(&$request) {
+  return array(
+    'description_field' => array(
+      'payment_processor_type_id',
+      'description',
+    ),
+    'params' => array(
+      'is_test' => 0,
+      'is_active' => 1,
+    ),
+  );
+}