RechargeCardPrinting   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getEPinNetworks() 0 4 1
A buyEPins() 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\Enums\NetworkEnum;
16
17
abstract class RechargeCardPrinting
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
    /**
29
     * @return ClubKonnectResponse
30
     */
31
    public function getEPinNetworks(): ClubKonnectResponse
32
    {
33
        return $this->clubKonnect->withAuth('APIEPINDiscountV1.asp', []);
34
    }
35
36
    /**
37
     * @param NetworkEnum $network
38
     * @param $amount
39
     * @param int $quantity
40
     * @param $requestID
41
     * @param $callbackUrl
42
     * @return ClubKonnectResponse
43
     */
44
    public function buyEPins(NetworkEnum $network, $amount, int $quantity, $requestID, $callbackUrl = null): ClubKonnectResponse
45
    {
46
        $callbackUrl = is_null($callbackUrl) ? $this->config['default_redirect_url'] : $callbackUrl;
47
        return $this->clubKonnect->withAuth('APIEPINV1.asp', [
48
            'MobileNetwork' => $network->getCode(),
49
            'Value' => $amount,
50
            'Quantity' => $quantity,
51
            'RequestID' => $requestID,
52
            'CallBackURL' => $callbackUrl
53
        ]);
54
    }
55
56
}
57