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

ResponseData::getResponseCode()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 6
cp 0
rs 9.9332
c 0
b 0
f 0
cc 3
nc 3
nop 0
crap 12
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