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
Merge requests
!149
Retrieve subscriptionID so we don't process charge.failed/invoice.payment_failed simultaneously
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Retrieve subscriptionID so we don't process charge.failed/invoice.payment_failed simultaneously
chargeinvoicefailed
into
6.6
Overview
3
Commits
1
Pipelines
0
Changes
1
Merged
mattwire
requested to merge
chargeinvoicefailed
into
6.6
3 years ago
Overview
3
Commits
1
Pipelines
0
Changes
1
Expand
@jamie
Does this fix
#282 (closed)
for you?
0
0
Merge request reports
Compare
6.6
version 1
774752dd
3 years ago
6.6 (base)
and
latest version
latest version
891cc7cd
1 commit,
3 years ago
version 1
774752dd
1 commit,
3 years ago
1 file
+
22
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
CRM/Core/Payment/StripeIPN.php
+
22
−
3
Options
@@ -114,13 +114,32 @@ class CRM_Core_Payment_StripeIPN {
$this
->
setData
(
$event
->
data
);
}
if
(
!
is_object
(
$this
->
getData
()))
{
$data
=
$this
->
getData
();
if
(
!
is_object
(
$data
))
{
$this
->
exception
(
'Invalid input data (not an object)'
);
}
$this
->
invoice_id
=
$this
->
retrieve
(
'invoice_id'
,
'String'
,
FALSE
);
// When we receive a charge.X webhook event and it has an invoice ID we expand the invoice object
// so that we have the subscription ID.
// We'll receive both invoice.payment_succeeded/failed and charge.succeeded/failed at the same time
// and we need to make sure we don't process them at the same time or we can get deadlocks/race conditions
// that cause processing to fail.
if
((
$data
->
object
instanceof
\Stripe\Charge
)
&&
!
empty
(
$data
->
object
->
invoice
))
{
$data
->
object
=
$this
->
_paymentProcessor
->
stripeClient
->
charges
->
retrieve
(
$this
->
getData
()
->
object
->
id
,
[
'expand'
=>
[
'invoice'
]]
);
$this
->
setData
(
$data
);
$this
->
subscription_id
=
CRM_Stripe_Api
::
getObjectParam
(
'subscription_id'
,
$this
->
getData
()
->
object
->
invoice
);
$this
->
invoice_id
=
CRM_Stripe_Api
::
getObjectParam
(
'invoice_id'
,
$this
->
getData
()
->
object
->
invoice
);
}
else
{
$this
->
subscription_id
=
$this
->
retrieve
(
'subscription_id'
,
'String'
,
FALSE
);
$this
->
invoice_id
=
$this
->
retrieve
(
'invoice_id'
,
'String'
,
FALSE
);
}
$this
->
charge_id
=
$this
->
retrieve
(
'charge_id'
,
'String'
,
FALSE
);
$this
->
subscription_id
=
$this
->
retrieve
(
'subscription_id'
,
'String'
,
FALSE
);
$this
->
setInputParametersHasRun
=
TRUE
;
}
Loading