Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
2d0c7968
Commit
2d0c7968
authored
Jan 05, 2017
by
Vedran Karacic
Committed by
Vedran Karačić
Jan 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Firefox autofill credit card bug.
parent
de08a802
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
20 deletions
+27
-20
ecommerce/static/js/pages/basket_page.js
+27
-20
No files found.
ecommerce/static/js/pages/basket_page.js
View file @
2d0c7968
...
@@ -132,12 +132,31 @@ define([
...
@@ -132,12 +132,31 @@ define([
appendCardValidationErrorMsg
(
event
,
cardExpiryMonthField
,
'Card expired'
);
appendCardValidationErrorMsg
(
event
,
cardExpiryMonthField
,
'Card expired'
);
}
}
},
},
detectCreditCard
=
function
()
{
var
cardNumber
=
$
(
'#card-number-input'
).
val
().
replace
(
/
\s
+/g
,
''
),
card
,
iconPath
=
'/static/images/credit_cards/'
;
if
(
cardNumber
.
length
>
12
)
{
card
=
CreditCardUtils
.
getCreditCardType
(
cardNumber
);
if
(
typeof
card
!==
'undefined'
)
{
$
(
'.card-type-icon'
).
attr
(
'src'
,
iconPath
+
card
.
name
+
'.png'
);
$
(
'input[name=card_type]'
).
val
(
card
.
type
);
}
else
{
$
(
'.card-type-icon'
).
attr
(
'src'
,
''
);
$
(
'input[name=card_type]'
).
val
(
''
);
}
}
},
onReady
=
function
()
{
onReady
=
function
()
{
var
$paymentButtons
=
$
(
'.payment-buttons'
),
var
$paymentButtons
=
$
(
'.payment-buttons'
),
basketId
=
$paymentButtons
.
data
(
'basket-id'
),
basketId
=
$paymentButtons
.
data
(
'basket-id'
);
cardNumber
,
iconPath
=
'/static/images/credit_cards/'
,
card
;
$
(
'#voucher_form_link'
).
on
(
'click'
,
function
(
event
)
{
$
(
'#voucher_form_link'
).
on
(
'click'
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -150,28 +169,16 @@ define([
...
@@ -150,28 +169,16 @@ define([
});
});
$
(
'#card-number-input'
).
on
(
'input'
,
function
()
{
$
(
'#card-number-input'
).
on
(
'input'
,
function
()
{
cardNumber
=
$
(
'#card-number-input'
).
val
().
replace
(
/
\s
+/g
,
''
);
detectCreditCard
();
if
(
cardNumber
.
length
>
12
)
{
card
=
CreditCardUtils
.
getCreditCardType
(
cardNumber
);
if
(
typeof
card
!==
'undefined'
)
{
$
(
'.card-type-icon'
).
attr
(
'src'
,
iconPath
+
card
.
name
+
'.png'
).
removeClass
(
'hidden'
);
$
(
'input[name=card_type]'
).
val
(
card
.
type
);
}
else
{
$
(
'.card-type-icon'
).
attr
(
'src'
,
''
).
addClass
(
'hidden'
);
$
(
'input[name=card_type]'
).
val
(
''
);
}
}
});
});
$
(
'#payment-button'
).
click
(
function
(
e
)
{
$
(
'#payment-button'
).
click
(
function
(
e
)
{
_
.
each
(
$
(
'.help-block'
),
function
(
errorMsg
)
{
_
.
each
(
$
(
'.help-block'
),
function
(
errorMsg
)
{
$
(
errorMsg
).
empty
();
// Clear existing validation error messages.
$
(
errorMsg
).
empty
();
// Clear existing validation error messages.
});
});
if
(
$
(
'#card-number-input'
).
val
())
{
detectCreditCard
();
}
cardInfoValidation
(
e
);
cardInfoValidation
(
e
);
cardHolderInfoValidation
(
e
);
cardHolderInfoValidation
(
e
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment