1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Containers\Payment\UI\API\Controllers; |
4
|
|
|
|
5
|
|
|
use Apiato\Core\Foundation\Facades\Apiato; |
6
|
|
|
use App\Containers\Payment\UI\API\Requests\DeletePaymentAccountRequest; |
7
|
|
|
use App\Containers\Payment\UI\API\Requests\FindPaymentAccountRequest; |
8
|
|
|
use App\Containers\Payment\UI\API\Requests\GetAllPaymentAccountsRequest; |
9
|
|
|
use App\Containers\Payment\UI\API\Requests\UpdatePaymentAccountRequest; |
10
|
|
|
use App\Containers\Payment\UI\API\Transformers\PaymentAccountTransformer; |
11
|
|
|
use App\Ship\Parents\Controllers\ApiController; |
12
|
|
|
use App\Ship\Transporters\DataTransporter; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class Controller |
16
|
|
|
* |
17
|
|
|
* @author Johannes Schobel <[email protected]> |
18
|
|
|
* @author Mahmoud Zalt <[email protected]> |
19
|
|
|
*/ |
20
|
|
View Code Duplication |
class Controller extends ApiController |
|
|
|
|
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param GetAllPaymentAccountsRequest $request |
25
|
|
|
* |
26
|
|
|
* @return array |
27
|
|
|
*/ |
28
|
|
|
public function getAllPaymentAccounts(GetAllPaymentAccountsRequest $request) |
29
|
|
|
{ |
30
|
|
|
$paymentAccounts = Apiato::call('[email protected]'); |
31
|
|
|
|
32
|
|
|
return $this->transform($paymentAccounts, PaymentAccountTransformer::class); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param FindPaymentAccountRequest $request |
37
|
|
|
* |
38
|
|
|
* @return array |
39
|
|
|
*/ |
40
|
|
|
public function getPaymentAccount(FindPaymentAccountRequest $request) |
41
|
|
|
{ |
42
|
|
|
$paymentAccount = Apiato::call('[email protected]', [new DataTransporter($request)]); |
43
|
|
|
|
44
|
|
|
return $this->transform($paymentAccount, PaymentAccountTransformer::class); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param UpdatePaymentAccountRequest $request |
49
|
|
|
* |
50
|
|
|
* @return array |
51
|
|
|
*/ |
52
|
|
|
public function updatePaymentAccount(UpdatePaymentAccountRequest $request) |
53
|
|
|
{ |
54
|
|
|
$paymentAccount = Apiato::call('[email protected]', [new DataTransporter($request)]); |
55
|
|
|
|
56
|
|
|
return $this->transform($paymentAccount, PaymentAccountTransformer::class); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param DeletePaymentAccountRequest $request |
61
|
|
|
* |
62
|
|
|
* @return \Illuminate\Http\JsonResponse |
63
|
|
|
*/ |
64
|
|
|
public function deletePaymentAccount(DeletePaymentAccountRequest $request) |
65
|
|
|
{ |
66
|
|
|
Apiato::call('[email protected]', [new DataTransporter($request)]); |
67
|
|
|
|
68
|
|
|
return $this->noContent(); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.