Completed
Push — master ( 22f05f...6ee38e )
by Vuong
02:09
created

PaymentClient::init()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4.5923

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 6
cts 9
cp 0.6667
rs 9.7333
c 0
b 0
f 0
cc 4
nc 4
nop 0
crap 4.5923
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\nganluong;
9
10
use yii\base\InvalidConfigException;
11
12
use yiiviet\payment\BasePaymentClient;
13
14
/**
15
 * Lớp PaymentClient là lớp chứa các thuộc tính để truy vấn đến ngân lượng nhu merchant id, merchant password, email...
16
 *
17
 * @method PaymentGateway getGateway()
18
 * @property PaymentGateway $gateway
19
 *
20
 * @author Vuong Minh <[email protected]>
21
 * @since 1.0
22
 */
23
class PaymentClient extends BasePaymentClient
24
{
25
26
    /**
27
     * PaymentClient id được cấp khi bạn tích hợp website với ngân lượng.
28
     *
29
     * @var string
30
     */
31
    public $merchantId;
32
33
    /**
34
     * PaymentClient password được cấp khi bạn tích hợp website với ngân lượng.
35
     *
36
     * @var string
37
     */
38
    public $merchantPassword;
39
40
    /**
41
     * Email mặc định để nhận tiền thanh toán từ khách hàng của bạn.
42
     *
43
     * @var string
44
     */
45
    public $email;
46
47
    /**
48
     * @inheritdoc
49
     * @throws InvalidConfigException
50
     * @since 1.0.3
51
     */
52 9
    public function init()
53
    {
54 9
        if ($this->merchantId === null) {
55
            throw new InvalidConfigException('Property `merchantId` must be set!');
56
        }
57
58 9
        if ($this->merchantPassword === null) {
59
            throw new InvalidConfigException('Property `merchantPassword` must be set!');
60
        }
61
62 9
        if ($this->email === null) {
63
            throw new InvalidConfigException('Property `email` must be set!');
64
        }
65
66 9
        parent::init();
67 9
    }
68
69
    /**
70
     * @inheritdoc
71
     */
72
    protected function initDataSignature(string $data, string $type = null): ?\yiiviet\payment\DataSignature
73
    {
74
        return null;
75
    }
76
77
}
78