Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (33 sloc)
959 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Alexey Samoylov <alexey.samoylov@gmail.com> | |
*/ | |
namespace yiidreamteam\perfectmoney; | |
use yii\bootstrap\Widget; | |
use yii\web\View; | |
class RedirectForm extends Widget | |
{ | |
public $message = 'Now you will be redirected to the payment system.'; | |
public $api; | |
public $invoiceId; | |
public $amount; | |
public $description = ''; | |
public function init() | |
{ | |
parent::init(); | |
assert(isset($this->api)); | |
assert(isset($this->invoiceId)); | |
assert(isset($this->amount)); | |
} | |
public function run() | |
{ | |
$this->view->registerJs("$('#perfect-money-checkout-form').submit();", View::POS_READY); | |
return $this->render('redirect', [ | |
'message' => $this->message, | |
'api' => $this->api, | |
'invoiceId' => $this->invoiceId, | |
'amount' => number_format($this->amount, 2, '.', ''), | |
'description' => $this->description, | |
]); | |
} | |
} |