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
08bd426e
Commit
08bd426e
authored
4 years ago
by
mattwire
Committed by
mattwire
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove legacy code that supports CiviCRM <5.28
parent
999a30ce
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!152
6.6 to master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Payment/Stripe.php
+4
-53
4 additions, 53 deletions
CRM/Core/Payment/Stripe.php
js/civicrm_stripe.js
+0
-22
0 additions, 22 deletions
js/civicrm_stripe.js
with
4 additions
and
75 deletions
CRM/Core/Payment/Stripe.php
+
4
−
53
View file @
08bd426e
...
...
@@ -33,8 +33,6 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
*/
public
function
__construct
(
$mode
,
$paymentProcessor
)
{
$this
->
_paymentProcessor
=
$paymentProcessor
;
// @todo Remove once we drop support for CiviCRM < 5.27
$this
->
_processorName
=
E
::
SHORT_NAME
;
}
/**
...
...
@@ -1075,18 +1073,11 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
public
function
doCancelRecurring
(
\Civi\Payment\PropertyBag
$propertyBag
)
{
// By default we always notify the processor and we don't give the user the option
// because supportsCancelRecurringNotifyOptional() = FALSE
// @fixme setIsNotifyProcessorOnCancelRecur was added in 5.27 - remove method_exists once minVer is 5.27
if
(
method_exists
(
$propertyBag
,
'setIsNotifyProcessorOnCancelRecur'
))
{
if
(
!
$propertyBag
->
has
(
'isNotifyProcessorOnCancelRecur'
))
{
// If isNotifyProcessorOnCancelRecur is NOT set then we set our default
$propertyBag
->
setIsNotifyProcessorOnCancelRecur
(
TRUE
);
}
$notifyProcessor
=
$propertyBag
->
getIsNotifyProcessorOnCancelRecur
();
}
else
{
// CiviCRM < 5.27
$notifyProcessor
=
(
boolean
)
CRM_Utils_Request
::
retrieveValue
(
'send_cancel_request'
,
'Boolean'
,
TRUE
,
FALSE
,
'POST'
);
if
(
!
$propertyBag
->
has
(
'isNotifyProcessorOnCancelRecur'
))
{
// If isNotifyProcessorOnCancelRecur is NOT set then we set our default
$propertyBag
->
setIsNotifyProcessorOnCancelRecur
(
TRUE
);
}
$notifyProcessor
=
$propertyBag
->
getIsNotifyProcessorOnCancelRecur
();
if
(
!
$notifyProcessor
)
{
return
[
'message'
=>
E
::
ts
(
'Successfully cancelled the subscription in CiviCRM ONLY.'
)];
...
...
@@ -1115,46 +1106,6 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
return
[
'message'
=>
E
::
ts
(
'Successfully cancelled the subscription at Stripe.'
)];
}
/**
* Attempt to cancel the subscription.
* @deprecated Remove when min CiviCRM version is 5.25
*
* @see supportsCancelRecurring()
*
* @param string $message
* @param array|\Civi\Payment\PropertyBag $params
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
public
function
cancelSubscription
(
&
$message
=
''
,
$params
=
[])
{
$propertyBag
=
\Civi\Payment\PropertyBag
::
cast
(
$params
);
// Fix Unknown property 'subscriptionId' (for < 5.25)
// @see https://lab.civicrm.org/extensions/stripe/-/issues/234
if
(
version_compare
(
CRM_Utils_System
::
version
(),
'5.25'
,
'<'
))
{
if
(
isset
(
$params
[
'subscriptionId'
]))
{
$propertyBag
->
setRecurProcessorID
(
$params
[
'subscriptionId'
]);
}
}
if
(
!
$propertyBag
->
has
(
'recurProcessorID'
))
{
throw
new
\Civi\Payment\Exception\PaymentProcessorException
(
"cancelSubscription requires the recurProcessorID"
);
}
// contributionRecurID is set when doCancelRecurring is called directly (from 5.25)
if
(
!
$propertyBag
->
has
(
'contributionRecurID'
))
{
$contrib_recur
=
civicrm_api3
(
'ContributionRecur'
,
'getsingle'
,
[
'trxn_id'
=>
$propertyBag
->
getRecurProcessorID
(),
]);
$propertyBag
->
setContributionRecurID
(
$contrib_recur
[
'id'
]);
}
$message
=
$this
->
doCancelRecurring
(
$propertyBag
)[
'message'
];
return
TRUE
;
}
/**
* Process incoming payment notification (IPN).
*
...
...
This diff is collapsed.
Click to expand it.
js/civicrm_stripe.js
+
0
−
22
View file @
08bd426e
...
...
@@ -898,28 +898,6 @@
$
(
this
).
attr
(
'
name
'
,
name
.
replace
(
'
[
'
+
name
.
split
(
'
[
'
).
pop
(),
''
));
});
// @todo remove once min version is 5.28 (https://github.com/civicrm/civicrm-core/pull/17672)
var
is_for_organization
=
$
(
'
#is_for_organization
'
);
if
(
is_for_organization
.
length
)
{
setValidateOnBehalfOfBlock
();
is_for_organization
.
on
(
'
change
'
,
function
()
{
setValidateOnBehalfOfBlock
();
});
}
function
setValidateOnBehalfOfBlock
()
{
if
(
is_for_organization
.
is
(
'
:checked
'
))
{
$
(
'
#onBehalfOfOrg select.crm-select2
'
).
removeClass
(
'
crm-no-validate
'
);
}
else
{
$
(
'
#onBehalfOfOrg select.crm-select2
'
).
addClass
(
'
crm-no-validate
'
);
}
}
var
validator
=
$
(
form
).
validate
();
validator
.
settings
.
errorClass
=
'
crm-inline-error alert-danger
'
;
validator
.
settings
.
ignore
=
'
.select2-offscreen, [readonly], :hidden:not(.crm-select2), .crm-no-validate
'
;
validator
.
settings
.
ignoreTitle
=
true
;
// Default email validator accepts test@example but on test@example.org is valid (https://jqueryvalidation.org/jQuery.validator.methods/)
$
.
validator
.
methods
.
email
=
function
(
value
,
element
)
{
// Regex from https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
...
...
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