Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stripe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
Stripe
Commits
a47ed634
Commit
a47ed634
authored
6 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Use the parameter on the recurring contribution to decide whether to send out email receipts
parent
e99172ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!21
Use the parameter on the recurring contribution to decide whether to send out email receipts
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Payment/StripeIPN.php
+50
-2
50 additions, 2 deletions
CRM/Core/Payment/StripeIPN.php
api/v3/Stripe/Ipn.php
+5
-0
5 additions, 0 deletions
api/v3/Stripe/Ipn.php
with
55 additions
and
2 deletions
CRM/Core/Payment/StripeIPN.php
+
50
−
2
View file @
a47ed634
...
...
@@ -20,6 +20,13 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// testing, we can properly test a failed recurring contribution.
protected
$verify_event
=
TRUE
;
/**
* Do we send an email receipt for each contribution?
*
* @var int
*/
protected
$is_email_receipt
=
NULL
;
// Properties of the event.
protected
$event_type
=
NULL
;
protected
$subscription_id
=
NULL
;
...
...
@@ -57,6 +64,47 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
parent
::
__construct
();
}
/**
* Set the value of is_email_receipt to use when a new contribution is received for a recurring contribution
* This is used for the API Stripe.Ipn function. If not set, we respect the value set on the ContributionRecur entity.
*
* @param int $sendReceipt The value of is_email_receipt
*/
public
function
setSendEmailReceipt
(
$sendReceipt
)
{
switch
(
$sendReceipt
)
{
case
0
:
$this
->
is_email_receipt
=
0
;
break
;
case
1
:
$this
->
is_email_receipt
=
1
;
break
;
default
:
$this
->
is_email_receipt
=
0
;
}
}
/**
* Get the value of is_email_receipt to use when a new contribution is received for a recurring contribution
* This is used for the API Stripe.Ipn function. If not set, we respect the value set on the ContributionRecur entity.
*
* @return int
* @throws \CiviCRM_API3_Exception
*/
public
function
getSendEmailReceipt
()
{
if
(
isset
(
$this
->
is_email_receipt
))
{
return
(
int
)
$this
->
is_email_receipt
;
}
if
(
!
empty
(
$this
->
contribution_recur_id
))
{
$this
->
is_email_receipt
=
civicrm_api3
(
'ContributionRecur'
,
'getvalue'
,
[
'return'
=>
[
"is_email_receipt"
],
'id'
=>
$this
->
contribution_recur_id
,
]);
}
return
(
int
)
$this
->
is_email_receipt
;
}
/**
* Store input array on the class.
* We override base because our input parameter is an object
...
...
@@ -236,7 +284,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
'trxn_id'
=>
$this
->
charge_id
,
'total_amount'
=>
$this
->
amount
,
'fee_amount'
=>
$this
->
fee
,
'is_email_receipt'
=>
0
,
'is_email_receipt'
=>
$this
->
getSendEmailReceipt
()
,
));
}
...
...
@@ -391,7 +439,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
'net_amount'
=>
$this
->
net_amount
,
'fee_amount'
=>
$this
->
fee
,
'payment_processor_id'
=>
$this
->
_paymentProcessor
[
'id'
],
'is_email_receipt'
=>
0
,
'is_email_receipt'
=>
$this
->
getSendEmailReceipt
()
,
));
}
...
...
This diff is collapsed.
Click to expand it.
api/v3/Stripe/Ipn.php
+
5
−
0
View file @
a47ed634
...
...
@@ -23,6 +23,8 @@ 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'
]
=
0
;
}
/**
...
...
@@ -77,6 +79,9 @@ function civicrm_api3_stripe_Ipn($params) {
$_GET
[
'processor_id'
]
=
$ppid
;
$ipnClass
=
new
CRM_Core_Payment_StripeIPN
(
$object
);
$ipnClass
->
main
();
if
(
$params
[
'noreceipt'
]
==
1
)
{
$ipnClass
->
setSendEmailReceipt
(
0
);
}
}
else
{
trigger_error
(
"The api depends on CRM_Core_Payment_StripeIPN"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment