From: Eileen McNaughton Date: Wed, 29 Jul 2015 09:23:38 +0000 (+1200) Subject: CRM-16914 add payment_instrument_id field to payment processor type, payment processor X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a1936a298e4913ac5aef7524a25074dd63139814;p=civicrm-core.git CRM-16914 add payment_instrument_id field to payment processor type, payment processor --- diff --git a/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl index e9eb3e1fae..238daaf4f2 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl @@ -25,3 +25,13 @@ UPDATE civicrm_option_value SET {localize field="label"}label = 'Activity Summar {include file='../CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl'} UPDATE civicrm_state_province SET name = 'Bataan' WHERE name = 'Batasn'; + +--CRM-16914 +ALTER TABLE civicrm_payment_processor +ADD COLUMN +`payment_instrument_id` int unsigned DEFAULT 1 COMMENT 'Payment Instrument ID'; + +ALTER TABLE civicrm_payment_processor_type +ADD COLUMN +`payment_instrument_id` int unsigned DEFAULT 1 COMMENT 'Payment Instrument ID'; + diff --git a/api/v3/PaymentProcessor.php b/api/v3/PaymentProcessor.php index 177b882b11..54ff1db80e 100644 --- a/api/v3/PaymentProcessor.php +++ b/api/v3/PaymentProcessor.php @@ -39,6 +39,12 @@ * @return 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); } diff --git a/api/v3/PaymentProcessorType.php b/api/v3/PaymentProcessorType.php index 2836db242b..8ad42cc0ef 100644 --- a/api/v3/PaymentProcessorType.php +++ b/api/v3/PaymentProcessorType.php @@ -69,6 +69,7 @@ function _civicrm_api3_payment_processor_type_create_spec(&$params) { // FIXME bool support // $params['is_recur']['api.required'] = 1; $params['name']['api.required'] = 1; $params['title']['api.required'] = 1; + $params['payment_instrument_id']['api.default'] = 'Credit Card'; } /** diff --git a/xml/schema/Financial/PaymentProcessor.xml b/xml/schema/Financial/PaymentProcessor.xml index 1659af0e64..e93e0a7755 100644 --- a/xml/schema/Financial/PaymentProcessor.xml +++ b/xml/schema/Financial/PaymentProcessor.xml @@ -174,7 +174,7 @@ Processor Billing Mode int unsigned true - Billing Mode + Billing Mode (deprecated) 1.8 @@ -189,7 +189,18 @@ Payment Type int unsigned 1 - Payment Type: Credit or Debit + Payment Type: Credit or Debit (deprecated) 3.0 + + payment_instrument_id + Payment Instrument + int unsigned + 1 + Payment Instrument ID + + payment_instrument + + 4.7 + diff --git a/xml/schema/Financial/PaymentProcessorType.xml b/xml/schema/Financial/PaymentProcessorType.xml index bb775170a1..e5cd323f10 100644 --- a/xml/schema/Financial/PaymentProcessorType.xml +++ b/xml/schema/Financial/PaymentProcessorType.xml @@ -156,7 +156,7 @@ billing_mode int unsigned true - Billing Mode + Billing Mode (deprecated) CRM_Core_SelectValues::billingMode @@ -177,7 +177,18 @@ Processor Type Payment Type int unsigned 1 - Payment Type: Credit or Debit + Payment Type: Credit or Debit (deprecated) 3.0 + + payment_instrument_id + Payment Instrument + int unsigned + 1 + Payment Instrument ID + + payment_instrument + + 4.7 +