Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
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
Stripe
Commits
d272c178
Commit
d272c178
authored
6 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
#19
Override subscriptionUrl so we can define which links to show in email for self-service
parent
64a56d56
No related branches found
No related tags found
1 merge request
!12
#19 Override subscriptionUrl so we can define which links to show in email for self-service
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/Payment/Stripe.php
+83
-0
83 additions, 0 deletions
CRM/Core/Payment/Stripe.php
with
83 additions
and
0 deletions
CRM/Core/Payment/Stripe.php
+
83
−
0
View file @
d272c178
...
...
@@ -926,5 +926,88 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
))));
}
/**
* Get url for users to manage this recurring contribution for this processor.
*
* @param int $entityID
* @param null $entity
* @param string $action
*
* @return string
*/
public
function
subscriptionURL
(
$entityID
=
NULL
,
$entity
=
NULL
,
$action
=
'cancel'
)
{
// Set URL
switch
(
$action
)
{
case
'cancel'
:
if
(
!
$this
->
supports
(
'cancelRecurring'
))
{
return
NULL
;
}
$url
=
'civicrm/contribute/unsubscribe'
;
break
;
case
'billing'
:
//in notify mode don't return the update billing url
if
(
!
$this
->
supports
(
'updateSubscriptionBillingInfo'
))
{
return
NULL
;
}
$url
=
'civicrm/contribute/updatebilling'
;
break
;
case
'update'
:
if
(
!
$this
->
supports
(
'changeSubscriptionAmount'
)
&&
!
$this
->
supports
(
'editRecurringContribution'
))
{
return
NULL
;
}
$url
=
'civicrm/contribute/updaterecur'
;
break
;
}
$userId
=
CRM_Core_Session
::
singleton
()
->
get
(
'userID'
);
$contactID
=
0
;
$checksumValue
=
''
;
$entityArg
=
''
;
// Find related Contact
if
(
$entityID
)
{
switch
(
$entity
)
{
case
'membership'
:
$contactID
=
CRM_Core_DAO
::
getFieldValue
(
"CRM_Member_DAO_Membership"
,
$entityID
,
"contact_id"
);
$entityArg
=
'mid'
;
break
;
case
'contribution'
:
$contactID
=
CRM_Core_DAO
::
getFieldValue
(
"CRM_Contribute_DAO_Contribution"
,
$entityID
,
"contact_id"
);
$entityArg
=
'coid'
;
break
;
case
'recur'
:
$sql
=
"
SELECT DISTINCT con.contact_id
FROM civicrm_contribution_recur rec
INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
WHERE rec.id = %1"
;
$contactID
=
CRM_Core_DAO
::
singleValueQuery
(
$sql
,
array
(
1
=>
array
(
$entityID
,
'Integer'
)));
$entityArg
=
'crid'
;
break
;
}
}
// Add entity arguments
if
(
$entityArg
!=
''
)
{
// Add checksum argument
if
(
$contactID
!=
0
&&
$userId
!=
$contactID
)
{
$checksumValue
=
'&cs='
.
CRM_Contact_BAO_Contact_Utils
::
generateChecksum
(
$contactID
,
NULL
,
'inf'
);
}
return
CRM_Utils_System
::
url
(
$url
,
"reset=1&
{
$entityArg
}
=
{
$entityID
}{
$checksumValue
}
"
,
TRUE
,
NULL
,
FALSE
,
TRUE
);
}
// Else login URL
if
(
$this
->
supports
(
'accountLoginURL'
))
{
return
$this
->
accountLoginURL
();
}
// Else default
return
isset
(
$this
->
_paymentProcessor
[
'url_recur'
])
?
$this
->
_paymentProcessor
[
'url_recur'
]
:
''
;
}
}
This diff is collapsed.
Click to expand it.
mattwire
@mattwire
mentioned in issue
#9 (closed)
·
6 years ago
mentioned in issue
#9 (closed)
mentioned in issue #9
Toggle commit list
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