OrderController::orderStatus()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
namespace bSecure;
4
5
use bSecure\Helpers\Constant;
6
7
abstract class OrderController
8
{
9
    /**
10
     * Create an order on your builder's behalf on bsecure server
11
     *
12
     * @param array $orderPayload
13
     *
14
     * @throws \bSecure\ApiResponse if the request fails
15
     *
16
     * @return \bSecure\ApiResponse
17
     */
18
    public static function createOrder($orderPayload)
19
    {
20
        $requestor = new ApiRequest();
21
        $response = $requestor->request(
22
          'post',
23
          Constant::API_ENDPOINTS['create_order'],
24
          $orderPayload,
25
          Constant::YES
26
        );
27
        return $response[0];
28
    }
29
30
    /**
31
     * Return order's status
32
     *
33
     * @param string $orderRef
34
     *
35
     * @throws \bSecure\ApiResponse if the request fails
36
     * @return \bSecure\ApiResponse
37
    */
38
39
    public static function orderStatus($orderRef)
40
    {
41
        $requestor = new ApiRequest();
42
        $response = $requestor->request(
43
          'post',
44
          Constant::API_ENDPOINTS['order_status'],
45
          ['order_ref' => $orderRef],
46
          Constant::YES
47
        );
48
        return $response[0];
49
    }
50
}