Flesh out readme, info.xml and remove Payflow Pro Payment Processor Type from install...
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 13 Apr 2021 23:36:09 +0000 (09:36 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 14 Apr 2021 05:19:26 +0000 (15:19 +1000)
Mark Processor as supporting recurring

CRM/Upgrade/Incremental/php/FiveThirtyEight.php
ext/payflowpro/CRM/Core/Payment/PayflowPro.mgd.php [new file with mode: 0644]
ext/payflowpro/README.md
ext/payflowpro/info.xml
ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php
sql/civicrm_generated.mysql
xml/templates/civicrm_data.tpl

index bba70172c58c89091a0fc49b497814c7abc9b155..aa397480ffc59299e5af3d89ee2c54f9463202c7 100644 (file)
@@ -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 (file)
index 0000000..08d7742
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+// This file declares a managed database record of type "ReportTemplate".
+// The record will be automatically inserted, updated, or deleted from the
+// database as appropriate. For more details, see "hook_civicrm_managed" at:
+// http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference
+use CRM_Payflowpro_ExtensionUtil as E;
+
+return [
+  0 => [
+    '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',
+    ],
+  ],
+];
index aa2f08fb86e5c542b4ab24b19ad8e3f6d4691a5c..99f89bd8e35d7c60dd211f5559e3ee4a7db175a8 100644 (file)
@@ -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 <extension-dir>
-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.
index 42da9e4f8c195e99e5ff064a53a942bbca1f5a4c..0b270dfa59c2560fef22667d543a440f730394a8 100644 (file)
@@ -1,26 +1,26 @@
 <?xml version="1.0"?>
 <extension key="payflowpro" type="module">
   <file>payflowpro</file>
-  <name>FIXME</name>
-  <description>FIXME</description>
+  <name>PayPal Payflow Pro Integration</name>
+  <description>This extension provides an integration with PayPal's Payflow Pro service. It supports one time and recurring payments from CiviCRM.</description>
   <license>AGPL-3.0</license>
   <maintainer>
     <author>Seamus Lee</author>
     <email>seamuslee001@gmail.com</email>
   </maintainer>
   <urls>
-    <url desc="Main Extension Page">http://FIXME</url>
-    <url desc="Documentation">http://FIXME</url>
-    <url desc="Support">http://FIXME</url>
+    <url desc="Main Extension Page">https://lab.civicrm.org</url>
+    <url desc="Documentation">https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/payflow/</url>
+    <url desc="Support">https://lab.civicrm.org</url>
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-04-13</releaseDate>
   <version>1.0</version>
-  <develStage>alpha</develStage>
+  <develStage>stable</develStage>
   <compatibility>
     <ver>5.0</ver>
   </compatibility>
-  <comments>This is a new, undeveloped module</comments>
+  <comments>This extension is extraction of the original Core Payflow Pro Payment Processor</comments>
   <classloader>
     <psr4 prefix="Civi\" path="Civi"/>
   </classloader>
index 4abca6d8a5f102c47ec998983f212b812c0227e6..8560f7ec6637e41d4691cb4a03bb30ebea254a45 100644 (file)
@@ -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',
     ];
   }
 
index 720e7a30dd5baf887bd7b253ab12f737807149e7..10a92a8beeba98e067d90345688039851ae6c266 100644 (file)
@@ -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;
 
index d7b27aa297a97861305ba146f8a886df47012f03..ad9ebafe45b7f199fd1e2b2878db4741c5612c4d 100644 (file)
@@ -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);