Skip to content

Commit

Permalink
Merge pull request #8 from khipu/heads/2.4.10
Browse files Browse the repository at this point in the history
2.4.10
  • Loading branch information
JKacicM authored Mar 19, 2024
2 parents 136956c + 91fc01b commit c682e6c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
14 changes: 11 additions & 3 deletions Model/Simplified.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
use Magento\Payment\Model\Method\Logger;
use Magento\Sales\Model\Order;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;


class Simplified extends \Magento\Payment\Model\Method\AbstractMethod
{
const KHIPU_MAGENTO_VERSION = "2.4.9";
const KHIPU_MAGENTO_VERSION = "2.4.10";
protected $_code = 'simplified';
protected $_isInitializeNeeded = true;
protected $urlBuilder;
protected $storeManager;
protected $orderSender;
protected $_canOrder = true;
protected $_canAuthorize = true;
protected $_canUseCheckout = true;
Expand Down Expand Up @@ -60,6 +63,7 @@ public function __construct(
Logger $logger,
UrlInterface $urlBuilder,
StoreManagerInterface $storeManager,
OrderSender $orderSender,
AbstractResource $resource = null,
AbstractDb $resourceCollection = null,
array $data = array()
Expand All @@ -80,6 +84,7 @@ public function __construct(

$this->urlBuilder = $urlBuilder;
$this->storeManager = $storeManager;
$this->orderSender = $orderSender;

}

Expand Down Expand Up @@ -225,16 +230,19 @@ public function validateKhipuCallback(Order $order, $notificationToken, $apiVers
$responseTxt .= 'Payer Name: ' . $paymentResponse->getPayerName() . '<br>';
$responseTxt .= 'Payer Email: ' . $paymentResponse->getPayerEmail() . '<br>';
$responseTxt .= 'Personal Identifier: ' . $paymentResponse->getPersonalIdentifier() . '<br>';

$invoice = $order->prepareInvoice();
$invoice->register();
$invoice->save();

$paymentCompleteStatus = $this->getConfigData('payment_complete_status');

$order->setState($paymentCompleteStatus, true);
$order->setState($paymentCompleteStatus, false, "Pago Realizado con Khipu", true);
$order->setStatus($order->getConfig()->getStateDefaultStatus($paymentCompleteStatus));
$order->setIsCustomerNotified(true);
$order->addStatusToHistory($paymentCompleteStatus, $responseTxt);
$order->save();

$this->orderSender->send($order);
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Magento 2 Khipu Plugin

khipu payment gateway Magento 2.4.9 plugin.
khipu payment gateway Magento 2.4.10 plugin.

This version is compatible with Magento 2.3 to 2.6

You can sign up for khipu account at <https://khipu.com>

## Install via Composer

You can install Magento 2.4.9 khipu plugin via [Composer](http://getcomposer.org/). Run the following command in your terminal:
You can install Magento 2.4.10 khipu plugin via [Composer](http://getcomposer.org/). Run the following command in your terminal:

1. Go to your Magento 2 root folder.

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": "khipu/magento2-khipu",
"type": "magento2-module",
"description": "khipu integration for Magento 2",
"version": "2.4.9",
"version": "2.4.10",
"homepage": "https://khipu.com",
"license": [
"OSL-3.0"
Expand Down
6 changes: 5 additions & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
<label>Secret</label>
</field>
<field id="payment_complete_status" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Estado del pago</label>
<label>Estado del pago Exitoso</label>
<source_model>Magento\Sales\Model\Config\Source\Order\Status</source_model>
</field>
<field id="new_order_status" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Estado de Nueva Orden</label>
<source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort Order</label>
</field>
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<simplified>
<active>1</active>
<model>Khipu\Payment\Model\Simplified</model>
<order_status>pending</order_status>
<title>khipu</title>
<payment_action>Authorization</payment_action>
<invoice_settings>default</invoice_settings>
</simplified>
</payment>
</default>
Expand Down
5 changes: 5 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
<type name="Magento\Framework\App\Request\CsrfValidator">
<plugin name="csrf_validator_skip" type="Khipu\Payment\Model\CsrfValidatorSkip" />
</type>
<type name="Khipu\Payment\Model\Simplified">
<arguments>
<argument name="orderSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\OrderSender</argument>
</arguments>
</type>
</config>
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Khipu_Payment" setup_version="2.4.9" active="true">
<module name="Khipu_Payment" setup_version="2.4.10" active="true">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Checkout"/>
Expand Down

0 comments on commit c682e6c

Please sign in to comment.