Skip to content

Commit 35eb401

Browse files
Merge pull request #32 from mercadopago/release/1.11.0
v1.11.0
2 parents 92f0fe4 + 9cd91b7 commit 35eb401

File tree

83 files changed

+2289
-543
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2289
-543
lines changed

.github/pull_request_template.md

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,54 @@
11
## 📝 Descrição
22

3-
> Descrição do PR. Pode ser a mesma descrição da task/história do JIRA.
4-
> [#PSW-1234](jira.link.com)
3+
Por favor, explique as mudanças que você fez aqui.
54

6-
## 🎯 Objetivos do PR
5+
## 🕵️ Testes
76

8-
> Como o problema foi resolvido funcionalmente e técnicamente
9-
> Se aplicável uma lista de:
10-
> - [ ] O que falta fazer para cumprir a história
11-
> - [x] O que está sendo feito em outras tasks da história
12-
> - [x] O que foi feito neste PR para completar a história
7+
<!-- Adicionada evidência de teste, impressões, como prova ou algo que você pensa em testar seu código -->
138

14-
## 📸 Screenshots
9+
## 🎯 Tipo de PR
1510

16-
> - Antes e depois, se for um fix
17-
> - Novas telas de novas funcionalidades
11+
<!-- Não envie atualizações para as dependências, a menos que isso corrija um problema. -->
1812

19-
## 🧰 Como reproduzir
13+
<!-- Tente limitar sua solicitação pull a um tipo, envie várias solicitações pull, se necessário. -->
2014

21-
> - Passo a passo de como testar
22-
> - Links para documentações externas
15+
Por favor, verifique o tipo de mudança que seu PR introduz:
2316

24-
<!-- Items opcionais
17+
- [ ] Correção de bug
18+
- [ ] Feature
19+
- [ ] Atualização de Lib e dependências
20+
- [ ] Atualização de estilo de código (formatação, renomeação)
21+
- [ ] Refatoração (sem alterações funcionais, sem alterações de API)
22+
- [ ] Alterações no conteúdo da documentação
23+
- [ ] Correção de vulnerabilidade
24+
- [ ] Testes E2E
25+
- [ ] Outro (descreva):
26+
27+
## 🚨 Checklist
28+
29+
- [ ] Código compila corretamente
30+
- [ ] Testes criados que falham sem a alteração (se possível)
31+
- [ ] Todos os testes passando
32+
- [ ] Atualizar o README / CHANGELOG / Documentação / Swagger / Fury Docs / Confluence (se necessário)
33+
34+
## 🧰 Qual é o comportamento atual?
35+
36+
<!-- Descreva o comportamento atual que você está modificando ou crie um link para um problema relevante. -->
37+
38+
Link da tarefa: N/A
39+
40+
<!-- Itens opcionais
2541
## 🔗 Links
2642
> - [link1.com](https://)
2743
> - [link2.com](https://)
2844
2945
## 🔀 PRs relacionados
3046
> - #123
3147
> - #321
32-
-->
48+
-->
49+
50+
---
51+
52+
❤️ Obrigado!
53+
54+
Ei revisor! Veja nossos 5 pilares de revisão: https://mercadolibre.atlassian.net/wiki/spaces/PLU/pages/2240021388/Processo+de+Revis+o+de+C+digo

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ testdoc.txt
44
.idea
55
coverage/
66
test-results
7+
.vscode
78

89
build/.env
910
build/logs

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.11.0] - 2025-07-21
9+
### Added
10+
- Add option in the admin to change the order of address lines
11+
- Add end-to-end testing
12+
13+
### Changed
14+
- Change the display of taxes for installment in Argentina
15+
816
## [1.10.1] - 2025-06-18
917
### Fixed
1018
- Correction of discount calculation in CHOPRO processing

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ install:
3131
$(DOCKER_COMPOSE) -f build/docker-compose.yaml up -d && \
3232
sleep 8 && \
3333
docker exec -it magento_php composer require mp-plugins/php-sdk ^3.3 && \
34+
docker exec -it magento_php composer require n98/magerun2-dist && \
3435
docker exec -it magento_php php ./bin/magento setup:install \
3536
--base-url=http://magento.local \
3637
--db-host=database \
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © MercadoPago. All rights reserved.
4+
*
5+
* @author Mercado Pago
6+
* @license See LICENSE for license details.
7+
*/
8+
9+
namespace MercadoPago\AdbPayment\Model\Adminhtml\Source;
10+
11+
use Magento\Framework\Option\ArrayInterface;
12+
13+
/**
14+
* Address line options for configuration.
15+
*/
16+
class AddressLine implements ArrayInterface
17+
{
18+
/**
19+
* Returns Options.
20+
*
21+
* @return array
22+
*/
23+
public function toOptionArray(): array
24+
{
25+
return [
26+
['value' => '0', 'label' => __('Address Line 1')],
27+
['value' => '1', 'label' => __('Address Line 2')],
28+
['value' => '2', 'label' => __('Address Line 3')],
29+
['value' => '3', 'label' => __('Address Line 4')],
30+
];
31+
}
32+
}

Plugin/AddressConfigValidation.php

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
/**
3+
* Copyright © MercadoPago. All rights reserved.
4+
*
5+
* @author Mercado Pago
6+
* @license See LICENSE for license details.
7+
*/
8+
9+
namespace MercadoPago\AdbPayment\Plugin;
10+
11+
use Magento\Config\Model\Config;
12+
use Magento\Framework\Exception\LocalizedException;
13+
14+
class AddressConfigValidation
15+
{
16+
/**
17+
* Address configuration fields to validate.
18+
*/
19+
private const ADDRESS_FIELDS = [
20+
'street_name',
21+
'street_number',
22+
'complement',
23+
'neighborhood'
24+
];
25+
26+
public function beforeSave(Config $subject)
27+
{
28+
$section = $subject->getSection();
29+
30+
if ($section !== 'payment') {
31+
return [];
32+
}
33+
34+
$addressLines = $this->extractAddressLines($subject);
35+
36+
if (!$addressLines) {
37+
return [];
38+
}
39+
40+
$this->validateAddressLinesConfig($addressLines);
41+
42+
return [];
43+
}
44+
45+
private function extractAddressLines(Config $subject): ?array
46+
{
47+
return $subject->getData()['groups']['mercadopago_base']['groups']['basic_settings']['groups']['address_lines']['fields'] ?? null;
48+
}
49+
50+
/**
51+
* Validate address configuration for duplicates.
52+
*
53+
* @param array $addressLines
54+
*
55+
* Example: [
56+
* 'street_name' => [
57+
* 'value' => '0',
58+
* ],
59+
* 'street_number' => [
60+
* 'value' => '1',
61+
* ],
62+
* 'complement' => [
63+
* 'value' => '2',
64+
* ],
65+
* 'neighborhood' => [
66+
* 'value' => '3',
67+
* ],
68+
* ]
69+
*
70+
* @return void
71+
* @throws LocalizedException
72+
*/
73+
private function validateAddressLinesConfig(array $addressLines): void
74+
{
75+
$valueFieldMap = [];
76+
$duplicates = [];
77+
78+
foreach (self::ADDRESS_FIELDS as $field) {
79+
if (isset($addressLines[$field]['value'])) {
80+
$value = $addressLines[$field]['value'];
81+
82+
if (isset($valueFieldMap[$value])) {
83+
$duplicates[] = __(
84+
'Address Line %1 is selected for both "%2" and "%3"',
85+
strval(intval($value) + 1),
86+
$field,
87+
$valueFieldMap[$value]
88+
);
89+
} else {
90+
$valueFieldMap[$value] = $field;
91+
}
92+
}
93+
}
94+
95+
if (!empty($duplicates)) {
96+
throw new LocalizedException(
97+
__('Address configuration error: %1', implode(', ', $duplicates))
98+
);
99+
}
100+
}
101+
}

build/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ services:
6363
magento_version: ${MAGENTO_VERSION}
6464
container_name: magento_php
6565
image: php-magento-mp
66+
environment:
67+
XDEBUG_MODE: '${XDEBUG_MODE:-debug}'
6668
volumes:
6769
- magento-php-volume:/var/www/html
6870
- ./credentials:/home/ubuntu/.composer

build/php/Dockerfile-7.2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ ENV HOST_OS=$host_os
1111
ARG magento_version
1212
ENV MAGENTO_VERSION=$magento_version
1313

14-
COPY ./build/php/conf/xdebug-${HOST_OS}.ini $PHP_CONFIG_PATH/mods-available/xdebug.ini
15-
1614
RUN useradd -m $USERNAME \
1715
&& chown -R $USERNAME:$USERNAME /var/www/html
1816

@@ -33,6 +31,8 @@ RUN composer create-project -vvv --repository-url=https://repo.magento.com/ mage
3331

3432
COPY ./build/credentials/auth.json /var/www/html/var/composer_home/auth.json
3533

34+
COPY ./build/php/conf/xdebug-${HOST_OS}.ini $PHP_CONFIG_PATH/mods-available/xdebug.ini
35+
3636
USER root
3737

3838
RUN chown -R $USERNAME:$USERNAME /var/www/html/var/composer_home

build/php/Dockerfile-7.4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ ENV HOST_OS=$host_os
1111
ARG magento_version
1212
ENV MAGENTO_VERSION=$magento_version
1313

14-
COPY ./build/php/conf/xdebug-${HOST_OS}.ini $PHP_CONFIG_PATH/mods-available/xdebug.ini
15-
1614
RUN useradd -m $USERNAME \
1715
&& chown -R $USERNAME:$USERNAME /var/www/html
1816

@@ -33,6 +31,8 @@ RUN composer create-project -vvv --repository-url=https://repo.magento.com/ mage
3331

3432
COPY ./build/credentials/auth.json /var/www/html/var/composer_home/auth.json
3533

34+
COPY ./build/php/conf/xdebug-${HOST_OS}.ini $PHP_CONFIG_PATH/mods-available/xdebug.ini
35+
3636
USER root
3737

3838
RUN chown -R $USERNAME:$USERNAME /var/www/html/var/composer_home

build/php/Dockerfile-8.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ ENV HOST_OS=$host_os
1111
ARG magento_version
1212
ENV MAGENTO_VERSION=$magento_version
1313

14-
COPY ./build/php/conf/xdebug-${HOST_OS}.ini $PHP_CONFIG_PATH/mods-available/xdebug.ini
15-
1614
RUN useradd -m $USERNAME \
1715
&& chown -R $USERNAME:$USERNAME /var/www/html
1816

@@ -33,6 +31,8 @@ RUN composer create-project -vvv --repository-url=https://repo.magento.com/ mage
3331

3432
COPY ./build/credentials/auth.json /var/www/html/var/composer_home/auth.json
3533

34+
COPY ./build/php/conf/xdebug-${HOST_OS}.ini $PHP_CONFIG_PATH/mods-available/xdebug.ini
35+
3636
USER root
3737

3838
RUN chown -R $USERNAME:$USERNAME /var/www/html/var/composer_home

0 commit comments

Comments
 (0)