Skip to content

Commit

Permalink
Merge pull request #27 from BITVAX/dev-1.1.9
Browse files Browse the repository at this point in the history
Dev 1.1.9
  • Loading branch information
jimmyn authored Aug 24, 2023
2 parents b6b5b90 + aebf7c6 commit 4e69327
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 111 deletions.
19 changes: 19 additions & 0 deletions Controller/Payment/Complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Magento\Sales\Api\OrderRepositoryInterface;
use Monei\MoneiPayment\Api\Config\MoneiPaymentModuleConfigInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
use Monei\MoneiPayment\Api\Service\GenerateInvoiceInterface;
use Monei\MoneiPayment\Model\PendingOrderFactory;
use Monei\MoneiPayment\Model\ResourceModel\PendingOrder as PendingOrderResource;
Expand Down Expand Up @@ -67,9 +68,15 @@ class Complete implements ActionInterface
*/
private $pendingOrderResource;

/**
* @var OrderSender
*/
protected $orderSender;

/**
* @param Context $context
* @param OrderRepositoryInterface $orderRepository
* @param OrderSender $orderSender
* @param OrderInterfaceFactory $orderFactory
* @param MoneiPaymentModuleConfigInterface $moduleConfig
* @param GenerateInvoiceInterface $generateInvoiceService
Expand All @@ -78,6 +85,7 @@ class Complete implements ActionInterface
public function __construct(
Context $context,
OrderRepositoryInterface $orderRepository,
OrderSender $orderSender,
OrderInterfaceFactory $orderFactory,
MoneiPaymentModuleConfigInterface $moduleConfig,
GenerateInvoiceInterface $generateInvoiceService,
Expand All @@ -87,6 +95,7 @@ public function __construct(
) {
$this->context = $context;
$this->orderRepository = $orderRepository;
$this->orderSender = $orderSender;
$this->orderFactory = $orderFactory;
$this->moduleConfig = $moduleConfig;
$this->generateInvoiceService = $generateInvoiceService;
Expand Down Expand Up @@ -128,6 +137,16 @@ public function execute()
$order->setStatus($this->moduleConfig->getConfirmedStatus())->setState(Order::STATE_NEW);
$order->setData('monei_payment_id', $data['id']);
$this->orderRepository->save($order);

// send Order email
if ($order->getCanSendNewEmailFlag()) {
try {
$this->orderSender->send($order);
} catch (\Exception $e) {
$this->logger->critical($e);
}
}

return $this->resultRedirectFactory->setPath('checkout/onepage/success', ['_secure' => true]);

default:
Expand Down
2 changes: 1 addition & 1 deletion Controller/Payment/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function execute()
*/
$order = $this->checkoutSession->getLastRealOrder();
$data = [
"amount" => $order->getGrandTotal() * 100,
"amount" => $order->getBaseGrandTotal() * 100,
"orderId" => (string) $order->getIncrementId(),
"currency" => $order->getBaseCurrencyCode(),
"customer" => $this->getCustomerDetails($order),
Expand Down
56 changes: 0 additions & 56 deletions Observer/SendMailOnOrderSuccess.php

This file was deleted.

45 changes: 0 additions & 45 deletions Plugin/Sales/Order/Email/Container/OrderIdentityPlugin.php

This file was deleted.

2 changes: 1 addition & 1 deletion Setup/Patch/Data/SetupSales.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getAliases(): array
*/
public static function getVersion(): string
{
return '1.1.8';
return '1.1.9';
}

public function apply(): void
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monei/module-monei-payment",
"version": "1.1.8",
"version": "1.1.9",
"description": "MONEI Payments Adobe Commerce (Magento 2) module",
"type": "magento2-module",
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<can_capture_partial>1</can_capture_partial>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_refund>1</can_refund>
<order_place_redirect_url>1</order_place_redirect_url>
</monei>
</payment>
</default>
Expand Down
3 changes: 0 additions & 3 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
<type name="Magento\Sales\Model\Service\CreditmemoService">
<plugin name="set_order_status_after_refund" type="Monei\MoneiPayment\Plugin\SetOrderStatusAfterRefund"/>
</type>
<type name="Magento\Sales\Model\Order\Email\Container\OrderIdentity">
<plugin name="change_is_enable_method" type="Monei\MoneiPayment\Plugin\Sales\Order\Email\Container\OrderIdentityPlugin"/>
</type>
<virtualType name="MoneiPaymentFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">Monei\MoneiPayment\Model\Payment\Monei::CODE</argument>
Expand Down
3 changes: 0 additions & 3 deletions etc/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<event name="sales_order_invoice_register">
<observer name="set_monei_order_status_and_state_after_invoice" instance="Monei\MoneiPayment\Observer\SetOrderStatusAfterInvoice"/>
</event>
<event name="checkout_onepage_controller_success_action">
<observer name="checkout_onepage_controller_success_action_sendmail" instance="Monei\MoneiPayment\Observer\SendMailOnOrderSuccess" />
</event>
<!-- <event name="sales_order_creditmemo_refund">-->
<!-- <observer name="set_monei_order_status_and_state_after_refund" instance="Monei\MoneiPayment\Observer\SetOrderStatusAfterRefund"/>-->
<!-- </event>-->
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
~ @copyright Copyright © Monei (https://monei.com)
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Monei_MoneiPayment" setup_version="1.1.8">
<module name="Monei_MoneiPayment" setup_version="1.1.9">
<sequence>
<module name="Magento_Checkout"/>
<module name="Magento_Config"/>
Expand Down

0 comments on commit 4e69327

Please sign in to comment.