1 | <?php |
||
22 | class RequestData extends BaseRequestData |
||
23 | { |
||
24 | |||
25 | /** |
||
26 | * @inheritdoc |
||
27 | */ |
||
28 | 4 | public function rules() |
|
29 | { |
||
30 | $rules = [ |
||
31 | 4 | [['merchant_id', 'merchant_password', 'version', 'function'], 'required', 'on' => [ |
|
32 | PaymentGateway::RC_PURCHASE, PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_AUTHENTICATE |
||
33 | ]], |
||
34 | [[ |
||
35 | 'bank_code', 'buyer_fullname', 'buyer_email', 'buyer_mobile', 'return_url', |
||
36 | 'total_amount', 'order_code', 'receiver_email', 'payment_method' |
||
37 | ], 'required', 'on' => PaymentGateway::RC_PURCHASE], |
||
38 | [['otp', 'auth_url'], 'required', 'on' => PaymentGateway::RC_AUTHENTICATE], |
||
39 | [['token'], 'required', 'on' => [PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_AUTHENTICATE]] |
||
40 | ]; |
||
41 | |||
42 | 4 | if ($this->getClient()->getGateway()->getSeamless()) { |
|
43 | 2 | return array_merge($rules, [ |
|
44 | 2 | [['card_number', 'card_fullname', 'card_month', 'card_year'], 'required', 'on' => PaymentGateway::RC_PURCHASE] |
|
45 | ]); |
||
46 | } else { |
||
47 | 2 | return $rules; |
|
48 | } |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | 4 | protected function ensureAttributes(array &$attributes) |
|
82 | |||
83 | } |
||
84 |