bitwarden-estensione-browser/src/models/view/cardView.ts

52 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-01-24 17:33:15 +01:00
import { View } from './view';
import { Card } from '../domain/card';
export class CardView implements View {
cardholderName: string;
expMonth: string;
expYear: string;
code: string;
2018-01-24 22:58:34 +01:00
// tslint:disable
private _brand: string;
private _number: string;
private _subTitle: string;
// tslint:enable
2018-01-24 17:33:15 +01:00
constructor(c?: Card) {
// ctor
}
2018-01-24 22:58:34 +01:00
get brand(): string {
return this._brand;
}
set brand(value: string) {
this._brand = value;
this._subTitle = null;
}
get number(): string {
return this._number;
}
set number(value: string) {
this._number = value;
this._subTitle = null;
}
get subTitle(): string {
if (this._subTitle == null) {
this._subTitle = this.brand;
if (this.number != null && this.number.length >= 4) {
if (this._subTitle != null && this._subTitle !== '') {
this._subTitle += ', ';
} else {
this._subTitle = '';
}
this._subTitle += ('*' + this.number.substr(this.number.length - 4));
}
}
return this._subTitle;
}
2018-01-24 17:33:15 +01:00
}