Skip to content

Commit e2244db

Browse files
Added 1.x versions
1 parent ce2a25e commit e2244db

40 files changed

+2667
-0
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: off

.editorconfig

Lines changed: 777 additions & 0 deletions
Large diffs are not rendered by default.

.gitattributes

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
* text=auto
2+
3+
.github/ export-ignore
4+
.run/ export-ignore
5+
6+
docs/ export-ignore
7+
tests/ export-ignore
8+
9+
.codecov.yml export-ignore
10+
.editorconfig export-ignore
11+
.gitattributes export-ignore
12+
.gitignore export-ignore
13+
.styleci.yml export-ignore
14+
15+
.env.example export-ignore
16+
17+
phpunit.php export-ignore
18+
phpunit.xml export-ignore

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.idea/
2+
3+
node_modules/
4+
vendor/
5+
6+
.env
7+
8+
*.bak
9+
*.cache
10+
*.clover
11+
*.orig
12+
*.lock

.gitkeep

Whitespace-only changes.

.styleci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
preset: psr12
2+
3+
risky: true
4+
5+
enabled:
6+
- align_double_arrow
7+
- align_equals
8+
- align_phpdoc
9+
- alpha_ordered_imports
10+
- binary_operator_spaces
11+
- blank_line_before_continue
12+
- blank_line_before_declare
13+
- blank_line_before_return
14+
- blank_line_before_throw
15+
- blank_line_before_try
16+
- cast_spaces
17+
- combine_consecutive_issets
18+
- const_separation
19+
- dir_constant
20+
- fully_qualified_strict_types
21+
- logical_operators
22+
- method_separation
23+
- no_alias_functions
24+
- no_blank_lines_after_phpdoc
25+
- no_blank_lines_between_traits
26+
- no_empty_comment
27+
- no_empty_phpdoc
28+
- no_extra_block_blank_lines
29+
- no_extra_consecutive_blank_lines
30+
- no_short_bool_cast
31+
- no_trailing_comma_in_singleline_array
32+
- no_unneeded_control_parentheses
33+
- no_unused_imports
34+
- ordered_class_elements
35+
- php_unit_construct
36+
- php_unit_fqcn_annotation
37+
- phpdoc_indent
38+
- phpdoc_inline_tag
39+
- phpdoc_link_to_see
40+
- phpdoc_no_access
41+
- phpdoc_no_empty_return
42+
- phpdoc_no_package
43+
- phpdoc_no_useless_inheritdoc
44+
- phpdoc_order
45+
- phpdoc_property
46+
- phpdoc_return_self_reference
47+
- phpdoc_scalar
48+
- phpdoc_separation
49+
- phpdoc_summary
50+
- phpdoc_to_comment
51+
- phpdoc_trim
52+
- phpdoc_type_to_var
53+
- phpdoc_types
54+
- phpdoc_types_order
55+
- phpdoc_var_without_name
56+
- property_separation
57+
- self_accessor
58+
- short_array_syntax
59+
- short_list_syntax
60+
- single_line_class_definition
61+
- single_line_throw
62+
- single_quote
63+
- space_after_semicolon
64+
- standardize_not_equals
65+
- ternary_to_null_coalescing
66+
- trailing_comma_in_multiline_array
67+
- trim_array_spaces

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Andrey Helldar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Cash Driver Provider
2+
3+
<img src="https://preview.dragon-code.pro/cashier-provider/cash.svg?brand=laravel" alt="Cash Driver"/>
4+
5+
[![Stable Version][badge_stable]][link_packagist]
6+
[![Unstable Version][badge_unstable]][link_packagist]
7+
[![Total Downloads][badge_downloads]][link_packagist]
8+
[![License][badge_license]][link_license]
9+
10+
11+
## Installation
12+
13+
To get the latest version of `Cash Driver Provider`, simply require the project using [Composer](https://getcomposer.org):
14+
15+
```bash
16+
$ composer require cashier-provider/cash
17+
```
18+
19+
Or manually update `require` block of `composer.json` and run `composer update`.
20+
21+
```json
22+
{
23+
"require": {
24+
"cashier-provider/cash": "^1.0"
25+
}
26+
}
27+
```
28+
29+
## Using
30+
31+
> **Note**:
32+
>
33+
> This project is the driver for [`Cashier Provider`](https://github.com/cashier-provider/core).
34+
35+
36+
### Configuration
37+
38+
Add your driver information to the `config/cashier.php` file:
39+
40+
```php
41+
use App\Models\Payment;
42+
use App\Payments\Cash as CashDetails;
43+
use CashierProvider\Cash\Driver as CashDriver;
44+
use CashierProvider\Core\Constants\Driver;
45+
46+
return [
47+
'payment' => [
48+
'map' => [
49+
Payment::TYPE_CASH => 'cash'
50+
]
51+
],
52+
53+
'drivers' => [
54+
'cash' => [
55+
Driver::DRIVER => CashDriver::class,
56+
Driver::DETAILS => CashDetails::class,
57+
]
58+
]
59+
];
60+
```
61+
62+
### Resource
63+
64+
Create a model resource class inheriting from `CashierProvider\Core\Resources\Model` in your application.
65+
66+
Use the `$this->model` link to refer to the payment model. When executed, the `$model` parameter will contain the payment instance.
67+
68+
```php
69+
namespace App\Payments;
70+
71+
use CashierProvider\Core\Resources\Model;
72+
73+
class Cash extends Model
74+
{
75+
protected function paymentId(): string
76+
{
77+
return (string) $this->model->id;
78+
}
79+
80+
protected function sum(): float
81+
{
82+
return (float) $this->model->sum;
83+
}
84+
85+
protected function currency(): int
86+
{
87+
return $this->model->currency;
88+
}
89+
90+
protected function createdAt(): Carbon
91+
{
92+
return $this->model->created_at;
93+
}
94+
}
95+
```
96+
97+
### Available Methods And Details Data
98+
99+
```php
100+
$payment->cashier->external_id
101+
// Returns transaction ID for this operation
102+
103+
$payment->cashier->details->getStatus(): ?string
104+
// Returns the text status from the bank
105+
// For example, `PAID`.
106+
107+
$payment->cashier->details->toArray(): array
108+
// Returns an array of status.
109+
// For example,
110+
//
111+
// [
112+
// 'status' => 'PAID'
113+
// ]
114+
```
115+
116+
[badge_downloads]: https://img.shields.io/packagist/dt/cashier-provider/cash.svg?style=flat-square
117+
118+
[badge_license]: https://img.shields.io/packagist/l/cashier-provider/cash.svg?style=flat-square
119+
120+
[badge_stable]: https://img.shields.io/github/v/release/cashier-provider/cash?label=stable&style=flat-square
121+
122+
[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square
123+
124+
[link_license]: LICENSE
125+
126+
[link_packagist]: https://packagist.org/packages/cashier-provider/cash

composer.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "cashier-provider/cash",
3+
"description": "Driver for managing cash payments (see cashier-provider/core)",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": [
7+
"bank",
8+
"billing",
9+
"cashier",
10+
"cash"
11+
],
12+
"authors": [
13+
{
14+
"name": "Andrey Helldar",
15+
"email": "[email protected]"
16+
}
17+
],
18+
"support": {
19+
"issues": "https://github.com/cashier-provider/cash/issues",
20+
"source": "https://github.com/cashier-provider/cash"
21+
},
22+
"require": {
23+
"php": "^7.3|^8.0",
24+
"cashier-provider/core": "^1.30",
25+
"psr/http-message": "^1.0"
26+
},
27+
"require-dev": {
28+
"ext-json": "*",
29+
"andrey-helldar/support": "^4.1",
30+
"illuminate/database": "^6.0|^7.0|^8.0|^9.0",
31+
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0",
32+
"phpunit/phpunit": "^9.0",
33+
"symfony/var-dumper": "^4.0|^5.0|^6.0"
34+
},
35+
"autoload": {
36+
"psr-4": {
37+
"CashierProvider\\Cash\\": "src"
38+
}
39+
},
40+
"autoload-dev": {
41+
"psr-4": {
42+
"Tests\\": "tests"
43+
}
44+
},
45+
"config": {
46+
"preferred-install": "dist",
47+
"sort-packages": true
48+
},
49+
"minimum-stability": "stable",
50+
"prefer-stable": true
51+
}

phpunit.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Register The Composer Auto Loader
6+
|--------------------------------------------------------------------------
7+
|
8+
| Composer provides a convenient, automatically generated class loader
9+
| for our application. We just need to utilize it! We'll require it
10+
| into the script here so that we do not have to worry about the
11+
| loading of any our classes "manually". Feels great to relax.
12+
|
13+
*/
14+
15+
require __DIR__ . '/vendor/autoload.php';
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Set The Default Timezone
20+
|--------------------------------------------------------------------------
21+
|
22+
| Here we will set the default timezone for PHP. PHP is notoriously mean
23+
| if the timezone is not explicitly set. This will be used by each of
24+
| the PHP date and date-time functions throughout the application.
25+
|
26+
*/
27+
28+
date_default_timezone_set('UTC');

0 commit comments

Comments
 (0)