Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit c5cf228

Browse files
committed
feat: add all components
1 parent b12c56b commit c5cf228

File tree

77 files changed

+4233
-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.

77 files changed

+4233
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
.gitattributes export-ignore
5+
.github export-ignore
6+
.gitignore export-ignore
7+
.github/ export-ignore
8+
tests/ export-ignore
9+
phpunit.xml export-ignore
10+
phpstan-baseline.neon export-ignore
11+
phpstan.neon export-ignore
12+
psalm.xml export-ignore

.github/workflows/release-please.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: release-please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
update_release_draft:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
13+
steps:
14+
- uses: google-github-actions/release-please-action@v2
15+
with:
16+
release-type: php
17+
bump-minor-pre-major: true

.github/workflows/static.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: static analysis
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
phpstan:
11+
name: PHPStan
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
strategy:
15+
matrix:
16+
php-version: [8.1]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: "${{ matrix.php-version }}"
26+
coverage: none
27+
tools: composer
28+
29+
- name: Download dependencies
30+
env:
31+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
32+
run: composer update --no-interaction --no-progress
33+
34+
- name: Download PHPStan
35+
env:
36+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
37+
run: composer bin phpstan require phpstan/phpstan
38+
39+
- name: Execute PHPStan
40+
run: vendor/bin/phpstan analyze --no-progress

.github/workflows/tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
laravel-tests:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
strategy:
14+
matrix:
15+
php-version: [8.1]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Install PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: "${{ matrix.php-version }}"
25+
coverage: pcov
26+
27+
- name: Install PHP dependencies
28+
env:
29+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
30+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
31+
32+
- name: Run PHPUnit
33+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
34+
35+
- name: Upload coverage to codecov
36+
uses: codecov/codecov-action@v2
37+
continue-on-error: true
38+
with:
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
files: ./coverage.xml
41+
42+
- name: Upload coverage to codeclimate
43+
uses: paambaati/codeclimate-action@v3.0.0
44+
continue-on-error: true
45+
env:
46+
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
47+
with:
48+
coverageCommand: ''
49+
coverageLocations: ./coverage.xml:clover

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/vendor/
2+
node_modules/
3+
npm-debug.log
4+
yarn-error.log
5+
6+
# Laravel 4 specific
7+
bootstrap/compiled.php
8+
app/storage/
9+
10+
# Laravel 5 & Lumen specific
11+
public/storage
12+
public/hot
13+
14+
# Laravel 5 & Lumen specific with changed public path
15+
public_html/storage
16+
public_html/hot
17+
18+
storage/*.key
19+
.env
20+
Homestead.yaml
21+
Homestead.json
22+
/.vagrant
23+
.phpunit.result.cache
24+
25+
composer.lock
26+
vendor-bin

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# bancore-service
2+
3+
[![License: MPL-2.0](https://img.shields.io/badge/license-MPL--2.0-purple.svg)](https://github.com/glocurrency/bancore-service/blob/main/LICENSE)
4+
[![tests](https://github.com/glocurrency/bancore-service/actions/workflows/tests.yml/badge.svg)](https://github.com/glocurrency/bancore-service/actions/workflows/tests.yml)
5+
[![Maintainability](https://api.codeclimate.com/v1/badges/d9476cc5ce4a529c942a/maintainability)](https://codeclimate.com/repos/61ffcbda569670017700083e/maintainability)
6+
[![Test Coverage](https://api.codeclimate.com/v1/badges/d9476cc5ce4a529c942a/test_coverage)](https://codeclimate.com/repos/61ffcbda569670017700083e/test_coverage)
7+
28
Bancore service to consume with MW.

composer.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "glocurrency/bancore-service",
3+
"description": "Bancore service to consume with MW.",
4+
"type": "library",
5+
"license": "MPL-2.0",
6+
"authors": [
7+
{
8+
"name": "Ivan Stasiuk",
9+
"email": "ivan@stasi.uk",
10+
"homepage": "https://stasi.uk"
11+
}
12+
],
13+
"require": {
14+
"php": "^8.1",
15+
"brokeyourbike/bancore-api-client": "^0.3.0",
16+
"brokeyourbike/base-models": "^0.3.0",
17+
"brokeyourbike/country-casts-laravel": "^0.1.0",
18+
"brokeyourbike/has-source-model": "^2.0",
19+
"glocurrency/middleware-blocks": "^0.3.0",
20+
"illuminate/contracts": "^8.0|^9.0",
21+
"illuminate/database": "^8.0|^9.0"
22+
},
23+
"require-dev": {
24+
"bamarni/composer-bin-plugin": "^1.4",
25+
"mockery/mockery": "^1.0",
26+
"orchestra/testbench": "^6.0|^7.0",
27+
"phpunit/phpunit": "^9.0"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"GloCurrency\\Bancore\\": "src/",
32+
"GloCurrency\\Bancore\\Database\\Factories\\": "database/factories/"
33+
}
34+
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"GloCurrency\\Bancore\\Tests\\": "tests/"
38+
}
39+
},
40+
"extra": {
41+
"laravel": {
42+
"providers": [
43+
"GloCurrency\\Bancore\\BancoreServiceProvider"
44+
]
45+
}
46+
},
47+
"config": {
48+
"sort-packages": true,
49+
"allow-plugins": {
50+
"bamarni/composer-bin-plugin": true
51+
}
52+
},
53+
"minimum-stability": "stable",
54+
"prefer-stable": true,
55+
"repositories": {
56+
"packagist.org": false,
57+
"private-packagist": {
58+
"type": "composer",
59+
"url": "https://repo.packagist.com/glocurrency/"
60+
}
61+
}
62+
}

config/bancore.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
return [
4+
'api' => [
5+
'url' => env('BANCORE_API_URL'),
6+
'username' => env('BANCORE_API_USERNAME'),
7+
'password' => env('BANCORE_API_PASSWORD'),
8+
],
9+
'sender_phone_number' => env('BANCORE_SENDER_PHONE_NUMBER'),
10+
'recipient_phone_number' => env('BANCORE_RECIPIENT_PHONE_NUMBER'),
11+
];

database/factories/BankFactory.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace GloCurrency\Bancore\Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use GloCurrency\Bancore\Models\Bank;
7+
use GloCurrency\Bancore\Bancore;
8+
9+
class BankFactory extends Factory
10+
{
11+
/**
12+
* The name of the factory's corresponding model.
13+
*
14+
* @var string
15+
*/
16+
protected $model = Bank::class;
17+
18+
/**
19+
* Define the model's default state.
20+
*
21+
* @return array
22+
*/
23+
public function definition()
24+
{
25+
return [
26+
'id' => $this->faker->uuid(),
27+
'bank_id' => (Bancore::$bankModel)::factory(),
28+
'code' => $this->faker->unique()->word(),
29+
];
30+
}
31+
}

database/factories/QuotaFactory.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace GloCurrency\Bancore\Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use GloCurrency\Bancore\Models\Transaction;
7+
use GloCurrency\Bancore\Models\Quota;
8+
9+
class QuotaFactory extends Factory
10+
{
11+
/**
12+
* The name of the factory's corresponding model.
13+
*
14+
* @var string
15+
*/
16+
protected $model = Quota::class;
17+
18+
/**
19+
* Define the model's default state.
20+
*
21+
* @return array
22+
*/
23+
public function definition()
24+
{
25+
return [
26+
'id' => $this->faker->uuid(),
27+
'bancore_transaction_id' => Transaction::factory(),
28+
'send_currency_code' => $this->faker->currencyCode(),
29+
'send_amount' => $this->faker->randomNumber(),
30+
'receive_currency_code' => $this->faker->currencyCode(),
31+
'reference' => $this->faker->uuid(),
32+
];
33+
}
34+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace GloCurrency\Bancore\Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use GloCurrency\Bancore\Models\Recipient;
7+
8+
class RecipientFactory extends Factory
9+
{
10+
/**
11+
* The name of the factory's corresponding model.
12+
*
13+
* @var string
14+
*/
15+
protected $model = Recipient::class;
16+
17+
/**
18+
* Define the model's default state.
19+
*
20+
* @return array
21+
*/
22+
public function definition()
23+
{
24+
return [
25+
'id' => $this->faker->uuid(),
26+
'first_name' => $this->faker->firstName(),
27+
'last_name' => $this->faker->lastName(),
28+
'country_code' => $this->faker->countryISOAlpha3(),
29+
'phone_number' => $this->faker->phoneNumber(),
30+
];
31+
}
32+
}

database/factories/SenderFactory.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace GloCurrency\Bancore\Database\Factories;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use GloCurrency\Bancore\Models\Sender;
7+
8+
class SenderFactory extends Factory
9+
{
10+
/**
11+
* The name of the factory's corresponding model.
12+
*
13+
* @var string
14+
*/
15+
protected $model = Sender::class;
16+
17+
/**
18+
* Define the model's default state.
19+
*
20+
* @return array
21+
*/
22+
public function definition()
23+
{
24+
return [
25+
'id' => $this->faker->uuid(),
26+
'first_name' => $this->faker->firstName(),
27+
'last_name' => $this->faker->lastName(),
28+
'birth_date' => $this->faker->date('Y-m-d', now()->subYears(30)),
29+
'country_code' => $this->faker->countryISOAlpha3(),
30+
'phone_number' => $this->faker->phoneNumber(),
31+
];
32+
}
33+
}

0 commit comments

Comments
 (0)