Skip to content

Commit

Permalink
Merge pull request #115 from Adyen/develop
Browse files Browse the repository at this point in the history
Merge from 'Develop'
  • Loading branch information
rikterbeek authored May 23, 2017
2 parents 9063aa5 + ca3ab99 commit a01f9d9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
20 changes: 15 additions & 5 deletions Block/Redirect/Pos.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class Pos extends \Magento\Payment\Block\Form
*/
protected $_adyenLogger;

/**
* Currency factory
*
* @var \Magento\Directory\Model\CurrencyFactory
*/
protected $_currencyFactory;

/**
* Pos constructor.
Expand All @@ -66,7 +72,8 @@ public function __construct(
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Checkout\Model\Session $checkoutSession,
\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Directory\Model\CurrencyFactory $currencyFactory
) {
$this->_orderFactory = $orderFactory;
$this->_checkoutSession = $checkoutSession;
Expand All @@ -75,6 +82,7 @@ public function __construct(
$this->_request = $context->getRequest();
$this->_adyenHelper = $adyenHelper;
$this->_adyenLogger = $adyenLogger;
$this->_currencyFactory = $currencyFactory;

if (!$this->_order) {
$incrementId = $this->_getCheckout()->getLastRealOrderId();
Expand All @@ -97,7 +105,7 @@ public function getLaunchLink()
{
$launchlink = "";
try {
if($this->_order->getPayment())
if ($this->_order->getPayment())
{

$realOrderId = $this->_order->getRealOrderId();
Expand Down Expand Up @@ -134,9 +142,10 @@ public function getLaunchLink()
$paymentAmount. "&originalCustomMerchantReference=".
$merchantReference . "&originalCustomSessionId=".session_id());

$launchlink = "adyen://payment?sessionId=".session_id()."&amount=".$paymentAmount.
"&currency=".$currencyCode."&merchantReference=".$merchantReference. $recurringParams .
$receiptOrderLines . "&callback=".$callbackUrl . $extraParamaters;
// Cash you can trigger by adding transactionType=CASH
$launchlink = "adyen://payment?sessionId=".session_id() .
"&amount=".$paymentAmount."&currency=".$currencyCode."&merchantReference=".$merchantReference .
$recurringParams . $receiptOrderLines . "&callback=".$callbackUrl . $extraParamaters;

// cash not working see ticket
// https://youtrack.is.adyen.com/issue/IOS-130#comment=102-20285
Expand Down Expand Up @@ -250,6 +259,7 @@ protected function _getReceiptOrderLines(\Magento\Sales\Model\Order $order)
"====== YOUR PAYMENT DETAILS ======||CB\n".
"---||C\n";


return $myReceiptOrderLines;
}

Expand Down
13 changes: 13 additions & 0 deletions Model/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,19 @@ public function processNotification()
sprintf("Processing notification %s", $notification->getEntityId())
);

/**
* If the event is a RECURRING_CONTRACT wait an extra 5 minutes
* before processing so we are sure the RECURRING_CONTRACT
*/
if (trim($notification->getEventCode()) == Notification::RECURRING_CONTRACT &&
strtotime($notification->getCreatedAt()) >= strtotime('-5 minutes', time())) {
$this->_adyenLogger->addAdyenNotificationCronjob(
"This is a recurring_contract notification wait an extra 5 minutes
before processing this to make sure the contract exists"
);
continue;
}

// log the executed notification
$this->_adyenLogger->addAdyenNotificationCronjob(print_r($notification->debug(), 1));

Expand Down
2 changes: 1 addition & 1 deletion Model/Ui/AdyenPosConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getConfig()
self::CODE => [
'isActive' => true,
'redirectUrl' => $this->_urlBuilder->getUrl(
'adyen/process/redirect', ['_secure' => $this->_getRequest()->isSecure()])
'adyen/process/redirectPos', ['_secure' => $this->_getRequest()->isSecure()])
]
]
];
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "2.0.4",
"version": "2.0.5",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
-->
<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="2.0.4">
<module name="Adyen_Payment" setup_version="2.0.5">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
Expand Down

0 comments on commit a01f9d9

Please sign in to comment.