1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AraneaDev\Electrum\App\Api; |
4
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
6
|
|
|
use AraneaDev\Electrum\Electrum; |
7
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class RequestsController. |
11
|
|
|
*/ |
12
|
|
|
class RequestsController extends Controller |
13
|
|
|
{ |
14
|
|
|
/** @var Electrum */ |
15
|
|
|
protected $electrum; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* RequestsController constructor. |
19
|
|
|
* |
20
|
|
|
* @param Electrum $electrum |
21
|
|
|
*/ |
22
|
|
|
public function __construct(Electrum $electrum) |
23
|
|
|
{ |
24
|
|
|
$this->middleware(config('electrum.web_interface.middleware', ['web', 'auth'])); |
25
|
|
|
$this->electrum = $electrum; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Show all payment requests. |
30
|
|
|
* |
31
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
32
|
|
|
*/ |
33
|
|
|
public function index() |
34
|
|
|
{ |
35
|
|
|
return response()->json($this->electrum->getRequests()); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Show a payment request. |
40
|
|
|
* |
41
|
|
|
* @param $address |
42
|
|
|
* |
43
|
|
|
* @return \Illuminate\Http\JsonResponse |
44
|
|
|
*/ |
45
|
|
|
public function show($address) |
46
|
|
|
{ |
47
|
|
|
return response()->json($this->electrum->getRequest($address)); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Create a payment request. |
52
|
|
|
* |
53
|
|
|
* @param Request $request |
54
|
|
|
* |
55
|
|
|
* @return \Illuminate\Http\JsonResponse |
56
|
|
|
*/ |
57
|
|
|
public function create(Request $request) |
58
|
|
|
{ |
59
|
|
|
$request->validate([ |
60
|
|
|
'amount' => 'required|numeric|min:0', |
61
|
|
|
'expires' => 'required|integer|min:0', |
62
|
|
|
'memo' => 'nullable', |
63
|
|
|
]); |
64
|
|
|
|
65
|
|
|
return response()->json($this->electrum->createRequest( |
66
|
|
|
$request->get('amount'), |
67
|
|
|
$request->get('memo'), |
68
|
|
|
$request->get('expires') |
69
|
|
|
)); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Remove a payment request. |
74
|
|
|
* |
75
|
|
|
* @param $address |
76
|
|
|
* |
77
|
|
|
* @return \Illuminate\Http\JsonResponse |
78
|
|
|
*/ |
79
|
|
|
public function destroy($address) |
80
|
|
|
{ |
81
|
|
|
return response()->json($this->electrum->clearRequest($address)); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Remove all payment requests. |
86
|
|
|
* |
87
|
|
|
* @return \Illuminate\Http\JsonResponse |
88
|
|
|
*/ |
89
|
|
|
public function clear() |
90
|
|
|
{ |
91
|
|
|
return response()->json($this->electrum->clearRequests()); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths