Skip to content
Snippets Groups Projects
Commit 8981375d authored by Jamie McClelland's avatar Jamie McClelland Committed by mattwire
Browse files

fix option to not send receipt when running IPN

This is an API interface change, but I don't think anyone is using it
and if they were using it, it wasn't working.

I've changed it to avoid the confusion around double negatives and
also fix the main logic.
parent 8370f486
No related branches found
No related tags found
No related merge requests found
......@@ -30,9 +30,9 @@ function _civicrm_api3_stripe_Ipn_spec(&$spec) {
$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['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'] = FALSE;
$spec['noreceipt']['type'] = CRM_Utils_Type::T_BOOLEAN;
$spec['suppressreceipt']['title'] = ts("Set to 1 to override contribution page settings and do not send a receipt (default is to use contribution page settings). )");
$spec['suppressreceipt']['api.default'] = 0;
$spec['suppressreceipt']['type'] = CRM_Utils_Type::T_INT;
}
/**
......@@ -98,12 +98,20 @@ function civicrm_api3_stripe_Ipn($params) {
}
if (class_exists('CRM_Core_Payment_StripeIPN')) {
// By default, set emailReceipt to NULL so the default receipt setting
// will kick in.
$emailReceipt = NULL;
if ($params['suppressreceipt'] == 1) {
// Override, do not send receipt.
$emailReceipt = 0;
}
try {
$paymentProcessor->processPaymentNotification(
$ppid,
json_encode($object),
FALSE,
($params['noreceipt'] === TRUE) ? 0 : NULL);
$emailReceipt);
} catch(Throwable $e) {
return civicrm_api3_create_error($e->getMessage());
}
......
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