Passed
Push — main ( 4a5f0c...02f3c9 )
by MyFatoorah
06:23 queued 02:44
created

MyFatoorahSupplier   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isSupplierApproved() 0 4 2
A getSupplierDashboard() 0 4 1
1
<?php
2
3
namespace MyFatoorah\Library\API;
4
5
use MyFatoorah\Library\MyFatoorah;
6
7
/**
8
 * MyFatoorahSupplier handles the Supplier process of MyFatoorah API endpoints
9
 *
10
 * @author    MyFatoorah <[email protected]>
11
 * @copyright 2021 MyFatoorah, All rights reserved
12
 * @license   GNU General Public License v3.0
13
 */
14
class MyFatoorahSupplier extends MyFatoorah
15
{
16
    //-----------------------------------------------------------------------------------------------------------------------------------------
17
18
    /**
19
     * Gets Supplier Dashboard information if Supplier exists in the MyFatoorah portal account.
20
     *
21
     * @param int $supplierCode The supplier code that exists in MyFatoorah portal account.
22
     *
23
     * @return object
24
     */
25
    public function getSupplierDashboard($supplierCode)
26
    {
27
        $url = $this->apiURL . '/v2/GetSupplierDashboard?SupplierCode=' . $supplierCode;
28
        return $this->callAPI($url, null, null, "Get Supplier Documents");
29
    }
30
31
    //-----------------------------------------------------------------------------------------------------------------------------------------
32
33
    /**
34
     * Returns the supplier status in MyFatoorah account
35
     *
36
     * @param int $supplierCode The supplier code that exists in MyFatoorah portal account.
37
     *
38
     * @return boolean
39
     */
40
    public function isSupplierApproved($supplierCode)
41
    {
42
        $supplier = $this->getSupplierDashboard($supplierCode);
43
        return ($supplier->IsApproved && $supplier->IsActive);
44
    }
45
46
    //-----------------------------------------------------------------------------------------------------------------------------------------
47
}
48