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
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
d409cbb8
Commit
d409cbb8
authored
5 years ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Don't popup user notification on card element change (only on submit)
parent
1eaefbd6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!109
6.4
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/civicrm_stripe.js
+14
-6
14 additions, 6 deletions
js/civicrm_stripe.js
js/civicrm_stripe.min.js
+1
-1
1 addition, 1 deletion
js/civicrm_stripe.min.js
with
15 additions
and
7 deletions
js/civicrm_stripe.js
+
14
−
6
View file @
d409cbb8
...
...
@@ -71,7 +71,13 @@ CRM.$(function($) {
return
form
.
submit
();
}
function
displayError
(
error
)
{
/**
* Display a stripe element error
*
* @param error - the stripe error object
* @param {boolean} notify - whether to popup a notification as well as display on the form.
*/
function
displayError
(
error
,
notify
)
{
// Display error.message in your UI.
debugging
(
'
error:
'
+
error
.
message
);
// Inform the user if there was an error
...
...
@@ -83,7 +89,9 @@ CRM.$(function($) {
submitButtons
[
i
].
removeAttribute
(
'
disabled
'
);
}
triggerEvent
(
'
crmBillingFormNotValid
'
);
notifyUser
(
'
error
'
,
''
,
error
.
message
,
'
#card-element
'
);
if
(
notify
)
{
notifyUser
(
'
error
'
,
''
,
error
.
message
,
'
#card-element
'
);
}
}
function
handleCardPayment
()
{
...
...
@@ -91,7 +99,7 @@ CRM.$(function($) {
stripe
.
createPaymentMethod
(
'
card
'
,
card
).
then
(
function
(
result
)
{
if
(
result
.
error
)
{
// Show error in payment form
displayError
(
result
.
error
);
displayError
(
result
.
error
,
true
);
}
else
{
if
(
getIsRecur
()
||
isEventAdditionalParticipants
())
{
...
...
@@ -121,7 +129,7 @@ CRM.$(function($) {
debugging
(
'
handleServerResponse
'
);
if
(
result
.
error
)
{
// Show error from server on payment form
displayError
(
result
.
error
);
displayError
(
result
.
error
,
true
);
}
else
if
(
result
.
requires_action
)
{
// Use Stripe.js to handle required card action
handleAction
(
result
);
...
...
@@ -136,7 +144,7 @@ CRM.$(function($) {
.
then
(
function
(
result
)
{
if
(
result
.
error
)
{
// Show error in payment form
displayError
(
result
.
error
);
displayError
(
result
.
error
,
true
);
}
else
{
// The card action has been handled
// The PaymentIntent can be confirmed again on the server
...
...
@@ -620,7 +628,7 @@ CRM.$(function($) {
$
(
'
div#card-errors
'
).
hide
();
}
else
if
(
event
.
error
)
{
displayError
(
event
.
error
);
displayError
(
event
.
error
,
false
);
}
else
if
(
event
.
complete
)
{
$
(
'
div#card-errors
'
).
hide
();
...
...
This diff is collapsed.
Click to expand it.
js/civicrm_stripe.min.js
+
1
−
1
View file @
d409cbb8
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