Skip to content

Commit

Permalink
Change author, package name and namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
MannikJ committed Jun 3, 2019
1 parent a309099 commit 580ab26
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 74 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Laravel Wallet

Some apps require a prepayment system like a virtual wallet where customers can recharge credits which they can then use to pay in app stuff.
With this package you can equip your eloquent models with one or multiple digital wallets that handle that for you.
With this package you can equip your eloquent models with one or multiple digital wallets that handle that for you.
All the wallet activities are tracked with transactions.

## Installation

Install the package with composer:

```bash
composer require depsimon/laravel-wallet
composer require mannikj/laravel-wallet
```

## Run Migrations
Expand All @@ -21,7 +21,7 @@ If you want more flexibility, you can publish the migration files to your own
migration directory with the following artisan command:

```bash
php artisan vendor:publish --provider="Depsimon\Wallet\WalletServiceProvider" --tag=migrations
php artisan vendor:publish --provider="MannikJ\Laravel\Wallet\WalletServiceProvider" --tag=migrations
```
Make sure to deactivate automatic migration loadingby setting
the config variable `load_migrations` to false when you have
Expand All @@ -32,7 +32,7 @@ published the migration file.
You can publish the config file with this artisan command:

```bash
php artisan vendor:publish --provider="Depsimon\Wallet\WalletServiceProvider" --tag=config
php artisan vendor:publish --provider="MannikJ\Laravel\Wallet\WalletServiceProvider" --tag=config
```

This will merge the `wallet.php` config file where you can specify the Users, Wallets & Transactions classes if you have custom ones.
Expand All @@ -43,7 +43,7 @@ Add the `HasWallet` trait to your User model.

``` php

use Depsimon\Wallet\Traits\HasWallet;
use MannikJ\Laravel\Wallet\Traits\HasWallet;

class User extends Model
{
Expand Down Expand Up @@ -82,15 +82,23 @@ This package makes use of https://github.com/orchestral/testbench to create a
laravel testing environment.
The tests will execute with a pre-configured in-memory sqlite database, so you don't need setup a database on your own.

To run the tests just make sure to install the dependencies via `composer install` first and then execute either `vendor/bin/phpunit` or `composer test` from within the project root directory.
To run the phpunit tests just make sure to install the package dependencies first via

`composer install`

Then execute from within the project root directory

`composer test`


## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.
If you discover any security related issues, open an issue on the [github repository](https://github.com/MannikJ/laravel-wallet/issues).

## Credits

- [Simon Depelchin](https://github.com/depsimon)
- [Simon Depelchin](https://github.com/depsimon) (forked from [despimon/laravel-wallet](https://github.com/depsimon/laravel-wallet))
- [MannikJ](https://github.com/mannikj)

## License

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "depsimon/laravel-wallet",
"name": "mannikj/laravel-wallet",
"description": "Easy to use virtual wallet for your app",
"keywords": [
"depsimon",
Expand Down Expand Up @@ -39,12 +39,12 @@
},
"autoload": {
"psr-4": {
"Depsimon\\Wallet\\": "src"
"MannikJ\\Laravel\\Wallet\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Depsimon\\Wallet\\Tests\\": "tests"
"MannikJ\\Laravel\\Wallet\\Tests\\": "tests"
}
},
"config": {
Expand All @@ -53,10 +53,10 @@
"extra": {
"laravel": {
"providers": [
"Depsimon\\Wallet\\WalletServiceProvider"
"MannikJ\\Laravel\\Wallet\\WalletServiceProvider"
],
"aliases": {
"Wallet": "Depsimon\\Wallet\\WalletFacade"
"Wallet": "MannikJ\\Laravel\\Wallet\\WalletFacade"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Models\Transaction;

return [
/**
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/UnacceptedTransactionException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Depsimon\Wallet\Exceptions;
namespace MannikJ\Laravel\Wallet\Exceptions;

use Exception;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Transaction;

class UnacceptedTransactionException extends Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/Facades/WalletFacade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Depsimon\Wallet\Facades;
namespace MannikJ\Laravel\Wallet\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @see \Depsimon\Wallet\Models\Wallet
* @see \MannikJ\Laravel\Wallet\Models\Wallet
*/
class WalletFacade extends Facade
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jobs/RecalculateWalletBalance.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace Depsimon\Wallet\Jobs;
namespace MannikJ\Laravel\Wallet\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Depsimon\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Models\Wallet;
use Cache;
use Illuminate\Support\Facades\Redis;
use Illuminate\Queue\Jobs\Job;
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Transaction.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Depsimon\Wallet\Models;
namespace MannikJ\Laravel\Wallet\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
Expand Down
10 changes: 5 additions & 5 deletions src/Models/Wallet.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Depsimon\Wallet\Models;
namespace MannikJ\Laravel\Wallet\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
use Exception;
use Depsimon\Wallet\Exceptions\UnacceptedTransactionException;
use MannikJ\Laravel\Wallet\Exceptions\UnacceptedTransactionException;

class Wallet extends Model
{
Expand Down Expand Up @@ -48,7 +48,7 @@ public function owner()
* @param integer $amount
* @param string $type
* @param array $meta
* @return Depsimon\Wallet\Models\Transaction
* @return MannikJ\Laravel\Wallet\Models\Transaction
*/
public function deposit($amount, $meta = [], $type = 'deposit', $forceFail = false)
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public function deposit($amount, $meta = [], $type = 'deposit', $forceFail = fal
* @param integer $amount
* @param string $type
* @param array $meta
* @return Depsimon\Wallet\Models\Transaction
* @return MannikJ\Laravel\Wallet\Models\Transaction
*/
public function failDeposit($amount, $meta = [], $type = 'deposit')
{
Expand All @@ -91,7 +91,7 @@ public function failDeposit($amount, $meta = [], $type = 'deposit')
* @param string $type
* @param array $meta
* @param boolean $shouldAccept
* @return Depsimon\Wallet\Models\Transaction
* @return MannikJ\Laravel\Wallet\Models\Transaction
*/
public function withdraw($amount, $meta = [], $type = 'withdraw', $shouldAccept = true)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Observers/TransactionObserver.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Depsimon\Wallet\Observers;
namespace MannikJ\Laravel\Wallet\Observers;

use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Models\Transaction;

class TransactionObserver
{
Expand Down
8 changes: 4 additions & 4 deletions src/Observers/WalletObserver.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Depsimon\Wallet\Observers;
namespace MannikJ\Laravel\Wallet\Observers;

use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Models\Transaction;
use Depsimon\Wallet\Jobs\RecalculateWalletBalance;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Jobs\RecalculateWalletBalance;

class WalletObserver
{
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasWallet.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Depsimon\Wallet\Traits;
namespace MannikJ\Laravel\Wallet\Traits;

trait HasWallet
{
Expand Down
6 changes: 3 additions & 3 deletions src/WalletServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Depsimon\Wallet;
namespace MannikJ\Laravel\Wallet;

use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Support\Carbon;
use Depsimon\Wallet\Observers\WalletObserver;
use Depsimon\Wallet\Observers\TransactionObserver;
use MannikJ\Laravel\Wallet\Observers\WalletObserver;
use MannikJ\Laravel\Wallet\Observers\TransactionObserver;

class WalletServiceProvider extends ServiceProvider
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Models/User.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Depsimon\Wallet\Tests\Models;
namespace MannikJ\Laravel\Wallet\Tests\Models;

use Illuminate\Foundation\Auth\User as AuthUser;
use Depsimon\Wallet\Traits\HasWallet;
use MannikJ\Laravel\Wallet\Traits\HasWallet;

class User extends AuthUser
{
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Depsimon\Wallet\Tests;
namespace MannikJ\Laravel\Wallet\Tests;

use Orchestra\Testbench\TestCase as BaseTestCase;
use Depsimon\Wallet\WalletServiceProvider;
use MannikJ\Laravel\Wallet\WalletServiceProvider;

class TestCase extends BaseTestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/factories/TransactionFactory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Faker\Generator as Faker;
use Depsimon\Wallet\Models\Transaction;
use Depsimon\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;

// $factory->define(Transaction::class, function (Faker $faker, $attributes) {
// $wallet = array_has($attributes, 'wallet_id')
Expand Down
2 changes: 1 addition & 1 deletion tests/factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Faker\Generator as Faker;
use Depsimon\Wallet\Tests\Models\User;
use MannikJ\Laravel\Wallet\Tests\Models\User;

$factory->define(User::class, function (Faker $faker) {
return [
Expand Down
4 changes: 2 additions & 2 deletions tests/factories/WalletFactory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Faker\Generator as Faker;
use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Tests\Models\User;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Tests\Models\User;

$factory->define(Wallet::class, function (Faker $faker, $attributes) {
$owner = array_has($attributes, 'owner_id')
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/HasWalletTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Depsimon\Wallet\Tests\Unit;
namespace MannikJ\Laravel\Wallet\Tests\Unit;

use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Exceptions\UnacceptedTransactionException;
use Depsimon\Wallet\Tests\TestCase;
use Depsimon\Wallet\Tests\Models\User;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Exceptions\UnacceptedTransactionException;
use MannikJ\Laravel\Wallet\Tests\TestCase;
use MannikJ\Laravel\Wallet\Tests\Models\User;
use MannikJ\Laravel\Wallet\Models\Transaction;
use Illuminate\Support\Collection;

class HasWalletTest extends TestCase
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/RecalculateWalletBalanceTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Depsimon\Wallet\Tests\Unit;
namespace MannikJ\Laravel\Wallet\Tests\Unit;

use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Exceptions\UnacceptedTransactionException;
use Depsimon\Wallet\Tests\TestCase;
use Depsimon\Wallet\Tests\Models\User;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Exceptions\UnacceptedTransactionException;
use MannikJ\Laravel\Wallet\Tests\TestCase;
use MannikJ\Laravel\Wallet\Tests\Models\User;
use MannikJ\Laravel\Wallet\Models\Transaction;
use Illuminate\Support\Collection;
use Depsimon\Wallet\Jobs\RecalculateWalletBalance;
use Depsimon\Wallet\DebouncedJob;
use MannikJ\Laravel\Wallet\Jobs\RecalculateWalletBalance;
use MannikJ\Laravel\Wallet\DebouncedJob;

class RecalculateWalletBalanceTest extends TestCase
{
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/TransactionTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Depsimon\Wallet\Tests\Unit;
namespace MannikJ\Laravel\Wallet\Tests\Unit;

use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Exceptions\UnacceptedTransactionException;
use Depsimon\Wallet\Tests\TestCase;
use Depsimon\Wallet\Tests\Models\User;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Exceptions\UnacceptedTransactionException;
use MannikJ\Laravel\Wallet\Tests\TestCase;
use MannikJ\Laravel\Wallet\Tests\Models\User;
use MannikJ\Laravel\Wallet\Models\Transaction;
use Illuminate\Support\Collection;

class TransactionTest extends TestCase
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/WalletTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Depsimon\Wallet\Tests\Unit;
namespace MannikJ\Laravel\Wallet\Tests\Unit;

use Depsimon\Wallet\Models\Wallet;
use Depsimon\Wallet\Exceptions\UnacceptedTransactionException;
use Depsimon\Wallet\Tests\TestCase;
use Depsimon\Wallet\Tests\Models\User;
use Depsimon\Wallet\Models\Transaction;
use MannikJ\Laravel\Wallet\Models\Wallet;
use MannikJ\Laravel\Wallet\Exceptions\UnacceptedTransactionException;
use MannikJ\Laravel\Wallet\Tests\TestCase;
use MannikJ\Laravel\Wallet\Tests\Models\User;
use MannikJ\Laravel\Wallet\Models\Transaction;
use Illuminate\Support\Collection;
use Depsimon\Wallet\Jobs\RecalculateWalletBalance;
use MannikJ\Laravel\Wallet\Jobs\RecalculateWalletBalance;

class WalletTest extends TestCase
{
Expand Down

0 comments on commit 580ab26

Please sign in to comment.