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
cb5c1e90
Commit
cb5c1e90
authored
Jan 02, 2019
by
Rik ter Beek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix recurring payments, added bcmc as type for card recognition and removed duplicate card list
parent
7f9add7a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
55 deletions
+56
-55
Model/Config/Source/CcType.php
Model/Config/Source/CcType.php
+1
-1
etc/adyen_payment.xml
etc/adyen_payment.xml
+4
-0
view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js
...nd/web/js/view/payment/method-renderer/adyen-cc-method.js
+28
-15
view/frontend/web/js/view/payment/method-renderer/adyen-oneclick-method.js
.../js/view/payment/method-renderer/adyen-oneclick-method.js
+23
-7
view/frontend/web/template/payment/cc-form.html
view/frontend/web/template/payment/cc-form.html
+0
-32
No files found.
Model/Config/Source/CcType.php
View file @
cb5c1e90
...
...
@@ -56,7 +56,7 @@ class CcType extends \Magento\Payment\Model\Source\Cctype
*/
public
function
getAllowedTypes
()
{
return
[
'VI'
,
'MC'
,
'AE'
,
'DI'
,
'JCB'
,
'UN'
,
'MI'
,
'DN'
];
return
[
'VI'
,
'MC'
,
'AE'
,
'DI'
,
'JCB'
,
'UN'
,
'MI'
,
'DN'
,
'BCMC'
];
}
/**
...
...
etc/adyen_payment.xml
View file @
cb5c1e90
...
...
@@ -61,5 +61,9 @@
<label>
UnionPay
</label>
<code_alt>
cup
</code_alt>
</type>
<type
id=
"BCMC"
order=
"80"
>
<label>
Bancontact
</label>
<code_alt>
bcmc
</code_alt>
</type>
</adyen_credit_cards>
</payment>
view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js
View file @
cb5c1e90
...
...
@@ -68,7 +68,7 @@ define(
* sets up the callbacks for card components and
* set up the installments
*/
renderSecureFields
:
function
()
{
renderSecureFields
:
function
()
{
var
self
=
this
;
self
.
placeOrderAllowed
(
false
);
...
...
@@ -91,8 +91,15 @@ define(
holderNameRequired
:
true
,
groupTypes
:
self
.
getAvailableCardTypeAltCodes
(),
onChange
:
function
(
state
)
{
// what card is this ??
onChange
:
function
(
state
)
{
// isValid is not present on start
if
(
typeof
state
.
isValid
!==
'
undefined
'
&&
state
.
isValid
===
false
)
{
self
.
creditCardDetailsValid
(
false
);
self
.
placeOrderAllowed
(
false
);
}
// Define the card type
// translate adyen card type to magento card type
var
creditCardType
=
self
.
getCcCodeByAltCode
(
state
.
brand
);
...
...
@@ -132,12 +139,18 @@ define(
}
// Color the image of the credit card
self
.
creditCardType
(
creditCardType
);
}
else
{
// for BCMC as this is not a core payment method inside magento use maestro as brand detection
if
(
creditCardType
==
"
BCMC
"
)
{
self
.
creditCardType
(
"
MI
"
);
}
else
{
self
.
creditCardType
(
creditCardType
);
}
}
else
{
self
.
creditCardType
(
""
)
}
},
onValid
:
function
(
state
)
{
onValid
:
function
(
state
)
{
self
.
variant
(
state
.
brand
);
self
.
creditCardNumber
(
state
.
data
.
encryptedCardNumber
);
self
.
expiryMonth
(
state
.
data
.
encryptedExpiryMonth
);
...
...
@@ -147,7 +160,7 @@ define(
self
.
creditCardDetailsValid
(
true
);
self
.
placeOrderAllowed
(
true
);
},
onError
:
function
(
state
)
{
onError
:
function
(
state
)
{
self
.
creditCardDetailsValid
(
false
);
self
.
placeOrderAllowed
(
false
);
}
...
...
@@ -179,9 +192,9 @@ define(
/**
* Returns state of place order button
* @returns {boolean}
*/
isButtonActive
:
function
()
{
return
this
.
isActive
()
&&
this
.
getCode
()
==
this
.
isChecked
()
&&
this
.
isPlaceOrderActionAllowed
()
&&
this
.
placeOrderAllowed
();
*/
isButtonActive
:
function
()
{
return
this
.
isActive
()
&&
this
.
getCode
()
==
this
.
isChecked
()
&&
this
.
isPlaceOrderActionAllowed
()
&&
this
.
placeOrderAllowed
();
},
/**
* Custom place order function
...
...
@@ -247,7 +260,7 @@ define(
*
* @returns {boolean}
*/
isCardOwnerValid
:
function
()
{
isCardOwnerValid
:
function
()
{
if
(
this
.
creditCardOwner
().
length
==
0
)
{
return
false
;
}
...
...
@@ -260,7 +273,7 @@ define(
*
* @returns {*}
*/
isCreditCardDetailsValid
:
function
()
{
isCreditCardDetailsValid
:
function
()
{
return
this
.
creditCardDetailsValid
();
},
/**
...
...
@@ -269,9 +282,9 @@ define(
* @param altCode
* @returns {*}
*/
getCcCodeByAltCode
:
function
(
altCode
)
{
getCcCodeByAltCode
:
function
(
altCode
)
{
var
ccTypes
=
window
.
checkoutConfig
.
payment
.
ccform
.
availableTypesByAlt
[
this
.
getCode
()];
if
(
ccTypes
.
hasOwnProperty
(
altCode
))
{
if
(
ccTypes
.
hasOwnProperty
(
altCode
))
{
return
ccTypes
[
altCode
];
}
...
...
@@ -283,7 +296,7 @@ define(
*
* @returns {string[]}
*/
getAvailableCardTypeAltCodes
:
function
()
{
getAvailableCardTypeAltCodes
:
function
()
{
var
ccTypes
=
window
.
checkoutConfig
.
payment
.
ccform
.
availableTypesByAlt
[
this
.
getCode
()];
return
Object
.
keys
(
ccTypes
);
},
...
...
view/frontend/web/js/view/payment/method-renderer/adyen-oneclick-method.js
View file @
cb5c1e90
...
...
@@ -130,6 +130,15 @@ define(
var
messageContainer
=
self
.
messageComponents
[
'
messages-
'
+
value
.
reference_id
];
// for recurring enable the placeOrder button at all times
var
placeOrderAllowed
=
true
;
if
(
self
.
hasVerification
())
{
placeOrderAllowed
=
false
;
}
else
{
// for recurring cards there is no validation needed
isValid
(
true
);
}
return
{
'
label
'
:
value
.
agreement_label
,
'
value
'
:
value
.
reference_id
,
...
...
@@ -142,11 +151,11 @@ define(
'
creditCardExpMonth
'
:
ko
.
observable
(
creditCardExpMonth
),
'
creditCardExpYear
'
:
ko
.
observable
(
creditCardExpYear
),
'
getInstallments
'
:
ko
.
observableArray
(
installments
),
'
placeOrderAllowed
'
:
ko
.
observable
(
false
),
'
placeOrderAllowed
'
:
ko
.
observable
(
placeOrderAllowed
),
isButtonActive
:
function
()
{
return
self
.
isActive
()
&&
this
.
getCode
()
==
self
.
isChecked
()
&&
self
.
isBillingAgreementChecked
()
&&
this
.
placeOrderAllowed
();
isButtonActive
:
function
()
{
return
self
.
isActive
()
&&
this
.
getCode
()
==
self
.
isChecked
()
&&
self
.
isBillingAgreementChecked
()
&&
this
.
placeOrderAllowed
();
},
/**
* @override
...
...
@@ -208,7 +217,7 @@ define(
if
(
self
.
agreement_data
.
variant
==
"
bcmc
"
)
{
hideCVC
=
true
;
self
.
placeOrderAllowed
(
true
);
}
else
if
(
self
.
agreement_data
.
variant
==
"
maestro
"
)
{
}
else
if
(
self
.
agreement_data
.
variant
==
"
maestro
"
)
{
// for maestro cvc is optional
self
.
placeOrderAllowed
(
true
);
}
...
...
@@ -239,7 +248,11 @@ define(
onChange
:
function
(
state
)
{
if
(
state
.
isValid
)
{
self
.
encryptedCreditCardVerificationNumber
=
state
.
data
.
encryptedSecurityCode
;
if
(
typeof
state
.
data
!==
'
undefined
'
&&
typeof
state
.
data
.
encryptedSecurityCode
!==
'
undefined
'
)
{
self
.
encryptedCreditCardVerificationNumber
=
state
.
data
.
encryptedSecurityCode
;
}
}
else
{
self
.
encryptedCreditCardVerificationNumber
=
''
;
}
...
...
@@ -253,7 +266,7 @@ define(
}
return
;
},
onError
:
function
(
data
)
{
onError
:
function
(
data
)
{
self
.
placeOrderAllowed
(
false
);
isValid
(
false
);
return
;
...
...
@@ -314,7 +327,7 @@ define(
return
window
.
checkoutConfig
.
payment
.
adyenOneclick
.
checkoutUrl
;
},
hasVerification
:
function
()
{
return
window
.
checkoutConfig
.
payment
.
adyenOneclick
.
hasCustomerInteraction
;
return
self
.
hasVerification
()
},
getMessageName
:
function
()
{
return
'
messages-
'
+
value
.
reference_id
;
...
...
@@ -407,6 +420,9 @@ define(
},
isShowLegend
:
function
()
{
return
true
;
},
hasVerification
:
function
()
{
return
window
.
checkoutConfig
.
payment
.
adyenOneclick
.
hasCustomerInteraction
;
}
});
}
...
...
view/frontend/web/template/payment/cc-form.html
View file @
cb5c1e90
...
...
@@ -68,38 +68,6 @@
<br/>
<!-- /ko -->
<div
class=
"field type"
>
<label
data-bind=
"attr: {for: getCode() + '_cc_type'}"
class=
"label"
>
<span>
<!-- ko text: $t('Credit Card Type')--><!-- /ko -->
</span>
</label>
<div
class=
"control"
>
<ul
class=
"credit-card-types"
>
<!-- ko foreach: {data: getCcAvailableTypesValues(), as: 'item'} -->
<li
class=
"item"
data-bind=
"css: {_active: $parent.creditCardType() == item.value} "
>
<!--ko if: $parent.getIcons(item.value) -->
<img
data-bind=
"attr: {
'src': $parent.getIcons(item.value).url,
'alt': item.type,
'width': $parent.getIcons(item.value).width,
'height': $parent.getIcons(item.value).height
}"
>
<!--/ko-->
</li>
<!--/ko-->
</ul>
<p
class=
"helper-text"
data-bind=
"css: {hidden: creditCardType() !== ''} "
>
<!-- ko text: $t('(Please provide a card with the type from the list above)')-->
<!-- /ko -->
</p>
<input
type=
"hidden"
name=
"payment[cc_type]"
class=
"input-text"
value=
""
data-bind=
"attr: {id: getCode() + '_cc_type', 'data-container': getCode() + '-cc-type'},
value: creditCardType
"
>
</div>
</div>
<div
class=
"field number cardContainerField"
>
<div
afterRender=
"renderSecureFields()"
data-bind=
"attr: { id: 'cardContainer'}"
></div>
</div>
...
...
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