Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #144 from pagarme/feature/messages-after-installation
Browse files Browse the repository at this point in the history
Exibe mensagens após instalação do plugin
  • Loading branch information
sfwill-dev authored Jan 11, 2021
2 parents 71e8782 + 4009c5e commit f543094
Show file tree
Hide file tree
Showing 9 changed files with 281 additions and 59 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** woocommerce, pagarme, payment
**Requires at least:** 4.0
**Tested up to:** 5.6
**Stable tag:** 2.4.1
**Stable tag:** 2.5.0
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -60,6 +60,8 @@ Também será necessário utilizar o plugin [WooCommerce Extra Checkout Fields f

Pronto, sua loja já pode receber pagamentos pelo Pagar.me.

Mais informações sobre as configurações do plugin em: [https://docs.pagar.me/v2/docs/configurando-o-plugin-pagarme-woocommerce](https://docs.pagar.me/v2/docs/configurando-o-plugin-pagarme-woocommerce).

## Frequently Asked Questions ##

### Qual é a licença do plugin? ###
Expand Down Expand Up @@ -125,6 +127,11 @@ Entre em contato [clicando aqui](http://wordpress.org/support/plugin/woocommerce

## Changelog ##

### 2.5.0 - 2020-01-07 ###

* Exibe mensagem após instalação/ativação do plugin, recomendando a instalação do plugin Brazilian Market on WooCommerce
* Exibe mensagem após instalação/ativação do plugin, com um link para a documentação da Pagar.me

### 2.4.1 - 2020-12-17 ###

* Fix: Reverte a alteração que tornava o plugin Brazilian Market on WooCommerce obrigatório
Expand Down
6 changes: 4 additions & 2 deletions includes/admin/views/html-notice-missing-brazilian-market.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

?>

<div class="error">
<p><strong><?php esc_html_e( 'WooCommerce Pagar.me', 'woocommerce-pagarme' ); ?></strong> <?php esc_html_e( 'depends on the last version of Brazilian Market to work!', 'woocommerce-pagarme' ); ?></p>
<div class="updated notice is-dismissible">
<p><strong><?php esc_html_e( 'WooCommerce Pagar.me', 'woocommerce-pagarme' ); ?></strong> <?php esc_html_e( 'recommends using the last version of Brazilian Market plugin to work!', 'woocommerce-pagarme' ); ?></p>

<?php if ( $is_installed && current_user_can( 'install_plugins' ) ) : ?>
<p><a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil/woocommerce-extra-checkout-fields-for-brazil.php&plugin_status=active' ), 'activate-plugin_woocommerce-extra-checkout-fields-for-brazil/woocommerce-extra-checkout-fields-for-brazil.php' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Active Brazilian Market', 'woocommerce-pagarme' ); ?></a></p>
Expand All @@ -30,4 +30,6 @@
<p><a href="https://wordpress.org/plugins/woocommerce-extra-checkout-fields-for-brazil/" class="button button-primary"><?php esc_html_e( 'Install Brazilian Market', 'woocommerce-pagarme' ); ?></a></p>
<?php endif; ?>
<?php endif; ?>

<p><a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'woocommerce-pagarme-hide-notice', 'missing_brazilian_market' ) ) ); ?>" class="notice-dismiss" style="text-decoration:none;"></a></p>
</div>
16 changes: 16 additions & 0 deletions includes/admin/views/html-notice-pagarme-documentation-link.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Notice: Pagar.me documentation link.
*
* @package WooCommerce_Pagarme/Admin/Notices
*/

?>

<div class="updated notice is-dismissible">
<p><?php esc_html_e( 'We recommend checking out our documentation before starting using', 'woocommerce-pagarme' ); ?> <strong><?php esc_html_e( 'WooCommerce Pagar.me', 'woocommerce-pagarme' ); ?></strong>!</p>
<p>
<a href="https://docs.pagar.me/v2/docs/configurando-o-plugin-pagarme-woocommerce" class="button button-primary" target="_blank"><?php esc_html_e( 'Pagar.me documentation', 'woocommerce-pagarme' ); ?></a>
</p>
<p><a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'woocommerce-pagarme-hide-notice', 'documentation_link' ) ) ); ?>" class="notice-dismiss" style="text-decoration:none;"></a></p>
</div>
23 changes: 16 additions & 7 deletions languages/woocommerce-pagarme.pot
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright (C) 2020 Pagar.me, Claudio Sanches
# Copyright (C) 2021 Pagar.me, Claudio Sanches
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
"Project-Id-Version: Pagar.me for WooCommerce 2.4.1\n"
"Project-Id-Version: Pagar.me for WooCommerce 2.5.0\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/woocommerce-pagarme\n"
"POT-Creation-Date: 2020-12-17 15:09:52+00:00\n"
"POT-Creation-Date: 2021-01-07 16:54:56+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"X-Generator: grunt-wp-i18n 0.5.4\n"
Expand All @@ -24,11 +24,12 @@ msgstr ""

#: includes/admin/views/html-notice-missing-brazilian-market.php:22
#: includes/admin/views/html-notice-missing-woocommerce.php:22
#: includes/admin/views/html-notice-pagarme-documentation-link.php:11
msgid "WooCommerce Pagar.me"
msgstr ""

#: includes/admin/views/html-notice-missing-brazilian-market.php:22
msgid "depends on the last version of Brazilian Market to work!"
msgid "recommends using the last version of Brazilian Market plugin to work!"
msgstr ""

#: includes/admin/views/html-notice-missing-brazilian-market.php:25
Expand All @@ -53,6 +54,14 @@ msgstr ""
msgid "Install WooCommerce"
msgstr ""

#: includes/admin/views/html-notice-pagarme-documentation-link.php:11
msgid "We recommend checking out our documentation before starting using"
msgstr ""

#: includes/admin/views/html-notice-pagarme-documentation-link.php:13
msgid "Pagar.me documentation"
msgstr ""

#: includes/class-wc-pagarme-api.php:469
msgid "Invalid transaction data."
msgstr ""
Expand Down Expand Up @@ -499,11 +508,11 @@ msgstr ""
msgid "%1$dx of %2$s %3$s"
msgstr ""

#: woocommerce-pagarme.php:132
#: woocommerce-pagarme.php:140
msgid "Bank Slip Settings"
msgstr ""

#: woocommerce-pagarme.php:134
#: woocommerce-pagarme.php:142
msgid "Credit Card Settings"
msgstr ""

Expand Down
9 changes: 8 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: pagarme, claudiosanches, murilohns
Tags: woocommerce, pagarme, payment
Requires at least: 4.0
Tested up to: 5.6
Stable tag: 2.4.1
Stable tag: 2.5.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -60,6 +60,8 @@ Também será necessário utilizar o plugin [WooCommerce Extra Checkout Fields f

Pronto, sua loja já pode receber pagamentos pelo Pagar.me.

Mais informações sobre as configurações do plugin em: [https://docs.pagar.me/v2/docs/configurando-o-plugin-pagarme-woocommerce](https://docs.pagar.me/v2/docs/configurando-o-plugin-pagarme-woocommerce).

== Frequently Asked Questions ==

= Qual é a licença do plugin? =
Expand Down Expand Up @@ -117,6 +119,11 @@ Entre em contato [clicando aqui](http://wordpress.org/support/plugin/woocommerce

== Changelog ==

= 2.5.0 - 2020-01-07 =

* Exibe mensagem após instalação/ativação do plugin, recomendando a instalação do plugin Brazilian Market on WooCommerce
* Exibe mensagem após instalação/ativação do plugin, com um link para a documentação da Pagar.me

= 2.4.1 - 2020-12-17 =

* Fix: Reverte a alteração que tornava o plugin Brazilian Market on WooCommerce obrigatório
Expand Down
141 changes: 141 additions & 0 deletions tests/e2e/dismissable-notices.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
context('Wordpress admin notices', () => {
describe('when go to the wordpress plugins page', () => {
describe('and deactivate the woocommerce plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.deactivateWoocommercePlugin()
})

it('should contain error message', () => {
cy.get('.error a.button')
.contains('WooCommerce')
.should('have.attr', 'href')
.and('match', /action\=activate\&plugin\=woocommerce/)
})

describe('and when reactivate the woocommerce plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.activateWoocommercePlugin()
})

it('should not contain the message anymore', () => {
cy.get('.error a[href*="action=activate&plugin=woocommerce"]')
.should('not.exist')
})
})
})

describe('and deactivate the woocommerce-pagarme plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.deactivateWoocommercePagarmePlugin()
})

describe('and reactivate the woocommerce-pagarme plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.activateWoocommercePagarmePlugin()
})

it('should contain a message with the Pagar.me documentation link button', () => {
cy.get('.updated a.button-primary')
.should('have.attr', 'href')
.and('match', /docs.pagar.me/)
})
})

describe('and when click to close the message', () => {
before(() => {
cy.goToPluginsPage()
cy.get('.is-dismissible a[href*="woocommerce-pagarme-hide-notice=documentation_link"]')
.click()
})

it('should not contain the message anymore', () => {
cy.get('.updated a[href*="docs.pagar.me"]')
.should('not.exist')
})
})
})

describe('and deactivate the brazilian market plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.deactivateBrazilianMarketPlugin()
})

describe('and deactivate the woocommerce-pagarme plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.deactivateWoocommercePagarmePlugin()
})

describe('and reactivate the woocommerce-pagarme plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.activateWoocommercePagarmePlugin()
})

it('should contain a message recommending the Brazilian Market plugin activation', () => {
cy.get('.updated a.button-primary')
.should('have.attr', 'href')
.and('match', /action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil/)
})
})

describe('and when click to close the message', () => {
before(() => {
cy.goToPluginsPage()
cy.get('.is-dismissible a[href*="woocommerce-pagarme-hide-notice=missing_brazilian_market"]')
.click()
})

it('should not contain the message anymore', () => {
cy.get('.updated a[href*="action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil"]')
.should('not.exist')
})
})
})

describe('and deactivate the woocommerce-pagarme plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.deactivateWoocommercePagarmePlugin()
})

describe('and reactivate the woocommerce-pagarme plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.activateWoocommercePagarmePlugin()
})

it('should contain again a message recommending the Brazilian Market plugin activation', () => {
cy.get('.updated a.button-primary')
.should('have.attr', 'href')
.and('match', /action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil/)
})
})

describe('and when reactivate the brazilian market plugin', () => {
before(() => {
cy.goToPluginsPage()
cy.activateBrazilianMarketPlugin()
})

it('should not contain the message anymore', () => {
cy.get('.updated a[href*="action=activate&plugin=woocommerce-extra-checkout-fields-for-brazil"]')
.should('not.exist')
})
})

after(() => {
cy.goToPluginsPage()
cy.get('.is-dismissible a[href*="woocommerce-pagarme-hide-notice=documentation_link"]')
.click()
})
})
})
})
})

42 changes: 0 additions & 42 deletions tests/e2e/required-plugins.spec.js

This file was deleted.

22 changes: 18 additions & 4 deletions tests/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,26 +340,40 @@ Cypress.Commands.add('deactivateBrazilianMarketPlugin', () => {
cy.log('Deactivating the Brazilian Market plugin...')

cy.get('#deactivate-woocommerce-extra-checkout-fields-for-brazil')
.click()
.click()
})

Cypress.Commands.add('activateBrazilianMarketPlugin', () => {
cy.log('Activating the Brazilian Market plugin...')

cy.get('#activate-woocommerce-extra-checkout-fields-for-brazil')
.click()
.click()
})

Cypress.Commands.add('deactivateWoocommercePlugin', () => {
cy.log('Deactivating the WooCommerce plugin...')

cy.get('#deactivate-woocommerce')
.click()
.click()
})

Cypress.Commands.add('activateWoocommercePlugin', () => {
cy.log('Activating the WooCommerce plugin...')

cy.get('#activate-woocommerce')
.click()
.click()
})

Cypress.Commands.add('deactivateWoocommercePagarmePlugin', () => {
cy.log('Deactivating the WooCommerce Pagarme plugin...')

cy.get('#deactivate-woocommerce-pagarme')
.click()
})

Cypress.Commands.add('activateWoocommercePagarmePlugin', () => {
cy.log('Activating the WooCommerce Pagarme plugin...')

cy.get('#activate-woocommerce-pagarme')
.click()
})
Loading

0 comments on commit f543094

Please sign in to comment.