Skip to content
Snippets Groups Projects

If Stripe is not using the same currency as the payment was made we need to...

Closed mattwire requested to merge currencyconvert into 6.4
1 file
+ 9
2
Compare changes
  • Side-by-side
  • Inline
@@ -686,8 +686,15 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
$errorMessage = $this->handleErrorNotification($err, $params['stripe_error_url']);
throw new \Civi\Payment\Exception\PaymentProcessorException('Failed to retrieve Stripe Balance Transaction: ' . $errorMessage);
}
$newParams['fee_amount'] = $stripeBalanceTransaction->fee / 100;
$newParams['net_amount'] = $stripeBalanceTransaction->net / 100;
if (($stripeCharge['currency'] !== $stripeBalanceTransaction['currency'])
&& (!empty($stripeBalanceTransaction['exchange_rate']))) {
$newParams['fee_amount'] = ($stripeBalanceTransaction->fee / $stripeBalanceTransaction['exchange_rate']) / 100;
$newParams['net_amount'] = ($stripeBalanceTransaction->net / $stripeBalanceTransaction['exchange_rate']) / 100;
}
else {
$newParams['fee_amount'] = $stripeBalanceTransaction->fee / 100;
$newParams['net_amount'] = $stripeBalanceTransaction->net / 100;
}
// Success!
// Set the desired contribution status which will be set later (do not set on the contribution here!)
$params['contribution_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
Loading