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
*/
public
function
getText
()
{
$message
=
''
;
if
(
!
empty
(
$this
->
adyenHelper
->
getWsUsername
()))
{
$message
=
'Please provide API-KEY for the webservice user '
.
$this
->
adyenHelper
->
getWsUsername
()
.
' for default/store '
.
$this
->
storeManagerInterface
->
getStore
()
->
getName
();
}
return
$message
;
return
'Please provide API-KEY for the webservice user '
.
$this
->
adyenHelper
->
getWsUsername
()
.
' for default/store '
.
$this
->
storeManagerInterface
->
getStore
()
->
getName
();
}
/**
...
...
Block/Form/Cc.php
View file @
ae4a6d04
...
...
@@ -45,16 +45,15 @@ class Cc extends \Magento\Payment\Block\Form\Cc
*/
protected
$checkoutSession
;
/**
* Cc constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param array $data
*/
/**
* Cc constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param array $data
*/
public
function
__construct
(
\Magento\Framework\View\Element\Template\Context
$context
,
\Magento\Payment\Model\Config
$paymentConfig
,
...
...
Gateway/Http/Client/TransactionPayment.php
View file @
ae4a6d04
...
...
@@ -30,47 +30,42 @@ use Magento\Payment\Gateway\Http\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
* @return mixed
* @throws ClientException
*/
public
function
placeRequest
(
\Magento\Payment\Gateway\Http\TransferInterface
$transferObject
)
{
$request
=
$transferObject
->
getBody
();
/**
* @var \Adyen\Payment\Helper\Data
*/
private
$adyenHelper
;
$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
);
}
catch
(
\Adyen\AdyenException
$e
)
{
$response
[
'error'
]
=
$e
->
getMessage
();
}
/**
* @param \Magento\Payment\Gateway\Http\TransferInterface $transferObject
* @return mixed
* @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
// If ccType is set use this. For bcmc you need bcmc otherwise it will fail
$request
[
'paymentMethod'
][
'type'
]
=
"scheme"
;
if
(
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
VARIANT
))
{
$request
[
'paymentMethod'
][
'type'
]
=
$
payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
VARIANT
)
;
if
(
$
variant
=
$
payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
VARIANT
))
{
$request
[
'paymentMethod'
][
'type'
]
=
$
variant
;
}
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;
class
CheckoutPaymentCommentHistoryHandler
implements
HandlerInterface
{
/**
* @param array $handlingSubject
* @param array $response
* @return $this
*/
public
function
handle
(
array
$handlingSubject
,
array
$response
)
{
$payment
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$handlingSubject
);
/**
* @param array $handlingSubject
* @param array $response
* @return $this
*/
public
function
handle
(
array
$handlingSubject
,
array
$response
)
{
$payment
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$handlingSubject
);
/** @var OrderPaymentInterface $payment */
$payment
=
$payment
->
getPayment
();
/** @var OrderPaymentInterface $payment */
$payment
=
$payment
->
getPayment
();
$commentText
=
"Adyen Result response:"
;
$commentText
=
"Adyen Result response:"
;
if
(
isset
(
$response
[
'resultCode'
]))
{
$responseCode
=
$response
[
'resultCode'
];
}
else
{
// try to get response from response key (used for modifications
if
(
isset
(
$response
[
'response'
]))
{
$responseCode
=
$response
[
'response'
];
}
else
{
$responseCode
=
""
;
}
}
if
(
isset
(
$response
[
'resultCode'
]))
{
$responseCode
=
$response
[
'resultCode'
];
}
else
{
// try to get response from response key (used for modifications
if
(
isset
(
$response
[
'response'
]))
{
$responseCode
=
$response
[
'response'
];
}
else
{
$responseCode
=
""
;
}
}
if
(
isset
(
$response
[
'pspReference'
]))
{
$pspReference
=
$response
[
'pspReference'
];
}
else
{
$pspReference
=
""
;
}
if
(
isset
(
$response
[
'pspReference'
]))
{
$pspReference
=
$response
[
'pspReference'
];
}
else
{
$pspReference
=
""
;
}
if
(
$responseCode
)
{
$commentText
.=
'<br /> authResult: '
.
$responseCode
;
$payment
->
getOrder
()
->
setAdyenResulturlEventCode
(
$responseCode
);
}
if
(
$responseCode
)
{
$commentText
.=
'<br /> authResult: '
.
$responseCode
;
$payment
->
getOrder
()
->
setAdyenResulturlEventCode
(
$responseCode
);
}
if
(
$pspReference
)
{
$commentText
.=
'<br /> authResult
: '
.
$pspReference
;
}
if
(
$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">
title=
"
<?php
echo
$block
->
escapeHtml
(
__
(
'Name on Card'
));
?>
"
class=
"admin__control-text"
value=
"
<?php
/* @noEscape */
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>
Available card types:
</div>
<div>
<?php
foreach
(
$block
->
getCcAvailableTypes
()
as
$typeCode
=>
$typeName
)
:
?>
<span
class=
"cc-type-
<?php
echo
$block
->
escapeHtml
(
$typeCode
);
?>
"
>
<?php
echo
$block
->
escapeHtml
(
$typeName
);
?>
</span>
<?php
endforeach
?>
</div>
<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>
</div>
<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]"
>
<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>
require
(
...
...
@@ -86,9 +80,9 @@ echo $code; ?>" style="display:none">
document
.
body
.
appendChild
(
scriptTag
);
// 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
];
}
...
...
@@ -114,14 +108,7 @@ echo $code; ?>" style="display:none">
type
:
'
card
'
,
groupTypes
:
ccTypes
,
onChange
:
function
(
state
)
{
if
(
state
.
isCardValid
)
{
jQuery
(
"
#cc-type-helper-text
"
).
hide
();
}
else
{
jQuery
(
"
#cc-type-helper-text
"
).
show
();
}
onChange
:
function
(
state
)
{
// When the state is valid update the input fields
if
(
state
.
isValid
)
{
// Here we enable the button if the component is now valid
...
...
@@ -132,38 +119,28 @@ echo $code; ?>" style="display:none">
jQuery
(
"
#
<?php
/* @noEscape */
echo
$code
;
?>
-cc_type
"
).
val
(
getCcCodeByAltCode
(
state
.
brand
));
}
},
onError
:
function
()
{}
onError
:
function
()
{
}
});
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
if
(
scriptTag
.
readyState
)
{
scriptTag
.
onreadystatechange
=
function
()
{
scriptTag
.
onreadystatechange
=
function
()
{
if
(
script
.
readyState
==
"
loaded
"
||
script
.
readyState
==
"
complete
"
){
script
.
readyState
==
"
complete
"
)
{
script
.
onreadystatechange
=
null
;
secureFieldsInitialize
();
}
};
}
else
{
scriptTag
.
onload
=
function
()
{
scriptTag
.
onload
=
function
()
{
secureFieldsInitialize
();
};
}
//]]>
});
// TODO Oneclick
// cvc is not required so cvchide: true or hidecvc
</script>
</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