From 2f859d0a1333eab29e8169862598c8c99f5eb2b9 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 5 Nov 2019 16:18:48 +1100 Subject: [PATCH] Schema changes for PaymentProcessor and PaymentProcessorType to support apiv4 entities --- CRM/Financial/DAO/PaymentProcessor.php | 6 +++++- CRM/Financial/DAO/PaymentProcessorType.php | 13 +++++++++---- .../CRM/Financial/BAO/PaymentProcessorTypeTest.php | 4 ++++ xml/schema/Financial/PaymentProcessor.xml | 4 ++++ xml/schema/Financial/PaymentProcessorType.xml | 9 +++++++-- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CRM/Financial/DAO/PaymentProcessor.php b/CRM/Financial/DAO/PaymentProcessor.php index 339daccc5e3d..8e54cc76b317 100644 --- a/CRM/Financial/DAO/PaymentProcessor.php +++ b/CRM/Financial/DAO/PaymentProcessor.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentProcessor.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0bd325aff061b6eea4854ef63757772a) + * (GenCodeChecksum:55a55af34cd25ec8d69f4145d3fa2870) */ /** @@ -283,6 +283,7 @@ public static function &fields() { 'name' => 'payment_processor_type_id', 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Payment Processor Type ID'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor.payment_processor_type_id', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', @@ -301,6 +302,7 @@ public static function &fields() { 'title' => ts('Processor is Active?'), 'description' => ts('Is this processor active?'), 'where' => 'civicrm_payment_processor.is_active', + 'default' => '1', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', @@ -312,6 +314,7 @@ public static function &fields() { 'title' => ts('Processor Is Default?'), 'description' => ts('Is this processor the default?'), 'where' => 'civicrm_payment_processor.is_default', + 'default' => '0', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', @@ -323,6 +326,7 @@ public static function &fields() { 'title' => ts('Is Test Processor?'), 'description' => ts('Is this processor for a test site?'), 'where' => 'civicrm_payment_processor.is_test', + 'default' => '0', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', diff --git a/CRM/Financial/DAO/PaymentProcessorType.php b/CRM/Financial/DAO/PaymentProcessorType.php index 7230d340df86..8f54134cb1aa 100644 --- a/CRM/Financial/DAO/PaymentProcessorType.php +++ b/CRM/Financial/DAO/PaymentProcessorType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentProcessorType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:65231e0b77bcce22bd505b89ace63506) + * (GenCodeChecksum:ea2020b03d32e0c0f1a2d4915f2a14b1) */ /** @@ -43,7 +43,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { public $name; /** - * Payment Processor Name. + * Payment Processor Type Title. * * @var string */ @@ -196,6 +196,7 @@ public static function &fields() { 'type' => CRM_Utils_Type::T_STRING, 'title' => ts('Payment Processor variable name to be used in code'), 'description' => ts('Payment Processor Name.'), + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'where' => 'civicrm_payment_processor_type.name', @@ -207,8 +208,9 @@ public static function &fields() { 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Payment Processor Title'), - 'description' => ts('Payment Processor Name.'), + 'title' => ts('Payment Processor Type Title'), + 'description' => ts('Payment Processor Type Title.'), + 'required' => TRUE, 'maxlength' => 127, 'size' => CRM_Utils_Type::HUGE, 'where' => 'civicrm_payment_processor_type.title', @@ -236,6 +238,7 @@ public static function &fields() { 'title' => ts('Processor Type Is Active?'), 'description' => ts('Is this processor active?'), 'where' => 'civicrm_payment_processor_type.is_active', + 'default' => '1', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', @@ -247,6 +250,7 @@ public static function &fields() { 'title' => ts('Processor Type is Default?'), 'description' => ts('Is this processor the default?'), 'where' => 'civicrm_payment_processor_type.is_default', + 'default' => '0', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', @@ -304,6 +308,7 @@ public static function &fields() { 'name' => 'class_name', 'type' => CRM_Utils_Type::T_STRING, 'title' => ts('Suffix for PHP class name implementation'), + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'where' => 'civicrm_payment_processor_type.class_name', diff --git a/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTypeTest.php b/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTypeTest.php index 7aaab9e7fcf9..d75d94a048f9 100644 --- a/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTypeTest.php +++ b/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTypeTest.php @@ -43,6 +43,7 @@ public function testCreate() { 'name' => 'Test_Payment_Processor', 'title' => 'Test Payment Processor', 'billing_mode' => 1, + 'class_name' => 'Payment_Dummy', ]; $paymentProcessor = CRM_Financial_BAO_PaymentProcessorType::create($params); $result = $this->assertDBNotNull( @@ -63,6 +64,7 @@ public function testRetrieve() { 'name' => 'Test_Retrieve_Payment_Processor', 'title' => 'Test Retrieve Payment Processor', 'billing_mode' => 1, + 'class_name' => 'Payment_Dummy', ]; $defaults = []; CRM_Financial_BAO_PaymentProcessorType::create($params); @@ -79,6 +81,7 @@ public function testSetIsActive() { 'title' => 'Test Set Payment Processor', 'billing_mode' => 1, 'is_active' => 1, + 'class_name' => 'Payment_Dummy', ]; $paymentProcessor = CRM_Financial_BAO_PaymentProcessorType::create($params); @@ -116,6 +119,7 @@ public function testDel() { 'title' => 'Test Del Payment Processor', 'billing_mode' => 1, 'is_active' => 1, + 'class_name' => 'Payment_Dummy', ]; $defaults = []; diff --git a/xml/schema/Financial/PaymentProcessor.xml b/xml/schema/Financial/PaymentProcessor.xml index ce5e3250abe7..e1aac7cab331 100644 --- a/xml/schema/Financial/PaymentProcessor.xml +++ b/xml/schema/Financial/PaymentProcessor.xml @@ -87,6 +87,7 @@ id title + true 10 4.3 @@ -102,6 +103,7 @@ boolean Is this processor active? 1.8 + 1 is_default @@ -109,6 +111,7 @@ boolean Is this processor the default? 1.8 + 0 is_test @@ -116,6 +119,7 @@ boolean Is this processor for a test site? 1.8 + 0 UI_name_test_domain_id diff --git a/xml/schema/Financial/PaymentProcessorType.xml b/xml/schema/Financial/PaymentProcessorType.xml index 3e5de5268217..27273978a9a1 100644 --- a/xml/schema/Financial/PaymentProcessorType.xml +++ b/xml/schema/Financial/PaymentProcessorType.xml @@ -24,14 +24,16 @@ 64 Payment Processor Name. 1.8 + true title - Payment Processor Title + Payment Processor Type Title varchar 127 - Payment Processor Name. + Payment Processor Type Title. 1.8 + true description @@ -47,6 +49,7 @@ boolean Is this processor active? 1.8 + 1 is_default @@ -54,6 +57,7 @@ boolean Is this processor the default? 1.8 + 0 UI_name @@ -95,6 +99,7 @@ varchar 255 1.8 + true url_site_default