Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
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
jamie
Stripe
Commits
8e427167
Commit
8e427167
authored
5 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Refactor passing of token parameters to use pre_approval_parameters
parent
d888076d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Core/Payment/Stripe.php
+42
-0
42 additions, 0 deletions
CRM/Core/Payment/Stripe.php
CRM/Stripe/Check.php
+1
-1
1 addition, 1 deletion
CRM/Stripe/Check.php
stripe.php
+0
-17
0 additions, 17 deletions
stripe.php
with
43 additions
and
18 deletions
CRM/Core/Payment/Stripe.php
+
42
−
0
View file @
8e427167
...
...
@@ -155,6 +155,15 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
return
FALSE
;
}
/**
* Is an authorize-capture flow supported.
*
* @return bool
*/
protected
function
supportsPreApproval
()
{
return
TRUE
;
}
/**
* Get the currency for the transaction.
*
...
...
@@ -348,6 +357,39 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
]);
}
/**
* Function to action pre-approval if supported
*
* @param array $params
* Parameters from the form
*
* This function returns an array which should contain
* - pre_approval_parameters (this will be stored on the calling form & available later)
* - redirect_url (if set the browser will be redirected to this.
*
* @return array
*/
public
function
doPreApproval
(
&
$params
)
{
$paymentIntentID
=
CRM_Utils_Request
::
retrieve
(
'paymentIntentID'
,
'String'
);
if
(
!
empty
(
$paymentIntentID
))
{
return
[
'pre_approval_parameters'
=>
[
'paymentIntentID'
=>
$paymentIntentID
]];
}
}
/**
* Get any details that may be available to the payment processor due to an approval process having happened.
*
* In some cases the browser is redirected to enter details on a processor site. Some details may be available as a
* result.
*
* @param array $storedDetails
*
* @return array
*/
public
function
getPreApprovalDetails
(
$storedDetails
)
{
return
$storedDetails
;
}
/**
* Process payment
* Submit a payment using Stripe's PHP API:
...
...
This diff is collapsed.
Click to expand it.
CRM/Stripe/Check.php
+
1
−
1
View file @
8e427167
...
...
@@ -10,7 +10,7 @@ use CRM_Stripe_ExtensionUtil as E;
*/
class
CRM_Stripe_Check
{
const
MIN_VERSION_MJWSHARED
=
'0.4.
4
'
;
const
MIN_VERSION_MJWSHARED
=
'0.4.
5
'
;
public
static
function
checkRequirements
(
&
$messages
)
{
$extensions
=
civicrm_api3
(
'Extension'
,
'get'
,
[
...
...
This diff is collapsed.
Click to expand it.
stripe.php
+
0
−
17
View file @
8e427167
...
...
@@ -128,23 +128,6 @@ function stripe_civicrm_buildForm($formName, &$form) {
}
}
/**
* Implements hook_civicrm_postProcess().
*
* @param string $formName
* @param \CRM_Core_Form $form
*
* @throws \CRM_Core_Exception
*/
function
stripe_civicrm_postProcess
(
$formName
,
&
$form
)
{
// We're only interested in forms that have a paymentprocessor
if
(
empty
(
$form
->
get
(
'paymentProcessor'
))
||
(
$form
->
get
(
'paymentProcessor'
)[
'class_name'
]
!==
'Payment_Stripe'
))
{
return
;
}
CRM_Core_Payment_Stripe
::
setTokenParameter
(
'paymentMethodID'
,
$form
);
CRM_Core_Payment_Stripe
::
setTokenParameter
(
'paymentIntentID'
,
$form
);
}
/**
* Implements hook_civicrm_check().
*
...
...
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