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
1c4061f4
Commit
1c4061f4
authored
5 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Add a minimum API version so we don't have problems every time Stripe release a new API version
parent
4e60f706
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!109
6.4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Core/Payment/Stripe.php
+2
-16
2 additions, 16 deletions
CRM/Core/Payment/Stripe.php
CRM/Stripe/Check.php
+13
-2
13 additions, 2 deletions
CRM/Stripe/Check.php
CRM/Stripe/Webhook.php
+2
-2
2 additions, 2 deletions
CRM/Stripe/Webhook.php
with
17 additions
and
20 deletions
CRM/Core/Payment/Stripe.php
+
2
−
16
View file @
1c4061f4
...
...
@@ -9,20 +9,8 @@ use CRM_Stripe_ExtensionUtil as E;
* Class CRM_Core_Payment_Stripe
*/
class
CRM_Core_Payment_Stripe
extends
CRM_Core_Payment
{
use
CRM_Core_Payment_MJWTrait
;
/**
* @var string
*/
const
API_VERSION
=
'2019-12-03'
;
/**
* @var string
*/
const
MIN_VERSION_MJWSHARED
=
'0.7'
;
/**
* Mode of operation: live or test.
*
...
...
@@ -30,9 +18,6 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
*/
protected
$_mode
=
NULL
;
public
static
function
getApiVersion
()
{
return
self
::
API_VERSION
;
}
/**
* Constructor
*
...
...
@@ -192,7 +177,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
// Set plugin info and API credentials.
\Stripe\Stripe
::
setAppInfo
(
'CiviCRM'
,
CRM_Utils_System
::
version
(),
CRM_Utils_System
::
baseURL
());
\Stripe\Stripe
::
setApiKey
(
self
::
getSecretKey
(
$this
->
_paymentProcessor
));
\Stripe\Stripe
::
setApiVersion
(
self
::
getApiVersion
()
);
\Stripe\Stripe
::
setApiVersion
(
CRM_Stripe_Check
::
API_VERSION
);
}
/**
...
...
@@ -367,6 +352,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
'jsDebug'
=>
(
boolean
)
\Civi
::
settings
()
->
get
(
'stripe_jsdebug'
),
'paymentProcessorTypeID'
=>
$form
->
_paymentProcessor
[
'payment_processor_type_id'
],
'locale'
=>
CRM_Core_I18n
::
getLocale
(),
'apiVersion'
=>
CRM_Stripe_Check
::
API_VERSION
,
'csrfToken'
=>
class_exists
(
'\Civi\Firewall\Firewall'
)
?
\Civi\Firewall\Firewall
::
getCSRFToken
()
:
NULL
,
];
\Civi
::
resources
()
->
addVars
(
E
::
SHORT_NAME
,
$jsVars
);
...
...
This diff is collapsed.
Click to expand it.
CRM/Stripe/Check.php
+
13
−
2
View file @
1c4061f4
...
...
@@ -10,6 +10,17 @@ use CRM_Stripe_ExtensionUtil as E;
*/
class
CRM_Stripe_Check
{
/**
* @var string
*/
const
API_VERSION
=
'2020-03-02'
;
const
API_MIN_VERSION
=
'2019-12-03'
;
/**
* @var string
*/
const
MIN_VERSION_MJWSHARED
=
'0.7'
;
public
static
function
checkRequirements
(
&
$messages
)
{
$extensions
=
civicrm_api3
(
'Extension'
,
'get'
,
[
'full_name'
=>
"mjwshared"
,
...
...
@@ -25,12 +36,12 @@ class CRM_Stripe_Check {
);
}
if
(
version_compare
(
$extensions
[
'values'
][
$extensions
[
'id'
]][
'version'
],
CRM_
Core_Payment_
Stripe
::
MIN_VERSION_MJWSHARED
)
===
-
1
)
{
if
(
version_compare
(
$extensions
[
'values'
][
$extensions
[
'id'
]][
'version'
],
CRM_Stripe
_Check
::
MIN_VERSION_MJWSHARED
)
===
-
1
)
{
$messages
[]
=
new
CRM_Utils_Check_Message
(
'stripe_requirements'
,
E
::
ts
(
'The Stripe extension requires the mjwshared extension version %1 or greater but your system has version %2.'
,
[
1
=>
CRM_
Core_Payment_
Stripe
::
MIN_VERSION_MJWSHARED
,
1
=>
CRM_Stripe
_Check
::
MIN_VERSION_MJWSHARED
,
2
=>
$extensions
[
'values'
][
$extensions
[
'id'
]][
'version'
]
]),
E
::
ts
(
'Stripe: Missing Requirements'
),
...
...
This diff is collapsed.
Click to expand it.
CRM/Stripe/Webhook.php
+
2
−
2
View file @
1c4061f4
...
...
@@ -58,7 +58,7 @@ class CRM_Stripe_Webhook {
try
{
$updates
=
self
::
checkWebhook
(
$wh
);
if
(
!
empty
(
$wh
->
api_version
)
&&
(
$wh
->
api_version
!==
CRM_Core_Payment_Stripe
::
getApiVersion
(
)))
{
if
(
!
empty
(
$wh
->
api_version
)
&&
(
strtotime
(
$wh
->
api_version
)
<
strtotime
(
CRM_Stripe_Check
::
API_MIN_VERSION
)))
{
// Add message about API version.
$messages
[]
=
new
CRM_Utils_Check_Message
(
'stripe_webhook'
,
...
...
@@ -66,7 +66,7 @@ class CRM_Stripe_Webhook {
[
1
=>
urldecode
(
$webhook_path
),
2
=>
$wh
->
api_version
,
3
=>
CRM_
Core_Payment_Stripe
::
getApiVersion
()
,
3
=>
CRM_
Stripe_Check
::
API_VERSION
,
]
),
self
::
getTitle
(
$paymentProcessor
),
...
...
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