1 | <?php |
||
10 | class AuthorizeRequest extends AbstractRequest |
||
11 | { |
||
12 | /** |
||
13 | * Get phone. |
||
14 | * |
||
15 | * @return string |
||
16 | */ |
||
17 | 24 | public function getPhone() |
|
21 | |||
22 | /** |
||
23 | * Set phone. |
||
24 | * |
||
25 | * @param string $value |
||
26 | * |
||
27 | * @return static|\Omnipay\Common\Message\AbstractRequest |
||
28 | */ |
||
29 | 3 | public function setPhone($value) |
|
33 | |||
34 | /** |
||
35 | * Get custom field 2. |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | 12 | public function getCf2() |
|
43 | |||
44 | /** |
||
45 | * Set custom field 2. |
||
46 | * |
||
47 | * @param string $value |
||
48 | * |
||
49 | * @return static|\Omnipay\Common\Message\AbstractRequest |
||
50 | */ |
||
51 | 3 | public function setCf2($value) |
|
55 | |||
56 | /** |
||
57 | * Get custom field 3. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 12 | public function getCf3() |
|
65 | |||
66 | /** |
||
67 | * Set custom field 3. |
||
68 | * |
||
69 | * @param string $value |
||
70 | * |
||
71 | * @return static|\Omnipay\Common\Message\AbstractRequest |
||
72 | */ |
||
73 | 3 | public function setCf3($value) |
|
77 | |||
78 | /** |
||
79 | * Get callback URL. |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 12 | public function getCallbackUrl() |
|
87 | |||
88 | /** |
||
89 | * Set callback URL. |
||
90 | * |
||
91 | * @param string $value |
||
92 | * |
||
93 | * @return static|\Omnipay\Common\Message\AbstractRequest |
||
94 | */ |
||
95 | 3 | public function setCallbackUrl($value) |
|
99 | |||
100 | /** |
||
101 | * Get the raw data array for this message. The format of this varies from gateway to |
||
102 | * gateway, but will usually be either an associative array, or a SimpleXMLElement. |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | 12 | public function getData() |
|
107 | { |
||
108 | 12 | $this->validate( |
|
109 | 12 | 'amount', |
|
110 | 12 | 'card', |
|
111 | 12 | 'transactionId', |
|
112 | 12 | 'clientIp', |
|
113 | 'productId' |
||
114 | 12 | ); |
|
115 | |||
116 | 12 | $card = $this->getCard(); |
|
117 | |||
118 | 12 | $card->validate(); |
|
119 | |||
120 | $data = array( |
||
121 | 12 | 'opcode' => 0, |
|
122 | 12 | 'product_id' => $this->getProductId(), |
|
123 | 12 | 'amount' => $this->getAmount(), |
|
124 | 12 | 'cf' => $this->getTransactionId(), |
|
125 | 12 | 'ip_address' => $this->getClientIp(), |
|
126 | 12 | 'pan' => $card->getNumber(), |
|
127 | 12 | 'cardholder' => $card->getName(), |
|
128 | 12 | 'exp_month' => $card->getExpiryMonth(), |
|
129 | 12 | 'exp_year' => $card->getExpiryYear(), |
|
130 | 12 | 'cvv' => $card->getCvv(), |
|
131 | 12 | 'pp_identity' => 'card', |
|
132 | 12 | 'token' => $this->getRequestToken(), |
|
133 | 12 | ); |
|
134 | |||
135 | 12 | if ($this->getPhone()) { |
|
136 | 3 | $data['phone'] = $this->getPhone(); |
|
137 | 3 | } |
|
138 | 12 | if ($this->getCf2()) { |
|
139 | 3 | $data['cf2'] = $this->getCf2(); |
|
140 | 3 | } |
|
141 | 12 | if ($this->getCf3()) { |
|
142 | 3 | $data['cf3'] = $this->getCf3(); |
|
143 | 3 | } |
|
144 | 12 | if ($this->getCallbackUrl()) { |
|
145 | 3 | $data['cb_url'] = $this->getCallbackUrl(); |
|
146 | 3 | } |
|
147 | |||
148 | 12 | return $data; |
|
149 | } |
||
150 | |||
151 | /** |
||
152 | * Get a request token. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | 24 | public function getRequestToken() |
|
160 | } |
||
161 |