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
4df2ca40
Commit
4df2ca40
authored
6 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Don't try and get parameters for IPNs that we ignore
parent
8d881f9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!9
5.1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Payment/Stripe.php
+1
-1
1 addition, 1 deletion
CRM/Core/Payment/Stripe.php
CRM/Core/Payment/StripeIPN.php
+8
-2
8 additions, 2 deletions
CRM/Core/Payment/StripeIPN.php
with
9 additions
and
3 deletions
CRM/Core/Payment/Stripe.php
+
1
−
1
View file @
4df2ca40
...
@@ -568,7 +568,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
...
@@ -568,7 +568,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
else
{
else
{
// Don't have return url - return error object to api
// Don't have return url - return error object to api
$core_err
=
CRM_Core_Error
::
singleton
();
$core_err
=
CRM_Core_Error
::
singleton
();
$core_err
->
push
(
9000
,
0
,
NULL
,
'Stripe transaction response not rec
i
eved! Check the Logs section of your stripe.com account.'
);
$core_err
->
push
(
9000
,
0
,
NULL
,
'Stripe transaction response not rece
i
ved! Check the Logs section of your stripe.com account.'
);
return
$core_err
;
return
$core_err
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/Payment/StripeIPN.php
+
8
−
2
View file @
4df2ca40
...
@@ -198,13 +198,14 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
...
@@ -198,13 +198,14 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
*/
*/
public
function
main
()
{
public
function
main
()
{
// Collect and determine all data about this event.
// Collect and determine all data about this event.
$this
->
setInfo
(
);
$this
->
event_type
=
$this
->
retrieve
(
'event_type'
,
'String'
);
$pendingStatusId
=
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_BAO_Contribution'
,
'contribution_status_id'
,
'Pending'
);
$pendingStatusId
=
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_BAO_Contribution'
,
'contribution_status_id'
,
'Pending'
);
switch
(
$this
->
event_type
)
{
switch
(
$this
->
event_type
)
{
// Successful recurring payment.
// Successful recurring payment.
case
'invoice.payment_succeeded'
:
case
'invoice.payment_succeeded'
:
$this
->
setInfo
();
// Lets do a check to make sure this payment has the amount same as that of first contribution.
// Lets do a check to make sure this payment has the amount same as that of first contribution.
// If it's not a match, something is wrong (since when we update a plan, we generate a whole
// If it's not a match, something is wrong (since when we update a plan, we generate a whole
// new recurring contribution).
// new recurring contribution).
...
@@ -273,6 +274,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
...
@@ -273,6 +274,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// Failed recurring payment.
// Failed recurring payment.
case
'invoice.payment_failed'
:
case
'invoice.payment_failed'
:
$this
->
setInfo
();
$fail_date
=
date
(
"Y-m-d H:i:s"
);
$fail_date
=
date
(
"Y-m-d H:i:s"
);
if
(
$this
->
previous_contribution_status_id
==
$pendingStatusId
)
{
if
(
$this
->
previous_contribution_status_id
==
$pendingStatusId
)
{
...
@@ -316,6 +318,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
...
@@ -316,6 +318,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// Subscription is cancelled
// Subscription is cancelled
case
'customer.subscription.deleted'
:
case
'customer.subscription.deleted'
:
$this
->
setInfo
();
// Cancel the recurring contribution
// Cancel the recurring contribution
civicrm_api3
(
'ContributionRecur'
,
'cancel'
,
array
(
civicrm_api3
(
'ContributionRecur'
,
'cancel'
,
array
(
'id'
=>
$this
->
contribution_recur_id
,
'id'
=>
$this
->
contribution_recur_id
,
...
@@ -332,12 +335,15 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
...
@@ -332,12 +335,15 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// One-time donation and per invoice payment.
// One-time donation and per invoice payment.
case
'charge.succeeded'
:
case
'charge.succeeded'
:
//$this->setInfo();
// TODO: Implement this so we can mark payments as failed?
// Not implemented.
// Not implemented.
return
TRUE
;
return
TRUE
;
// Subscription is updated. Delete existing recurring contribution and start a fresh one.
// Subscription is updated. Delete existing recurring contribution and start a fresh one.
// This tells a story to site admins over editing a recurring contribution record.
// This tells a story to site admins over editing a recurring contribution record.
case
'customer.subscription.updated'
:
case
'customer.subscription.updated'
:
$this
->
setInfo
();
if
(
empty
(
$this
->
previous_plan_id
))
{
if
(
empty
(
$this
->
previous_plan_id
))
{
// Not a plan change...don't care.
// Not a plan change...don't care.
return
TRUE
;
return
TRUE
;
...
@@ -428,6 +434,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
...
@@ -428,6 +434,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// Keep plans table in sync with Stripe when a plan is deleted.
// Keep plans table in sync with Stripe when a plan is deleted.
case
'plan.deleted'
:
case
'plan.deleted'
:
$this
->
setInfo
();
$is_live
=
$this
->
test_mode
==
1
?
0
:
1
;
$is_live
=
$this
->
test_mode
==
1
?
0
:
1
;
$query_params
=
array
(
$query_params
=
array
(
1
=>
array
(
$this
->
plan_id
,
'String'
),
1
=>
array
(
$this
->
plan_id
,
'String'
),
...
@@ -454,7 +461,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
...
@@ -454,7 +461,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
* @throws \CiviCRM_API3_Exception
* @throws \CiviCRM_API3_Exception
*/
*/
public
function
setInfo
()
{
public
function
setInfo
()
{
$this
->
event_type
=
$this
->
retrieve
(
'event_type'
,
'String'
);
$this
->
test_mode
=
$this
->
retrieve
(
'test_mode'
,
'Integer'
);
$this
->
test_mode
=
$this
->
retrieve
(
'test_mode'
,
'Integer'
);
$abort
=
FALSE
;
$abort
=
FALSE
;
...
...
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