Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
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
Rich
Stripe
Commits
dcda399d
Commit
dcda399d
authored
6 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Log IPN exceptions
parent
9dfdea12
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/Payment/StripeIPN.php
+12
-7
12 additions, 7 deletions
CRM/Core/Payment/StripeIPN.php
with
12 additions
and
7 deletions
CRM/Core/Payment/StripeIPN.php
+
12
−
7
View file @
dcda399d
...
...
@@ -68,7 +68,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
*/
public
function
setInputParameters
(
$parameters
)
{
if
(
empty
(
$parameters
)
||
!
is_object
(
$parameters
)
||
empty
(
$parameters
->
id
))
{
th
row
new
CRM_Core_E
xception
(
'Invalid input parameters. Should be an object with an id parameter
.
'
);
$
th
is
->
e
xception
(
'Invalid input parameters. Should be an object with an id parameter'
);
}
// Determine the proper Stripe Processor ID so we can get the secret key
...
...
@@ -76,7 +76,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// The $_GET['processor_id'] value is set by CRM_Core_Payment::handlePaymentMethod.
if
(
!
array_key_exists
(
'processor_id'
,
$_GET
)
||
empty
(
$_GET
[
'processor_id'
]))
{
th
row
new
CRM_Core_E
xception
(
'Cannot determine processor id.'
);
$
th
is
->
e
xception
(
'Cannot determine processor id.'
);
}
$this
->
ppid
=
$_GET
[
'processor_id'
];
...
...
@@ -86,7 +86,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
$this
->
secret_key
=
civicrm_api3
(
'PaymentProcessor'
,
'getvalue'
,
$params
);
}
catch
(
Exception
$e
)
{
th
row
new
CRM_Core_E
xception
(
'Failed to get Stripe secret key
.
'
);
$
th
is
->
e
xception
(
'Failed to get Stripe secret key'
);
}
// Now re-retrieve the data from Stripe to ensure it's legit.
...
...
@@ -185,7 +185,8 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
}
$value
=
CRM_Utils_Type
::
validate
(
$value
,
$type
,
FALSE
);
if
(
$abort
&&
$value
===
NULL
)
{
throw
new
CRM_Core_Exception
(
"Could not find an entry for '
$name
'."
);
echo
"Failure: Missing Parameter<p>"
.
CRM_Utils_Type
::
escape
(
$name
,
'String'
);
$this
->
exception
(
"Could not find an entry for
$name
"
);
}
return
$value
;
}
...
...
@@ -208,7 +209,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// If it's not a match, something is wrong (since when we update a plan, we generate a whole
// new recurring contribution).
if
(
$this
->
previous_contribution_total_amount
!=
$this
->
amount
)
{
th
row
new
CRM_Core_E
xception
(
"Subscription amount mismatch. I have "
.
$this
->
amount
.
" and I expect "
.
$this
->
previous_contribution_total_amount
.
"."
);
$
th
is
->
e
xception
(
"Subscription amount mismatch. I have "
.
$this
->
amount
.
" and I expect "
.
$this
->
previous_contribution_total_amount
);
}
if
(
$this
->
previous_contribution_status_id
==
$pendingStatusId
)
{
...
...
@@ -488,7 +489,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
}
}
catch
(
Exception
$e
)
{
th
row
new
CRM_Core_E
xception
(
'Cannot get contribution amounts
from Stripe.
'
);
$
th
is
->
e
xception
(
'Cannot get contribution amounts'
);
}
}
else
{
// The customer had a credit on their subscription from a downgrade or gift card.
...
...
@@ -538,7 +539,7 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// This is an unrecoverable error - without a contribution_recur record
// there is nothing we can do with an invoice.payment_succeeded
// event.
th
row
new
CRM_Core_E
xception
(
'I cannot find contribution_recur record for subscription: '
.
$this
->
subscription_id
);
$
th
is
->
e
xception
(
'I cannot find contribution_recur record for subscription: '
.
$this
->
subscription_id
);
}
}
...
...
@@ -584,4 +585,8 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
}
}
public
function
exception
(
$message
)
{
Civi
::
log
()
->
debug
(
"StripeIPN:
$message
"
);
throw
new
CRM_Core_Exception
(
"StripeIPN:
$message
"
);
}
}
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