CompletePurchaseResponse   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 17
lcom 1
cbo 1
dl 0
loc 77
ccs 20
cts 30
cp 0.6667
rs 10
c 0
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A isSuccessful() 0 4 2
A isCancelled() 0 4 2
A isRedirect() 0 4 1
A getRedirectUrl() 0 4 1
A getRedirectMethod() 0 4 1
A getRedirectData() 0 4 1
A getAmount() 0 4 1
A getCurrency() 0 4 1
A getDescription() 0 4 1
A getPurse() 0 4 1
A getFee() 0 4 1
A getPayer() 0 4 1
A getTime() 0 4 1
A getTransactionReference() 0 4 1
A getTransactionId() 0 4 1
1
<?php
2
/**
3
 * OKPAY driver for Omnipay PHP payment library.
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-okpay
6
 * @package   omnipay-okpay
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\OKPAY\Message;
12
13
use Omnipay\Common\Message\AbstractResponse;
14
use Omnipay\Common\Message\RedirectResponseInterface;
15
16
class CompletePurchaseResponse extends AbstractResponse implements RedirectResponseInterface
17
{
18 1
    public function isSuccessful()
19
    {
20 1
        return ($this->data['ok_txn_status'] === 'completed') ? true : false;
21
    }
22
23
    public function isCancelled()
24
    {
25
        return ($this->data['ok_txn_status'] !== 'completed') ? true : false;
26
    }
27
28
    public function isRedirect()
29
    {
30
        return false;
31
    }
32
33
    public function getRedirectUrl()
34
    {
35
        return null;
36
    }
37
38
    public function getRedirectMethod()
39
    {
40
        return null;
41
    }
42
43
    public function getRedirectData()
44
    {
45
        return null;
46
    }
47
48 1
    public function getAmount()
49
    {
50 1
        return $this->data['ok_txn_gross'];
51
    }
52
53 1
    public function getCurrency()
54
    {
55 1
        return $this->data['ok_txn_currency'];
56
    }
57
58 1
    public function getDescription()
59
    {
60 1
        return $this->data['ok_item_1_name'];
61
    }
62
63 1
    public function getPurse()
64
    {
65 1
        return $this->data['ok_receiver'];
66
    }
67
68 1
    public function getFee()
69
    {
70 1
        return $this->data['ok_txn_fee'];
71
    }
72
73 1
    public function getPayer()
74
    {
75 1
        return $this->data['ok_payer_first_name'] . ' ' . $this->data['ok_payer_last_name'] . ' / ' . $this->data['ok_payer_email'];
76
    }
77
78 1
    public function getTime()
79
    {
80 1
        return new \DateTime($this->data['ok_txn_datetime']);
81
    }
82
83 1
    public function getTransactionReference()
84
    {
85 1
        return $this->data['ok_txn_id'];
86
    }
87
88 1
    public function getTransactionId()
89
    {
90 1
        return $this->data['ok_invoice'];
91
    }
92
}
93