We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit ae4a6d04 authored by Rik ter Beek's avatar Rik ter Beek

fix based on the PR comments + fixed backend order layout css

parent ad418cf9
......@@ -126,16 +126,11 @@ 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 ' .
return 'Please provide API-KEY for the webservice user ' .
$this->adyenHelper->getWsUsername() . ' for default/store ' .
$this->storeManagerInterface->getStore()->getName();
}
return $message;
}
/**
* Retrieve system message severity
*
......
......@@ -52,7 +52,6 @@ class Cc extends \Magento\Payment\Block\Form\Cc
* @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
*/
public function __construct(
......
......@@ -30,26 +30,21 @@ use Magento\Payment\Gateway\Http\ClientInterface;
*/
class TransactionPayment implements ClientInterface
{
/**
* PaymentRequest constructor.
*
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/**
* TransactionPayment constructor.
* @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 = []
\Adyen\Payment\Helper\Data $adyenHelper
) {
$this->_encryptor = $encryptor;
$this->_adyenHelper = $adyenHelper;
$this->_recurringType = $recurringType;
$this->_appState = $context->getAppState();
$this->adyenHelper = $adyenHelper;
}
/**
......@@ -61,13 +56,13 @@ class TransactionPayment implements ClientInterface
{
$request = $transferObject->getBody();
$client = $this->_adyenHelper->initializeAdyenClient();
$client = $this->adyenHelper->initializeAdyenClient();
$service = new \Adyen\Service\Checkout($client);
try {
$response = $service->payments($request);
} catch(\Adyen\AdyenException $e) {
} catch (\Adyen\AdyenException $e) {
$response['error'] = $e->getMessage();
}
......
......@@ -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)) {
......
......@@ -65,7 +65,7 @@ class CheckoutPaymentCommentHistoryHandler implements HandlerInterface
}
if ($pspReference) {
$commentText .= '<br /> authResult: ' . $pspReference;
$commentText .= '<br /> pspReference: ' . $pspReference;
}
$comment = __($commentText);
......
......@@ -48,24 +48,18 @@ echo $code; ?>" style="display:none">
</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,7 +80,7 @@ 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)) {
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>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment