Completed
Push — master ( 91f911...d54fb1 )
by Dmitry
01:20
created

CompletePurchaseResponse::getPayer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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 getTransactionId()
49
    {
50 1
        return intval($this->data['ok_txn_id']);
51
    }
52
53 1
    public function getAmount()
54
    {
55 1
        return $this->data['ok_txn_gross'];
56
    }
57
58 1
    public function getCurrency()
59
    {
60 1
        return $this->data['ok_txn_currency'];
61
    }
62
63 1
    public function getDescription()
64
    {
65 1
        return $this->data['ok_item_1_name'];
66
    }
67
68 1
    public function getPurse()
69
    {
70 1
        return $this->data['ok_receiver'];
71
    }
72
73 1
    public function getFee()
74
    {
75 1
        return $this->data['ok_txn_fee'];
76
    }
77
78 1
    public function getPayer()
79
    {
80 1
        return $this->data['ok_payer_first_name'] . ' ' . $this->data['ok_payer_last_name'] . ' / ' . $this->data['ok_payer_email'];
81
    }
82
83 1
    public function getTime()
84
    {
85 1
        return new \DateTime($this->data['ok_txn_datetime']);
86
    }
87
}
88