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 | 3 | */ |
|
78 | public $depositFromClass = DepositForm::class; |
||
79 | 3 | /** |
|
80 | * @var TransactionRepositoryInterface |
||
81 | */ |
||
82 | protected $transactionRepository; |
||
83 | |||
84 | 3 | public function __construct($id, $parent = null, TransactionRepositoryInterface $transactionRepository, array $config = []) |
|
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 | 3 | protected $_username; |
|
149 | |||
150 | 3 | /** |
|
151 | 3 | * 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) |
||
243 | |||
244 | /** |
||
245 | * Saves the $url to session with [[URL_PREFIX]] key, trailed with $name. |
||
246 | * |
||
247 | * @param array|string $url |
||
248 | * @param string $name the trailing part for the URL save key. Defaults to `back` |
||
249 | * @void |
||
250 | */ |
||
251 | public function rememberUrl($url, $name = 'back') |
||
255 | |||
256 | /** |
||
257 | * Extracts the URL from session storage, saved with [[URL_PREFIX]] key, trailed with $name. |
||
258 | * |
||
259 | * @param string $name the trailing part for the URL save key. Defaults to `back` |
||
260 | * @return string |
||
261 | */ |
||
262 | public function previousUrl($name = 'back') |
||
266 | |||
267 | /** |
||
268 | * @var PayController The Payment controller |
||
269 | */ |
||
270 | protected $_payController; |
||
271 | |||
272 | /** |
||
273 | * @throws InvalidConfigException |
||
274 | * |
||
275 | * @return PayController |
||
276 | */ |
||
277 | public function getPayController() |
||
285 | |||
286 | /** |
||
287 | * Renders page, that contains list of payment systems, that might be choosen by user. |
||
288 | * Should be implemented in `PayController`. |
||
289 | * |
||
290 | * @param DepositForm $form |
||
291 | * @return \yii\web\Response |
||
292 | */ |
||
293 | public function renderDeposit($form) |
||
297 | |||
298 | /** |
||
299 | * @param Transaction $transaction |
||
300 | * @return Transaction |
||
301 | */ |
||
302 | public function saveTransaction($transaction) |
||
306 | |||
307 | public function insertTransaction($id, $merchant, $data) |
||
313 | |||
314 | /** |
||
315 | * @param string $id transaction ID |
||
316 | * @return Transaction|null |
||
317 | */ |
||
318 | public function findTransaction($id) |
||
326 | } |
||
327 |
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.