1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

card exp month and year empty string defaults

This commit is contained in:
Kyle Spearrin 2019-01-16 23:26:39 -05:00
parent 64f41f004d
commit 47bda7d789

View File

@ -26,8 +26,8 @@ export class PaymentComponent implements OnInit {
card: any = { card: any = {
number: null, number: null,
exp_month: null, exp_month: '',
exp_year: null, exp_year: '',
address_country: '', address_country: '',
address_zip: null, address_zip: null,
}; };
@ -59,7 +59,7 @@ export class PaymentComponent implements OnInit {
this.btScript.async = true; this.btScript.async = true;
this.cardExpMonthOptions = [ this.cardExpMonthOptions = [
{ name: '-- ' + i18nService.t('select') + ' --', value: null }, { name: '-- ' + i18nService.t('select') + ' --', value: '' },
{ name: '01 - ' + i18nService.t('january'), value: '01' }, { name: '01 - ' + i18nService.t('january'), value: '01' },
{ name: '02 - ' + i18nService.t('february'), value: '02' }, { name: '02 - ' + i18nService.t('february'), value: '02' },
{ name: '03 - ' + i18nService.t('march'), value: '03' }, { name: '03 - ' + i18nService.t('march'), value: '03' },
@ -75,7 +75,7 @@ export class PaymentComponent implements OnInit {
]; ];
this.cardExpYearOptions = [ this.cardExpYearOptions = [
{ name: '-- ' + i18nService.t('select') + ' --', value: null }, { name: '-- ' + i18nService.t('select') + ' --', value: '' },
]; ];
const year = (new Date()).getFullYear(); const year = (new Date()).getFullYear();
for (let i = year; i < (year + 15); i++) { for (let i = year; i < (year + 15); i++) {
@ -150,9 +150,10 @@ export class PaymentComponent implements OnInit {
reject(err.message); reject(err.message);
}); });
} else if (this.method === 'card' || this.method === 'bank') { } else if (this.method === 'card' || this.method === 'bank') {
const createObj: any = this.method === 'card' ? (window as any).Stripe.card : const isCard = this.method === 'card';
const createObj: any = isCard ? (window as any).Stripe.card :
(window as any).Stripe.bankAccount; (window as any).Stripe.bankAccount;
const sourceObj = this.method === 'card' ? this.card : this.bank; const sourceObj = isCard ? this.card : this.bank;
createObj.createToken(sourceObj, (status: number, response: any) => { createObj.createToken(sourceObj, (status: number, response: any) => {
if (status === 200 && response.id != null) { if (status === 200 && response.id != null) {
resolve(response.id); resolve(response.id);