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 f6968a08 authored by Rik ter Beek's avatar Rik ter Beek

Merge pull request #11 from Adyen/develop

Merge branch 'develop'
parents 3b4acc26 55792411
...@@ -42,11 +42,6 @@ class Cc extends \Magento\Payment\Block\Form ...@@ -42,11 +42,6 @@ class Cc extends \Magento\Payment\Block\Form
*/ */
protected $_adyenHelper; protected $_adyenHelper;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/** /**
* @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
...@@ -56,13 +51,11 @@ class Cc extends \Magento\Payment\Block\Form ...@@ -56,13 +51,11 @@ class Cc extends \Magento\Payment\Block\Form
\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\View\Element\Template\Context $context,
\Magento\Payment\Model\Config $paymentConfig, \Magento\Payment\Model\Config $paymentConfig,
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Store\Model\StoreManagerInterface $storeManager,
array $data = [] array $data = []
) { ) {
parent::__construct($context, $data); parent::__construct($context, $data);
$this->_paymentConfig = $paymentConfig; $this->_paymentConfig = $paymentConfig;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_storeManager = $storeManager;
} }
......
...@@ -189,6 +189,7 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -189,6 +189,7 @@ class Json extends \Magento\Framework\App\Action\Action
} else { } else {
return "401"; return "401";
} }
return true;
} }
......
...@@ -147,7 +147,7 @@ class Result extends \Magento\Framework\App\Action\Action ...@@ -147,7 +147,7 @@ class Result extends \Magento\Framework\App\Action\Action
'adyen_response' => $response 'adyen_response' => $response
]); ]);
if (isset($response['handled'])) { if (isset($response['handled'])) {
return; return $response['handled_response'];
} }
// set StoreId for retrieving debug log setting // set StoreId for retrieving debug log setting
......
...@@ -277,6 +277,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -277,6 +277,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
if($defaultCountry) { if($defaultCountry) {
return $defaultCountry; return $defaultCountry;
} }
return "";
} }
/** /**
...@@ -335,6 +337,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface ...@@ -335,6 +337,8 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
// connect to magento log // connect to magento log
$client->setLogger($this->_adyenLogger); $client->setLogger($this->_adyenLogger);
$hmacKey = $this->_adyenHelper->getHmac();
// create and add signature // create and add signature
$requestParams["merchantSig"] = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $requestParams); $requestParams["merchantSig"] = \Adyen\Util\Util::calculateSha256Signature($hmacKey, $requestParams);
......
...@@ -544,7 +544,7 @@ class Cron ...@@ -544,7 +544,7 @@ class Cron
case Notification::PENDING: case Notification::PENDING:
if($this->_getConfigData('send_email_bank_sepa_on_pending', 'adyen_abstract', $this->_order->getStoreId())) { if($this->_getConfigData('send_email_bank_sepa_on_pending', 'adyen_abstract', $this->_order->getStoreId())) {
// Check if payment is banktransfer or sepa if true then send out order confirmation email // Check if payment is banktransfer or sepa if true then send out order confirmation email
$isBankTransfer = $this->_isBankTransfer($this->_paymentMethod); $isBankTransfer = $this->_isBankTransfer();
if($isBankTransfer || $this->_paymentMethod == 'sepadirectdebit') { if($isBankTransfer || $this->_paymentMethod == 'sepadirectdebit') {
// $this->_order->sendNewOrderEmail(); // send order email // $this->_order->sendNewOrderEmail(); // send order email
$this->_orderSender->send($this->_order); $this->_orderSender->send($this->_order);
...@@ -581,7 +581,7 @@ class Cron ...@@ -581,7 +581,7 @@ class Cron
// $this->_uncancelOrder($this->_order); // $this->_uncancelOrder($this->_order);
// FOR POS authorize the payment on the CAPTURE notification // FOR POS authorize the payment on the CAPTURE notification
$this->_authorizePayment($this->_order, $this->_paymentMethod); $this->_authorizePayment();
} }
break; break;
case Notification::CAPTURE_FAILED: case Notification::CAPTURE_FAILED:
...@@ -603,7 +603,7 @@ class Cron ...@@ -603,7 +603,7 @@ class Cron
$this->_debugData['_processNotification info'] = 'Order is already cancelled or holded so do nothing'; $this->_debugData['_processNotification info'] = 'Order is already cancelled or holded so do nothing';
} else if ($this->_order->canCancel() || $this->_order->canHold()) { } else if ($this->_order->canCancel() || $this->_order->canHold()) {
$this->_debugData['_processNotification info'] = 'try to cancel the order'; $this->_debugData['_processNotification info'] = 'try to cancel the order';
$this->_holdCancelOrder($this->_order, true); $this->_holdCancelOrder(true);
} else { } else {
$this->_debugData['_processNotification info'] = 'try to refund the order'; $this->_debugData['_processNotification info'] = 'try to refund the order';
// refund // refund
...@@ -701,10 +701,10 @@ class Cron ...@@ -701,10 +701,10 @@ class Cron
}else { }else {
$this->_debugData[$this->_count]['_processNotification error'] = 'Failed to create billing agreement for this order (listRecurringCall did not contain contract)'; $this->_debugData['_processNotification error'] = 'Failed to create billing agreement for this order (listRecurringCall did not contain contract)';
$this->_debugData[$this->_count]['_processNotification ref'] = printf('recurringDetailReference in notification is %1', $recurringDetailReference) ; $this->_debugData['_processNotification ref'] = printf('recurringDetailReference in notification is %1', $recurringDetailReference) ;
$this->_debugData[$this->_count]['_processNotification customer ref'] = printf('CustomerReference is: %1 and storeId is %2', $customerReference, $storeId); $this->_debugData['_processNotification customer ref'] = printf('CustomerReference is: %1 and storeId is %2', $customerReference, $storeId);
$this->_debugData[$this->_count]['_processNotification customer result'] = $listRecurringContracts; $this->_debugData['_processNotification customer result'] = $listRecurringContracts;
$message = __('Failed to create billing agreement for this order (listRecurringCall did not contain contract)'); $message = __('Failed to create billing agreement for this order (listRecurringCall did not contain contract)');
} }
...@@ -714,7 +714,7 @@ class Cron ...@@ -714,7 +714,7 @@ class Cron
} }
break; break;
default: default:
$this->_debugData[$this->_count]['_processNotification info'] = sprintf('This notification event: %s is not supported so will be ignored', $this->_eventCode); $this->_debugData['_processNotification info'] = sprintf('This notification event: %s is not supported so will be ignored', $this->_eventCode);
break; break;
} }
} }
...@@ -978,6 +978,7 @@ class Cron ...@@ -978,6 +978,7 @@ class Cron
case 'amex': case 'amex':
case 'bcmc': case 'bcmc':
case 'maestro': case 'maestro':
case 'maestrouk':
case 'diners': case 'diners':
case 'discover': case 'discover':
case 'jcb': case 'jcb':
...@@ -1106,7 +1107,7 @@ class Cron ...@@ -1106,7 +1107,7 @@ class Cron
// create invoice for the capture notification if you are on manual capture // create invoice for the capture notification if you are on manual capture
if($createInvoice == true && $amount == $orderAmount) { if($createInvoice == true && $amount == $orderAmount) {
$this->_debugData['_setPaymentAuthorized amount'] = 'amount notification:'.$amount . ' amount order:'.$orderAmount; $this->_debugData['_setPaymentAuthorized amount'] = 'amount notification:'.$amount . ' amount order:'.$orderAmount;
$this->_createInvoice($this->_order); $this->_createInvoice();
} }
// if you have capture on shipment enabled don't set update the status of the payment // if you have capture on shipment enabled don't set update the status of the payment
...@@ -1125,7 +1126,7 @@ class Cron ...@@ -1125,7 +1126,7 @@ class Cron
} }
// check for boleto if payment is totally paid // check for boleto if payment is totally paid
if($this->_paymentMethodCode($this->_order) == "adyen_boleto") { if($this->_paymentMethodCode() == "adyen_boleto") {
// check if paid amount is the same as orginal amount // check if paid amount is the same as orginal amount
$orginalAmount = $this->_boletoOriginalAmount; $orginalAmount = $this->_boletoOriginalAmount;
......
...@@ -82,6 +82,13 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -82,6 +82,13 @@ class Cc extends \Magento\Payment\Model\Method\Cc
*/ */
protected $_adyenHelper; protected $_adyenHelper;
/**
* Request object
*
* @var \Magento\Framework\App\RequestInterface
*/
protected $_request;
/** /**
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest * @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
...@@ -103,6 +110,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -103,6 +110,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
* @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\RequestInterface $request,
\Adyen\Payment\Model\Api\PaymentRequest $paymentRequest, \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Checkout\Model\Session $checkoutSession, \Magento\Checkout\Model\Session $checkoutSession,
...@@ -140,6 +148,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -140,6 +148,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
$this->_checkoutSession = $checkoutSession; $this->_checkoutSession = $checkoutSession;
$this->_urlBuilder = $urlBuilder; $this->_urlBuilder = $urlBuilder;
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->_request = $request;
} }
protected $_paymentMethodType = 'api'; protected $_paymentMethodType = 'api';
...@@ -318,7 +327,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -318,7 +327,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
*/ */
public function getCheckoutRedirectUrl() public function getCheckoutRedirectUrl()
{ {
return $this->_urlBuilder->getUrl('adyen/process/validate3d/'); return $this->_urlBuilder->getUrl('adyen/process/validate3d/',['_secure' => $this->_getRequest()->isSecure()]);
} }
/** /**
...@@ -361,4 +370,14 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -361,4 +370,14 @@ class Cc extends \Magento\Payment\Model\Method\Cc
return $this; return $this;
} }
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected function _getRequest()
{
return $this->_request;
}
} }
\ No newline at end of file
...@@ -24,13 +24,12 @@ ...@@ -24,13 +24,12 @@
namespace Adyen\Payment\Model; namespace Adyen\Payment\Model;
use Adyen\Payment\Api\Data\NotificationInterface; use Adyen\Payment\Api\Data\NotificationInterface;
use Magento\Framework\Object\IdentityInterface; use Magento\Framework\DataObject\IdentityInterface;
class Notification extends \Magento\Framework\Model\AbstractModel class Notification extends \Magento\Framework\Model\AbstractModel
implements NotificationInterface implements NotificationInterface
{ {
const AUTHORISATION = 'AUTHORISATION'; const AUTHORISATION = 'AUTHORISATION';
const PENDING = 'PENDING'; const PENDING = 'PENDING';
const AUTHORISED = 'AUTHORISED'; const AUTHORISED = 'AUTHORISED';
......
...@@ -2,19 +2,11 @@ ...@@ -2,19 +2,11 @@
"name": "adyen/module-payment", "name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module", "type": "magento2-module",
"version": "1.0.0.1", "version": "1.1.1",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"
], ],
"repositories": [
{
"adyen": {
"type": "vcs",
"url": "git@github.com:Adyen/adyen-php-api-library.git"
}
}
],
"require": { "require": {
"php": "~5.5.0|~5.6.0|~7.0.0", "php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-config": "100.0.*", "magento/module-config": "100.0.*",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="1.0.0.2"> <module name="Adyen_Payment" setup_version="1.1.1">
<sequence> <sequence>
<module name="Magento_Sales"/> <module name="Magento_Sales"/>
<module name="Magento_Quote"/> <module name="Magento_Quote"/>
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
/*jshint browser:true jquery:true*/ /*jshint browser:true jquery:true*/
/*global alert*/ /*global alert*/
var config = { var config = {
paths: {
'adyen/encrypt' : 'Adyen_Payment/js/view/payment/adyen.encrypt.min'
},
config: { config: {
mixins: { mixins: {
'Adyen_Payment/js/action/place-order': { 'Adyen_Payment/js/action/place-order': {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -29,9 +29,10 @@ define( ...@@ -29,9 +29,10 @@ define(
'Adyen_Payment/js/action/place-order', 'Adyen_Payment/js/action/place-order',
'mage/translate', 'mage/translate',
'Magento_Checkout/js/model/payment/additional-validators', 'Magento_Checkout/js/model/payment/additional-validators',
'Adyen_Payment/js/view/payment/adyen-encrypt' 'adyen/encrypt',
], ],
function (_, $, Component, placeOrderAction, $t, additionalValidators) { function (_, $, Component, placeOrderAction, $t, additionalValidators, adyenEncrypt) {
'use strict'; 'use strict';
$.validator.addMethod( $.validator.addMethod(
'validate-custom-required', function (value) { 'validate-custom-required', function (value) {
...@@ -102,7 +103,7 @@ define( ...@@ -102,7 +103,7 @@ define(
var cse_key = this.getCSEKey(); var cse_key = this.getCSEKey();
var options = {}; var options = {};
var cseInstance = adyen.encrypt.createEncryption(cse_key, options); var cseInstance = adyenEncrypt.createEncryption(cse_key, options);
var generationtime = self.getGenerationTime(); var generationtime = self.getGenerationTime();
var cardData = { var cardData = {
......
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