-
Notifications
You must be signed in to change notification settings - Fork 18
/
StripeHelper.php
42 lines (34 loc) · 938 Bytes
/
StripeHelper.php
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
<?php
/**
* @copyright Copyright Victor Demin, 2014
* @license https://github.com/ruskid/yii2-stripe/LICENSE
* @link https://github.com/ruskid/yii2-stripe#readme
*/
namespace ruskid\stripe;
use yii\base\Exception;
/**
* Yii Stripe helper class.
*
* @author Victor Demin <[email protected]>
*/
class StripeHelper {
/**
* If the value is boolean, then it must be in quotes.
* @param boolean|string $value
*/
public static function prepareBoolean(&$value) {
if (is_bool($value)) {
$value = $value ? 'true' : 'false';
}
}
/**
* Check Stripe's documentation. You should not use name tag for card inputs.
* @param array $options
* @throws Exception
*/
public static function secCheck($options) {
if (isset($options['name'])) {
throw new Exception("Do not use 'name' tag for number/cvc/month/year inputs.");
}
}
}