Completed
Push — master ( 035046...524244 )
by Vuong
02:35
created

ResponseData   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIsOk() 0 8 3
1
<?php
2
/**
3
 * @link https://github.com/yiiviet/yii2-payment
4
 * @copyright Copyright (c) 2017 Yii Viet
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace yiiviet\payment\onepay;
9
10
use vxm\gatewayclients\ResponseData as BaseResponseData;
11
12
/**
13
 * Lớp ResponseData cung cấp dữ liệu nhận được từ OnePay khi gọi [[request()]] ở lớp [[PaymentGateway]].
14
 *
15
 * @method PaymentClient getClient() đối tượng client đã dùng để thực thi request.
16
 *
17
 * @property PaymentClient $client đối tượng client đã dùng để thực thi request.
18
 * @property bool $isOk trạng thái phản hồi từ OnePay `TRUE` thành công và ngược lại.
19
 * @property string $redirect_url đường dẫn redirect khách đến trang thanh toán, chỉ tồn tại khi `isOk` là TRUE.
20
 *
21
 * @author Vuong Minh <[email protected]>
22
 * @since 1.0
23
 */
24
class ResponseData extends BaseResponseData
25
{
26
27
    use MagicPropertiesTrait;
28
29
    /**
30
     * @inheritdoc
31
     */
32 4
    public function getIsOk(): bool
33
    {
34 4
        if ($this->getCommand() === PaymentGateway::RC_QUERY_DR) {
35 2
            return isset($this['vpc_DRExists']) ? strcasecmp($this['vpc_DRExists'], 'Y') === 0 : false;
36
        } else {
37 2
            return true;
38
        }
39
    }
40
41
}
42