Skip to content

Commit

Permalink
Merge pull request #104 from TransbankDevelopers/chore/prepare-releas…
Browse files Browse the repository at this point in the history
…e-2.2.0

Prepare release 2.2.0
  • Loading branch information
Matiasnickolas authored Oct 10, 2024
2 parents ee9df3a + 923ca7c commit 154ac39
Show file tree
Hide file tree
Showing 25 changed files with 847 additions and 174 deletions.
83 changes: 54 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,85 @@
# Changelog

Todos los cambios notables a este proyecto serán documentados en este archivo.

El formato está basado en [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
y este proyecto adhiere a [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.0] 2024-10-10

### Agrega:

- Se agrega una vista para visualizar las transacciones realizadas.

### Actualiza:

- Se refina la funcionalidad de log detallado.
- Se refina el flujo de pago de Webpay y Oneclick.

## [2.1.0] 2023-11-03
- Se agrega compatibilidad con Prestashop 8 🎉
- Se mejora utilidad de logs para seguimiento de transacciones Webpay plus y Oneclick Mall e instalación del plugin
- Se agrega Docker para prestashop 8 y PHP 8

- Se agrega compatibilidad con Prestashop 8 🎉.
- Se mejora utilidad de logs para seguimiento de transacciones Webpay plus y Oneclick Mall e instalación del plugin.
- Se agrega Docker para prestashop 8 y PHP 8.

## [2.0.3] 2023-03-20
- Se agrega la posibilidad a activar/desactivar WebpayPlus y Oneclick.
- Se reducen las imágenes de WebpayPlus y Oneclick que se muestran en la pantalla de pago.

- Se agrega la posibilidad a activar/desactivar WebpayPlus y Oneclick.
- Se reducen las imágenes de WebpayPlus y Oneclick que se muestran en la pantalla de pago.

## [2.0.2] 2023-03-10
- Se libera una versión estable.

- Se libera una versión estable.

## [2.0.1-Beta] 2023-01-30
- Se agrega un servicio para recolectar datos que nos permitira darle mayor seguimiento a las versiones del plugin y las versiones de Prestashop mas usadas.

- Se agrega un servicio para recolectar datos que nos permitira darle mayor seguimiento a las versiones del plugin y las versiones de Prestashop mas usadas.

## [2.0.0-Beta] 2023-01-24
- Se realiza un refactor de la totalidad del código para mejorar su legibilidad
- Se migran los formularios del módulo de administración a Symfony.
- Se sube la versión minima soportada a 1.7.6.0
- Se mejora el log detallado para darle seguimiento a los errores.
- Se mejora visualmente el módulo de administracion para Webpay.
- Se agrego un módulo de administración para Oneclick.
- Se agrego la opción de inscribir tarjetas utilizando Oneclick.
- Se agrego soporte para agregar multiples tarjetas por usuario para Oneclick.

- Se realiza un refactor de la totalidad del código para mejorar su legibilidad.
- Se migran los formularios del módulo de administración a Symfony.
- Se sube la versión minima soportada a 1.7.6.0
- Se mejora el log detallado para darle seguimiento a los errores.
- Se mejora visualmente el módulo de administracion para Webpay.
- Se agrego un módulo de administración para Oneclick.
- Se agrego la opción de inscribir tarjetas utilizando Oneclick.
- Se agrego soporte para agregar multiples tarjetas por usuario para Oneclick.

## [1.1.3] 2022-11-16
- Se agrega un log detallado para darle seguimiento a los errores.
- Se agrega un try catch en la inicialización del servicio de telemetría.

- Se agrega un log detallado para darle seguimiento a los errores.
- Se agrega un try catch en la inicialización del servicio de telemetría.

## [1.1.2] 2022-03-29
- Se soluciona el problema que se produce al comparar el monto que se paga por Webpay y el monto del carrito cuando tiene decimales.

- Se soluciona el problema que se produce al comparar el monto que se paga por Webpay y el monto del carrito cuando tiene decimales.

## [1.1.1] 2021-12-29
- Se soluciona un problema al configurar las credenciales de producción.

- Se soluciona un problema al configurar las credenciales de producción.

## [1.1.0] 2021-12-14
- Se actualiza SDK de PHP a versión 2.0, por lo que ahora se usa la API v1.2 de Transbank.
- Se elimina botón para la generación del PDF de diagnostico.

- Se actualiza SDK de PHP a versión 2.0, por lo que ahora se usa la API v1.2 de Transbank.
- Se elimina botón para la generación del PDF de diagnostico.

## [1.0.3] 2021-08-18
- Se arregla caso en que usuarios pueden manipular monto de carrito durante el proceso de pago.

- Se arregla caso en que usuarios pueden manipular monto de carrito durante el proceso de pago.

## [1.0.2]
- Permite configurar estado del pedido [PR 13](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/13).
- Se agregan datos de la transacción al detalle de la orden [PR 12](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/12).
- Se mejora coding style [PR 14](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/14).
- Se mejora compatibilidad con Prestashop 1.7.7 [PR 18](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/18).

- Permite configurar estado del pedido [PR 13](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/13).
- Se agregan datos de la transacción al detalle de la orden [PR 12](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/12).
- Se mejora coding style [PR 14](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/14).
- Se mejora compatibilidad con Prestashop 1.7.7 [PR 18](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/18).

## [1.0.1] - 2020-11-12
- Se soluciona error 500 cuando una transacción era rechazada [PR 5](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/5).
- Se mejora documentación de instalación [PR 4](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/4).

- Se soluciona error 500 cuando una transacción era rechazada [PR 5](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/5).
- Se mejora documentación de instalación [PR 4](https://github.com/TransbankDevelopers/transbank-plugin-prestashop-webpay-rest/pull/4).

## [1.0.0] - 2020-11-12
- Primer release.

- Primer release.
75 changes: 45 additions & 30 deletions webpay/config/routes.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
ps_controller_webpay_configure:
path: /webpay/configure
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::webpayplusAction'
_legacy_controller: 'WebpayPlusConfigure'
_legacy_link: 'WebpayPlusConfigure'
path: /webpay/configure
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::webpayplusAction'
_legacy_controller: "WebpayPlusConfigure"
_legacy_link: "WebpayPlusConfigure"

ps_controller_webpay_configure_webpayplus:
path: /webpay/configure/webpayplus
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::webpayplusAction'
_legacy_controller: 'WebpayPlusConfigure'
_legacy_link: 'WebpayPlusConfigure'
path: /webpay/configure/webpayplus
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::webpayplusAction'
_legacy_controller: "WebpayPlusConfigure"
_legacy_link: "WebpayPlusConfigure"

ps_controller_webpay_configure_oneclick:
path: /webpay/configure/oneclick
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::oneclickAction'
_legacy_controller: 'WebpayPlusConfigure'
_legacy_link: 'WebpayPlusConfigure'
path: /webpay/configure/oneclick
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::oneclickAction'
_legacy_controller: "WebpayPlusConfigure"
_legacy_link: "WebpayPlusConfigure"

ps_controller_webpay_configure_diagnosis:
path: /webpay/configure/diagnosis
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::diagnosisAction'
_legacy_controller: 'WebpayPlusConfigure'
_legacy_link: 'WebpayPlusConfigure'
path: /webpay/configure/diagnosis
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::diagnosisAction'
_legacy_controller: "WebpayPlusConfigure"
_legacy_link: "WebpayPlusConfigure"

ps_controller_webpay_configure_logs:
path: /webpay/configure/logs
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::logsAction'
_legacy_controller: 'WebpayPlusConfigure'
_legacy_link: 'WebpayPlusConfigure'
path: /webpay/configure/logs
methods: [GET, POST]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::logsAction'
_legacy_controller: "WebpayPlusConfigure"
_legacy_link: "WebpayPlusConfigure"

#config form
ps_controller_webpay_configure_webpay_plus_form_save:
Expand All @@ -57,3 +57,18 @@ ps_controller_webpay_configure_diagnosis_form_save:
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::saveDiagnosisFormAction'

ps_controller_webpay_transaction_list:
path: /webpay/transaction-list
methods: [GET]
defaults:
_controller: 'PrestaShop\Module\WebpayPlus\Controller\Admin\ConfigureController::transactionListAction'

ps_controller_webpay_transaction_list_search:
path: /webpay/transaction-list
methods: [POST]
defaults:
_controller: PrestaShopBundle:Admin\Common:searchGrid
gridDefinitionFactoryServiceId: webpay.grid.definition.factory.transactions_grid_definition_factory
redirectRoute: ps_controller_webpay_transaction_list
_legacy_controller: WebpayPlusConfigure
_legacy_link: WebpayPlusConfigure:searchTransactionList
84 changes: 56 additions & 28 deletions webpay/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
services:
_defaults:
public: true
# Grid services

# webpayplus Form services

Expand All @@ -10,87 +9,116 @@ services:
arguments:
- "@translator"
- "@=service('prestashop.adapter.legacy.context').getLanguages()"
- '@prestashop.adapter.legacy.configuration'
- "@prestashop.adapter.legacy.configuration"
public: true
tags:
- { name: form.type }

webpay.form.webpay_plus_form_data_provider:
class: 'PrestaShop\Module\WebpayPlus\Form\WebpayPlusFormDataProvider'
arguments:
- '@webpay.form.webpay_plus_data_configuration'
- "@webpay.form.webpay_plus_data_configuration"

webpay.form.webpay_plus_form_data_handler:
class: 'PrestaShop\Module\WebpayPlus\Form\CustomHandler'
arguments:
- '@form.factory'
- '@prestashop.core.hook.dispatcher'
- '@webpay.form.webpay_plus_form_data_provider'
- "@form.factory"
- "@prestashop.core.hook.dispatcher"
- "@webpay.form.webpay_plus_form_data_provider"
- 'PrestaShop\Module\WebpayPlus\Form\WebpayPlusType'
- 'WebpayPlus'
- "WebpayPlus"

webpay.form.webpay_plus_data_configuration:
class: PrestaShop\Module\WebpayPlus\Form\WebpayPlusDataConfiguration
arguments: [ '@prestashop.adapter.legacy.configuration' ]
arguments: ["@prestashop.adapter.legacy.configuration"]


# oneclick Form services
# oneclick Form services

webpay.form.type.oneclick:
class: 'PrestaShop\Module\WebpayPlus\Form\OneclickType'
arguments:
- "@translator"
- "@=service('prestashop.adapter.legacy.context').getLanguages()"
- '@prestashop.adapter.legacy.configuration'
- "@prestashop.adapter.legacy.configuration"
public: true
tags:
- { name: form.type }

webpay.form.oneclick_form_data_provider:
class: 'PrestaShop\Module\WebpayPlus\Form\OneclickFormDataProvider'
arguments:
- '@webpay.form.oneclick_data_configuration'
- "@webpay.form.oneclick_data_configuration"

webpay.form.oneclick_form_data_handler:
class: 'PrestaShop\Module\WebpayPlus\Form\CustomHandler'
arguments:
- '@form.factory'
- '@prestashop.core.hook.dispatcher'
- '@webpay.form.oneclick_form_data_provider'
- "@form.factory"
- "@prestashop.core.hook.dispatcher"
- "@webpay.form.oneclick_form_data_provider"
- 'PrestaShop\Module\WebpayPlus\Form\OneclickType'
- 'WebpayPlus'
- "WebpayPlus"

webpay.form.oneclick_data_configuration:
class: PrestaShop\Module\WebpayPlus\Form\OneclickDataConfiguration
arguments: [ '@prestashop.adapter.legacy.configuration' ]
arguments: ["@prestashop.adapter.legacy.configuration"]

# diagnosis Form services
# diagnosis Form services

webpay.form.type.diagnosis:
class: 'PrestaShop\Module\WebpayPlus\Form\DiagnosisType'
arguments:
- "@translator"
- "@=service('prestashop.adapter.legacy.context').getLanguages()"
- '@prestashop.adapter.legacy.configuration'
- "@prestashop.adapter.legacy.configuration"
public: true
tags:
- { name: form.type }

webpay.form.diagnosis_form_data_provider:
class: 'PrestaShop\Module\WebpayPlus\Form\DiagnosisFormDataProvider'
arguments:
- '@webpay.form.diagnosis_data_configuration'
- "@webpay.form.diagnosis_data_configuration"

webpay.form.diagnosis_form_data_handler:
class: 'PrestaShop\Module\WebpayPlus\Form\CustomHandler'
arguments:
- '@form.factory'
- '@prestashop.core.hook.dispatcher'
- '@webpay.form.diagnosis_form_data_provider'
- "@form.factory"
- "@prestashop.core.hook.dispatcher"
- "@webpay.form.diagnosis_form_data_provider"
- 'PrestaShop\Module\WebpayPlus\Form\DiagnosisType'
- 'WebpayPlus'
- "WebpayPlus"

webpay.form.diagnosis_data_configuration:
class: PrestaShop\Module\WebpayPlus\Form\DiagnosisDataConfiguration
arguments: [ '@prestashop.adapter.legacy.configuration' ]

arguments: ["@prestashop.adapter.legacy.configuration"]

# transaction grid services

webpay.grid.definition.factory.transactions_grid_definition_factory:
class: 'PrestaShop\Module\WebpayPlus\Grid\TransactionsGridDefinitionFactory'
parent: "prestashop.core.grid.definition.factory.abstract_grid_definition"
public: true

webpay.grid.query.transactions_query_builder:
class: 'PrestaShop\Module\WebpayPlus\Grid\TransactionsQueryBuilder'
parent: "prestashop.core.grid.abstract_query_builder"
arguments:
- "@=service('prestashop.adapter.legacy.context').getContext().language.id"
- "@=service('prestashop.adapter.legacy.context').getContext().shop.id"
public: true

webpay.grid.data.factory.transactions_data_factory:
class: 'PrestaShop\PrestaShop\Core\Grid\Data\Factory\DoctrineGridDataFactory'
arguments:
- "@webpay.grid.query.transactions_query_builder"
- "@prestashop.core.hook.dispatcher"
- "@prestashop.core.grid.query.doctrine_query_parser"
- "webpay_transactions"

webpay.grid.transactions_grid_factory:
class: 'PrestaShop\PrestaShop\Core\Grid\GridFactory'
arguments:
- "@webpay.grid.definition.factory.transactions_grid_definition_factory"
- "@webpay.grid.data.factory.transactions_data_factory"
- "@prestashop.core.grid.filter.form_factory"
- "@prestashop.core.hook.dispatcher"
19 changes: 19 additions & 0 deletions webpay/controllers/front/oneclickpaymentvalidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ private function authorizeTransaction($inscriptionId, $cart, $amount){
{$inscriptionId}, cartId: {$cart->id}, amount: {$amount}");
}
$ins = new TransbankInscriptions($inscriptionId); //recuperamos la inscripcion de la tarjeta por el id

if (!$this->validatePayerMatchesCardInscription($ins)) {
$this->throwErrorRedirect("Datos incorrectos para autorizar la transacción.");
}

if($this->isDebugActive()){
$this->logInfo("B.2. Despues de obtener inscripción de la BD => inscriptionId: {$inscriptionId}");
$this->logInfo(json_encode($ins));
Expand Down Expand Up @@ -173,5 +178,19 @@ private function authorizeTransaction($inscriptionId, $cart, $amount){
return $transaction;
}

/**
* Validate that the user paying for the order is the same as the one who registered the card.
*
* @param TransbankInscriptions $inscriptionData The card inscription data.
*
* @return bool True if the payer matches the card inscription, false otherwise.
*/
private function validatePayerMatchesCardInscription(TransbankInscriptions $inscriptionData)
{
$customerData = Context::getContext()->customer;
$customerId = $customerData->id;
$inscriptionUserId = $inscriptionData->user_id;

return $customerId == $inscriptionUserId;
}
}
Loading

0 comments on commit 154ac39

Please sign in to comment.