1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace bSecure\UniversalCheckout; |
4
|
|
|
|
5
|
|
|
use bSecure\UniversalCheckout\Controllers\Orders\CreateOrderController; |
6
|
|
|
use bSecure\UniversalCheckout\Controllers\Orders\IOPNController; |
7
|
|
|
use bSecure\UniversalCheckout\Controllers\Orders\OrderStatusUpdateController; |
|
|
|
|
8
|
|
|
|
9
|
|
|
use Illuminate\Support\Facades\Facade; |
|
|
|
|
10
|
|
|
|
11
|
|
|
class BsecureCheckout extends Facade |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
private $orderPayload = [ |
15
|
|
|
'order_id' => null, |
16
|
|
|
'customer' => null, |
17
|
|
|
'products' => null, |
18
|
|
|
'shipment_charges' => null, |
19
|
|
|
'shipment_method_name' => null, |
20
|
|
|
'sub_total_amount' => null, |
21
|
|
|
'discount_amount' => null, |
22
|
|
|
'total_amount' => null |
23
|
|
|
]; |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
/* |
27
|
|
|
* CREATE ORDER: Set Order Id |
28
|
|
|
*/ |
29
|
|
|
public function setOrderId($orderId) |
30
|
|
|
{ |
31
|
|
|
try { |
32
|
|
|
$this->orderPayload['order_id'] = $orderId; |
33
|
|
|
return $this->orderPayload; |
34
|
|
|
//code... |
35
|
|
|
} catch (\Throwable $th) { |
36
|
|
|
throw $th; |
37
|
|
|
} |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
/* |
42
|
|
|
* CREATE ORDER: Set Customer Payload |
43
|
|
|
*/ |
44
|
|
|
public function setCustomer($customerData) |
45
|
|
|
{ |
46
|
|
|
try { |
47
|
|
|
$order = new CreateOrderController(); |
48
|
|
|
$customer = $order->_setCustomer($customerData); |
49
|
|
|
$this->orderPayload['customer'] = $customer; |
50
|
|
|
return $this->orderPayload; |
51
|
|
|
//code... |
52
|
|
|
} catch (\Throwable $th) { |
53
|
|
|
throw $th; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/* |
58
|
|
|
* CREATE ORDER: Set Shipment Details |
59
|
|
|
*/ |
60
|
|
|
public function setShipmentDetails($shipmentData) |
61
|
|
|
{ |
62
|
|
|
try { |
63
|
|
|
$order = new CreateOrderController(); |
64
|
|
|
$shipment = $order->_setShipmentDetails($shipmentData); |
65
|
|
|
$this->orderPayload['shipment_charges'] = $shipment['charges']; |
66
|
|
|
$this->orderPayload['shipment_method_name'] = $shipment['method_name']; |
67
|
|
|
return $this->orderPayload; |
68
|
|
|
//code... |
69
|
|
|
} catch (\Throwable $th) { |
70
|
|
|
throw $th; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/* |
75
|
|
|
* CREATE ORDER: Set Products Data |
76
|
|
|
*/ |
77
|
|
|
|
78
|
|
|
public function setCartItems($productsData) |
79
|
|
|
{ |
80
|
|
|
try { |
81
|
|
|
$order = new CreateOrderController(); |
82
|
|
|
$orderItems = $order->_setProductsDataStructure($productsData); |
83
|
|
|
|
84
|
|
|
$this->orderPayload['products'] = $orderItems['products']; |
85
|
|
|
$this->orderPayload['sub_total_amount'] = $orderItems['sub_total_amount']; |
86
|
|
|
$this->orderPayload['discount_amount'] = $orderItems['discount_amount']; |
87
|
|
|
$this->orderPayload['total_amount'] = $orderItems['total_amount']; |
88
|
|
|
|
89
|
|
|
return $this->orderPayload; |
90
|
|
|
//code... |
91
|
|
|
} catch (\Throwable $th) { |
92
|
|
|
throw $th; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/* |
97
|
|
|
* CREATE ORDER: Create Order using Merchant Access Token from Merchant backend server |
98
|
|
|
*/ |
99
|
|
|
public function createOrder() |
100
|
|
|
{ |
101
|
|
|
try { |
102
|
|
|
$order = new CreateOrderController(); |
103
|
|
|
$result = $order->create($this->orderPayload); |
104
|
|
|
return json_decode($result->getContent(),true); |
105
|
|
|
// return $result->getContent(); |
106
|
|
|
//code... |
107
|
|
|
} catch (\Throwable $th) { |
108
|
|
|
throw $th; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/* |
113
|
|
|
* INSTANT ORDER PROCESSING NOTIFICATIONS : Get order status for merchant |
114
|
|
|
*/ |
115
|
|
|
|
116
|
|
|
public function orderStatusUpdates($order_ref = null) |
117
|
|
|
{ |
118
|
|
|
try { |
119
|
|
|
$customer = new IOPNController(); |
120
|
|
|
$result = $customer->orderStatus($order_ref); |
121
|
|
|
return json_decode($result->getContent(),true); |
122
|
|
|
//code... |
123
|
|
|
} catch (\Throwable $th) { |
124
|
|
|
throw $th; |
125
|
|
|
} |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
} |
129
|
|
|
|
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