-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #489 from mollie/release/2.6.0
Release/2.6.0
- Loading branch information
Showing
34 changed files
with
1,365 additions
and
969 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
Plugin/InstantPurchase/Button/PlaceOrderAddRedirectUrl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/* | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Plugin\InstantPurchase\Button; | ||
|
||
use Magento\Framework\App\ResponseInterface; | ||
use Magento\Framework\Controller\Result\Json; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\Serialize\SerializerInterface; | ||
use Magento\InstantPurchase\Controller\Button\PlaceOrder; | ||
use Mollie\Payment\Observer\CheckoutSubmitAllAfter\StartTransactionForInstantPurchaseOrders; | ||
|
||
class PlaceOrderAddRedirectUrl | ||
{ | ||
/** | ||
* @var ResponseInterface | ||
*/ | ||
private $response; | ||
|
||
/** | ||
* @var SerializerInterface | ||
*/ | ||
private $serializer; | ||
|
||
/** | ||
* @var ResultFactory | ||
*/ | ||
private $resultFactory; | ||
|
||
/** | ||
* @var StartTransactionForInstantPurchaseOrders | ||
*/ | ||
private $startTransaction; | ||
|
||
public function __construct( | ||
ResponseInterface $response, | ||
SerializerInterface $serializer, | ||
ResultFactory $resultFactory, | ||
StartTransactionForInstantPurchaseOrders $startTransaction | ||
) { | ||
$this->response = $response; | ||
$this->serializer = $serializer; | ||
$this->resultFactory = $resultFactory; | ||
$this->startTransaction = $startTransaction; | ||
} | ||
|
||
public function afterExecute(PlaceOrder $subject, Json $result) | ||
{ | ||
$redirectUrl = $this->startTransaction->getRedirectUrl(); | ||
if (!$redirectUrl) { | ||
return $result; | ||
} | ||
|
||
$result->renderResult($this->response); | ||
|
||
$body = $this->serializer->unserialize($this->response->getContent()); | ||
|
||
$body['mollie_redirect_url'] = $redirectUrl; | ||
|
||
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON); | ||
$result->setData($body); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/* | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Service\Order\Lines\Generator; | ||
|
||
use Magento\Sales\Api\Data\OrderInterface; | ||
use Mollie\Payment\Helper\General; | ||
|
||
class MageWorxRewardPoints implements GeneratorInterface | ||
{ | ||
/** | ||
* @var General | ||
*/ | ||
private $mollieHelper; | ||
|
||
public function __construct( | ||
General $mollieHelper | ||
) { | ||
$this->mollieHelper = $mollieHelper; | ||
} | ||
|
||
public function process(OrderInterface $order, array $orderLines): array | ||
{ | ||
if (!$order->getMwRwrdpointsAmnt()) { | ||
return $orderLines; | ||
} | ||
|
||
$forceBaseCurrency = (bool)$this->mollieHelper->useBaseCurrency($order->getStoreId()); | ||
$currency = $forceBaseCurrency ? $order->getBaseCurrencyCode() : $order->getOrderCurrencyCode(); | ||
|
||
$orderLines[] = [ | ||
'type' => 'surcharge', | ||
'name' => 'Reward Points', | ||
'quantity' => 1, | ||
'unitPrice' => $this->mollieHelper->getAmountArray($currency, -$order->getMwRwrdpointsAmnt()), | ||
'totalAmount' => $this->mollieHelper->getAmountArray($currency, -$order->getMwRwrdpointsAmnt()), | ||
'vatRate' => 0, | ||
'vatAmount' => $this->mollieHelper->getAmountArray($currency, 0.0), | ||
]; | ||
|
||
return $orderLines; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.