1 | <?php |
||
58 | class Module extends \yii\base\Module |
||
59 | { |
||
60 | /** |
||
61 | * The URL prefix that will be used as a key to save current URL in the session. |
||
62 | * |
||
63 | * @see rememberUrl() |
||
64 | * @see previousUrl() |
||
65 | * @see \yii\helpers\BaseUrl::remember() |
||
66 | * @see \yii\helpers\BaseUrl::previous() |
||
67 | */ |
||
68 | const URL_PREFIX = 'merchant_url_'; |
||
69 | |||
70 | /** |
||
71 | * @var string merchant collection class name. Defaults to [[Collection]] |
||
72 | */ |
||
73 | public $purchaseRequestCollectionClass = Collection::class; |
||
74 | |||
75 | /** |
||
76 | * @var string Deposit model class name. Defaults to [[DepositForm]] |
||
77 | */ |
||
78 | public $depositFromClass = DepositForm::class; |
||
79 | /** |
||
80 | * @var TransactionRepositoryInterface |
||
81 | */ |
||
82 | protected $transactionRepository; |
||
83 | |||
84 | public function __construct($id, $parent = null, TransactionRepositoryInterface $transactionRepository, array $config = []) |
||
85 | { |
||
86 | parent::__construct($id, $parent, $config); |
||
87 | |||
88 | $this->transactionRepository = $transactionRepository; |
||
89 | } |
||
90 | |||
91 | public function setCollection(array $collection) |
||
95 | |||
96 | /** |
||
97 | * @param DepositRequest $depositRequest |
||
98 | * @return PurchaseRequest[] list of merchants |
||
99 | */ |
||
100 | public function getPurchaseRequestCollection($depositRequest = null) |
||
108 | |||
109 | /** |
||
110 | * @param string $merchant_name merchant id |
||
111 | * @param DepositRequest $depositRequest |
||
112 | * @return PurchaseRequest merchant instance |
||
113 | */ |
||
114 | public function getPurchaseRequest($merchant_name, DepositRequest $depositRequest) |
||
118 | |||
119 | /** |
||
120 | * Checks if merchant exists in the hub. |
||
121 | * |
||
122 | * @param string $id merchant id |
||
123 | * @return bool whether merchant exist |
||
124 | */ |
||
125 | public function hasPurchaseRequest($id) |
||
129 | |||
130 | /** |
||
131 | * Method builds data for merchant request. |
||
132 | * |
||
133 | * @param DepositRequest $depositRequest |
||
134 | * @return array |
||
135 | */ |
||
136 | public function prepareRequestData($depositRequest) |
||
144 | |||
145 | /** |
||
146 | * @var string client login |
||
147 | */ |
||
148 | protected $_username; |
||
149 | |||
150 | /** |
||
151 | * Sets [[_username]]. |
||
152 | * |
||
153 | * @param $username |
||
154 | */ |
||
155 | public function setUsername($username) |
||
159 | |||
160 | /** |
||
161 | * Gets [[_username]] when defined, otherwise - `Yii::$app->user->identity->username`, |
||
162 | * otherwise `Yii::$app->user->identity->getId()`. |
||
163 | * @throws InvalidConfigException |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getUsername() |
||
181 | |||
182 | /** |
||
183 | * @var string|array the URL that will be used for payment system notifications. Will be passed through [[Url::to()]] |
||
184 | */ |
||
185 | public $notifyPage = 'notify'; |
||
186 | /** |
||
187 | * @var string|array the URL that will be used to redirect client from the merchant after the success payment. |
||
188 | * Will be passed through [[Url::to()]] |
||
189 | */ |
||
190 | public $returnPage = 'return'; |
||
191 | /** |
||
192 | * @var string|array the URL that will be used to redirect client from the merchant after the failed payment. |
||
193 | * Will be passed through [[Url::to()]] |
||
194 | */ |
||
195 | public $cancelPage = 'cancel'; |
||
196 | /** |
||
197 | * @var string|array the URL that might be used to redirect used from the success or error page to the finish page. |
||
198 | * Will be passed through [[Url::to()]] |
||
199 | */ |
||
200 | public $finishPage = 'finish'; |
||
201 | |||
202 | /** |
||
203 | * Builds URLs that will be passed in the request to the merchant. |
||
204 | * |
||
205 | * @param string $destination `notify`, `return`, `cancel` |
||
206 | * @param DepositRequest $depositRequest |
||
207 | * @return string URL |
||
208 | */ |
||
209 | public function buildUrl($destination, DepositRequest $depositRequest) |
||
226 | |||
227 | /** |
||
228 | * Builds url to `this_module/pay/$page` if page is not /full/page. |
||
229 | * @param mixed $page |
||
230 | * @return mixed |
||
231 | */ |
||
232 | public function localizePage($page) |
||
236 | |||
237 | public function getPage($destination, DepositRequest $depositRequest) |
||
248 | |||
249 | /** |
||
250 | * Saves the $url to session with [[URL_PREFIX]] key, trailed with $name. |
||
251 | * |
||
252 | * @param array|string $url |
||
253 | * @param string $name the trailing part for the URL save key. Defaults to `back` |
||
254 | * @void |
||
255 | */ |
||
256 | public function rememberUrl($url, $name = 'back') |
||
260 | |||
261 | /** |
||
262 | * Extracts the URL from session storage, saved with [[URL_PREFIX]] key, trailed with $name. |
||
263 | * |
||
264 | * @param string $name the trailing part for the URL save key. Defaults to `back` |
||
265 | * @return string |
||
266 | */ |
||
267 | public function previousUrl($name = 'back') |
||
271 | |||
272 | /** |
||
273 | * @var PayController The Payment controller |
||
274 | */ |
||
275 | protected $_payController; |
||
276 | |||
277 | /** |
||
278 | * @throws InvalidConfigException |
||
279 | * |
||
280 | * @return PayController |
||
281 | */ |
||
282 | public function getPayController() |
||
290 | |||
291 | /** |
||
292 | * Renders page, that contains list of payment systems, that might be choosen by user. |
||
293 | * Should be implemented in `PayController`. |
||
294 | * |
||
295 | * @param DepositForm $form |
||
296 | * @return \yii\web\Response |
||
297 | */ |
||
298 | public function renderDeposit($form) |
||
302 | |||
303 | /** |
||
304 | * @param Transaction $transaction |
||
305 | * @return Transaction |
||
306 | */ |
||
307 | public function saveTransaction($transaction) |
||
311 | |||
312 | public function insertTransaction($id, $merchant, $data) |
||
318 | |||
319 | /** |
||
320 | * @param string $id transaction ID |
||
321 | * @return Transaction|null |
||
322 | */ |
||
323 | public function findTransaction($id) |
||
331 | } |
||
332 |
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.