From: Seamus Lee Date: Tue, 13 Apr 2021 23:36:09 +0000 (+1000) Subject: Flesh out readme, info.xml and remove Payflow Pro Payment Processor Type from install... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=68f91be13ed473a136904753e6f896954e2a22aa;p=civicrm-core.git Flesh out readme, info.xml and remove Payflow Pro Payment Processor Type from install data and add in upgrade step to enable extension appropriately as needed and add in civicrm managed file Mark Processor as supporting recurring --- diff --git a/CRM/Upgrade/Incremental/php/FiveThirtyEight.php b/CRM/Upgrade/Incremental/php/FiveThirtyEight.php index bba70172c5..aa397480ff 100644 --- a/CRM/Upgrade/Incremental/php/FiveThirtyEight.php +++ b/CRM/Upgrade/Incremental/php/FiveThirtyEight.php @@ -55,6 +55,47 @@ class CRM_Upgrade_Incremental_php_FiveThirtyEight extends CRM_Upgrade_Incrementa * (change the x in the function name): */ + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_5_38_alpha1($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); + $this->addTask('Enable Payflow Pro Payment Processor Extension', 'enablePayflowProExtension'); + } + + public static function enablePayflowProExtension(CRM_Queue_TaskContext $ctx) { + $payflowProPaymentProcessorType = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_payment_processor_type WHERE class_name = 'Payment_PayflowPro'"); + if ($payflowProPaymentProcessorType) { + $payflowProPaymentProcessorCount = CRM_Core_DAO::singleValueQuery("SELECT count(id) FROM civicrm_payment_processor WHERE payment_processor_type_id = %1", [1 => [$payflowProPaymentProcessorType, 'Positive']]); + if ($payflowProPaymentProcessorCount) { + $insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([ + 'type' => 'module', + 'full_name' => 'payflowpro', + 'name' => 'PayPal PayFlo Pro Integration', + 'label' => 'PayPal PayFlo Pro Integration', + 'file' => 'payflowpro', + 'schema_version' => NULL, + 'is_active' => 1, + ]); + CRM_Core_DAO::executeQuery($insert->usingReplace()->toSQL()); + $managedEntity = CRM_Utils_SQL_Insert::into('civicrm_managed')->row([ + 'name' => 'PayflowPro', + 'module' => 'payflowpro', + 'entity_type' => 'PaymentProcessorType', + 'entity_id' => $payflowProPaymentProcessorType, + 'cleanup' => NULL, + ]); + CRM_Core_DAO::executeQuery($managedEntity->usingReplace()->toSQL()); + } + else { + CRM_Core_DAO::executeQuery("DELETE FROM civicrm_payment_processor_type WHERE id = %1", [1 => [$payflowProPaymentProcessorType, 'Positive']]); + } + } + return TRUE; + } + // /** // * Upgrade function. // * diff --git a/ext/payflowpro/CRM/Core/Payment/PayflowPro.mgd.php b/ext/payflowpro/CRM/Core/Payment/PayflowPro.mgd.php new file mode 100644 index 0000000000..08d77423b4 --- /dev/null +++ b/ext/payflowpro/CRM/Core/Payment/PayflowPro.mgd.php @@ -0,0 +1,29 @@ + [ + 'name' => 'PayflowPro', + 'entity' => 'PaymentProcessorType', + 'params' => [ + 'version' => 3, + 'name' => 'PayflowPro', + 'title' => E::ts('PayflowPro'), + 'description' => '', + 'user_name_label' => 'Vendor ID', + 'password_label' => 'Password', + 'signature_label' => 'Partner (merchant)', + 'subject_label' => 'User', + 'class_name' => 'Payment_PayflowPro', + 'billing_mode' => 1, + 'url_site_default' => 'https://Payflowpro.paypal.com', + 'payment_type' => 1, + 'is_recur' => 1, + 'url_site_test_default' => 'https://pilot-Payflowpro.paypal.com', + ], + ], +]; diff --git a/ext/payflowpro/README.md b/ext/payflowpro/README.md index aa2f08fb86..99f89bd8e3 100644 --- a/ext/payflowpro/README.md +++ b/ext/payflowpro/README.md @@ -1,44 +1,22 @@ -# payflowpro +# Payflow Pro -![Screenshot](/images/screenshot.png) - -(*FIXME: In one or two paragraphs, describe what the extension does and why one would download it. *) +This extension provides an integration with PayPal's Payflow Pro service. It supports one time and recurring payments from CiviCRM. The extension is licensed under [AGPL-3.0](LICENSE.txt). ## Requirements * PHP v7.2+ -* CiviCRM (*FIXME: Version number*) +* CiviCRM 5.38 ## Installation (Web UI) Learn more about installing CiviCRM extensions in the [CiviCRM Sysadmin Guide](https://docs.civicrm.org/sysadmin/en/latest/customize/extensions/). -## Installation (CLI, Zip) - -Sysadmins and developers may download the `.zip` file for this extension and -install it with the command-line tool [cv](https://github.com/civicrm/cv). - -```bash -cd -cv dl payflowpro@https://github.com/FIXME/payflowpro/archive/master.zip -``` - -## Installation (CLI, Git) - -Sysadmins and developers may clone the [Git](https://en.wikipedia.org/wiki/Git) repo for this extension and -install it with the command-line tool [cv](https://github.com/civicrm/cv). - -```bash -git clone https://github.com/FIXME/payflowpro.git -cv en payflowpro -``` - ## Getting Started -(* FIXME: Where would a new user navigate to get started? What changes would they see? *) +After enabling the extension you will need to go to Administer >> System Settings >> Payment Processors and create a Payment Processor that uses Payflow Pro ## Known Issues -(* FIXME *) +At Present the extension can create recurring contributions processes in the Payment Processor but does not use the APIs provided to check that subsequent transactions have been processed. diff --git a/ext/payflowpro/info.xml b/ext/payflowpro/info.xml index 42da9e4f8c..0b270dfa59 100644 --- a/ext/payflowpro/info.xml +++ b/ext/payflowpro/info.xml @@ -1,26 +1,26 @@ payflowpro - FIXME - FIXME + PayPal Payflow Pro Integration + This extension provides an integration with PayPal's Payflow Pro service. It supports one time and recurring payments from CiviCRM. AGPL-3.0 Seamus Lee seamuslee001@gmail.com - http://FIXME - http://FIXME - http://FIXME + https://lab.civicrm.org + https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/payflow/ + https://lab.civicrm.org http://www.gnu.org/licenses/agpl-3.0.html 2021-04-13 1.0 - alpha + stable 5.0 - This is a new, undeveloped module + This extension is extraction of the original Core Payflow Pro Payment Processor diff --git a/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php b/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php index 4abca6d8a5..8560f7ec66 100644 --- a/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php +++ b/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php @@ -250,7 +250,7 @@ class CRM_Core_Payment_PayflowProTest extends \PHPUnit\Framework\TestCase implem public function getExpectedRecuringPaymentRequests() { return [ - 'USER[4]=test&VENDOR[4]=test&PARTNER[6]=PayPal&PWD[8]=test1234&TENDER[1]=C&TRXTYPE[1]=R&ACCT[16]=4111111111111111&CVV2[3]=123&EXPDATE[4]=1022&ACCTTYPE[4]=Visa&AMT[5]=20.00&CURRENCY[3]=AUD&FIRSTNAME[4]=John&LASTNAME[8]=O\'Connor&STREET[16]=8 Hobbitton Road&CITY[9]=The+Shire&STATE[3]=NSW&ZIP[4]=5010&COUNTRY[3]=AUS&EMAIL[24]=unittesteway@civicrm.org&CUSTIP[9]=127.0.0.1&COMMENT1[4]=4200&COMMENT2[4]=live&INVNUM[3]=xyz&ORDERDESC[17]=Test+Contribution&VERBOSITY[6]=MEDIUM&BILLTOCOUNTRY[3]=AUS&OPTIONALTRX[1]=S&OPTIONALTRXAMT[5]=20.00&ACTION[1]=A&PROFILENAME[19]=RegularContribution&TERM[2]=12&START[8]=05132021&PAYPERIOD[4]=MONT', + 'USER[4]=test&VENDOR[4]=test&PARTNER[6]=PayPal&PWD[8]=test1234&TENDER[1]=C&TRXTYPE[1]=R&ACCT[16]=4111111111111111&CVV2[3]=123&EXPDATE[4]=1022&ACCTTYPE[4]=Visa&AMT[5]=20.00&CURRENCY[3]=AUD&FIRSTNAME[4]=John&LASTNAME[8]=O\'Connor&STREET[16]=8 Hobbitton Road&CITY[9]=The+Shire&STATE[3]=NSW&ZIP[4]=5010&COUNTRY[3]=AUS&EMAIL[24]=unittesteway@civicrm.org&CUSTIP[9]=127.0.0.1&COMMENT1[4]=4200&COMMENT2[4]=live&INVNUM[3]=xyz&ORDERDESC[17]=Test+Contribution&VERBOSITY[6]=MEDIUM&BILLTOCOUNTRY[3]=AUS&OPTIONALTRX[1]=S&OPTIONALTRXAMT[5]=20.00&ACTION[1]=A&PROFILENAME[19]=RegularContribution&TERM[2]=12&START[8]=' . date('mdY', mktime(0, 0, 0, date("m") + 1, date("d"), date("Y"))) . '&PAYPERIOD[4]=MONT', ]; } diff --git a/sql/civicrm_generated.mysql b/sql/civicrm_generated.mysql index 720e7a30dd..10a92a8bee 100644 --- a/sql/civicrm_generated.mysql +++ b/sql/civicrm_generated.mysql @@ -1065,7 +1065,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_payment_processor_type` WRITE; /*!40000 ALTER TABLE `civicrm_payment_processor_type` DISABLE KEYS */; -INSERT INTO `civicrm_payment_processor_type` (`id`, `name`, `title`, `description`, `is_active`, `is_default`, `user_name_label`, `password_label`, `signature_label`, `subject_label`, `class_name`, `url_site_default`, `url_api_default`, `url_recur_default`, `url_button_default`, `url_site_test_default`, `url_api_test_default`, `url_recur_test_default`, `url_button_test_default`, `billing_mode`, `is_recur`, `payment_type`, `payment_instrument_id`) VALUES (1,'PayPal_Standard','PayPal - Website Payments Standard',NULL,1,0,'Merchant Account Email',NULL,NULL,NULL,'Payment_PayPalImpl','https://www.paypal.com/',NULL,'https://www.paypal.com/',NULL,'https://www.sandbox.paypal.com/',NULL,'https://www.sandbox.paypal.com/',NULL,4,1,1,1),(2,'PayPal','PayPal - Website Payments Pro',NULL,1,0,'User Name','Password','Signature',NULL,'Payment_PayPalImpl','https://www.paypal.com/','https://api-3t.paypal.com/','https://www.paypal.com/','https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif','https://www.sandbox.paypal.com/','https://api-3t.sandbox.paypal.com/','https://www.sandbox.paypal.com/','https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',3,1,1,1),(3,'PayPal_Express','PayPal - Express',NULL,1,0,'User Name','Password','Signature',NULL,'Payment_PayPalImpl','https://www.paypal.com/','https://api-3t.paypal.com/',NULL,'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif','https://www.sandbox.paypal.com/','https://api-3t.sandbox.paypal.com/',NULL,'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',2,1,1,1),(4,'AuthNet','Authorize.Net',NULL,1,0,'API Login','Payment Key','MD5 Hash',NULL,'Payment_AuthorizeNet','https://secure2.authorize.net/gateway/transact.dll',NULL,'https://api2.authorize.net/xml/v1/request.api',NULL,'https://test.authorize.net/gateway/transact.dll',NULL,'https://apitest.authorize.net/xml/v1/request.api',NULL,1,1,1,1),(5,'PayJunction','PayJunction',NULL,0,0,'User Name','Password',NULL,NULL,'Payment_PayJunction','https://payjunction.com/quick_link',NULL,NULL,NULL,'https://www.payjunctionlabs.com/quick_link',NULL,NULL,NULL,1,1,1,1),(6,'Dummy','Dummy Payment Processor',NULL,1,1,'User Name',NULL,NULL,NULL,'Payment_Dummy',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,1),(7,'Elavon','Elavon Payment Processor','Elavon / Nova Virtual Merchant',0,0,'SSL Merchant ID ','SSL User ID','SSL PIN',NULL,'Payment_Elavon','https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do',NULL,NULL,NULL,'https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do',NULL,NULL,NULL,1,0,1,1),(8,'Realex','Realex Payment',NULL,0,0,'Merchant ID','Password',NULL,'Account','Payment_Realex','https://epage.payandshop.com/epage.cgi',NULL,NULL,NULL,'https://epage.payandshop.com/epage-remote.cgi',NULL,NULL,NULL,1,0,1,1),(9,'PayflowPro','PayflowPro',NULL,0,0,'Vendor ID','Password','Partner (merchant)','User','Payment_PayflowPro','https://Payflowpro.paypal.com',NULL,NULL,NULL,'https://pilot-Payflowpro.paypal.com',NULL,NULL,NULL,1,0,1,1),(10,'FirstData','FirstData (aka linkpoint)','FirstData (aka linkpoint)',0,0,'Store name','certificate path',NULL,NULL,'Payment_FirstData','https://secure.linkpt.net',NULL,NULL,NULL,'https://staging.linkpt.net',NULL,NULL,NULL,1,NULL,1,1); +INSERT INTO `civicrm_payment_processor_type` (`id`, `name`, `title`, `description`, `is_active`, `is_default`, `user_name_label`, `password_label`, `signature_label`, `subject_label`, `class_name`, `url_site_default`, `url_api_default`, `url_recur_default`, `url_button_default`, `url_site_test_default`, `url_api_test_default`, `url_recur_test_default`, `url_button_test_default`, `billing_mode`, `is_recur`, `payment_type`, `payment_instrument_id`) VALUES (1,'PayPal_Standard','PayPal - Website Payments Standard',NULL,1,0,'Merchant Account Email',NULL,NULL,NULL,'Payment_PayPalImpl','https://www.paypal.com/',NULL,'https://www.paypal.com/',NULL,'https://www.sandbox.paypal.com/',NULL,'https://www.sandbox.paypal.com/',NULL,4,1,1,1),(2,'PayPal','PayPal - Website Payments Pro',NULL,1,0,'User Name','Password','Signature',NULL,'Payment_PayPalImpl','https://www.paypal.com/','https://api-3t.paypal.com/','https://www.paypal.com/','https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif','https://www.sandbox.paypal.com/','https://api-3t.sandbox.paypal.com/','https://www.sandbox.paypal.com/','https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',3,1,1,1),(3,'PayPal_Express','PayPal - Express',NULL,1,0,'User Name','Password','Signature',NULL,'Payment_PayPalImpl','https://www.paypal.com/','https://api-3t.paypal.com/',NULL,'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif','https://www.sandbox.paypal.com/','https://api-3t.sandbox.paypal.com/',NULL,'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',2,1,1,1),(4,'AuthNet','Authorize.Net',NULL,1,0,'API Login','Payment Key','MD5 Hash',NULL,'Payment_AuthorizeNet','https://secure2.authorize.net/gateway/transact.dll',NULL,'https://api2.authorize.net/xml/v1/request.api',NULL,'https://test.authorize.net/gateway/transact.dll',NULL,'https://apitest.authorize.net/xml/v1/request.api',NULL,1,1,1,1),(5,'PayJunction','PayJunction',NULL,0,0,'User Name','Password',NULL,NULL,'Payment_PayJunction','https://payjunction.com/quick_link',NULL,NULL,NULL,'https://www.payjunctionlabs.com/quick_link',NULL,NULL,NULL,1,1,1,1),(6,'Dummy','Dummy Payment Processor',NULL,1,1,'User Name',NULL,NULL,NULL,'Payment_Dummy',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,1),(7,'Elavon','Elavon Payment Processor','Elavon / Nova Virtual Merchant',0,0,'SSL Merchant ID ','SSL User ID','SSL PIN',NULL,'Payment_Elavon','https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do',NULL,NULL,NULL,'https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do',NULL,NULL,NULL,1,0,1,1),(8,'Realex','Realex Payment',NULL,0,0,'Merchant ID','Password',NULL,'Account','Payment_Realex','https://epage.payandshop.com/epage.cgi',NULL,NULL,NULL,'https://epage.payandshop.com/epage-remote.cgi',NULL,NULL,NULL,1,0,1,1),(9,'FirstData','FirstData (aka linkpoint)','FirstData (aka linkpoint)',0,0,'Store name','certificate path',NULL,NULL,'Payment_FirstData','https://secure.linkpt.net',NULL,NULL,NULL,'https://staging.linkpt.net',NULL,NULL,NULL,1,NULL,1,1); /*!40000 ALTER TABLE `civicrm_payment_processor_type` ENABLE KEYS */; UNLOCK TABLES; diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index d7b27aa297..ad9ebafe45 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -1159,7 +1159,6 @@ VALUES ('Dummy', '{ts escape="sql"}Dummy Payment Processor{/ts}',NULL,1,1,'{ts escape="sql"}User Name{/ts}',NULL,NULL,NULL,'Payment_Dummy',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1), ('Elavon', '{ts escape="sql"}Elavon Payment Processor{/ts}','{ts escape="sql"}Elavon / Nova Virtual Merchant{/ts}',0,0,'{ts escape="sql"}SSL Merchant ID {/ts}','{ts escape="sql"}SSL User ID{/ts}','{ts escape="sql"}SSL PIN{/ts}',NULL,'Payment_Elavon','https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do',NULL,NULL,NULL,'https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do',NULL,NULL,NULL,1,0), ('Realex', '{ts escape="sql"}Realex Payment{/ts}', NULL,0,0,'Merchant ID', 'Password', NULL, 'Account', 'Payment_Realex', 'https://epage.payandshop.com/epage.cgi', NULL, NULL, NULL, 'https://epage.payandshop.com/epage-remote.cgi', NULL, NULL, NULL, 1, 0), - ('PayflowPro', '{ts escape="sql"}PayflowPro{/ts}', NULL,0,0,'Vendor ID', 'Password', 'Partner (merchant)', 'User', 'Payment_PayflowPro', 'https://Payflowpro.paypal.com', NULL, NULL, NULL, 'https://pilot-Payflowpro.paypal.com', NULL, NULL, NULL, 1, 0), ('FirstData', '{ts escape="sql"}FirstData (aka linkpoint){/ts}', '{ts escape="sql"}FirstData (aka linkpoint){/ts}', 0, 0, 'Store name', 'certificate path', NULL, NULL, 'Payment_FirstData', 'https://secure.linkpt.net', NULL, NULL, NULL, 'https://staging.linkpt.net', NULL, NULL, NULL, 1, NULL);