This repository has been archived by the owner on May 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b12c56b
commit c5cf228
Showing
77 changed files
with
4,233 additions
and
0 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,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true |
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,12 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
.gitattributes export-ignore | ||
.github export-ignore | ||
.gitignore export-ignore | ||
.github/ export-ignore | ||
tests/ export-ignore | ||
phpunit.xml export-ignore | ||
phpstan-baseline.neon export-ignore | ||
phpstan.neon export-ignore | ||
psalm.xml export-ignore |
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,17 @@ | ||
name: release-please | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- uses: google-github-actions/release-please-action@v2 | ||
with: | ||
release-type: php | ||
bump-minor-pre-major: true |
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,40 @@ | ||
name: static analysis | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
php-version: [8.1] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer | ||
|
||
- name: Download dependencies | ||
env: | ||
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | ||
run: composer update --no-interaction --no-progress | ||
|
||
- name: Download PHPStan | ||
env: | ||
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | ||
run: composer bin phpstan require phpstan/phpstan | ||
|
||
- name: Execute PHPStan | ||
run: vendor/bin/phpstan analyze --no-progress |
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,49 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
laravel-tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
php-version: [8.1] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: pcov | ||
|
||
- name: Install PHP dependencies | ||
env: | ||
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
|
||
- name: Run PHPUnit | ||
run: vendor/bin/phpunit --coverage-clover=coverage.xml | ||
|
||
- name: Upload coverage to codecov | ||
uses: codecov/codecov-action@v2 | ||
continue-on-error: true | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.xml | ||
|
||
- name: Upload coverage to codeclimate | ||
uses: paambaati/[email protected] | ||
continue-on-error: true | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }} | ||
with: | ||
coverageCommand: '' | ||
coverageLocations: ./coverage.xml:clover |
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,26 @@ | ||
/vendor/ | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# Laravel 4 specific | ||
bootstrap/compiled.php | ||
app/storage/ | ||
|
||
# Laravel 5 & Lumen specific | ||
public/storage | ||
public/hot | ||
|
||
# Laravel 5 & Lumen specific with changed public path | ||
public_html/storage | ||
public_html/hot | ||
|
||
storage/*.key | ||
.env | ||
Homestead.yaml | ||
Homestead.json | ||
/.vagrant | ||
.phpunit.result.cache | ||
|
||
composer.lock | ||
vendor-bin |
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,2 +1,8 @@ | ||
# bancore-service | ||
|
||
[![License: MPL-2.0](https://img.shields.io/badge/license-MPL--2.0-purple.svg)](https://github.com/glocurrency/bancore-service/blob/main/LICENSE) | ||
[![tests](https://github.com/glocurrency/bancore-service/actions/workflows/tests.yml/badge.svg)](https://github.com/glocurrency/bancore-service/actions/workflows/tests.yml) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/d9476cc5ce4a529c942a/maintainability)](https://codeclimate.com/repos/61ffcbda569670017700083e/maintainability) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/d9476cc5ce4a529c942a/test_coverage)](https://codeclimate.com/repos/61ffcbda569670017700083e/test_coverage) | ||
|
||
Bancore service to consume with MW. |
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,62 @@ | ||
{ | ||
"name": "glocurrency/bancore-service", | ||
"description": "Bancore service to consume with MW.", | ||
"type": "library", | ||
"license": "MPL-2.0", | ||
"authors": [ | ||
{ | ||
"name": "Ivan Stasiuk", | ||
"email": "[email protected]", | ||
"homepage": "https://stasi.uk" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"brokeyourbike/bancore-api-client": "^0.3.0", | ||
"brokeyourbike/base-models": "^0.3.0", | ||
"brokeyourbike/country-casts-laravel": "^0.1.0", | ||
"brokeyourbike/has-source-model": "^2.0", | ||
"glocurrency/middleware-blocks": "^0.3.0", | ||
"illuminate/contracts": "^8.0|^9.0", | ||
"illuminate/database": "^8.0|^9.0" | ||
}, | ||
"require-dev": { | ||
"bamarni/composer-bin-plugin": "^1.4", | ||
"mockery/mockery": "^1.0", | ||
"orchestra/testbench": "^6.0|^7.0", | ||
"phpunit/phpunit": "^9.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"GloCurrency\\Bancore\\": "src/", | ||
"GloCurrency\\Bancore\\Database\\Factories\\": "database/factories/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"GloCurrency\\Bancore\\Tests\\": "tests/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"GloCurrency\\Bancore\\BancoreServiceProvider" | ||
] | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"bamarni/composer-bin-plugin": true | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"prefer-stable": true, | ||
"repositories": { | ||
"packagist.org": false, | ||
"private-packagist": { | ||
"type": "composer", | ||
"url": "https://repo.packagist.com/glocurrency/" | ||
} | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
return [ | ||
'api' => [ | ||
'url' => env('BANCORE_API_URL'), | ||
'username' => env('BANCORE_API_USERNAME'), | ||
'password' => env('BANCORE_API_PASSWORD'), | ||
], | ||
'sender_phone_number' => env('BANCORE_SENDER_PHONE_NUMBER'), | ||
'recipient_phone_number' => env('BANCORE_RECIPIENT_PHONE_NUMBER'), | ||
]; |
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,31 @@ | ||
<?php | ||
|
||
namespace GloCurrency\Bancore\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use GloCurrency\Bancore\Models\Bank; | ||
use GloCurrency\Bancore\Bancore; | ||
|
||
class BankFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var string | ||
*/ | ||
protected $model = Bank::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'id' => $this->faker->uuid(), | ||
'bank_id' => (Bancore::$bankModel)::factory(), | ||
'code' => $this->faker->unique()->word(), | ||
]; | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace GloCurrency\Bancore\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use GloCurrency\Bancore\Models\Transaction; | ||
use GloCurrency\Bancore\Models\Quota; | ||
|
||
class QuotaFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var string | ||
*/ | ||
protected $model = Quota::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'id' => $this->faker->uuid(), | ||
'bancore_transaction_id' => Transaction::factory(), | ||
'send_currency_code' => $this->faker->currencyCode(), | ||
'send_amount' => $this->faker->randomNumber(), | ||
'receive_currency_code' => $this->faker->currencyCode(), | ||
'reference' => $this->faker->uuid(), | ||
]; | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
namespace GloCurrency\Bancore\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use GloCurrency\Bancore\Models\Recipient; | ||
|
||
class RecipientFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var string | ||
*/ | ||
protected $model = Recipient::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'id' => $this->faker->uuid(), | ||
'first_name' => $this->faker->firstName(), | ||
'last_name' => $this->faker->lastName(), | ||
'country_code' => $this->faker->countryISOAlpha3(), | ||
'phone_number' => $this->faker->phoneNumber(), | ||
]; | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
namespace GloCurrency\Bancore\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use GloCurrency\Bancore\Models\Sender; | ||
|
||
class SenderFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var string | ||
*/ | ||
protected $model = Sender::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'id' => $this->faker->uuid(), | ||
'first_name' => $this->faker->firstName(), | ||
'last_name' => $this->faker->lastName(), | ||
'birth_date' => $this->faker->date('Y-m-d', now()->subYears(30)), | ||
'country_code' => $this->faker->countryISOAlpha3(), | ||
'phone_number' => $this->faker->phoneNumber(), | ||
]; | ||
} | ||
} |
Oops, something went wrong.