Skip to content
Snippets Groups Projects
Commit bae1863a authored by mattwire's avatar mattwire
Browse files

Fixes #32 Don't send out contribution receipts for IPNs

parent aa980988
No related branches found
No related tags found
No related merge requests found
...@@ -15,13 +15,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -15,13 +15,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
*/ */
protected $transaction_id; protected $transaction_id;
/**
* Do we send an email receipt for each contribution?
*
* @var int
*/
public $is_email_receipt = 1;
// By default, always retrieve the event from stripe to ensure we are // By default, always retrieve the event from stripe to ensure we are
// not being fed garbage. However, allow an override so when we are // not being fed garbage. However, allow an override so when we are
// testing, we can properly test a failed recurring contribution. // testing, we can properly test a failed recurring contribution.
...@@ -234,7 +227,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -234,7 +227,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
'trxn_id' => $this->charge_id, 'trxn_id' => $this->charge_id,
'total_amount' => $this->amount, 'total_amount' => $this->amount,
'fee_amount' => $this->fee, 'fee_amount' => $this->fee,
'is_email_receipt' => $this->is_email_receipt, 'is_email_receipt' => 0,
)); ));
} }
...@@ -257,7 +250,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -257,7 +250,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
'id' => $this->previous_contribution['id'], 'id' => $this->previous_contribution['id'],
'contribution_status_id' => "Failed", 'contribution_status_id' => "Failed",
'receive_date' => $failDate, 'receive_date' => $failDate,
'is_email_receipt' => $this->is_email_receipt, 'is_email_receipt' => 0,
)); ));
} }
else { else {
...@@ -266,7 +259,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -266,7 +259,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
'contribution_status_id' => 'Failed', 'contribution_status_id' => 'Failed',
'receive_date' => $failDate, 'receive_date' => $failDate,
'total_amount' => $this->amount, 'total_amount' => $this->amount,
'is_email_receipt' => $this->is_email_receipt, 'is_email_receipt' => 0,
]; ];
civicrm_api3('Contribution', 'repeattransaction', $contributionParams); civicrm_api3('Contribution', 'repeattransaction', $contributionParams);
} }
...@@ -389,7 +382,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -389,7 +382,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
'net_amount' => $this->net_amount, 'net_amount' => $this->net_amount,
'fee_amount' => $this->fee, 'fee_amount' => $this->fee,
'payment_processor_id' => $this->_paymentProcessor['id'], 'payment_processor_id' => $this->_paymentProcessor['id'],
'is_email_receipt' => $this->is_email_receipt, 'is_email_receipt' => 0,
)); ));
} }
......
...@@ -23,8 +23,6 @@ function _civicrm_api3_stripe_Ipn_spec(&$spec) { ...@@ -23,8 +23,6 @@ function _civicrm_api3_stripe_Ipn_spec(&$spec) {
$spec['id']['title'] = ts("CiviCRM System Log id to replay from system log."); $spec['id']['title'] = ts("CiviCRM System Log id to replay from system log.");
$spec['evtid']['title'] = ts("An event id as generated by Stripe."); $spec['evtid']['title'] = ts("An event id as generated by Stripe.");
$spec['ppid']['title'] = ts("The payment processor to use (required if using evtid)"); $spec['ppid']['title'] = ts("The payment processor to use (required if using evtid)");
$spec['noreceipt']['title'] = ts("Set to 1 to override contribution page settings and do not send a receipt (default is off or 0). )");
$spec['noreceipt']['api.default'] = 0;
} }
/** /**
...@@ -78,9 +76,6 @@ function civicrm_api3_stripe_Ipn($params) { ...@@ -78,9 +76,6 @@ function civicrm_api3_stripe_Ipn($params) {
// CRM_Core_Payment::handlePaymentMethod // CRM_Core_Payment::handlePaymentMethod
$_GET['processor_id'] = $ppid; $_GET['processor_id'] = $ppid;
$ipnClass = new CRM_Core_Payment_StripeIPN($object); $ipnClass = new CRM_Core_Payment_StripeIPN($object);
if ($params['noreceipt'] == 1) {
$ipnClass->is_email_receipt = 0;
}
$ipnClass->main(); $ipnClass->main();
} }
else { else {
......
...@@ -5,6 +5,7 @@ There are no database changes in this release but you should update your Stripe ...@@ -5,6 +5,7 @@ There are no database changes in this release but you should update your Stripe
* Update stripe-php from 6.19.5 to 6.30.4. * 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). * 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. * Fix saving of fee amount and transaction ID on contribution record.
* Don't send out contribution receipts for IPNs.
## Release 5.2 ## 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.* *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.*
......
...@@ -128,7 +128,7 @@ class CRM_Stripe_BaseTest extends \PHPUnit_Framework_TestCase implements Headles ...@@ -128,7 +128,7 @@ class CRM_Stripe_BaseTest extends \PHPUnit_Framework_TestCase implements Headles
'max_amount' => 1000, 'max_amount' => 1000,
'receipt_from_email' => 'gaia@the.cosmos', 'receipt_from_email' => 'gaia@the.cosmos',
'receipt_from_name' => 'Pachamama', 'receipt_from_name' => 'Pachamama',
'is_email_receipt' => FALSE, 'is_email_receipt' => 0,
), $params); ), $params);
$result = civicrm_api3('ContributionPage', 'create', $params); $result = civicrm_api3('ContributionPage', 'create', $params);
$this->assertEquals(0, $result['is_error']); $this->assertEquals(0, $result['is_error']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment