Skip to content

Commit

Permalink
Merge pull request iATSPayments#332 from iATSPayments/remove_gross_am…
Browse files Browse the repository at this point in the history
…ount

Remove unused gross_amount.
Also includes a collection of formatting cleanups.
  • Loading branch information
adixon authored Sep 23, 2020
2 parents e2ffb68 + 154ac64 commit 472b0ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
5 changes: 2 additions & 3 deletions CRM/Core/Payment/Faps.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ public function doPayment(&$params, $component = 'contribute') {
// For versions >= 4.6.6, the proper key.
$params['payment_status_id'] = 1;
$params['trxn_id'] = trim($result['data']['referenceNumber']).':'.time();
$params['gross_amount'] = $params['amount'];
return $params;
}
else {
Expand Down Expand Up @@ -481,7 +480,7 @@ protected function convertParams($params, $method) {
$result = civicrm_api3('Country', 'get', [
'sequential' => 1,
'return' => ['name'],
'id' => $params['country_id'],
'id' => $params['country_id'],
'options' => ['limit' => 1],
]);
$params['country'] = $result['values'][0]['name'];
Expand All @@ -495,7 +494,7 @@ protected function convertParams($params, $method) {
$result = civicrm_api3('StateProvince', 'get', [
'sequential' => 1,
'return' => ['name'],
'id' => $params['state_province_id'],
'id' => $params['state_province_id'],
'options' => ['limit' => 1],
]);
$params['state_province'] = $result['values'][0]['name'];
Expand Down
13 changes: 6 additions & 7 deletions CRM/Core/Payment/FapsACH.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function __construct( $mode, &$paymentProcessor ) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->disable_cryptogram = iats_get_setting('disable_cryptogram');
$this->is_test = ($this->_mode == 'test' ? 1 : 0);
$this->is_test = ($this->_mode == 'test' ? 1 : 0);
}

/**
Expand Down Expand Up @@ -104,11 +104,11 @@ public function buildForm(&$form) {
));
// and now add in a helpful cheque image and description
switch($currency) {
case 'USD':
case 'USD':
CRM_Core_Region::instance('billing-block')->add(array(
'template' => 'CRM/Iats/BillingBlockFapsACH_USD.tpl',
));
case 'CAD':
case 'CAD':
CRM_Core_Region::instance('billing-block')->add(array(
'template' => 'CRM/Iats/BillingBlockFapsACH_CAD.tpl',
));
Expand Down Expand Up @@ -151,7 +151,7 @@ public function doPayment(&$params, $component = 'contribute') {
);
$vault_request = new CRM_Iats_FapsRequest($options);
$request = $this->convertParams($params, $options['action']);
// auto-generate a compliant vault key
// auto-generate a compliant vault key
$vault_key = self::generateVaultKey($request['ownerEmail']);
$request['vaultKey'] = $vault_key;
$request['ipAddress'] = $ipAddress;
Expand Down Expand Up @@ -216,7 +216,6 @@ public function doPayment(&$params, $component = 'contribute') {
if ($success) {
$params['payment_status_id'] = 2;
$params['trxn_id'] = trim($result['data']['referenceNumber']).':'.time();
$params['gross_amount'] = $params['amount'];
// Core assumes that a pending result will have no transaction id, but we have a useful one.
if (!empty($params['contributionID'])) {
$contribution_update = array('id' => $params['contributionID'], 'trxn_id' => $params['trxn_id']);
Expand All @@ -237,7 +236,7 @@ public function doPayment(&$params, $component = 'contribute') {
}

/**
* Get the category text.
* Get the category text.
* Before I return it, check that the category text exists, and create it if
* it doesn't.
*
Expand All @@ -257,7 +256,7 @@ public static function getCategoryText($credentials, $is_test, $ipAddress = NULL
static $ach_category_text_saved;
if (!empty($ach_category_text_saved)) {
return $ach_category_text_saved;
}
}
$ach_category_text = iats_get_setting('ach_category_text');
$ach_category_text = empty($ach_category_text) ? FAPS_DEFAULT_ACH_CATEGORY_TEXT : $ach_category_text;
$ach_category_exists = FALSE;
Expand Down
2 changes: 0 additions & 2 deletions CRM/Core/Payment/iATSService.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ public function doPayment(&$params, $component = 'contribute') {
// Success.
$params['payment_status_id'] = 1;
$params['trxn_id'] = trim($result['remote_id']) . ':' . time();
$params['gross_amount'] = $params['amount'];
return $params;
}
else {
Expand Down Expand Up @@ -285,7 +284,6 @@ public function doPayment(&$params, $component = 'contribute') {
// uniqueness and provide helpful referencing.
$update = array(
'trxn_id' => trim($result['remote_id']) . ':' . time(),
'gross_amount' => $params['amount'],
'payment_status_id' => 1,
);
// do some cleanups to the recurring record in updateRecurring
Expand Down
2 changes: 0 additions & 2 deletions CRM/Core/Payment/iATSServiceACHEFT.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ public function doPayment(&$params, $component = 'contribute') {
if ($result['status']) {
$params['payment_status_id'] = 2;
$params['trxn_id'] = trim($result['remote_id']) . ':' . time();
$params['gross_amount'] = $params['amount'];
// Core assumes that a pending result will have no transaction id, but we have a useful one.
if (!empty($params['contributionID'])) {
$contribution_update = array('id' => $params['contributionID'], 'trxn_id' => $params['trxn_id']);
Expand Down Expand Up @@ -325,7 +324,6 @@ public function doPayment(&$params, $component = 'contribute') {
// Add a time string to iATS short authentication string to ensure uniqueness and provide helpful referencing.
$update = array(
'trxn_id' => trim($result['remote_id']) . ':' . time(),
'gross_amount' => $params['amount'],
'payment_status_id' => 2,
);
// Setting the next_sched_contribution_date param doesn't do anything,
Expand Down

0 comments on commit 472b0ef

Please sign in to comment.