Biller::updateOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Digikraaft\Flutterwave;
4
5
class Biller extends ApiResource
6
{
7
    const OBJECT_NAME = 'billers';
8
9
    use ApiOperations\All;
10
    use ApiOperations\Create;
11
12
    /**
13
     * @param string $billerCode
14
     * @return array|object
15
     * @link https://developer.flutterwave.com/reference#get-products-under-a-agency
16
     */
17
    public static function products(string $billerCode)
18
    {
19
        $url = static::endPointUrl("{$billerCode}/products");
20
21
        return static::staticRequest('GET', $url);
22
    }
23
24
    /**
25
     * @param string $billerCode
26
     * @param string $productCode
27
     * @return array|object
28
     * @link https://developer.flutterwave.com/reference#get-amount-to-be-paid-for-a-product
29
     */
30
    public static function productAmount(string $billerCode, string $productCode)
31
    {
32
        $url = static::endPointUrl("{$billerCode}/products/{$productCode}/orders");
33
34
        return static::staticRequest('GET', $url);
35
    }
36
37
    /**
38
     * @param string $orderId
39
     * @param array $params
40
     * @return array|object
41
     * @link https://developer.flutterwave.com/reference#get-amount-to-be-paid-for-a-product
42
     */
43
    public static function updateOrder(string $orderId, array $params)
44
    {
45
        static::validateParams($params, true);
46
        $url = urlencode("product-orders/{$orderId}");
47
48
        return static::staticRequest('PUT', $url, $params);
49
    }
50
}
51