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
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
mjwshared
Commits
ec977235
Commit
ec977235
authored
4 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Convert beginDoPayment and getRecurringContributionId to use payment propertyBag
parent
e2039573
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!9
0.9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/Payment/MJWTrait.php
+28
-32
28 additions, 32 deletions
CRM/Core/Payment/MJWTrait.php
with
28 additions
and
32 deletions
CRM/Core/Payment/MJWTrait.php
+
28
−
32
View file @
ec977235
...
...
@@ -144,39 +144,29 @@ trait CRM_Core_Payment_MJWTrait {
}
/**
* Get the recurring contribution ID from parameters passed in to cancelSubscription
* Historical the data passed to cancelSubscription is pretty poor and doesn't include much!
* @todo Remove once CiviCRM minver = 5.25 (https://github.com/civicrm/civicrm-core/pull/16741)
* Get the recurring contribution ID from parameters
*
* @param
array $params
* @param
\Civi\Payment\PropertyBag $propertyBag
*
* @return int|null
*/
protected
function
getRecurringContributionId
(
$params
)
{
// contribution_recur_id = Not yet passed, but could be added via core PR
// contributionRecurID = backend live contribution
$contributionRecurId
=
$params
[
'contribution_recur_id'
]
??
$params
[
'contributionRecurID'
]
??
NULL
;
if
(
!
empty
(
$contributionRecurId
))
{
return
$contributionRecurId
;
protected
function
getRecurringContributionId
(
\Civi\Payment\PropertyBag
$propertyBag
)
{
if
(
$propertyBag
->
has
(
'contributionRecurID'
))
{
return
$propertyBag
->
getContributionRecurID
();
}
// Not yet passed, but could be added via core PR
$contributionId
=
$params
[
'contribution_id'
]
??
NULL
;
try
{
return
(
int
)
civicrm_api3
(
'Contribution'
,
'getvalue'
,
[
'id'
=>
$contributionId
,
'return'
=>
'contribution_recur_id'
]);
if
(
$propertyBag
->
has
(
'contributionID'
))
{
return
(
int
)
civicrm_api3
(
'Contribution'
,
'getvalue'
,
[
'id'
=>
$propertyBag
->
getContributionID
(),
'return'
=>
'contribution_recur_id'
]);
}
catch
(
Exception
$e
)
{
$subscriptionId
=
$params
[
'subscriptionId'
]
??
NULL
;
if
(
!
empty
(
$subscriptionId
))
{
try
{
return
(
int
)
civicrm_api3
(
'ContributionRecur'
,
'getvalue'
,
[
'processor_id'
=>
$subscriptionId
,
'return'
=>
'id'
]);
}
catch
(
Exception
$e
)
{
return
NULL
;
}
}
return
NULL
;
if
(
$propertyBag
->
has
(
'processorID'
))
{
$propertyBag
->
getRecurProcessorID
();
return
(
int
)
civicrm_api3
(
'ContributionRecur'
,
'getvalue'
,
[
'processor_id'
=>
$propertyBag
->
getRecurProcessorID
(),
'return'
=>
'id'
]);
}
return
NULL
;
}
/**
...
...
@@ -435,20 +425,26 @@ trait CRM_Core_Payment_MJWTrait {
}
/**
* @param \Civi\Payment\PropertyBag $p
arams
* @param \Civi\Payment\PropertyBag $p
ropertyBag
*
* @return \Civi\Payment\PropertyBag
*/
protected
function
beginDoPayment
(
$p
arams
)
{
protected
function
beginDoPayment
(
$p
ropertyBag
)
{
// This currently doesn't have a default (5.27). Should be fixed in a future version of CiviCRM.
if
(
!
$params
->
has
(
'isRecur'
))
{
$params
->
setIsRecur
(
FALSE
);
if
(
!
$propertyBag
->
has
(
'isRecur'
))
{
$propertyBag
->
setIsRecur
(
FALSE
);
}
// Make sure we have a description for the contribution
if
(
!
$propertyBag
->
has
(
'description'
))
{
$propertyBag
->
setDescription
(
E
::
ts
(
'Contribution: %1'
,
[
1
=>
$this
->
getPaymentProcessorLabel
()]));
}
$params
->
setCustomProperty
(
'error_url'
,
$this
->
getErrorUrl
(
$params
));
$propertyBag
->
setCustomProperty
(
'error_url'
,
$this
->
getErrorUrl
(
$propertyBag
));
// Make sure we have a contactID set on propertyBag
$this
->
getContactId
(
$p
arams
);
return
$p
arams
;
$this
->
getContactId
(
$p
ropertyBag
);
return
$p
ropertyBag
;
}
/**
...
...
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