-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathWalletOneButton.php
More file actions
78 lines (61 loc) · 1.87 KB
/
WalletOneButton.php
File metadata and controls
78 lines (61 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Created by PhpStorm.
* User: Bookin
* Date: 08.12.2015
* Time: 23:32
*/
namespace bookin\walletone;
use yii\base\Exception;
use yii\base\Widget;
class WalletOneButton extends Widget
{
use TWalletOne;
/**
* @var string
*/
public $label;
/**
* @var array
*/
public $buttonOptions = ['class'=>'btn btn-info'];
public $component = 'walletone';
public function init(){
parent::init();
try{
/** @var self $component */
$component = \Yii::$app->{$this->component};
if($component){
if(!$this->secretKey && $component->secretKey){
$this->secretKey = $component->secretKey;
}
if($component->walletOptions){
$this->walletOptions = self::array_merge_recursive_distinct($component->walletOptions, $this->walletOptions);
}
if($component->buttonLabel){
$this->label = $component->buttonLabel;
}
if($component->buttonOptions){
$this->buttonOptions = self::array_merge_recursive_distinct($component->buttonOptions, $this->buttonOptions);
}
if(!$this->signatureMethod && $component->signatureMethod){
$this->signatureMethod = $component->signatureMethod;
}
}
}catch (Exception $c){}
if(!$this->signatureMethod){
$this->signatureMethod = WalletOne::SIGNATURE_SHA1;
}
if(!$this->label){
$this->label = 'WalletOne Play';
}
}
public function run()
{
\Yii::$app->request->enableCsrfValidation = false;
$formData = $this->getFields();
return $this->render('form',[
'formData' => $formData
]);
}
}