forked from bavix/laravel-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
124 lines (113 loc) · 3.12 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
use Bavix\Wallet\Objects\Bring;
use Bavix\Wallet\Objects\Cart;
use Bavix\Wallet\Objects\EmptyLock;
use Bavix\Wallet\Objects\Operation;
use Bavix\Wallet\Services\ExchangeService;
use Bavix\Wallet\Services\CommonService;
use Bavix\Wallet\Services\WalletService;
use Bavix\Wallet\Services\LockService;
use Bavix\Wallet\Models\Transaction;
use Bavix\Wallet\Models\Transfer;
use Bavix\Wallet\Models\Wallet;
use Bavix\Wallet\Simple\Rate;
use Bavix\Wallet\Simple\Store;
use Bavix\Wallet\Simple\BCMath;
use Bavix\Wallet\Simple\Math;
$bcLoaded = extension_loaded('bcmath');
return [
/**
* This parameter is necessary for more accurate calculations.
* PS, Arbitrary Precision Calculations
*/
'math' => [
'scale' => 64,
],
/**
* The parameter is used for fast packet overload.
* You do not need to search for the desired class by code, the library will do it itself.
*/
'package' => [
'rateable' => Rate::class,
'storable' => Store::class,
'mathable' => $bcLoaded ?
BCMath::class :
Math::class,
],
/**
* Lock settings for highload projects
*
* If you want to replace the default cache with another,
* then write the name of the driver cache in the key `wallet.lock.cache`.
* @see https://laravel.com/docs/6.x/cache#driver-prerequisites
*
* @example
* 'cache' => 'redis'
*/
'lock' => [
'cache' => null,
'enabled' => false,
'seconds' => 1,
],
/**
* Sometimes a slug may not match the currency and you need the ability to add an exception.
* The main thing is that there are not many exceptions)
*
* Syntax:
* 'slug' => 'currency'
*
* @example
* 'my-usd' => 'USD'
*/
'currencies' => [],
/**
* Services are the main core of the library and sometimes they need to be improved.
* This configuration will help you to quickly customize the library.
*/
'services' => [
'exchange' => ExchangeService::class,
'common' => CommonService::class,
'wallet' => WalletService::class,
'lock' => LockService::class,
],
'objects' => [
'bring' => Bring::class,
'cart' => Cart::class,
'emptyLock' => EmptyLock::class,
'operation' => Operation::class,
],
/**
* Transaction model configuration.
*/
'transaction' => [
'table' => 'transactions',
'model' => Transaction::class,
'casts' => [
'amount' => $bcLoaded ? 'string' : 'int',
],
],
/**
* Transfer model configuration.
*/
'transfer' => [
'table' => 'transfers',
'model' => Transfer::class,
'casts' => [
'fee' => $bcLoaded ? 'string' : 'int',
],
],
/**
* Wallet model configuration.
*/
'wallet' => [
'table' => 'wallets',
'model' => Wallet::class,
'casts' => [
'balance' => $bcLoaded ? 'string' : 'int',
],
'default' => [
'name' => 'Default Wallet',
'slug' => 'default',
],
],
];