Completed
Push — master ( 2d293e...b89557 )
by Vuong
02:12
created

VerifiedData   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 22
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A rules() 0 14 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
    /**
39
     * @inheritdoc
40
     */
41
    public function rules()
42
    {
43
        return [
44
            [['signature'], 'required', 'on' => [
45
                PaymentGateway::VRC_PURCHASE_SUCCESS, PaymentGateway::VRC_IPN
46
            ]],
47
            [['signature'], SignatureValidator::class, 'dataSignAttributes' => [
48
                'partnerCode', 'accessKey', 'requestId', 'amount', 'orderId', 'orderInfo', 'orderType',
49
                'transId', 'message', 'localMessage', 'responseTime', 'errorCode', 'payType', 'extraData'
50
            ], 'client' => $this->getClient(), 'on' => [
51
                PaymentGateway::VRC_PURCHASE_SUCCESS, PaymentGateway::VRC_IPN
52
            ]]
53
        ];
54
    }
55
56
}
57