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
848172f0
Commit
848172f0
authored
1 year ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Add ACH direct debit support and disable SEPA if currency NOT EUR
parent
e7a59ab0
No related branches found
No related tags found
1 merge request
!217
Implement Stripe Checkout (with support for SEPA and ACH)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/Payment/StripeCheckout.php
+28
-1
28 additions, 1 deletion
CRM/Core/Payment/StripeCheckout.php
CRM/Stripe/Api.php
+1
-1
1 addition, 1 deletion
CRM/Stripe/Api.php
with
29 additions
and
2 deletions
CRM/Core/Payment/StripeCheckout.php
+
28
−
1
View file @
848172f0
...
...
@@ -192,7 +192,7 @@ class CRM_Core_Payment_StripeCheckout extends CRM_Core_Payment_Stripe {
'customer'
=>
$stripeCustomerID
,
// 'submit_type' => one of 'auto', pay, book, donate
'client_reference_id'
=>
$propertyBag
->
getInvoiceID
(),
'payment_method_types'
=>
\Civi
::
settings
()
->
get
(
'stripe_checkout_s
upported
_p
ayment
_m
ethods
'
),
'payment_method_types'
=>
$this
->
getS
upported
P
ayment
M
ethods
(
$propertyBag
),
];
// Allows you to alter the params passed to StripeCheckout (eg. payment_method_types)
...
...
@@ -208,6 +208,33 @@ class CRM_Core_Payment_StripeCheckout extends CRM_Core_Payment_Stripe {
CRM_Utils_System
::
redirect
(
$checkoutSession
->
url
);
}
/**
* @param \Civi\Payment\PropertyBag $propertyBag
*
* @return array
*/
private
function
getSupportedPaymentMethods
(
\Civi\Payment\PropertyBag
$propertyBag
)
:
array
{
$paymentMethods
=
\Civi
::
settings
()
->
get
(
'stripe_checkout_supported_payment_methods'
);
$result
=
[];
foreach
(
$paymentMethods
as
$index
=>
$paymentMethod
)
{
switch
(
$paymentMethod
)
{
case
'sepa_debit'
:
if
(
$propertyBag
->
getCurrency
()
===
'EUR'
)
{
$result
[]
=
$paymentMethod
;
}
break
;
default
:
$result
[]
=
$paymentMethod
;
}
}
if
(
empty
(
$result
))
{
throw
new
PaymentProcessorException
(
'There are no valid Stripe payment methods enabled for this configuration. Check currency etc.'
);
}
return
$result
;
}
/**
* Takes the lineitems passed into doPayment and converts them into an array suitable for passing to Stripe Checkout
*
...
...
This diff is collapsed.
Click to expand it.
CRM/Stripe/Api.php
+
1
−
1
View file @
848172f0
...
...
@@ -296,7 +296,7 @@ class CRM_Stripe_Api {
// 'promptpay',
'sepa_debit'
=>
E
::
ts
(
'SEPA Direct Debit'
),
// 'sofort',
//
'us_bank_account',
'us_bank_account'
=>
E
::
ts
(
'ACH Direct Debit'
)
,
// 'wechat_pay',
];
}
...
...
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