Skip to content

Commit

Permalink
Update StripeForm.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ruskid committed Mar 21, 2016
1 parent f361e5d commit fb7fde4
Showing 1 changed file with 51 additions and 49 deletions.
100 changes: 51 additions & 49 deletions StripeForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,16 @@ public function registerJqueryPaymentScripts() {
* @return string genetared input tag
*/
public function numberInput($options = []) {
$mergedOptions = array_merge($options, [
'id' => self::NUMBER_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_CC_ATTR,
'placeholder' => '•••• •••• •••• ••••',
'required' => true,
'type' => 'tel',
'size' => 20
]);

$defaultOptions = [
'id' => self::NUMBER_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_CC_ATTR,
'placeholder' => '•••• •••• •••• ••••',
'required' => true,
'type' => 'tel',
'size' => 20
];
$mergedOptions = array_merge($defaultOptions, $options);
StripeHelper::secCheck($mergedOptions);
$mergedOptions['data-stripe'] = self::NUMBER_ID;
return Html::input('text', null, null, $mergedOptions);
Expand All @@ -266,15 +266,16 @@ public function numberInput($options = []) {
* @return string genetared input tag
*/
public function cvcInput($options = []) {
$mergedOptions = array_merge($options, [
'id' => self::CVC_ID,
'class' => 'form-control',
'autocomplete' => 'off',
'placeholder' => '•••',
'required' => true,
'type' => 'tel',
'size' => 4
]);
$defaultOptions = [
'id' => self::CVC_ID,
'class' => 'form-control',
'autocomplete' => 'off',
'placeholder' => '•••',
'required' => true,
'type' => 'tel',
'size' => 4
];
$mergedOptions = array_merge($defaultOptions, $options);
StripeHelper::secCheck($mergedOptions);
$mergedOptions['data-stripe'] = self::CVC_ID;
return Html::input('text', null, null, $mergedOptions);
Expand All @@ -286,16 +287,17 @@ public function cvcInput($options = []) {
* @return string genetared input tag
*/
public function yearInput($options = []) {
$mergedOptions = array_merge($options, [
'id' => self::YEAR_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_YEAR_ATTR,
'placeholder' => '••••',
'required' => true,
'type' => 'tel',
'maxlength' => 4,
'size' => 4
]);
$defaultOptions = [
'id' => self::YEAR_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_YEAR_ATTR,
'placeholder' => '••••',
'required' => true,
'type' => 'tel',
'maxlength' => 4,
'size' => 4
];
$mergedOptions = array_merge($defaultOptions, $options);
StripeHelper::secCheck($mergedOptions);
$mergedOptions['data-stripe'] = self::YEAR_ID;
return Html::input('text', null, null, $mergedOptions);
Expand All @@ -307,17 +309,17 @@ public function yearInput($options = []) {
* @return string genetared input tag
*/
public function monthInput($options = []) {
$mergedOptions = array_merge($options, [
'id' => self::MONTH_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_MONTH_ATTR,
'placeholder' => '••',
'required' => true,
'type' => 'tel',
'maxlength' => 2,
'size' => 2
]);

$defaultOptions = [
'id' => self::MONTH_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_MONTH_ATTR,
'placeholder' => '••',
'required' => true,
'type' => 'tel',
'maxlength' => 2,
'size' => 2
];
$mergedOptions = array_merge($defaultOptions, $options);
StripeHelper::secCheck($mergedOptions);
$mergedOptions['data-stripe'] = self::MONTH_ID;
return Html::input('text', null, null, $mergedOptions);
Expand All @@ -329,15 +331,15 @@ public function monthInput($options = []) {
* @return string genetared input tag
*/
public function monthAndYearInput($options = []) {
$mergedOptions = array_merge($options, [
'id' => self::MONTH_YEAR_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_EXP_ATTR,
'placeholder' => '•• / ••',
'required' => true,
'type' => 'tel',
]);

$defaultOptions = [
'id' => self::MONTH_YEAR_ID,
'class' => 'form-control',
'autocomplete' => self::AUTO_EXP_ATTR,
'placeholder' => '•• / ••',
'required' => true,
'type' => 'tel',
];
$mergedOptions = array_merge($defaultOptions, $options);
StripeHelper::secCheck($mergedOptions);
$mergedOptions['data-stripe'] = self::MONTH_YEAR_ID;
$inputs = Html::input('text', null, null, $mergedOptions);
Expand Down

0 comments on commit fb7fde4

Please sign in to comment.