mirror of
https://github.com/bitwarden/jslib
synced 2025-12-23 03:33:29 +00:00
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { CardView } from '../view/cardView';
|
|
|
|
export class Card {
|
|
static template(): Card {
|
|
const req = new Card();
|
|
req.cardholderName = 'John Doe';
|
|
req.brand = 'visa';
|
|
req.number = '4242424242424242';
|
|
req.expMonth = '04';
|
|
req.expYear = '2023';
|
|
req.code = '123';
|
|
return req;
|
|
}
|
|
|
|
static toView(req: Card, view = new CardView()) {
|
|
view.cardholderName = req.cardholderName;
|
|
view.brand = req.brand;
|
|
view.number = req.number;
|
|
view.expMonth = req.expMonth;
|
|
view.expYear = req.expYear;
|
|
view.code = req.code;
|
|
return view;
|
|
}
|
|
|
|
cardholderName: string;
|
|
brand: string;
|
|
number: string;
|
|
expMonth: string;
|
|
expYear: string;
|
|
code: string;
|
|
|
|
constructor(o?: CardView) {
|
|
if (o == null) {
|
|
return;
|
|
}
|
|
|
|
this.cardholderName = o.cardholderName;
|
|
this.brand = o.brand;
|
|
this.number = o.number;
|
|
this.expMonth = o.expMonth;
|
|
this.expYear = o.expYear;
|
|
this.code = o.code;
|
|
}
|
|
}
|