Smile   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 38
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDataBundles() 0 4 1
A verifySmileAccountID() 0 7 1
A purchaseBundle() 0 11 2
1
<?php
2
/**
3
 * Created By: Henry Ejemuta
4
 * PC: Enrico Systems
5
 * Project: laravel-clubkonnect
6
 * Company: Stimolive Technologies Limited
7
 * Class Name: Transaction.php
8
 * Date Created: 5/14/21
9
 * Time Created: 10:24 AM
10
 */
11
12
namespace HenryEjemuta\LaravelClubKonnect;
13
14
use HenryEjemuta\LaravelClubKonnect\Classes\ClubKonnectResponse;
15
use HenryEjemuta\LaravelClubKonnect\Exceptions\ClubKonnectErrorException;
16
17
abstract class Smile
18
{
19
    private $config;
20
    private $clubKonnect;
21
22
    public function __construct(ClubKonnect $clubKonnect, $config)
23
    {
24
        $this->config = $config;
25
        $this->clubKonnect = $clubKonnect;
26
    }
27
28
    public function getDataBundles(): ClubKonnectResponse
29
    {
30
        return $this->clubKonnect->withAuth('APISmilePackagesV2.asp', []);
31
    }
32
33
    public function verifySmileAccountID($phoneNumber): ClubKonnectResponse
34
    {
35
        return $this->clubKonnect->withAuth('APIVerifySmileV1.asp', [
36
            'MobileNetwork' => 'smile-direct',
37
            'MobileNumber' => $phoneNumber,
38
        ]);
39
    }
40
41
    public function purchaseBundle(string $plan, string $phoneNumber, $requestID, $callbackUrl = null): ClubKonnectResponse
42
    {
43
        $callbackUrl = is_null($callbackUrl) ? $this->config['default_redirect_url'] : $callbackUrl;
44
        return $this->clubKonnect->withAuth('APISmileV1.asp', [
45
            'MobileNetwork' => 'smile-direct',
46
            'DataPlan' => $plan,
47
            'MobileNumber' => $phoneNumber,
48
            'RequestID' => $requestID,
49
            'CallBackURL' => $callbackUrl
50
        ]);
51
    }
52
53
54
}
55