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
Container registry
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
9a515422
Commit
9a515422
authored
4 years ago
by
Rich
Committed by
mattwire
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add some comments to StripeIPN.php
parent
fb3a7c57
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!152
6.6 to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/Payment/StripeIPN.php
+14
-2
14 additions, 2 deletions
CRM/Core/Payment/StripeIPN.php
with
14 additions
and
2 deletions
CRM/Core/Payment/StripeIPN.php
+
14
−
2
View file @
9a515422
...
...
@@ -220,7 +220,7 @@ class CRM_Core_Payment_StripeIPN {
// We have not received this webhook before.
// Some webhooks we always add to the queue and do not process immediately (eg. invoice.finalized)
if
(
in_array
(
$this
->
eventType
,
CRM_Stripe_Webhook
::
getDelayProcessingEvents
()))
{
// Process the webhook immediately.
// Process the webhook immediately.
@todo is this comment correct? surely it means do NOT process webhook immediately?
$processWebhook
=
FALSE
;
}
}
...
...
@@ -313,6 +313,7 @@ class CRM_Core_Payment_StripeIPN {
// An invoice has been created and finalized (ready for payment)
// This usually happens automatically through a Stripe subscription
if
(
!
$this
->
setInfo
())
{
// Unable to find a Contribution.
if
(
!
$this
->
contribution_recur_id
)
{
// We don't have a matching contribution or a recurring contribution - this was probably created outside of CiviCRM
// @todo In the future we may want to match the customer->contactID and create a contribution to match.
...
...
@@ -339,8 +340,15 @@ class CRM_Core_Payment_StripeIPN {
case
'invoice.payment_succeeded'
:
// Successful recurring payment. Either we are completing an existing contribution or it's the next one in a subscription
//
// We *normally/ideally* expect to be able to find the contribution via setInfo(),
// since the logical order of events would be invoice.finalized first which
// creates a contribution; then invoice.payment_succeeded following, which would
// find it.
if
(
!
$this
->
setInfo
())
{
// We were unable to locate the Contribution; it could be the next one in a subscription.
if
(
!
$this
->
contribution_recur_id
)
{
// Hmmm. We could not find the contribution recur record either. Silently ignore this event(!)
return
TRUE
;
}
else
{
...
...
@@ -405,6 +413,7 @@ class CRM_Core_Payment_StripeIPN {
}
if
(
!
$this
->
setInfo
())
{
// We could not find this contribution.
return
TRUE
;
}
$params
=
[
...
...
@@ -541,7 +550,7 @@ class CRM_Core_Payment_StripeIPN {
* as much as we can about this event and set that information as
* properties to be used later.
*
* @return bool
* @return bool
TRUE if we were able to find a contribution (via getContribution)
* @throws \CRM_Core_Exception
*/
public
function
setInfo
()
{
...
...
@@ -628,6 +637,7 @@ class CRM_Core_Payment_StripeIPN {
}
// B2) Contribution linked to subscription and we have invoice_id
// @todo there is a case where $contribution is not defined (i.e. if charge_id is empty)
if
(
!
$contribution
[
'count'
])
{
unset
(
$paymentParams
[
'trxn_id'
]);
if
(
!
empty
(
$this
->
invoice_id
))
{
...
...
@@ -637,6 +647,7 @@ class CRM_Core_Payment_StripeIPN {
}
// B1) Contribution linked to subscription and we have subscription_id
// @todo there is a case where $contribution is not defined (i.e. if charge_id, invoice_id are empty)
if
(
!
$contribution
[
'count'
])
{
unset
(
$paymentParams
[
'trxn_id'
]);
if
(
!
empty
(
$this
->
subscription_id
))
{
...
...
@@ -645,6 +656,7 @@ class CRM_Core_Payment_StripeIPN {
}
}
// @todo there is a case where $contribution is not defined (i.e. if charge_id, invoice_id, subscription_id are empty)
if
(
!
$contribution
[
'count'
])
{
if
((
bool
)
\Civi
::
settings
()
->
get
(
'stripe_ipndebug'
))
{
$message
=
$this
->
_paymentProcessor
->
getPaymentProcessorLabel
()
.
'No matching contributions for event '
.
$this
->
getEventID
();
...
...
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