Completed
Push — master ( 4f7c7c...fdaf8f )
by Vuong
02:10
created

VerifiedData::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 2
cts 2
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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\momo;
9
10
use yiiviet\payment\VerifiedData as BaseVerifiedData;
11
12
/**
13
 * Lớp VerifiedData
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 string $partnerCode của client sử dụng khi tạo request purchase.
19
 * @property string $accessKey của client sử dụng khi tạo request purchase.
20
 * @property mixed $requestId mã unique request id khi tạo request purchase
21
 * @property double $amount số tiền của đơn hàng.
22
 * @property string $orderId mã đơn hàng tại hệ thống.
23
 * @property string $orderType có giá trị cố định là `momo_wallet`.
24
 * @property string $transId mã giao dịch tại MOMO.
25
 * @property string $message thống báo (eng).
26
 * @property string $localMessage thống báo (vi).
27
 * @property string $responseTime thời gian phản hồi.
28
 * @property int $errorCode mã báo lỗi.
29
 * @property string $payType hình thức thanh toán (web hoặc qr).
30
 * @property mixed $extraData dữ liệu kèm theo khi tạo request purchase.
31
 *
32
 * @author Vuong Minh <[email protected]>
33
 * @since 1.0.3
34
 */
35
class VerifiedData extends BaseVerifiedData
36
{
37
38
    use SignatureValidatorTrait;
39
40
    /**
41
     * @inheritdoc
42
     */
43 2 View Code Duplication
    public function rules()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        return [
46 2
            [['signature'], 'required', 'on' => [
47
                PaymentGateway::VRC_PURCHASE_SUCCESS, PaymentGateway::VRC_IPN
48
            ]],
49
            [['signature'], 'signatureValidator', 'message' => '{attribute} is not valid!', 'on' => [
50
                PaymentGateway::VRC_PURCHASE_SUCCESS, PaymentGateway::VRC_IPN
51
            ]]
52
        ];
53
    }
54
55
    /**
56
     * @inheritdoc
57
     */
58
    protected function getDataSignAttributes(): array
59
    {
60
        return [
61
            'partnerCode', 'accessKey', 'requestId', 'amount', 'orderId', 'orderInfo', 'orderType',
62
            'transId', 'message', 'localMessage', 'responseTime', 'errorCode', 'payType', 'extraData'
63
        ];
64
    }
65
}
66