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
97b5e77a
Commit
97b5e77a
authored
Mar 27, 2021
by
mattwire
Committed by
mattwire
Apr 10, 2021
Browse files
Set the 'payment_status' and add helper functions on doPayment()
parent
87476831
Changes
1
Hide whitespace changes
Inline
Side-by-side
CRM/Core/Payment/MJWTrait.php
View file @
97b5e77a
...
...
@@ -500,9 +500,11 @@ trait CRM_Core_Payment_MJWTrait {
* @throws \CiviCRM_API3_Exception
*/
protected
function
endDoPayment
(
$params
,
$contributionParams
=
[])
{
$contributionParams
[
'trxn_id'
]
=
$this
->
getPaymentProcessorOrderID
();
if
(
$this
->
getPaymentProcessorOrderID
())
{
$contributionParams
[
'trxn_id'
]
=
$this
->
getPaymentProcessorOrderID
();
}
if
(
isset
(
$params
[
'contributionID'
]))
{
if
(
isset
(
$params
[
'contributionID'
])
&&
!
empty
(
$contributionParams
)
)
{
$contributionParams
[
'id'
]
=
$params
[
'contributionID'
];
$contributionParams
[
'skipCleanMoney'
]
=
TRUE
;
$contributionParams
[
'skipRecentView'
]
=
TRUE
;
...
...
@@ -516,11 +518,38 @@ trait CRM_Core_Payment_MJWTrait {
// We need to set this to ensure that contributions are set to the correct status
// It should have already been set to "Completed" if we made a successful payment
if
(
empty
(
$params
[
'payment_status_id'
]))
{
$
params
[
'payment_status_id'
]
=
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_BAO_Contribution'
,
'contribution_status_id'
,
'Pending'
);
$
this
->
setStatusPaymentPending
(
$params
);
}
return
$params
;
}
/**
* Set the payment status to Pending
* @param array $params
*
* @return array
*/
protected
function
setStatusPaymentPending
(
array
$params
)
{
$params
[
'payment_status_id'
]
=
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_BAO_Contribution'
,
'contribution_status_id'
,
'Pending'
);
$params
[
'payment_status'
]
=
'Pending'
;
return
$params
;
}
/**
* Set the payment status to Completed
* @param $params
*
* @return array
*/
protected
function
setStatusPaymentCompleted
(
array
$params
)
{
$returnParams
[
'payment_status_id'
]
=
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_BAO_Contribution'
,
'contribution_status_id'
,
'Completed'
);
$returnParams
[
'payment_status'
]
=
'Completed'
;
return
$params
;
}
/**
* Get a "token" parameter that was inserted via javascript on the payment form (eg. paymentIntentID).
*
...
...
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