forked from rjsandim/GetnetSDK
-
Notifications
You must be signed in to change notification settings - Fork 16
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 #7 from edson-nascimento/feature/drop-support-php56
Feature drop support php56
- Loading branch information
Showing
25 changed files
with
624 additions
and
120 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Run tests | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- ready_for_review | ||
|
||
env: | ||
PHP_EXTENSIONS: mbstring | ||
PHP_TOOLS: composer:v2, phpunit:9.5 | ||
|
||
jobs: | ||
run-tests: | ||
if: ${{ !github.event.pull_request.draft }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- 7.4 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
php-version: ${{ matrix.php-version }} | ||
extensions: ${{ env.PHP_EXTENSIONS }} | ||
tools: ${{ env.PHP_TOOLS }} | ||
|
||
- name: Determine composer cache directory | ||
id: determine-composer-cache-directory | ||
run: echo "::set-output name=directory::$(composer config cache-dir)" | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.determine-composer-cache-directory.outputs.directory }} | ||
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }} | ||
restore-keys: php-${{ matrix.php-version }}-composer- | ||
|
||
# TODO test direct env php with github actios | ||
- name: Add config/env.test.php | ||
run: echo '${{ secrets.ENV_PHP }}' > $GITHUB_WORKSPACE/config/env.test.php | ||
|
||
- name: Install dependencies | ||
run: composer update --no-interaction --no-progress --ignore-platform-reqs | ||
|
||
- name: Static analysis | ||
run: composer phpstan | ||
|
||
- name: PHPUnit tests | ||
run: composer phpunit | ||
|
||
- name: Remove temp files | ||
run: rm -f $GITHUB_WORKSPACE/auth.json, $GITHUB_WORKSPACE/config/env.test.php |
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
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,26 +1,48 @@ | ||
{ | ||
"name": "edson-nascimento/getnet-php", | ||
"description": "SDK php para integração com a API Getnet", | ||
"minimum-stability": "stable", | ||
"license": "MIT", | ||
"type": "library", | ||
"require": { | ||
"php": ">=5.6.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Getnet\\": "src//Getnet" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Bruno Paz", | ||
"email": "brunopaz@azpay.com.br" | ||
"name":"edson-nascimento/getnet-php", | ||
"description":"SDK php para integração com a API Getnet", | ||
"minimum-stability":"stable", | ||
"license":"MIT", | ||
"type":"library", | ||
"require":{ | ||
"php": ">=7.4" | ||
}, | ||
{ | ||
"name": "Edson Nascimento", | ||
"email": "edson27bn@gmail.com" | ||
} | ||
], | ||
"homepage": "https://github.com/edson-nascimento/getnet-php" | ||
} | ||
"require-dev":{ | ||
"phpunit/phpunit":"^9", | ||
"phpstan/phpstan":"^1.8.0", | ||
"kint-php/kint":"^3.3", | ||
"monolog/monolog":"*" | ||
}, | ||
"autoload":{ | ||
"psr-4":{ | ||
"Getnet\\":"src//Getnet" | ||
} | ||
}, | ||
"autoload-dev":{ | ||
"psr-4":{ | ||
"Tests\\": "tests" | ||
} | ||
}, | ||
"scripts":{ | ||
"phpstan":"phpstan analyse -c phpstan.neon", | ||
"phpunit":"phpunit --configuration phpunit.xml --testdox", | ||
"test":[ | ||
"@phpstan", | ||
"@phpunit" | ||
], | ||
"test:unit":"phpunit --configuration phpunit.xml --testdox --exclude e2e", | ||
"test:e2e":"phpunit --configuration phpunit.xml --testdox --group e2e", | ||
"test:coverage":"phpunit --configuration phpunit.xml --coverage-clover build/logs/clover.xml --coverage-html build/coverage" | ||
}, | ||
"authors":[ | ||
{ | ||
"name":"Bruno Paz", | ||
"email":"brunopaz@azpay.com.br" | ||
}, | ||
{ | ||
"name":"Edson Nascimento", | ||
"email":"edson27bn@gmail.com" | ||
} | ||
], | ||
"homepage":"https://github.com/edson-nascimento/getnet-php" | ||
} |
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,24 @@ | ||
<?php | ||
use Getnet\API\Getnet; | ||
use Getnet\API\Environment; | ||
|
||
$ROOTDIR = dirname(__DIR__); | ||
|
||
require_once $ROOTDIR . '/vendor/autoload.php'; | ||
|
||
// for local development copy config/env.test.php.txt to config/env.test.php and add your credentials | ||
require_once $ROOTDIR . '/config/env.test.php'; | ||
|
||
/** | ||
* | ||
* @return Getnet | ||
* @throws Exception | ||
*/ | ||
function getnetServiceTest() | ||
{ | ||
$getnet = new Getnet(getenv('GETNET_CLIENT_ID'), getenv('GETNET_CLIENT_SECRET'), Environment::sandbox()); | ||
|
||
$getnet->setSellerId(getenv('GETNET_SELLER_ID')); | ||
|
||
return $getnet; | ||
} |
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 @@ | ||
<?php | ||
$client_id = "xxxx"; | ||
$seller_id = "xxxx"; | ||
$client_secret = "xxxx"; | ||
|
||
putenv("GETNET_CLIENT_ID=$client_id"); | ||
putenv("GETNET_SELLER_ID=$seller_id"); | ||
putenv("GETNET_CLIENT_SECRET=$client_secret"); |
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
19 changes: 3 additions & 16 deletions
19
tests/AuthorizePosterior.php → examples/AuthorizePosterior.php
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
use Getnet\API\PixTransaction; | ||
|
||
require_once '../config/bootstrap.test.php'; | ||
|
||
//Autenticação da API | ||
$getnet = getnetServiceTest(); | ||
|
||
//Cria a transação | ||
$transaction = new PixTransaction(75.50); | ||
$transaction->setCurrency("BRL"); | ||
$transaction->setOrderId('DEV-1608748980'); | ||
$transaction->setCustomerId('12345'); | ||
|
||
|
||
$response = $getnet->pix($transaction); | ||
|
||
var_dump($response); |
Oops, something went wrong.