-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] Convert Elavon Payment Processor to be a core Extension
- Loading branch information
1 parent
d5b2b3f
commit d488da1
Showing
18 changed files
with
1,679 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* Upgrade logic for the 5.54.x series. | ||
* | ||
* Each minor version in the series is handled by either a `5.54.x.mysql.tpl` file, | ||
* or a function in this class named `upgrade_5_54_x`. | ||
* If only a .tpl file exists for a version, it will be run automatically. | ||
* If the function exists, it must explicitly add the 'runSql' task if there is a corresponding .mysql.tpl. | ||
* | ||
* This class may also implement `setPreUpgradeMessage()` and `setPostUpgradeMessage()` functions. | ||
*/ | ||
class CRM_Upgrade_Incremental_php_FiveFiftyFour extends CRM_Upgrade_Incremental_Base { | ||
|
||
|
||
/** | ||
* Upgrade step; adds tasks including 'runSql'. | ||
* | ||
* @param string $rev | ||
* The version number matching this function name | ||
*/ | ||
public function upgrade_5_54_alpha1($rev): void { | ||
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); | ||
$this->addTask('Install Elavon Payment Processor Extension as needed', 'installElavonPaymentProcessorExtension'); | ||
} | ||
|
||
/** | ||
* @param CRM_Queue_TaskContext $ctx | ||
* @return bool | ||
*/ | ||
public static function installElavonPaymentProcessorExtension(CRM_Queue_TaskContext $ctx) { | ||
$paymentProcessors = CRM_Core_DAO::singleValueQuery("SELECT count(cpp.id) FROM civicrm_payment_processor cpp | ||
INNER JOIN civicrm_payment_processor_type cppt ON cppt.id = cpp.payment_processor_type_id | ||
WEHERE cppt.name = 'Elavon'"); | ||
if (count($paymentProcessors) > 1) { | ||
$paymentProcessorType = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_payment_processor_type WHERE name = 'Elavon'"); | ||
$insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([ | ||
'type' => 'module', | ||
'full_name' => 'elavon', | ||
'name' => 'Elavon Payment Processor', | ||
'label' => 'Elavon Payment Processor', | ||
'file' => 'elavon', | ||
'schema_version' => NULL, | ||
'is_active' => 1, | ||
]); | ||
CRM_Core_DAO::executeQuery($insert->usingReplace()->toSQL()); | ||
$mgdInert = CRM_Utils_SQL_Insert::into('civicrm_managed')->row([ | ||
'module' => 'elavon', | ||
'name' => 'Elavon', | ||
'entity_type' => 'PaymentProcessorType', | ||
'entity_id' => $paymentProcessorType, | ||
'cleanup' => NULL, | ||
'update' => NULL, | ||
]); | ||
CRM_Core_DAO::executeQuery($mgdInert->usingReplace()->toSQL()); | ||
} | ||
else { | ||
CRM_Core_DAO::exeucteQuery("DELETE FROM civicrm_payment_processor_type WHERE name = 'Elavon'"); | ||
} | ||
return TRUE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ recaptcha | |
search_kit | ||
sequentialcreditnotes | ||
legacycustomsearches | ||
evalon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
use CRM_Elavon_ExtensionUtil as E; | ||
// 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 | ||
return [ | ||
0 => [ | ||
'name' => 'Elavon', | ||
'entity' => 'PaymentProcessorType', | ||
'params' => [ | ||
'version' => 3, | ||
'name' => 'Elavon', | ||
'title' => E::ts('Elavon Payment Processor'), | ||
'description' => E::ts('Elavon / Nova Virtual Merchant'), | ||
'user_name_label' => E::ts('SSL Merchant ID'), | ||
'password_label' => E::ts('SSL User ID'), | ||
'signature_label' => E::ts('SSL PIN'), | ||
'class_name' => 'Payment_Elavon', | ||
'billing_mode' => 1, | ||
'url_site_default' => 'https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do', | ||
'payment_type' => 1, | ||
'is_recur' => 0, | ||
'url_site_test_default' => 'https://www.myvirtualmerchant.com/VirtualMerchant/processxml.do', | ||
], | ||
], | ||
]; |
File renamed without changes.
Oops, something went wrong.