1 | <?php |
||
51 | class Module extends \yii\base\Module |
||
52 | { |
||
53 | /** |
||
54 | * The URL prefix that will be used as a key to save current URL in the session. |
||
55 | * |
||
56 | * @see rememberUrl() |
||
57 | * @see previousUrl() |
||
58 | * @see \yii\helpers\BaseUrl::remember() |
||
59 | * @see \yii\helpers\BaseUrl::previous() |
||
60 | */ |
||
61 | const URL_PREFIX = 'merchant_url_'; |
||
62 | |||
63 | /** |
||
64 | * @var string merchant collection class name. Defaults to [[Collection]] |
||
65 | */ |
||
66 | public $purchaseRequestCollectionClass = Collection::class; |
||
67 | /** |
||
68 | * @var string currencies collection class name. Defaults to [[Collection]] |
||
69 | */ |
||
70 | public $currenciesCollectionClass; |
||
71 | /** |
||
72 | * @var string Deposit model class name. Defaults to [[DepositForm]] |
||
73 | */ |
||
74 | public $depositFromClass = DepositForm::class; |
||
75 | /** |
||
76 | * @var TransactionRepositoryInterface |
||
77 | */ |
||
78 | protected $transactionRepository; |
||
79 | |||
80 | public function __construct($id, $parent = null, TransactionRepositoryInterface $transactionRepository, array $config = []) |
||
86 | |||
87 | public function setCollection(array $collection) |
||
91 | |||
92 | /** |
||
93 | * @param DepositRequest $depositRequest |
||
94 | * @return Collection |
||
95 | * @throws InvalidConfigException |
||
96 | */ |
||
97 | public function getPurchaseRequestCollection($depositRequest = null) |
||
105 | |||
106 | /** |
||
107 | * @return Currencies |
||
108 | * @throws InvalidConfigException |
||
109 | */ |
||
110 | public function getAvailableCurrenciesCollection(): Currencies |
||
117 | |||
118 | /** |
||
119 | * @param string $merchant_name merchant id |
||
120 | * @param DepositRequest $depositRequest |
||
121 | * @return PurchaseRequest merchant instance |
||
122 | */ |
||
123 | public function getPurchaseRequest($merchant_name, DepositRequest $depositRequest) |
||
127 | |||
128 | /** |
||
129 | * Checks if merchant exists in the hub. |
||
130 | * |
||
131 | * @param string $id merchant id |
||
132 | * @return bool whether merchant exist |
||
133 | */ |
||
134 | public function hasPurchaseRequest($id) |
||
138 | |||
139 | /** |
||
140 | * Method builds data for merchant request. |
||
141 | * |
||
142 | * @param DepositRequest $depositRequest |
||
143 | * @return array |
||
144 | */ |
||
145 | public function prepareRequestData($depositRequest) |
||
153 | |||
154 | /** |
||
155 | * @var string client login |
||
156 | */ |
||
157 | protected $_username; |
||
158 | |||
159 | /** |
||
160 | * Sets [[_username]]. |
||
161 | * |
||
162 | * @param $username |
||
163 | */ |
||
164 | public function setUsername($username) |
||
168 | |||
169 | /** |
||
170 | * Gets [[_username]] when defined, otherwise - `Yii::$app->user->identity->username`, |
||
171 | * otherwise `Yii::$app->user->identity->getId()`. |
||
172 | * @throws InvalidConfigException |
||
173 | * @return string |
||
174 | */ |
||
175 | public function getUsername() |
||
190 | |||
191 | /** |
||
192 | * @var string|array the URL that will be used for payment system notifications. Will be passed through [[Url::to()]] |
||
193 | */ |
||
194 | public $notifyPage = 'notify'; |
||
195 | /** |
||
196 | * @var string|array the URL that will be used to redirect client from the merchant after the success payment. |
||
197 | * Will be passed through [[Url::to()]] |
||
198 | */ |
||
199 | public $returnPage = 'return'; |
||
200 | /** |
||
201 | * @var string|array the URL that will be used to redirect client from the merchant after the failed payment. |
||
202 | * Will be passed through [[Url::to()]] |
||
203 | */ |
||
204 | public $cancelPage = 'cancel'; |
||
205 | /** |
||
206 | * @var string|array the URL that might be used to redirect used from the success or error page to the finish page. |
||
207 | * Will be passed through [[Url::to()]] |
||
208 | */ |
||
209 | public $finishPage = 'finish'; |
||
210 | |||
211 | /** |
||
212 | * Builds URLs that will be passed in the request to the merchant. |
||
213 | * |
||
214 | * @param string $destination `notify`, `return`, `cancel` |
||
215 | * @param DepositRequest $depositRequest |
||
216 | * @return string URL |
||
217 | */ |
||
218 | public function buildUrl($destination, DepositRequest $depositRequest) |
||
235 | |||
236 | /** |
||
237 | * Builds url to `this_module/pay/$page` if page is not /full/page. |
||
238 | * @param mixed $page |
||
239 | * @return mixed |
||
240 | */ |
||
241 | public function localizePage($page) |
||
245 | |||
246 | public function getPage($destination, DepositRequest $depositRequest) |
||
257 | |||
258 | /** |
||
259 | * Saves the $url to session with [[URL_PREFIX]] key, trailed with $name. |
||
260 | * |
||
261 | * @param array|string $url |
||
262 | * @param string $name the trailing part for the URL save key. Defaults to `back` |
||
263 | * @void |
||
264 | */ |
||
265 | public function rememberUrl($url, $name = 'back') |
||
269 | |||
270 | /** |
||
271 | * Extracts the URL from session storage, saved with [[URL_PREFIX]] key, trailed with $name. |
||
272 | * |
||
273 | * @param string $name the trailing part for the URL save key. Defaults to `back` |
||
274 | * @return string |
||
275 | */ |
||
276 | public function previousUrl($name = 'back') |
||
280 | |||
281 | /** |
||
282 | * @var PayController The Payment controller |
||
283 | */ |
||
284 | protected $_payController; |
||
285 | |||
286 | /** |
||
287 | * @throws InvalidConfigException |
||
288 | * |
||
289 | * @return PayController |
||
290 | */ |
||
291 | public function getPayController() |
||
299 | |||
300 | /** |
||
301 | * Renders page, that contains list of payment systems, that might be choosen by user. |
||
302 | * Should be implemented in `PayController`. |
||
303 | * |
||
304 | * @param DepositForm $form |
||
305 | * @return \yii\web\Response |
||
306 | */ |
||
307 | public function renderDeposit($form) |
||
311 | |||
312 | /** |
||
313 | * @param Transaction $transaction |
||
314 | * @return Transaction |
||
315 | */ |
||
316 | public function saveTransaction($transaction) |
||
320 | |||
321 | public function insertTransaction($id, $merchant, $data) |
||
327 | |||
328 | /** |
||
329 | * @param string $id transaction ID |
||
330 | * @return Transaction|null |
||
331 | */ |
||
332 | public function findTransaction($id) |
||
340 | } |
||
341 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.