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
ae4a6d04
Commit
ae4a6d04
authored
Jan 07, 2019
by
Rik ter Beek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix based on the PR comments + fixed backend order layout css
parent
ad418cf9
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
942 additions
and
139 deletions
+942
-139
AdminMessage/APIKeyMessage.php
AdminMessage/APIKeyMessage.php
+3
-8
Block/Form/Cc.php
Block/Form/Cc.php
+9
-10
Gateway/Http/Client/TransactionPayment.php
Gateway/Http/Client/TransactionPayment.php
+33
-38
Gateway/Request/CcAuthorizationDataBuilder.php
Gateway/Request/CcAuthorizationDataBuilder.php
+2
-2
Gateway/Response/CheckoutPaymentCommentHistoryHandler.php
Gateway/Response/CheckoutPaymentCommentHistoryHandler.php
+37
-37
view/adminhtml/templates/form/cc.phtml
view/adminhtml/templates/form/cc.phtml
+21
-44
view/adminhtml/web/css/order_create_styles.css
view/adminhtml/web/css/order_create_styles.css
+837
-0
No files found.
AdminMessage/APIKeyMessage.php
View file @
ae4a6d04
...
@@ -126,14 +126,9 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
...
@@ -126,14 +126,9 @@ class APIKeyMessage implements \Magento\Framework\Notification\MessageInterface
*/
*/
public
function
getText
()
public
function
getText
()
{
{
$message
=
''
;
return
'Please provide API-KEY for the webservice user '
.
if
(
!
empty
(
$this
->
adyenHelper
->
getWsUsername
()))
{
$this
->
adyenHelper
->
getWsUsername
()
.
' for default/store '
.
$message
=
'Please provide API-KEY for the webservice user '
.
$this
->
storeManagerInterface
->
getStore
()
->
getName
();
$this
->
adyenHelper
->
getWsUsername
()
.
' for default/store '
.
$this
->
storeManagerInterface
->
getStore
()
->
getName
();
}
return
$message
;
}
}
/**
/**
...
...
Block/Form/Cc.php
View file @
ae4a6d04
...
@@ -45,16 +45,15 @@ class Cc extends \Magento\Payment\Block\Form\Cc
...
@@ -45,16 +45,15 @@ class Cc extends \Magento\Payment\Block\Form\Cc
*/
*/
protected
$checkoutSession
;
protected
$checkoutSession
;
/**
/**
* Cc constructor.
* Cc constructor.
*
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param array $data
* @param array $data
*/
*/
public
function
__construct
(
public
function
__construct
(
\Magento\Framework\View\Element\Template\Context
$context
,
\Magento\Framework\View\Element\Template\Context
$context
,
\Magento\Payment\Model\Config
$paymentConfig
,
\Magento\Payment\Model\Config
$paymentConfig
,
...
...
Gateway/Http/Client/TransactionPayment.php
View file @
ae4a6d04
...
@@ -30,47 +30,42 @@ use Magento\Payment\Gateway\Http\ClientInterface;
...
@@ -30,47 +30,42 @@ use Magento\Payment\Gateway\Http\ClientInterface;
*/
*/
class
TransactionPayment
implements
ClientInterface
class
TransactionPayment
implements
ClientInterface
{
{
/**
* PaymentRequest constructor.
*
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Model\RecurringType $recurringType
* @param array $data
*/
public
function
__construct
(
\Magento\Framework\Model\Context
$context
,
\Magento\Framework\Encryption\EncryptorInterface
$encryptor
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Model\RecurringType
$recurringType
,
array
$data
=
[]
)
{
$this
->
_encryptor
=
$encryptor
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_recurringType
=
$recurringType
;
$this
->
_appState
=
$context
->
getAppState
();
}
/**
/**
* @param \Magento\Payment\Gateway\Http\TransferInterface $transferObject
* @var \Adyen\Payment\Helper\Data
* @return mixed
*/
* @throws ClientException
private
$adyenHelper
;
*/
public
function
placeRequest
(
\Magento\Payment\Gateway\Http\TransferInterface
$transferObject
)
{
$request
=
$transferObject
->
getBody
();
$client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
$service
=
new
\Adyen\Service\Checkout
(
$client
);
/**
* TransactionPayment constructor.
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
)
{
$this
->
adyenHelper
=
$adyenHelper
;
}
try
{
/**
$response
=
$service
->
payments
(
$request
);
* @param \Magento\Payment\Gateway\Http\TransferInterface $transferObject
}
catch
(
\Adyen\AdyenException
$e
)
{
* @return mixed
$response
[
'error'
]
=
$e
->
getMessage
();
* @throws ClientException
}
*/
public
function
placeRequest
(
\Magento\Payment\Gateway\Http\TransferInterface
$transferObject
)
{
$request
=
$transferObject
->
getBody
();
return
$response
;
$client
=
$this
->
adyenHelper
->
initializeAdyenClient
();
}
$service
=
new
\Adyen\Service\Checkout
(
$client
);
try
{
$response
=
$service
->
payments
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
$response
[
'error'
]
=
$e
->
getMessage
();
}
return
$response
;
}
}
}
Gateway/Request/CcAuthorizationDataBuilder.php
View file @
ae4a6d04
...
@@ -67,8 +67,8 @@ class CcAuthorizationDataBuilder implements BuilderInterface
...
@@ -67,8 +67,8 @@ class CcAuthorizationDataBuilder implements BuilderInterface
// If ccType is set use this. For bcmc you need bcmc otherwise it will fail
// If ccType is set use this. For bcmc you need bcmc otherwise it will fail
$request
[
'paymentMethod'
][
'type'
]
=
"scheme"
;
$request
[
'paymentMethod'
][
'type'
]
=
"scheme"
;
if
(
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
VARIANT
))
{
if
(
$
variant
=
$
payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
VARIANT
))
{
$request
[
'paymentMethod'
][
'type'
]
=
$
payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
VARIANT
)
;
$request
[
'paymentMethod'
][
'type'
]
=
$
variant
;
}
}
if
(
$cardNumber
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
CREDIT_CARD_NUMBER
))
{
if
(
$cardNumber
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
CREDIT_CARD_NUMBER
))
{
...
...
Gateway/Response/CheckoutPaymentCommentHistoryHandler.php
View file @
ae4a6d04
...
@@ -28,50 +28,50 @@ use Magento\Payment\Gateway\Response\HandlerInterface;
...
@@ -28,50 +28,50 @@ use Magento\Payment\Gateway\Response\HandlerInterface;
class
CheckoutPaymentCommentHistoryHandler
implements
HandlerInterface
class
CheckoutPaymentCommentHistoryHandler
implements
HandlerInterface
{
{
/**
/**
* @param array $handlingSubject
* @param array $handlingSubject
* @param array $response
* @param array $response
* @return $this
* @return $this
*/
*/
public
function
handle
(
array
$handlingSubject
,
array
$response
)
public
function
handle
(
array
$handlingSubject
,
array
$response
)
{
{
$payment
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$handlingSubject
);
$payment
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$handlingSubject
);
/** @var OrderPaymentInterface $payment */
/** @var OrderPaymentInterface $payment */
$payment
=
$payment
->
getPayment
();
$payment
=
$payment
->
getPayment
();
$commentText
=
"Adyen Result response:"
;
$commentText
=
"Adyen Result response:"
;
if
(
isset
(
$response
[
'resultCode'
]))
{
if
(
isset
(
$response
[
'resultCode'
]))
{
$responseCode
=
$response
[
'resultCode'
];
$responseCode
=
$response
[
'resultCode'
];
}
else
{
}
else
{
// try to get response from response key (used for modifications
// try to get response from response key (used for modifications
if
(
isset
(
$response
[
'response'
]))
{
if
(
isset
(
$response
[
'response'
]))
{
$responseCode
=
$response
[
'response'
];
$responseCode
=
$response
[
'response'
];
}
else
{
}
else
{
$responseCode
=
""
;
$responseCode
=
""
;
}
}
}
}
if
(
isset
(
$response
[
'pspReference'
]))
{
if
(
isset
(
$response
[
'pspReference'
]))
{
$pspReference
=
$response
[
'pspReference'
];
$pspReference
=
$response
[
'pspReference'
];
}
else
{
}
else
{
$pspReference
=
""
;
$pspReference
=
""
;
}
}
if
(
$responseCode
)
{
if
(
$responseCode
)
{
$commentText
.=
'<br /> authResult: '
.
$responseCode
;
$commentText
.=
'<br /> authResult: '
.
$responseCode
;
$payment
->
getOrder
()
->
setAdyenResulturlEventCode
(
$responseCode
);
$payment
->
getOrder
()
->
setAdyenResulturlEventCode
(
$responseCode
);
}
}
if
(
$pspReference
)
{
if
(
$pspReference
)
{
$commentText
.=
'<br /> authResult
: '
.
$pspReference
;
$commentText
.=
'<br /> pspReference
: '
.
$pspReference
;
}
}
$comment
=
__
(
$commentText
);
$comment
=
__
(
$commentText
);
$payment
->
getOrder
()
->
addStatusHistoryComment
(
$comment
);
$payment
->
getOrder
()
->
addStatusHistoryComment
(
$comment
);
return
$this
;
return
$this
;
}
}
}
}
view/adminhtml/templates/form/cc.phtml
View file @
ae4a6d04
...
@@ -44,28 +44,22 @@ echo $code; ?>" style="display:none">
...
@@ -44,28 +44,22 @@ echo $code; ?>" style="display:none">
title=
"
<?php
echo
$block
->
escapeHtml
(
__
(
'Name on Card'
));
?>
"
class=
"admin__control-text"
title=
"
<?php
echo
$block
->
escapeHtml
(
__
(
'Name on Card'
));
?>
"
class=
"admin__control-text"
value=
"
<?php
/* @noEscape */
value=
"
<?php
/* @noEscape */
echo
$block
->
getInfoData
(
'cc_owner'
);
?>
"
echo
$block
->
getInfoData
(
'cc_owner'
);
?>
"
placeholder=
"
<?php
echo
$block
->
escapeHtml
(
__
(
'Name on Card'
));
?>
"
/>
placeholder=
"
<?php
echo
$block
->
escapeHtml
(
__
(
'Name on Card'
));
?>
"
/>
</div>
</div>
</div>
</div>
<div>
<div
id=
"cardContainer-
<?php
/* @noEscape */
<div>
Available card types:
</div>
echo
$code
;
?>
"
></div>
<div>
<input
id=
"
<?php
/* @noEscape */
<?php
foreach
(
$block
->
getCcAvailableTypes
()
as
$typeCode
=>
$typeName
)
:
?>
echo
$code
;
?>
-number"
type=
"hidden"
name=
"payment[number]"
>
<span
class=
"cc-type-
<?php
echo
$block
->
escapeHtml
(
$typeCode
);
?>
"
>
<input
id=
"
<?php
/* @noEscape */
<?php
echo
$block
->
escapeHtml
(
$typeName
);
?>
echo
$code
;
?>
-cvc"
type=
"hidden"
name=
"payment[cvc]"
>
</span>
<input
id=
"
<?php
/* @noEscape */
<?php
endforeach
?>
echo
$code
;
?>
-expiryMonth"
type=
"hidden"
name=
"payment[expiryMonth]"
>
</div>
<input
id=
"
<?php
/* @noEscape */
<p
class=
"helper-text"
id=
"cc-type-helper-text"
>
<?php
echo
$block
->
escapeHtml
(
__
(
'(Please provide a card with the type from the list above)'
));
?>
</p>
echo
$code
;
?>
-expiryYear"
type=
"hidden"
name=
"payment[expiryYear]"
>
</div>
<input
id=
"
<?php
/* @noEscape */
echo
$code
;
?>
-cc_type"
type=
"hidden"
name=
"payment[cc_type]"
>
<div
id=
"cardContainer-
<?php
/* @noEscape */
echo
$code
;
?>
"
></div>
<input
id=
"
<?php
/* @noEscape */
echo
$code
;
?>
-number"
type=
"hidden"
name=
"payment[number]"
>
<input
id=
"
<?php
/* @noEscape */
echo
$code
;
?>
-cvc"
type=
"hidden"
name=
"payment[cvc]"
>
<input
id=
"
<?php
/* @noEscape */
echo
$code
;
?>
-expiryMonth"
type=
"hidden"
name=
"payment[expiryMonth]"
>
<input
id=
"
<?php
/* @noEscape */
echo
$code
;
?>
-expiryYear"
type=
"hidden"
name=
"payment[expiryYear]"
>
<input
id=
"
<?php
/* @noEscape */
echo
$code
;
?>
-cc_type"
type=
"hidden"
name=
"payment[cc_type]"
>
<script>
<script>
require
(
require
(
...
@@ -86,9 +80,9 @@ echo $code; ?>" style="display:none">
...
@@ -86,9 +80,9 @@ echo $code; ?>" style="display:none">
document
.
body
.
appendChild
(
scriptTag
);
document
.
body
.
appendChild
(
scriptTag
);
// Get cc type by adyen cc type
// Get cc type by adyen cc type
var
getCcCodeByAltCode
=
function
(
altCode
)
{
var
getCcCodeByAltCode
=
function
(
altCode
)
{
if
(
ccTypes
.
hasOwnProperty
(
altCode
))
{
if
(
ccTypes
.
hasOwnProperty
(
altCode
))
{
return
ccTypes
[
altCode
];
return
ccTypes
[
altCode
];
}
}
...
@@ -114,14 +108,7 @@ echo $code; ?>" style="display:none">
...
@@ -114,14 +108,7 @@ echo $code; ?>" style="display:none">
type
:
'
card
'
,
type
:
'
card
'
,
groupTypes
:
ccTypes
,
groupTypes
:
ccTypes
,
onChange
:
function
(
state
)
{
onChange
:
function
(
state
)
{
if
(
state
.
isCardValid
)
{
jQuery
(
"
#cc-type-helper-text
"
).
hide
();
}
else
{
jQuery
(
"
#cc-type-helper-text
"
).
show
();
}
// When the state is valid update the input fields
// When the state is valid update the input fields
if
(
state
.
isValid
)
{
if
(
state
.
isValid
)
{
// Here we enable the button if the component is now valid
// Here we enable the button if the component is now valid
...
@@ -132,38 +119,28 @@ echo $code; ?>" style="display:none">
...
@@ -132,38 +119,28 @@ echo $code; ?>" style="display:none">
jQuery
(
"
#
<?php
/* @noEscape */
echo
$code
;
?>
-cc_type
"
).
val
(
getCcCodeByAltCode
(
state
.
brand
));
jQuery
(
"
#
<?php
/* @noEscape */
echo
$code
;
?>
-cc_type
"
).
val
(
getCcCodeByAltCode
(
state
.
brand
));
}
}
},
},
onError
:
function
()
{}
onError
:
function
()
{
}
});
});
card
.
mount
(
cardNode
);
card
.
mount
(
cardNode
);
/*order.submit = order.submit.wrap(function (originalSaveMethod) {
attachSecureFieldsData.call(this);
originalSaveMethod();
});*/
}
}
// Load card components and force wait until the external script is loaded
// Load card components and force wait until the external script is loaded
if
(
scriptTag
.
readyState
)
{
if
(
scriptTag
.
readyState
)
{
scriptTag
.
onreadystatechange
=
function
()
{
scriptTag
.
onreadystatechange
=
function
()
{
if
(
script
.
readyState
==
"
loaded
"
||
if
(
script
.
readyState
==
"
loaded
"
||
script
.
readyState
==
"
complete
"
){
script
.
readyState
==
"
complete
"
)
{
script
.
onreadystatechange
=
null
;
script
.
onreadystatechange
=
null
;
secureFieldsInitialize
();
secureFieldsInitialize
();
}
}
};
};
}
}
else
{
else
{
scriptTag
.
onload
=
function
()
{
scriptTag
.
onload
=
function
()
{
secureFieldsInitialize
();
secureFieldsInitialize
();
};
};
}
}
//]]>
//]]>
});
});
// TODO Oneclick
// cvc is not required so cvchide: true or hidecvc
</script>
</script>
</fieldset>
</fieldset>
view/adminhtml/web/css/order_create_styles.css
View file @
ae4a6d04
This diff is collapsed.
Click to expand it.
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