1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace bSecure\Payments\Models; |
4
|
|
|
|
5
|
|
|
use bSecure\Payments\Models\Merchant; |
6
|
|
|
use bSecure\Payments\Helpers\Helper; |
7
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
|
8
|
|
|
|
9
|
|
|
class Order extends Model |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Author: Sara Hasan |
13
|
|
|
* Date: 10-November-2020 |
14
|
|
|
*/ |
15
|
|
|
public static function createMerchantOrder($orderPayload) |
16
|
|
|
{ |
17
|
|
|
try { |
18
|
|
|
|
19
|
|
|
$order_response = Helper::createPaymentPluginOrder($orderPayload); |
20
|
|
|
if ($order_response['error']) { |
21
|
|
|
return ['error' => true, 'message' => $order_response['body']['message'], 'exception' => $order_response['body']['exception']]; |
22
|
|
|
} else { |
23
|
|
|
return $order_response; |
24
|
|
|
} |
25
|
|
|
/* |
26
|
|
|
$merchantToken = Merchant::getMerchantAccessToken(); |
27
|
|
|
|
28
|
|
|
if ($merchantToken['error']) { |
29
|
|
|
return ['error' => true, 'message' => $merchantToken['message']]; |
30
|
|
|
} else { |
31
|
|
|
$merchantAccessToken = $merchantToken['body']; |
32
|
|
|
// Call Create Order API |
33
|
|
|
$order_response = Helper::createOrder($merchantAccessToken, $orderPayload); |
34
|
|
|
|
35
|
|
|
if ($order_response['error']) { |
36
|
|
|
return ['error' => true, 'message' => $order_response['body']['message'], 'exception' => $order_response['body']['exception']]; |
37
|
|
|
} else { |
38
|
|
|
return $order_response; |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
*/ |
42
|
|
|
} catch (\Exception $e) { |
43
|
|
|
return ['error' => true, 'message' => trans('bSecurePayments::messages.order.failure'), 'exception' => $e->getTraceAsString()]; |
|
|
|
|
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Author: Sara Hasan |
50
|
|
|
* Date: 10-November-2020 |
51
|
|
|
*/ |
52
|
|
|
public static function getOrderStatus($order_ref) |
53
|
|
|
{ |
54
|
|
|
try { |
55
|
|
|
$merchantToken = Merchant::getMerchantAccessToken(); |
56
|
|
|
|
57
|
|
|
if ($merchantToken['error']) { |
58
|
|
|
return ['error' => true, 'message' => $merchantToken['message']]; |
59
|
|
|
} else { |
60
|
|
|
$merchantAccessToken = $merchantToken['body']; |
61
|
|
|
// Call Order Status Update API |
62
|
|
|
|
63
|
|
|
$payload = ['order_ref' => $order_ref]; |
64
|
|
|
|
65
|
|
|
$order_response = Helper::orderStatus($merchantAccessToken, $payload); |
66
|
|
|
|
67
|
|
|
if ($order_response['error']) { |
68
|
|
|
return ['error' => true, 'message' => $order_response['body']['message']]; |
69
|
|
|
} else { |
70
|
|
|
return $order_response; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
} catch (\Exception $e) { |
74
|
|
|
return ['error' => true, 'message' => trans('bSecurePayments::messages.order.status.failure'), 'exception' => $e->getTraceAsString()]; |
|
|
|
|
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
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