Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sluc23
mjwshared
Commits
87476831
Commit
87476831
authored
Mar 19, 2021
by
Rich
Committed by
mattwire
Apr 10, 2021
Browse files
Add handleErrorThrowsException option (to help with testing)
parent
e27c7746
Changes
2
Hide whitespace changes
Inline
Side-by-side
CRM/Core/Payment/MJWTrait.php
View file @
87476831
...
...
@@ -36,6 +36,11 @@ trait CRM_Core_Payment_MJWTrait {
*/
private
$paymentProcessorSubscriptionID
;
/**
* @var bool Throw an exception in handleError.
*/
public
$handleErrorThrowsException
=
FALSE
;
/**
* Get the billing email address
*
...
...
@@ -354,6 +359,10 @@ trait CRM_Core_Payment_MJWTrait {
$message
=
$errorCode
.
$errorMessage
;
Civi
::
log
()
->
error
(
$this
->
getPaymentTypeLabel
()
.
' Payment Error: '
.
$message
);
if
(
$this
->
handleErrorThrowsException
)
{
// We're in a test environment. Throw exception.
throw
new
\
Exception
(
'Exception thrown to avoid statusBounce because handleErrorThrowsException is set.'
.
$message
);
}
if
(
$bounceURL
)
{
CRM_Core_Error
::
statusBounce
(
$message
,
$bounceURL
,
$this
->
getPaymentTypeLabel
());
...
...
@@ -370,6 +379,13 @@ trait CRM_Core_Payment_MJWTrait {
return
$this
->
_paymentProcessor
[
'name'
];
}
/**
* Allow (phpunit test code) to configure handleError to throw an exception,
* thereby avoiding a statusBounce which is hard to deal with in tests.
*/
public
function
setHandleErrorThrowsException
(
bool
$value
)
{
$this
->
handleErrorThrowsException
=
$value
;
}
/**
* Set the payment processor Transaction ID
*
...
...
docs/releasenotes.md
View file @
87476831
...
...
@@ -17,6 +17,7 @@ Releases use the following numbering system:
*
IPN data can be array, object or string.
*
Clear cancel_date when setting a contribution back to pending.
*
Support CiviCRM multi-domain (add default domain to API calls).
*
Add
`handleErrorThrowsException`
option to MJWTrait (to help with testing).
## Release 0.9.12
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment