Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mjwshared
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
wmortada
mjwshared
Commits
520b5faf
Commit
520b5faf
authored
5 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Tweaks to support Stripe 6.2
parent
bda55b89
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Payment/MJWTrait.php
+12
-53
12 additions, 53 deletions
CRM/Core/Payment/MJWTrait.php
info.xml
+2
-2
2 additions, 2 deletions
info.xml
with
14 additions
and
55 deletions
CRM/Core/Payment/MJWTrait.php
+
12
−
53
View file @
520b5faf
...
...
@@ -130,8 +130,13 @@ trait CRM_Core_Payment_MJWTrait {
* contributionID is set in the contribution workflow
* We do NOT have a contribution ID for event and membership payments as they are created after payment!
* See: https://github.com/civicrm/civicrm-core/pull/13763 (for events)
*
* Following https://github.com/civicrm/civicrm-core/pull/15477 we are passing contribution_id via the
* PaymentProcessor.Pay API and this is the preferred format.
* Historically most places passed contributionID.
*/
return
CRM_Utils_Array
::
value
(
'contributionID'
,
$params
);
return
CRM_Utils_Array
::
value
(
'contribution_id'
,
$params
,
CRM_Utils_Array
::
value
(
'contributionID'
,
$params
));
}
/**
...
...
@@ -503,62 +508,16 @@ trait CRM_Core_Payment_MJWTrait {
* @throws \CRM_Core_Exception
*/
protected
function
getTokenParameter
(
$parameterName
,
$params
,
$required
=
TRUE
)
{
// Get the passed in parameter
$parameterValue
=
NULL
;
if
(
!
empty
(
CRM_Utils_Array
::
value
(
$parameterName
,
$params
)))
{
$parameterValue
=
CRM_Utils_Array
::
value
(
$parameterName
,
$params
);
// If we stored it via pre_approval_parameters it should already be in the params array
if
(
!
empty
(
$params
[
$parameterName
]))
{
return
$params
;
}
elseif
(
CRM_Core_Session
::
singleton
()
->
get
(
$parameterName
))
{
// @fixme Hack for contributionpages - see https://github.com/civicrm/civicrm-core/pull/15252
$parameterValue
=
CRM_Core_Session
::
singleton
()
->
get
(
$parameterName
);
CRM_Core_Session
::
singleton
()
->
set
(
$parameterName
,
NULL
);
}
elseif
(
CRM_Utils_Request
::
retrieve
(
$parameterName
,
'String'
))
{
$parameterValue
=
CRM_Utils_Request
::
retrieve
(
$parameterName
,
'String'
);
}
if
(
empty
(
$parameterValue
)
&&
$required
)
{
// If we're submitting without a confirmation page it should be in the $_POST array
$params
[
$parameterName
]
=
CRM_Utils_Request
::
retrieve
(
$parameterName
,
'String'
);
if
(
empty
(
$params
[
$parameterName
])
&&
$required
)
{
Civi
::
log
()
->
debug
(
"
{
$parameterName
}
not found.
\$
params: "
.
print_r
(
$params
,
TRUE
));
CRM_Core_Error
::
statusBounce
(
E
::
ts
(
'Unable to complete payment! Missing %1.'
,
[
1
=>
$parameterName
]));
}
$params
[
$parameterName
]
=
$parameterValue
;
return
$params
;
}
/**
* Given a submitted form, retrieve a parameter that was added via (an input element added by) javascript.
* Save the parameter in the params array for the form so it's accessible at the end of a multi-page form.
*
* @param string $parameterName
* @param \CRM_Core_Form $form
*
* @throws \CRM_Core_Exception
*/
public
static
function
setTokenParameter
(
$parameterName
,
&
$form
)
{
// Retrieve the parameterValue that was posted along with the form and add it to the form params
// This allows multi-page checkout to work (eg. register->confirm->thankyou)
$params
=
$form
->
get
(
'params'
);
if
(
!
$params
)
{
// @fixme Hack for contributionpages - see https://github.com/civicrm/civicrm-core/pull/15252
$params
=
$form
->
getVar
(
'_params'
);
}
if
(
isset
(
$params
[
'amount'
]))
{
// Contribution pages have params directly in the main array
$paymentParams
=
&
$params
;
}
elseif
(
isset
(
$params
[
0
][
'amount'
]))
{
// Event registration pages have params in a sub-array
$paymentParams
=
&
$params
[
0
];
}
else
{
return
;
}
$parameterValue
=
CRM_Utils_Request
::
retrieveValue
(
$parameterName
,
'String'
);
if
(
$parameterValue
)
{
$paymentParams
[
$parameterName
]
=
$parameterValue
;
$form
->
set
(
'params'
,
$params
);
// @fixme Hack for contributionpages - see https://github.com/civicrm/civicrm-core/pull/15252
CRM_Core_Session
::
singleton
()
->
set
(
$parameterName
,
$parameterValue
);
}
}
}
This diff is collapsed.
Click to expand it.
info.xml
+
2
−
2
View file @
520b5faf
...
...
@@ -13,8 +13,8 @@
<url
desc=
"Support"
>
https://www.mjwconsult.co.uk
</url>
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
2019-
09-25
</releaseDate>
<version>
0.4.
4
</version>
<releaseDate>
2019-
10-14
</releaseDate>
<version>
0.4.
5
</version>
<develStage>
stable
</develStage>
<compatibility>
<ver>
5.13
</ver>
...
...
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