-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from ebanx/release/v1.13.0
Release/v1.13.0
- Loading branch information
Showing
102 changed files
with
1,655 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
.idea/ | ||
wordpress/ | ||
woocommerce-gateway-ebanx/travis/vendor/ | ||
.DS_Store | ||
*.log | ||
*.gz | ||
*.gz.* | ||
cypress/videos | ||
cypress/screenshots | ||
node_modules | ||
.vscode | ||
apidocs/phpdoc-cache-* | ||
.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,41 @@ | ||
language: php | ||
php: | ||
- '5.6' | ||
|
||
env: | ||
WOOCOMMERCE_VERSION: 3.0.7 | ||
EBANX_ADMIN_USERNAME: ebanx | ||
EBANX_ADMIN_PASSWORD: ebanx | ||
EBANX_SITE_TITLE: EBANX | ||
EBANX_SITE_EMAIL: [email protected] | ||
EBANX_DB: wordpress | ||
EBANX_PASSWORD: root | ||
|
||
services: | ||
- docker | ||
|
||
cache: | ||
- yarn: true | ||
- apt: true | ||
|
||
before_install: | ||
- sudo service mysql stop | ||
- sudo apt-get update | ||
- sudo apt-key update | ||
- sudo apt-get install -y docker-engine | ||
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash | ||
- nvm install node 7 | ||
- nvm alias default node 7 | ||
- npm install -g kill-port | ||
- kill-port --port 80 | ||
- kill-port --port 3306 | ||
- docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=${EBANX_PASSWORD} -e MYSQL_DATABASE=${EBANX_DB} -d mariadb:5 | ||
- docker run --name ebanx-woocommerce -p 80:80 --link mysql:mysql --volume="${TRAVIS_BUILD_DIR}/woocommerce-gateway-ebanx/:/var/www/html/wp-content/plugins/woocommerce-gateway-ebanx/" -e EBANX_WC_PLUGIN_VERSION=${WOOCOMMERCE_VERSION} -e EBANX_ADMIN_USERNAME=${EBANX_ADMIN_USERNAME} -e EBANX_ADMIN_PASSWORD=${EBANX_ADMIN_PASSWORD} -e EBANX_SITE_TITLE=${EBANX_SITE_TITLE} -e EBANX_SITE_EMAIL=${EBANX_SITE_EMAIL} -d ebanx/ebanx-woocommerce | ||
|
||
install: | ||
- npm install -g cypress-cli | ||
- cypress install | ||
- npm install | ||
|
||
script: | ||
- ./wait-for-it.sh -t 300 localhost:3306 -- echo "MySQL is alive!" | ||
- ./wait-for-it.sh -t 300 localhost:80 -- echo "Plugin is alive!" | ||
- cypress run --record --key f54e0f8d-46b4-47a4-b331-10a8e4731c3b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,35 +9,71 @@ Please, visit the [official plugin page on WordPress store](https://wordpress.or | |
## Introduction | ||
We've put together all the information you'll need on this file. Also, we always try to keep this file updated and with as much information as possible. If you want to help us with this file or with any coding issue, we would really appreciate it. :heart: | ||
|
||
## Getting Started | ||
|
||
If you want to contribute to our repository the best way is to clone it and then create a symbolic link: | ||
|
||
1. Install [WordPress](https://codex.wordpress.org/Installing_WordPress) to your prefered location: | ||
1. With your terminal `cd` into your web root folder: `cd /path/to/public_html` | ||
2. Download the latest WordPress build: `wget https://wordpress.org/latest.tar.gz` | ||
3. Unzip the just downloaded file: `tar -xzvf latest.tar.gz` | ||
4. Delete that file since we don't need it anymore: `rm latest.tar.gz` | ||
5. Create the Database and a User | ||
6. Access `http://localhost/wordpress`(it might be different depending on the folder you've downloaded WordPress) and follow its steps. | ||
2. Install [WooCommerce](https://docs.woocommerce.com/document/installing-uninstalling-woocommerce/). If you've configured FTP you can access WordPress Admin Dashboard and install it automatically. Otherwise, you can follow these steps: | ||
1. Go to the plugins folder on your WordPress: `cd /path/to/wordpress/wp-content/plugins` | ||
2. Download the lastest WooCommerce build: `git clone https://github.com/woocommerce/woocommerce.git` | ||
3. Configure it on WordPress Admin Dashboard | ||
3. Clone this repository to your projects folder (not inside WordPress folder): `git clone https://github.com/ebanx/woocommerce-gateway-ebanx` | ||
4. Create a symlink from the inner folder to your wordpress plugins folder: `ln -s /path/to/clone/directory/woocommerce-gateway-ebanx/woocommerce-gateway-ebanx /path/to/wordpress/wp-content/plugins/woocommerce-gateway-ebanx` | ||
5. Let the coding begin! | ||
## Getting Started with Docker | ||
|
||
## Have you found a bug? | ||
Don't you know what is Docker? [Know here](https://www.docker.com/what-docker). | ||
|
||
You can create a new [Issue](https://github.com/ebanx/woocommerce-gateway-ebanx/issues/new) and wait for someone to fix it. Keep in mind that if you don't provide enough information no one will be able to help you. | ||
You need to install Docker on your machine before start. [Please install the CE Edition of your OS](https://www.docker.com/community-edition). | ||
|
||
## So you want to code... | ||
#### Disable built-in Apache server (Mac OS only) | ||
|
||
``` | ||
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist | ||
``` | ||
|
||
#### Create the containers | ||
|
||
After installed Docker and disabled apache, clone this repo, go to root folder and run: | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
**The first installation may take up to 5 minutes. After that, visit `http://localhost` on your browser. We use the port 80 and 3306. So, check if you are not using these ports.** | ||
|
||
Every time that you want to go back to plugin development, just run `docker-compose up`. | ||
|
||
To run docker in background, execute `docker-compose up -d`, and `docker-compose stop` to stop the application. | ||
|
||
To login into Wordpress, visit `http://localhost/wp-admin/`. | ||
|
||
The credentials are: | ||
|
||
If you want to code (and you are not an ebanker [yet](https://ebanx.recruiterbox.com/)) all you have to do is fork our repo create a [well named]branch from develop and make a [pull request](https://github.com/ebanx/woocommerce-gateway-ebanx/compare) to our develop. | ||
``` | ||
Username: ebanx | ||
Password: ebanx | ||
``` | ||
|
||
## Documentation | ||
**To change these informations, you can edit the environments on file `docker-compose.yml`.** | ||
|
||
Documentation is in `apidocs` folder. | ||
The defaults are: | ||
|
||
``` | ||
MYSQL_DATABASE: wordpress | ||
MYSQL_ROOT_PASSWORD: root | ||
WORDPRESS_DB_NAME: wordpress | ||
WORDPRESS_DB_USER: root | ||
WORDPRESS_DB_PASSWORD: root | ||
WORDPRESS_DB_HOST: mysql | ||
EBANX_WC_PLUGIN_VERSION: 3.0.5 | ||
EBANX_ADMIN_USERNAME: ebanx | ||
EBANX_ADMIN_PASSWORD: ebanx | ||
EBANX_SITE_TITLE: EBANX | ||
EBANX_SITE_EMAIL: [email protected] | ||
``` | ||
|
||
#### What did we do here? | ||
|
||
The Docker installed Wordpress, MySQL, PHP, WooCommerce, create some products and pages, installed the EBANX plugin and another things. | ||
|
||
To know more about the Docker commands, [please read this gist](https://gist.github.com/cezarlz/cf9ecbd8be33562b16d07fc1bc04b150). | ||
|
||
## Have you found a bug? | ||
|
||
You can create a new [Issue](https://github.com/ebanx/woocommerce-gateway-ebanx/issues/new) and wait for someone to fix it. Keep in mind that if you don't provide enough information no one will be able to help you. | ||
|
||
## So you want to code... | ||
|
||
To generate a new documentation, install `phpdoc` and run at root folder `phpdoc --template="clean" -d . -i "travis/*,woocommerce-gateway-ebanx/vendor/*,woocommerce-gateway-ebanx/templates/*" -t apidocs` | ||
If you want to code (and you are not an ebanker [yet](https://ebanx.recruiterbox.com/)) all you have to do is fork our repo create a [well named]branch from develop and make a [pull request](https://github.com/ebanx/woocommerce-gateway-ebanx/compare) to our develop. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FROM php:5-apache | ||
|
||
MAINTAINER Cezar Luiz <[email protected]> | ||
|
||
ARG WORDPRESS_DB_USER | ||
ARG WORDPRESS_DB_PASSWORD | ||
ARG WORDPRESS_DB_NAME | ||
ARG WORDPRESS_DB_HOST | ||
|
||
# install the PHP extensions we need | ||
RUN set -ex; \ | ||
\ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
libjpeg-dev \ | ||
libpng12-dev \ | ||
mysql-client \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ | ||
docker-php-ext-install gd mysqli opcache pdo pdo_mysql | ||
|
||
RUN { \ | ||
echo 'opcache.memory_consumption=128'; \ | ||
echo 'opcache.interned_strings_buffer=8'; \ | ||
echo 'opcache.max_accelerated_files=4000'; \ | ||
echo 'opcache.revalidate_freq=2'; \ | ||
echo 'opcache.fast_shutdown=1'; \ | ||
echo 'opcache.enable_cli=1'; \ | ||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini | ||
|
||
RUN a2enmod rewrite expires | ||
|
||
WORKDIR /var/www/html | ||
|
||
# Download WP-CLI, install and configure Wordpress | ||
RUN curl -O "https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar"; \ | ||
chmod +x wp-cli.phar; \ | ||
mv wp-cli.phar /usr/local/bin/wp; \ | ||
wp --info --allow-root --debug; \ | ||
wp core download --allow-root --force --debug; \ | ||
wp core config --dbname=$WORDPRESS_DB_NAME --dbuser=$WORDPRESS_DB_USER --dbpass=$WORDPRESS_DB_PASSWORD --dbhost=$WORDPRESS_DB_HOST --force --allow-root --debug --skip-check --extra-php="define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'FS_METHOD', 'direct' );"; | ||
|
||
COPY wait-for-it.sh /usr/local/bin/ | ||
COPY entrypoint.sh /usr/local/bin/ | ||
|
||
RUN chmod +x /usr/local/bin/wait-for-it.sh | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
EXPOSE 80 | ||
|
||
ENTRYPOINT /usr/local/bin/entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"env": { | ||
"admin": "admin", | ||
"site": "site" | ||
}, | ||
"projectId": "ff45ju", | ||
"chromeWebSecurity": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const defaults = require('../../lib/defaults'); | ||
|
||
global.ebanx = {}; | ||
let admin = {}; | ||
|
||
describe('Admin', () => { | ||
|
||
context('Settings', () => { | ||
before(function () { | ||
admin = require('../../lib/admin/admin_operator')(cy); | ||
}); | ||
|
||
it('Fill sandbox keys and save settings', () => { | ||
admin | ||
.openAdmin() | ||
.openEbanxSettings() | ||
.fillKeys({ | ||
integration_key: defaults.api.integration_key, | ||
public_key: defaults.api.public_key | ||
}) | ||
.saveSettings(); | ||
}); | ||
|
||
it('Fill instalment number and save settings', () => { | ||
admin | ||
.openAdmin() | ||
.openEbanxSettings() | ||
.fillInstalments(defaults.admin.instalments) | ||
.saveSettings(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
const Faker = require('faker'); | ||
const CPF = require('cpf_cnpj').CPF; | ||
const CNPJ = require('cpf_cnpj').CNPJ; | ||
const defaults = require('../../lib/defaults'); | ||
let site = {}; | ||
let api = {}; | ||
let mock = {}; | ||
|
||
global.ebanx = {}; | ||
|
||
describe('Site', () => { | ||
|
||
context('Brazil Payments', () => { | ||
beforeEach(function () { | ||
Faker.locale = 'pt_BR'; | ||
|
||
site = require('../../lib/site/site_operator')(cy); | ||
api = require('../../lib/pay/api_operator')(cy); | ||
|
||
mock = { | ||
firstName: Faker.name.firstName(), | ||
lastName: Faker.name.lastName(), | ||
company: Faker.company.companyName(), | ||
email: Faker.internet.email(), | ||
phone: Faker.phone.phoneNumber(), | ||
country: Faker.address.country(), | ||
address: Faker.address.streetAddress(), | ||
state: Faker.address.state(), | ||
postcode: Faker.address.zipCode('########'), | ||
city: Faker.address.city() | ||
}; | ||
|
||
mock.country = 'Brazil'; | ||
mock.state = 'Paraná'; | ||
mock.brazilDocument = CPF.generate(true); | ||
mock.brazilBirthdate = '01/01/1970'; | ||
}); | ||
|
||
it('Make a Boleto Payment', () => { | ||
site.makeBoletoPayment(mock, hash => { | ||
api.assertPaymentStatus(hash, 'PE'); | ||
}); | ||
}); | ||
|
||
it('Make a Credit Card Payment using Visa', () => { | ||
let cc_data = { | ||
cvv: Faker.random.number({ min: 100, max: 999 }).toString(), | ||
due_date: `02 / ${Faker.random.number({ min: 20, max: 30 }) }`, | ||
card_name: `${Faker.name.firstName} ${Faker.name.lastName}`, | ||
number: defaults.site.payments.credit_card.visa | ||
}; | ||
|
||
site.makeCreditCardToBrazilPayment(mock, cc_data, hash => { | ||
api.assertPaymentStatus(hash, 'CO'); | ||
}); | ||
}); | ||
|
||
it('Make a Credit Card Payment using Visa with Instalments', () => { | ||
let cc_data = { | ||
cvv: Faker.random.number({ min: 100, max: 999 }).toString(), | ||
due_date: `02 / ${Faker.random.number({ min: 20, max: 30 }) }`, | ||
card_name: `${Faker.name.firstName} ${Faker.name.lastName}`, | ||
number: defaults.site.payments.credit_card.visa, | ||
instalments: Faker.random.number({ min: 2, max: 12 }).toString() | ||
}; | ||
|
||
site.makeCreditCardToBrazilPayment(mock, cc_data, hash => { | ||
api.assertPaymentStatus(hash, 'CO'); | ||
}); | ||
}); | ||
|
||
it('Make a TEF Payment using Itau', () => { | ||
site.makeItauPayment(mock); | ||
}); | ||
|
||
it('Make a TEF Payment using Bradesco', () => { | ||
site.makeBradescoPayment(mock); | ||
}); | ||
|
||
it('Make a TEF Payment using Banco do Brasil', () => { | ||
site.makeBBPayment(mock); | ||
}); | ||
|
||
it('Make a TEF Payment using Banrisul', () => { | ||
site.makeBanrisulPayment(mock); | ||
}); | ||
|
||
it('Make a EBANX Account Payment', () => { | ||
site.makeAccountPayment(mock); | ||
}); | ||
|
||
}); | ||
|
||
}); |
Oops, something went wrong.