Skip to content

Commit 6f8fa20

Browse files
first commit
0 parents  commit 6f8fa20

File tree

97 files changed

+11266
-0
lines changed

Some content is hidden

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

97 files changed

+11266
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig is awesome: https://editorconfig.org/
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = false
12+
insert_final_newline = true
13+
14+
[*.php]
15+
indent_size = 4
16+
php_remove_redundant_closing_tag=autofix

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'github-actions'
4+
directory: '/'
5+
commit-message:
6+
prefix: 'chore'
7+
schedule:
8+
interval: 'monthly'
9+
open-pull-requests-limit: 10
10+
labels: ['dependencies']
11+
12+
- package-ecosystem: 'composer'
13+
directory: '/'
14+
commit-message:
15+
prefix: 'chore'
16+
schedule:
17+
interval: 'monthly'
18+
open-pull-requests-limit: 10
19+
groups:
20+
all-dependencies:
21+
patterns: ['*']
22+
update-types: ['minor', 'patch', 'major']
23+
labels: ['dependencies']
24+
versioning-strategy: 'increase'

.github/workflows/pull_request.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Run lint and tests
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- ready_for_review
8+
workflow_dispatch:
9+
10+
env:
11+
PHP_VERSION: 8.3
12+
PHP_EXTENSIONS: mbstring
13+
PHP_TOOLS: composer:v2, phpunit:11
14+
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
run-tests:
21+
if: ${{ !github.event.pull_request.draft }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install PHP ${{ env.PHP_VERSION }}
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
coverage: none
30+
php-version: ${{ env.PHP_VERSION }}
31+
extensions: ${{ env.PHP_EXTENSIONS }}
32+
tools: ${{ env.PHP_TOOLS }}
33+
34+
- name: Get Composer Cache Directory
35+
id: composer-cache
36+
run: |
37+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
38+
- uses: actions/cache@v4
39+
with:
40+
path: ${{ steps.composer-cache.outputs.dir }}
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-composer-
44+
45+
- name: Restore cache folder
46+
uses: actions/cache@v4
47+
with:
48+
path: cache/
49+
key: ${{ runner.os }}-cache-folder-${{ hashFiles('cache/**') }}
50+
restore-keys: |
51+
${{ runner.os }}-cache-folder-
52+
53+
- name: Install dependencies
54+
run: composer update --no-interaction --no-progress
55+
56+
- name: Static analysis
57+
run: composer phpstan
58+
59+
- name: PHP Coding Standards Fixer
60+
run: composer format:check
61+
62+
- name: Run PHPUnit
63+
run: composer phpunit

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/vendor/*
2+
/config/app.php
3+
/tmp/*
4+
/logs/*
5+
/cache/
6+
/.env
7+
/test.php
8+
/.env
9+
/env.php
10+
/teste.php
11+
error_log
12+
.phpunit.cache/*
13+
.vscode/settings.json
14+
/build/*
15+
.php-cs-fixer.cache

.php-cs-fixer.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/**
4+
* @see https://cs.symfony.com/doc/rules/index.html
5+
* @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/f65e6a20c9ef30f2fc93d8c3e1bf6aa3bd910192/src/RuleSet/Sets/PSR12Set.php
6+
* @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/f65e6a20c9ef30f2fc93d8c3e1bf6aa3bd910192/src/RuleSet/Sets/SymfonySet.php
7+
*/
8+
$finder = PhpCsFixer\Finder::create()
9+
->in(__DIR__)
10+
->name('*.php')
11+
->exclude([
12+
'cache',
13+
'tmps',
14+
'log',
15+
])
16+
->ignoreDotFiles(true)
17+
->ignoreVCS(true);
18+
19+
return (new PhpCsFixer\Config())
20+
->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
21+
->setRiskyAllowed(false)
22+
->setCacheFile(__DIR__ . '/cache/.php-cs-fixer.cache')
23+
->setRules([
24+
'@PSR12' => true,
25+
'@Symfony' => true,
26+
'fully_qualified_strict_types' => false, // Garantir namespaces completos
27+
'array_syntax' => ['syntax' => 'short'],
28+
'binary_operator_spaces' => ['default' => 'single_space'],
29+
'concat_space' => ['spacing' => 'one'],
30+
'increment_style' => ['style' => 'post'],
31+
'yoda_style' => false,
32+
'class_attributes_separation' => true,
33+
])
34+
->setIndent(' ')
35+
->setLineEnding("\n")
36+
->setFinder($finder);

.vscode/extensions.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode",
6+
"streetsidesoftware.code-spell-checker",
7+
"streetsidesoftware.code-spell-checker-portuguese",
8+
"usernamehw.errorlens",
9+
"eamodio.gitlens",
10+
"seatonjiang.gitmoji-vscode",
11+
"devsense.phptools-vscode",
12+
"phproberto.vscode-php-getters-setters",
13+
"mehedidracula.php-namespace-resolver",
14+
"junstyle.php-cs-fixer"
15+
],
16+
"unwantedRecommendations": []
17+
}

.vscode/settings.example.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"files.eol": "\n",
3+
"eslint.run": "onSave",
4+
"eslint.format.enable": true,
5+
"editor.tabSize": 2,
6+
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
7+
"[php]": {
8+
"editor.defaultFormatter": "junstyle.php-cs-fixer",
9+
"editor.formatOnSave": false,
10+
"editor.tabSize": 4,
11+
"editor.insertSpaces": true,
12+
"editor.trimAutoWhitespace": true,
13+
"editor.bracketPairColorization.enabled": true
14+
},
15+
"php.format.codeStyle": "PSR-12",
16+
"php.debug.port": 9000,
17+
"editor.rulers": [
18+
150
19+
],
20+
"files.insertFinalNewline": true,
21+
"files.readonlyInclude": {
22+
"**/vendor/**/*": true
23+
},
24+
"javascript.suggest.autoImports": true,
25+
"typescript.suggest.autoImports": true,
26+
"editor.codeActionsOnSave": {
27+
"source.fixAll.eslint": "explicit",
28+
"source.organizeImports": "explicit"
29+
},
30+
"editor.defaultFormatter": "esbenp.prettier-vscode",
31+
"[json][jsonc]": {
32+
"editor.defaultFormatter": "vscode.json-language-features"
33+
}
34+
}

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# PagBank SDK PHP - v1
2+
3+
Todos os passos e processos referentes à integração com o sistema de captura e autorização de transações financeiras do PagBank via as funcionalidades da API.
4+
5+
Documentação oficial
6+
7+
- <https://developer.pagbank.com.br/reference/introducao>
8+
9+
## Pré-requisitos
10+
11+
- PHP `^8.2`
12+
13+
## Instalação
14+
15+
add composer.json
16+
17+
```bash
18+
"silbeckdevs/pagbank-sdk-php": "^1.0"
19+
```
20+
21+
ou execute
22+
23+
```bash
24+
composer require silbeckdevs/pagbank-sdk-php
25+
```
26+
27+
## Exemplos de uso
28+
29+
- [Connect](./docs/connect.md)
30+
- [Order e Payment](./docs/order.md)
31+
- [Checkout](./docs/checkout.md)
32+
- [Chaves Públicas](./docs/public-keys.md)
33+
- [Outros](./docs/custom.md)
34+
35+
### Testes e linters
36+
37+
- Rodar todos os testes e PHPStan `composer test`
38+
- Rodar todos os testes `composer phpunit`
39+
- Testes unitários `composer test:unit`
40+
- Testes integração `composer test:e2e`
41+
- PHPStan `composer phpstan`
42+
- PHP-CS-Fixer verify `composer format:check`
43+
- PHP-CS-Fixer fix `composer format:fix`

composer.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "https://getcomposer.org/schema.json",
3+
"name": "silbeckdevs/pagbank-sdk-php",
4+
"description": "SDK php para integração com a API PagBank",
5+
"minimum-stability": "stable",
6+
"license": "MIT",
7+
"type": "library",
8+
"require": {
9+
"php": "^8.2",
10+
"psr/http-client": "^1.0.3",
11+
"guzzlehttp/guzzle": "^7.9.2"
12+
},
13+
"require-dev": {
14+
"phpunit/phpunit": "^11.5.2",
15+
"phpstan/phpstan": "^2.1.1",
16+
"kint-php/kint": "^6.0.1",
17+
"monolog/monolog": "^3.8.1",
18+
"friendsofphp/php-cs-fixer": "^3.67.0",
19+
"brainmaestro/composer-git-hooks": "^3.0.0"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"PagBankApi\\": "src/PagBankApi/"
24+
}
25+
},
26+
"autoload-dev": {
27+
"psr-4": {
28+
"PagBankApi\\Tests\\": "tests/"
29+
}
30+
},
31+
"scripts": {
32+
"start": "php -S localhost:8879 -t .",
33+
"format:check": "php-cs-fixer fix --dry-run --stop-on-violation",
34+
"format:fix": "php-cs-fixer fix",
35+
"phpstan": "phpstan analyse -c phpstan.neon --xdebug",
36+
"phpunit": "phpunit --configuration phpunit.xml --testdox",
37+
"test": [
38+
"@phpstan",
39+
"@phpunit"
40+
],
41+
"lint": [
42+
"@format:fix",
43+
"@phpstan"
44+
],
45+
"test:unit": "phpunit tests/Unit --configuration phpunit.xml --testdox",
46+
"test:e2e": "phpunit tests/E2E --configuration phpunit.xml --testdox",
47+
"test:coverage": "phpunit --configuration phpunit.xml --coverage-clover build/logs/clover.xml --coverage-html build/coverage",
48+
"post-install-cmd": "cghooks add --ignore-lock",
49+
"post-update-cmd": "cghooks update"
50+
},
51+
"extra": {
52+
"hooks": {
53+
"config": {
54+
"stop-on-failure": [
55+
"pre-push",
56+
"pre-commit"
57+
]
58+
},
59+
"pre-commit": [
60+
"composer format:check"
61+
]
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)