1 | <?php |
||||
2 | |||||
3 | namespace bSecure\Payments\Controllers\Orders; |
||||
4 | |||||
5 | use App\Http\Controllers\Controller; |
||||
0 ignored issues
–
show
|
|||||
6 | |||||
7 | //Models |
||||
8 | use bSecure\Payments\Models\Order; |
||||
9 | |||||
10 | //Helper |
||||
11 | use bSecure\Payments\Helpers\AppException; |
||||
0 ignored issues
–
show
The type
bSecure\Payments\Helpers\AppException was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
12 | use bSecure\Payments\Helpers\ApiResponseHandler; |
||||
13 | |||||
14 | //Facade |
||||
15 | use Validator; |
||||
0 ignored issues
–
show
The type
Validator was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
16 | |||||
17 | |||||
18 | class CreateOrderController extends Controller |
||||
19 | { |
||||
20 | |||||
21 | protected $validationRule = [ |
||||
22 | 'order_id' => 'order_id', |
||||
23 | 'customer' => 'customer', |
||||
24 | 'products' => 'products', |
||||
25 | ]; |
||||
26 | |||||
27 | |||||
28 | |||||
29 | /** |
||||
30 | * Author: Sara Hasan |
||||
31 | * Date: 10-November-2020 |
||||
32 | */ |
||||
33 | public function create($orderData) |
||||
34 | { |
||||
35 | try { |
||||
36 | $orderResponse = Order::createMerchantOrder($orderData); |
||||
37 | if($orderResponse['error']) |
||||
38 | { |
||||
39 | return ApiResponseHandler::failure($orderResponse['message'],$orderResponse['exception']); |
||||
40 | }else{ |
||||
41 | $response = $orderResponse['body']; |
||||
42 | return ApiResponseHandler::success($response, trans('bSecurePayments::messages.order.success')); |
||||
0 ignored issues
–
show
The function
trans was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
43 | } |
||||
44 | } catch (\Exception $e) { |
||||
45 | return ApiResponseHandler::failure(trans('bSecurePayments::messages.order.failure'), $e->getTraceAsString()); |
||||
46 | } |
||||
47 | } |
||||
48 | |||||
49 | |||||
50 | public function _setCharges($object) |
||||
51 | { |
||||
52 | $orderData['sub_total_amount'] = array_key_exists('sub_total_amount',$object ) ? $object['sub_total_amount'] : null; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
53 | $orderData['discount_amount'] = array_key_exists('discount_amount',$object ) ? $object['discount_amount'] : null; |
||||
54 | $orderData['total_amount'] = array_key_exists('total_amount',$object ) ? $object['total_amount'] : null; |
||||
55 | return $orderData; |
||||
56 | } |
||||
57 | |||||
58 | |||||
59 | public function _setCustomer($customerData) |
||||
60 | { |
||||
61 | $customer = []; |
||||
62 | if(!empty($customerData)) |
||||
63 | { |
||||
64 | $auth_code = array_key_exists('auth_code',$customerData) ? $customerData['auth_code'] : '' ; |
||||
65 | |||||
66 | if( !empty( $auth_code ) ) |
||||
67 | { |
||||
68 | $customer = [ |
||||
69 | "auth_code" => $auth_code, |
||||
70 | ];; |
||||
71 | } |
||||
72 | else{ |
||||
73 | $customer = [ |
||||
74 | "country_code" => array_key_exists('country_code',$customerData) ? $customerData['country_code'] : '', |
||||
75 | "phone_number" => array_key_exists('phone_number',$customerData) ? $customerData['phone_number'] : '', |
||||
76 | "name" => array_key_exists('name',$customerData) ? $customerData['name'] : '', |
||||
77 | "email" => array_key_exists('email',$customerData) ? $customerData['email'] : '', |
||||
78 | ]; |
||||
79 | } |
||||
80 | } |
||||
81 | |||||
82 | return $customer; |
||||
83 | } |
||||
84 | |||||
85 | public function _setCustomerAddress($customerData) |
||||
86 | { |
||||
87 | $customer = []; |
||||
88 | if(!empty($customerData)) |
||||
89 | { |
||||
90 | $customer = [ |
||||
91 | "country" => array_key_exists('country',$customerData) ? $customerData['country'] : '', |
||||
92 | "province" => array_key_exists('province',$customerData) ? $customerData['province'] : '', |
||||
93 | "city" => array_key_exists('city',$customerData) ? $customerData['city'] : '', |
||||
94 | "area" => array_key_exists('area',$customerData) ? $customerData['area'] : '', |
||||
95 | "address" => array_key_exists('address',$customerData) ? $customerData['address'] : '', |
||||
96 | ]; |
||||
97 | } |
||||
98 | |||||
99 | return $customer; |
||||
100 | } |
||||
101 | } |
||||
102 |
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