Skip to content

Commit

Permalink
Migrate Eway(Single Currency) Payment Processor Type out into its own…
Browse files Browse the repository at this point in the history
… extension
  • Loading branch information
seamuslee001 committed Sep 4, 2020
1 parent 3cd27a4 commit 4f4b162
Show file tree
Hide file tree
Showing 17 changed files with 4,362 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
!/ext/sequentialcreditnotes
!/ext/flexmailer
!/ext/eventcart
!/ext/ewaysingle
!/ext/search
!/ext/financialacls
backdrop/
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/DAO/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Event/Event.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:164ee1a507b9244536114d1569ccff1e)
* (GenCodeChecksum:82ba48cbb804cf6f4b26fa50f07d44db)
*/

/**
Expand Down
37 changes: 34 additions & 3 deletions CRM/Upgrade/Incremental/php/FiveThirtyOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,39 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
// // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
// }

// public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
// return TRUE;
// }
/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_5_31_alpha1($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('enableeWAYSingleCurrencyExtension', 'enableEwaySingleExtension');
}

public static function enableEwaySingleExtension(CRM_Queue_TaskContext $ctx) {
$eWAYPaymentProcessorType = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_payment_processor_type WHERE class_name = 'Payment_eWAY'");
if ($eWAYPaymentProcessorType) {
$insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([
'type' => 'module',
'full_name' => 'ewaysingle',
'name' => 'eway Single currency extension',
'label' => 'eway Single currency extension',
'file' => 'ewaysingle',
'schema_version' => NULL,
'is_active' => 1,
]);
CRM_Core_DAO::executeQuery($insert->usingReplace()->toSQL());
$managedEntity = CRM_Utils_SQL_Insert::into('civicrm_managed')->row([
'name' => 'eWAY',
'module' => 'ewaysingle',
'entity_type' => 'PaymentProcessorType',
'entity_id' => $eWAYPaymentProcessorType,
'cleanup' => NULL,
]);
CRM_Core_DAO::executeQuery($managedEntity->usingReplace()->toSQL());
}
return TRUE;
}

}
24 changes: 24 additions & 0 deletions ext/ewaysingle/CRM/Core/Payment/eWAY.mgd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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
return array(
0 => array(
'name' => 'eWAY',
'entity' => 'PaymentProcessorType',
'params' => array(
'version' => 3,
'name' => 'eWAY',
'title' => 'eWAY (eWAY (Single Currency)',
'description' => '',
'user_name_label' => 'Customer ID',
'class_name' => 'Payment_eWAY',
'billing_mode' => 1,
'url_site_default' => 'https://www.eway.com.au/gateway_cvn/xmlpayment.asp',
'payment_type' => 1,
'is_recur' => 0,
'url_site_test_default' => 'https://www.eway.com.au/gateway_cvn/xmltest/testpage.asp',
),
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@
*/

use Civi\Payment\Exception\PaymentProcessorException;
use CRM_Ewaysingle_ExtensionUtil as E;

// require Standard eWAY API libraries
require_once 'eWAY/eWAY_GatewayRequest.php';
require_once 'eWAY/eWAY_GatewayResponse.php';
require_once E::path('lib/eWAY/eWAY_GatewayRequest.php');
require_once E::path('lib/eWAY/eWAY_GatewayResponse.php');

/**
* Class CRM_Core_Payment_eWAY.
Expand Down
Loading

0 comments on commit 4f4b162

Please sign in to comment.