- • Fecha de la Transacción: ".date('d-m-Y', strtotime($transactionResult->transactionDate)).'
+ • Fecha de la Transacción: " . date('d-m-Y', strtotime($transactionResult->transactionDate)) . '
- • Hora de la Transacción: '.date('H:i:s', strtotime($transactionResult->transactionDate))."
+ • Hora de la Transacción: ' . date('H:i:s', strtotime($transactionResult->transactionDate)) . "
• Tarjeta: **** **** **** {$transactionResult->cardNumber}
@@ -355,8 +352,8 @@ protected function getRejectMessage($transactionResult, $oneclickTitle)
Respuesta de la Transacción: {$this->responseCodeArray[$transactionResult->details[0]->responseCode]} Monto: $ {$transactionResult->details[0]->amount} Order de Compra: {$transactionResult->details[0]->buyOrder}
- Fecha de la Transacción: ".date('d-m-Y', strtotime($transactionResult->transactionDate)).'
- Hora de la Transacción: '.date('H:i:s', strtotime($transactionResult->transactionDate))."
+ Fecha de la Transacción: " . date('d-m-Y', strtotime($transactionResult->transactionDate)) . '
+ Hora de la Transacción: ' . date('H:i:s', strtotime($transactionResult->transactionDate)) . " Tarjeta: **** **** **** {$transactionResult->cardNumber}
";
diff --git a/Model/Config/ConfigProvider.php b/Model/Config/ConfigProvider.php
index 4324c99..8e2e0d5 100644
--- a/Model/Config/ConfigProvider.php
+++ b/Model/Config/ConfigProvider.php
@@ -4,11 +4,11 @@
class ConfigProvider implements \Magento\Checkout\Model\ConfigProviderInterface
{
- const SECURITY_CONFIGS_ROUTE = 'payment/transbank_webpay/security/';
- const ORDER_CONFIGS_ROUTE = 'payment/transbank_webpay/general_parameters/';
-
- const SECURITY_CONFIGS_ROUTE_ONECLICK = 'payment/transbank_oneclick/security/';
- const ORDER_CONFIGS_ROUTE_ONECLICK = 'payment/transbank_oneclick/general_parameters/';
+ const SECURITY_CONFIGS_ROUTE = 'payment/transbank_webpay/';
+ const ORDER_CONFIGS_ROUTE = 'payment/transbank_webpay/';
+
+ const SECURITY_CONFIGS_ROUTE_ONECLICK = 'payment/transbank_oneclick/';
+ const ORDER_CONFIGS_ROUTE_ONECLICK = 'payment/transbank_oneclick/';
const CC_VAULT_CODE = 'transbank_oneclick_cc_vault';
diff --git a/Model/HealthCheck.php b/Model/HealthCheck.php
index 5947174..62f99f4 100755
--- a/Model/HealthCheck.php
+++ b/Model/HealthCheck.php
@@ -99,7 +99,7 @@ public function __construct($config)
*/
private function getValidatePHP()
{
- if (version_compare(phpversion(), '7.2.1', '<=') && version_compare(phpversion(), '5.5.0', '>=')) {
+ if (version_compare(phpversion(), '7.4.33', '<=') && version_compare(phpversion(), '5.5.0', '>=')) {
$this->versionInfo = [
'status' => 'OK',
'version' => phpversion(),
diff --git a/Model/Oneclick.php b/Model/Oneclick.php
index 9602b37..0026f78 100755
--- a/Model/Oneclick.php
+++ b/Model/Oneclick.php
@@ -5,6 +5,7 @@
class Oneclick extends \Magento\Payment\Model\Method\AbstractMethod
{
const CODE = 'transbank_oneclick';
+ const PRODUCT_NAME = 'webpay_oneclick';
/**
* Payment code.
diff --git a/Observer/SaveConfigObserver.php b/Observer/SaveConfigObserver.php
index 68c12a3..273706f 100644
--- a/Observer/SaveConfigObserver.php
+++ b/Observer/SaveConfigObserver.php
@@ -14,10 +14,10 @@
class SaveConfigObserver implements ObserverInterface
{
- const TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS = 'payment/transbank_webpay/general_parameters/payment_successful_status';
- const TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS = 'payment/transbank_oneclick/general_parameters/payment_successful_status';
- const TRANSBANK_ONECLICK_INVOICE_SETTINGS = 'payment/transbank_oneclick/general_parameters/invoice_settings';
- const TRANSBANK_WEBPAY_INVOICE_SETTINGS = 'payment/transbank_webpay/general_parameters/invoice_settings';
+ const TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS = 'payment/transbank_webpay/payment_successful_status';
+ const TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS = 'payment/transbank_oneclick/payment_successful_status';
+ const TRANSBANK_ONECLICK_INVOICE_SETTINGS = 'payment/transbank_oneclick/invoice_settings';
+ const TRANSBANK_WEBPAY_INVOICE_SETTINGS = 'payment/transbank_webpay/invoice_settings';
protected $request;
protected $configWriter;
@@ -26,13 +26,13 @@ class SaveConfigObserver implements ObserverInterface
protected ScopeConfigInterface $scopeConfig;
protected StoreManagerInterface $storeManager;
- public function __construct (
+ public function __construct(
LoggerInterface $logger,
RequestInterface $request,
WriterInterface $configWriter,
ScopeConfigInterface $scopeConfig,
- StoreManagerInterface $storeManager)
- {
+ StoreManagerInterface $storeManager
+ ) {
$this->request = $request;
$this->_logger = $logger;
$this->configWriter = $configWriter;
@@ -46,13 +46,28 @@ public function execute(EventObserver $observer)
$websiteId = $this->getWebsiteId();
$params = $this->request->getParam('groups');
-
- if( isset($params['transbank_webpay']['groups']['general_parameters']['fields']['payment_successful_status']['value']) ){
- $orderStatus = $params['transbank_webpay']['groups']['general_parameters']['fields']['payment_successful_status']['value'];
- } elseif (empty($this->scopeConfig->getValue(self::TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS,ScopeInterface::SCOPE_WEBSITE, $websiteId ))) {
- $orderStatus = $this->scopeConfig->getValue(self::TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS,ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
+ $transbankParams = $params['transbank']['groups'];
+ $webpayFields = $transbankParams['transbank_webpay']['fields'];
+ $oneclickFields = $transbankParams['transbank_oneclick']['fields'];
+
+ if (isset($webpayFields['payment_successful_status']['value'])) {
+ $orderStatus = $webpayFields['payment_successful_status']['value'];
+ } elseif (empty($this->scopeConfig->getValue(
+ self::TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS,
+ ScopeInterface::SCOPE_WEBSITE,
+ $websiteId
+ ))) {
+ $orderStatus = $this->scopeConfig->getValue(
+ self::TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS,
+ ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
+ $websiteId
+ );
} else {
- $orderStatus = $this->scopeConfig->getValue(self::TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS,ScopeInterface::SCOPE_WEBSITE, $websiteId );
+ $orderStatus = $this->scopeConfig->getValue(
+ self::TRANSBANK_WEBPAY_PAYMENT_SUCCESSFUL_STATUS,
+ ScopeInterface::SCOPE_WEBSITE,
+ $websiteId
+ );
}
if ($orderStatus !== 'processing') {
@@ -60,12 +75,24 @@ public function execute(EventObserver $observer)
$this->configWriter->save(self::TRANSBANK_WEBPAY_INVOICE_SETTINGS, $value);
}
- if(isset($params['transbank_oneclick']['groups']['general_parameters']['fields']['payment_successful_status']['value']) ) {
- $oneclickOrderStatus = $params['transbank_oneclick']['groups']['general_parameters']['fields']['payment_successful_status']['value'];
- }elseif (empty($this->scopeConfig->getValue(self::TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS,ScopeInterface::SCOPE_WEBSITE, $websiteId))) {
- $oneclickOrderStatus = $this->scopeConfig->getValue(self::TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS,ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
- }else {
- $oneclickOrderStatus = $this->scopeConfig->getValue(self::TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS,ScopeInterface::SCOPE_WEBSITE, $websiteId);
+ if (isset($oneclickFields['payment_successful_status']['value'])) {
+ $oneclickOrderStatus = $oneclickFields['payment_successful_status']['value'];
+ } elseif (empty($this->scopeConfig->getValue(
+ self::TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS,
+ ScopeInterface::SCOPE_WEBSITE,
+ $websiteId
+ ))) {
+ $oneclickOrderStatus = $this->scopeConfig->getValue(
+ self::TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS,
+ ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
+ $websiteId
+ );
+ } else {
+ $oneclickOrderStatus = $this->scopeConfig->getValue(
+ self::TRANSBANK_ONECLICK_PAYMENT_SUCCESSFUL_STATUS,
+ ScopeInterface::SCOPE_WEBSITE,
+ $websiteId
+ );
}
if ($oneclickOrderStatus !== 'processing') {
@@ -88,4 +115,3 @@ public function getWebsiteId(): int
return $websiteId;
}
}
-
diff --git a/Setup/UpgradeData.php b/Setup/UpgradeData.php
new file mode 100644
index 0000000..873b8ef
--- /dev/null
+++ b/Setup/UpgradeData.php
@@ -0,0 +1,78 @@
+configInterface = $configInterface;
+ $this->scopeConfigInterface = $scopeConfigInterface;
+ }
+
+ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
+ {
+ $setup->startSetup();
+
+ if (version_compare($context->getVersion(), '2.2.1', '<')) {
+ $this->updateConfigData();
+ }
+
+ $setup->endSetup();
+ }
+
+ private function updateConfigData()
+ {
+ $newConfigValues = [
+ 'payment/transbank_webpay/general_parameters/payment_successful_status' =>
+ 'payment/transbank_webpay/payment_successful_status',
+ 'payment/transbank_webpay/general_parameters/payment_error_status' =>
+ 'payment/transbank_webpay/payment_error_status',
+ 'payment/transbank_webpay/general_parameters/new_order_status' =>
+ 'payment/transbank_webpay/new_order_status',
+ 'payment/transbank_webpay/general_parameters/invoice_settings' =>
+ 'payment/transbank_webpay/invoice_settings',
+ 'payment/transbank_webpay/general_parameters/sort_order' => 'payment/transbank_webpay/sort_order',
+ 'payment/transbank_webpay/general_parameters/new_email_order' =>
+ 'payment/transbank_webpay/new_email_order',
+ 'payment/transbank_webpay/security/environment' => 'payment/transbank_webpay/environment',
+ 'payment/transbank_webpay/security/commerce_code' => 'payment/transbank_webpay/commerce_code',
+ 'payment/transbank_webpay/security/api_key' => 'payment/transbank_webpay/api_key',
+ 'payment/transbank_oneclick/general_parameters/payment_successful_status' =>
+ 'payment/transbank_oneclick/payment_successful_status',
+ 'payment/transbank_oneclick/general_parameters/payment_error_status' =>
+ 'payment/transbank_oneclick/payment_error_status',
+ 'payment/transbank_oneclick/general_parameters/invoice_settings' =>
+ 'payment/transbank_oneclick/invoice_settings',
+ 'payment/transbank_oneclick/general_parameters/new_order_status' =>
+ 'payment/transbank_oneclick/new_order_status',
+ 'payment/transbank_oneclick/general_parameters/sort_order' => 'payment/transbank_oneclick/sort_order',
+ 'payment/transbank_oneclick/general_parameters/new_email_order' =>
+ 'payment/transbank_oneclick/new_email_order',
+ 'payment/transbank_oneclick/security/environment' => 'payment/transbank_oneclick/environment',
+ 'payment/transbank_oneclick/security/commerce_code' => 'payment/transbank_oneclick/commerce_code',
+ 'payment/transbank_oneclick/security/child_commerce_code' =>
+ 'payment/transbank_oneclick/child_commerce_code',
+ 'payment/transbank_oneclick/security/transaction_max_amount' =>
+ 'payment/transbank_oneclick/transaction_max_amount',
+ 'payment/transbank_oneclick/security/api_key' => 'payment/transbank_oneclick/api_key',
+ ];
+
+ foreach ($newConfigValues as $key => $value) {
+ $currentConfigValue = $this->scopeConfigInterface->getValue($key);
+ $this->configInterface->deleteConfig($key);
+ $this->configInterface->saveConfig($value, $currentConfigValue);
+ }
+ }
+}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index d705629..7507c5f 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -22,54 +22,54 @@
Transbank\Webpay\Model\Config\Environment
- payment/transbank_webpay/security/environment
+ payment/transbank_webpay/environmentIdentificador único del comercio, asegurate de que comience con 5970
- payment/transbank_webpay/security/commerce_code
+ payment/transbank_webpay/commerce_codeLlave secreta utilizada para conectarse a la API ¡asegúrate de no compartir su contenido!
- payment/transbank_webpay/security/api_key
+ payment/transbank_webpay/api_keyTransbank\Webpay\Model\Config\OrderStatus
- payment/transbank_webpay/general_parameters/payment_successful_status
+ payment/transbank_webpay/payment_successful_statusTransbank\Webpay\Model\Config\OrderStatus
- payment/transbank_webpay/general_parameters/payment_error_status
+ payment/transbank_webpay/payment_error_statusMagento\Sales\Model\Config\Source\Order\Status\NewStatus
- payment/transbank_webpay/general_parameters/new_order_status
+ payment/transbank_webpay/new_order_statusvalidate-numberPosición en la que aparecerá la opción de pago, debe ser menor a otros medios de pago para que aparezca primero
- payment/transbank_webpay/general_parameters/sort_order
+ payment/transbank_webpay/sort_orderTransbank\Webpay\Model\Config\ConfigEmailAl seleccionar 'Default' el correo electrónico se enviará al crear el pedido y no al procesar la compra
- payment/transbank_webpay/general_parameters/new_email_order
+ payment/transbank_webpay/new_email_order
@@ -77,7 +77,7 @@
Transbank\Webpay\Model\Config\ConfigInvoicePara modificar esta opción es necesario que el estado de Pago Exitoso sea "Processing"Transbank\Webpay\Helper\Disable
- payment/transbank_webpay/general_parameters/invoice_settings
+ payment/transbank_webpay/invoice_settings
@@ -99,21 +99,21 @@
Transbank\Webpay\Model\Config\Environment
- payment/transbank_oneclick/security/environment
+ payment/transbank_oneclick/environmentIdentificador único del comercio, asegurate de que comience con 5970
- payment/transbank_oneclick/security/commerce_code
+ payment/transbank_oneclick/commerce_codeIdentificador único del comercio asignado por Transbank para la tienda perteneciente al mall, asegurate de que comience con 5970
- payment/transbank_oneclick/security/child_commerce_code
+ payment/transbank_oneclick/child_commerce_code
@@ -126,14 +126,14 @@
fraude o contracargo. Independiente del monto que definas en esta configuración, en tu
contrato de Oneclick, existe un límite de cantidad de transacciones diarias, un monto máximo por
transacción y monto acumulado diario. Si un cliente supera ese límite, su transacción será rechazada.
- payment/transbank_oneclick/security/transaction_max_amount
+ payment/transbank_oneclick/transaction_max_amountLlave secreta utilizada para conectarse a la API ¡asegúrate de no compartir su contenido!
- payment/transbank_oneclick/security/api_key
+ payment/transbank_oneclick/api_key
@@ -141,33 +141,33 @@
Transbank\Webpay\Model\Config\OrderStatusPara reversar o anular una transacción el estado de pago exitoso debe de ser Processing.
- payment/transbank_oneclick/general_parameters/payment_successful_status
+ payment/transbank_oneclick/payment_successful_statusTransbank\Webpay\Model\Config\OrderStatus
- payment/transbank_oneclick/general_parameters/payment_error_status
+ payment/transbank_oneclick/payment_error_statusMagento\Sales\Model\Config\Source\Order\Status\NewStatus
- payment/transbank_oneclick/general_parameters/new_order_status
+ payment/transbank_oneclick/new_order_statusvalidate-numberPosición en la que aparecerá la opción de pago, debe ser menor a otros medios de pago para que aparezca primero
- payment/transbank_oneclick/general_parameters/sort_order
+ payment/transbank_oneclick/sort_orderTransbank\Webpay\Model\Config\ConfigEmailAl seleccionar 'Default' el correo electrónico se enviará al crear el pedido y no al procesar la compra
- payment/transbank_oneclick/general_parameters/new_email_order
+ payment/transbank_oneclick/new_email_order
@@ -175,7 +175,7 @@
Transbank\Webpay\Model\Config\ConfigInvoicePara modificar esta opción es necesario que el estado de Pago Exitoso sea "Processing"Transbank\Webpay\Helper\Disable
- payment/transbank_oneclick/general_parameters/invoice_settings
+ payment/transbank_oneclick/invoice_settings
diff --git a/etc/config.xml b/etc/config.xml
index 574af18..652b8e1 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -6,39 +6,31 @@
Transbank\Webpay\Model\WebpayWebpay Plus1
-
- complete
- canceled
- pending
- 0
- default
- default
-
-
- TEST
- 597055555532
- 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
-
+ complete
+ canceled
+ pending
+ 0
+ default
+ default
+ TEST
+ 597055555532
+ 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1CTransbank\Webpay\Model\OneclickOneclick1
-
- complete
- canceled
- pending
- 1
- default
- default
-
-
- TEST
- 597055555541
- 597055555542
- 0
- 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
-
+ complete
+ canceled
+ pending
+ 1
+ default
+ default
+ TEST
+ 597055555541
+ 597055555542
+ 0
+ 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
diff --git a/etc/module.xml b/etc/module.xml
index 95469cd..9d5188d 100644
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -1,6 +1,6 @@
-
+