Commit aa980988 authored by mattwire's avatar mattwire

Fix saving of fee amount and transaction ID on contribution record.

parent b7f4a8a0
......@@ -542,12 +542,12 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
throw new \Civi\Payment\Exception\PaymentProcessorException('Failed to create Stripe Charge: ' . $errorMessage);
}
// Success! Return some values for CiviCRM.
$params['trxn_id'] = $stripeCharge->id;
$params['payment_status_id'] = $completedStatusId;
// Success! Return some values for CiviCRM.
$newParams['id'] = $this->getContributionId($params);
$newParams['trxn_id'] = $stripeCharge->id;
$newParams['payment_status_id'] = $completedStatusId;
// Return fees & net amount for Civi reporting.
// Uses new Balance Trasaction object.
try {
$stripeBalanceTransaction = \Stripe\BalanceTransaction::retrieve($stripeCharge->balance_transaction);
}
......@@ -556,8 +556,12 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
$errorMessage = self::handleErrorNotification($err, $params['stripe_error_url']);
throw new \Civi\Payment\Exception\PaymentProcessorException('Failed to retrieve Stripe Balance Transaction: ' . $errorMessage);
}
$params['fee_amount'] = $stripeBalanceTransaction->fee / 100;
$params['net_amount'] = $stripeBalanceTransaction->net / 100;
$newParams['fee_amount'] = $stripeBalanceTransaction->fee / 100;
$newParams['net_amount'] = $stripeBalanceTransaction->net / 100;
civicrm_api3('Contribution', 'create', $newParams);
unset($newParams['id']);
$params = array_merge($params, $newParams);
return $params;
}
......
......@@ -4,7 +4,7 @@ There are no database changes in this release but you should update your Stripe
* Update required Stripe API version from 2018-11-08 to 2019-02-19.
* Update stripe-php from 6.19.5 to 6.30.4.
* Make sure we clear processor specific metadata from payment form when switching payment processor (fixes https://lab.civicrm.org/extensions/stripe/issues/26).
* Fix saving of fee amount and transaction ID on contribution record.
## Release 5.2
*This release introduces a number of new features, standardises the behaviour of recurring contributions/memberships to match standard CiviCRM functionality and does a major cleanup of the backend code to improve stability and allow for new features.*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment