Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
6f7bbd58
Commit
6f7bbd58
authored
Nov 10, 2020
by
Ricardo Ambrogi
Committed by
GitHub
Nov 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update adyen-cc-method.js
Improve readability of adyen-cc-method.js;
parent
9b5d48cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
57 deletions
+39
-57
view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js
...nd/web/js/view/payment/method-renderer/adyen-cc-method.js
+39
-57
No files found.
view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js
View file @
6f7bbd58
...
@@ -171,7 +171,7 @@ define(
...
@@ -171,7 +171,7 @@ define(
var
creditCardType
=
self
.
getCcCodeByAltCode
(
state
.
brand
);
var
creditCardType
=
self
.
getCcCodeByAltCode
(
state
.
brand
);
if
(
creditCardType
)
{
if
(
creditCardType
)
{
// If the credit card type is already set, check if it changed or not
// If the credit card type is already set, check if it changed or not
if
(
!
self
.
creditCardType
()
||
self
.
creditCardType
()
&&
self
.
creditCardType
()
!
=
creditCardType
)
{
if
(
!
self
.
creditCardType
()
||
self
.
creditCardType
()
!=
=
creditCardType
)
{
var
numberOfInstallments
=
[];
var
numberOfInstallments
=
[];
if
(
creditCardType
in
allInstallments
)
{
if
(
creditCardType
in
allInstallments
)
{
...
@@ -190,13 +190,9 @@ define(
...
@@ -190,13 +190,9 @@ define(
self
.
installments
(
0
);
self
.
installments
(
0
);
}
}
}
}
// for BCMC as this is not a core payment method inside magento use maestro as brand detection
// for BCMC as this is not a core payment method inside magento use maestro as brand detection
if
(
creditCardType
==
"
BCMC
"
)
{
self
.
creditCardType
(
creditCardType
==
"
BCMC
"
?
"
MI
"
:
creditCardType
);
self
.
creditCardType
(
"
MI
"
);
}
else
{
self
.
creditCardType
(
creditCardType
);
}
}
else
{
}
else
{
self
.
creditCardType
(
""
)
self
.
creditCardType
(
""
)
self
.
installments
(
0
);
self
.
installments
(
0
);
...
@@ -219,24 +215,26 @@ define(
...
@@ -219,24 +215,26 @@ define(
var
self
=
this
;
var
self
=
this
;
var
threeDS2Node
=
document
.
getElementById
(
'
threeDS2Container
'
);
var
threeDS2Node
=
document
.
getElementById
(
'
threeDS2Container
'
);
if
(
type
==
"
IdentifyShopper
"
)
{
if
(
type
===
"
IdentifyShopper
"
)
{
var
onComplete
=
function
(
result
)
{
self
.
threeDS2IdentifyComponent
.
unmount
();
var
request
=
result
.
data
;
request
.
orderId
=
orderId
;
threeds2
.
processThreeDS2
(
request
).
done
(
function
(
responseJSON
)
{
self
.
validateThreeDS2OrPlaceOrder
(
responseJSON
,
orderId
)
}).
fail
(
function
(
result
)
{
errorProcessor
.
process
(
result
,
self
.
messageContainer
);
self
.
isPlaceOrderActionAllowed
(
true
);
fullScreenLoader
.
stopLoader
();
});
};
self
.
threeDS2IdentifyComponent
=
self
.
checkout
self
.
threeDS2IdentifyComponent
=
self
.
checkout
.
create
(
'
threeDS2DeviceFingerprint
'
,
{
.
create
(
'
threeDS2DeviceFingerprint
'
,
{
fingerprintToken
:
token
,
fingerprintToken
:
token
,
onComplete
:
function
(
result
)
{
onComplete
:
onComplete
,
self
.
threeDS2IdentifyComponent
.
unmount
();
var
request
=
result
.
data
;
request
.
orderId
=
orderId
;
threeds2
.
processThreeDS2
(
request
).
done
(
function
(
responseJSON
)
{
self
.
validateThreeDS2OrPlaceOrder
(
responseJSON
,
orderId
)
}).
fail
(
function
(
result
)
{
errorProcessor
.
process
(
result
,
self
.
messageContainer
);
self
.
isPlaceOrderActionAllowed
(
true
);
fullScreenLoader
.
stopLoader
();
});
},
onError
:
function
(
error
)
{
onError
:
function
(
error
)
{
console
.
log
(
JSON
.
stringify
(
error
));
//
console.log(JSON.stringify(error));
}
}
});
});
...
@@ -255,25 +253,26 @@ define(
...
@@ -255,25 +253,26 @@ define(
});
});
popupModal
.
modal
(
"
openModal
"
);
popupModal
.
modal
(
"
openModal
"
);
var
onComplete
=
function
(
result
)
{
self
.
threeDS2ChallengeComponent
.
unmount
();
self
.
closeModal
(
popupModal
);
fullScreenLoader
.
startLoader
();
var
request
=
result
.
data
;
request
.
orderId
=
orderId
;
threeds2
.
processThreeDS2
(
request
).
done
(
function
(
responseJSON
)
{
self
.
validateThreeDS2OrPlaceOrder
(
responseJSON
,
orderId
);
}).
fail
(
function
(
result
)
{
errorProcessor
.
process
(
result
,
self
.
messageContainer
);
self
.
isPlaceOrderActionAllowed
(
true
);
fullScreenLoader
.
stopLoader
();
});
};
self
.
threeDS2ChallengeComponent
=
self
.
checkout
self
.
threeDS2ChallengeComponent
=
self
.
checkout
.
create
(
'
threeDS2Challenge
'
,
{
.
create
(
'
threeDS2Challenge
'
,
{
challengeToken
:
token
,
challengeToken
:
token
,
size
:
'
05
'
,
size
:
'
05
'
,
onComplete
:
function
(
result
)
{
onComplete
:
onComplete
,
self
.
threeDS2ChallengeComponent
.
unmount
();
self
.
closeModal
(
popupModal
);
fullScreenLoader
.
startLoader
();
var
request
=
result
.
data
;
request
.
orderId
=
orderId
;
threeds2
.
processThreeDS2
(
request
).
done
(
function
(
responseJSON
)
{
self
.
validateThreeDS2OrPlaceOrder
(
responseJSON
,
orderId
);
}).
fail
(
function
(
result
)
{
errorProcessor
.
process
(
result
,
self
.
messageContainer
);
self
.
isPlaceOrderActionAllowed
(
true
);
fullScreenLoader
.
stopLoader
();
});
},
onError
:
function
(
error
)
{
onError
:
function
(
error
)
{
console
.
log
(
JSON
.
stringify
(
error
));
console
.
log
(
JSON
.
stringify
(
error
));
}
}
...
@@ -410,11 +409,7 @@ define(
...
@@ -410,11 +409,7 @@ define(
var
validate
=
$
(
form
).
validation
()
&&
$
(
form
).
validation
(
'
isValid
'
);
var
validate
=
$
(
form
).
validation
()
&&
$
(
form
).
validation
(
'
isValid
'
);
if
(
!
validate
)
{
return
validate
return
false
;
}
return
true
;
},
},
/**
/**
* Validates if the typed in card holder is valid
* Validates if the typed in card holder is valid
...
@@ -423,11 +418,7 @@ define(
...
@@ -423,11 +418,7 @@ define(
* @returns {boolean}
* @returns {boolean}
*/
*/
isCardOwnerValid
:
function
()
{
isCardOwnerValid
:
function
()
{
if
(
this
.
creditCardOwner
().
length
==
0
)
{
return
!!
this
.
creditCardOwner
().
length
;
return
false
;
}
return
true
;
},
},
/**
/**
* The card component send the card details validity in a callback which is saved in the
* The card component send the card details validity in a callback which is saved in the
...
@@ -446,11 +437,7 @@ define(
...
@@ -446,11 +437,7 @@ define(
*/
*/
getCcCodeByAltCode
:
function
(
altCode
)
{
getCcCodeByAltCode
:
function
(
altCode
)
{
var
ccTypes
=
window
.
checkoutConfig
.
payment
.
ccform
.
availableTypesByAlt
[
this
.
getCode
()];
var
ccTypes
=
window
.
checkoutConfig
.
payment
.
ccform
.
availableTypesByAlt
[
this
.
getCode
()];
if
(
ccTypes
.
hasOwnProperty
(
altCode
))
{
return
ccTypes
.
hasOwnProperty
(
altCode
))
?
ccTypes
[
altCode
]
:
""
;
return
ccTypes
[
altCode
];
}
return
""
;
},
},
/**
/**
* Get available card types translated to the Adyen card type codes
* Get available card types translated to the Adyen card type codes
...
@@ -489,11 +476,7 @@ define(
...
@@ -489,11 +476,7 @@ define(
return
window
.
checkoutConfig
.
payment
.
iframe
.
placeOrderUrl
[
this
.
getCode
()];
return
window
.
checkoutConfig
.
payment
.
iframe
.
placeOrderUrl
[
this
.
getCode
()];
},
},
canCreateBillingAgreement
:
function
()
{
canCreateBillingAgreement
:
function
()
{
if
(
customer
.
isLoggedIn
())
{
return
customer
.
isLoggedIn
()
&&
window
.
checkoutConfig
.
payment
.
adyenCc
.
canCreateBillingAgreement
;
return
window
.
checkoutConfig
.
payment
.
adyenCc
.
canCreateBillingAgreement
;
}
return
false
;
},
},
isShowLegend
:
function
()
{
isShowLegend
:
function
()
{
return
true
;
return
true
;
...
@@ -503,8 +486,7 @@ define(
...
@@ -503,8 +486,7 @@ define(
},
},
getIcons
:
function
(
type
)
{
getIcons
:
function
(
type
)
{
return
window
.
checkoutConfig
.
payment
.
adyenCc
.
icons
.
hasOwnProperty
(
type
)
return
window
.
checkoutConfig
.
payment
.
adyenCc
.
icons
.
hasOwnProperty
(
type
)
?
window
.
checkoutConfig
.
payment
.
adyenCc
.
icons
[
type
]
&&
window
.
checkoutConfig
.
payment
.
adyenCc
.
icons
[
type
];
:
false
},
},
hasInstallments
:
function
()
{
hasInstallments
:
function
()
{
return
this
.
comboCardOption
()
===
'
credit
'
&&
window
.
checkoutConfig
.
payment
.
adyenCc
.
hasInstallments
;
return
this
.
comboCardOption
()
===
'
credit
'
&&
window
.
checkoutConfig
.
payment
.
adyenCc
.
hasInstallments
;
...
...
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