src/app/models/template.model.ts
Properties |
accountCategory |
accountCategory:
|
Type : string
|
accountNumber |
accountNumber:
|
Type : string
|
accountOwnerType |
accountOwnerType:
|
Type : AccountOwnerTypes
|
accountType |
accountType:
|
Type : AccountTypes
|
displayName |
displayName:
|
Type : string
|
fee |
fee:
|
Type : number
|
id |
id:
|
Type : string
|
isFrozen |
isFrozen:
|
Type : boolean
|
isMicroDepositVerificationPending |
isMicroDepositVerificationPending:
|
micrAccountNumber |
micrAccountNumber:
|
Type : string
|
name |
name:
|
Type : string
|
permissions |
permissions:
|
Type : Array<IPermission>
|
requireMfaOnPaymentCreation |
requireMfaOnPaymentCreation:
|
routingNumber |
routingNumber:
|
Type : string
|
import { AccountCategory } from '../enums/account-category.enum';
import { AccountOwnerTypes } from '../enums/account-owner-types.enum';
import { AccountTypes } from '../enums/account-types.enum';
import { Permission, IPermission } from './permission';
export interface ITemplate {
id: string;
name: string;
fee: number;
displayName: string;
accountNumber: string;
micrAccountNumber: string;
accountCategory: string;
routingNumber: string;
accountType: AccountTypes;
accountOwnerType: AccountOwnerTypes;
permissions: Array<IPermission>;
isFrozen: boolean;
isMicroDepositVerificationPending: false;
requireMfaOnPaymentCreation: false;
}
export class Template {
id: string;
name: string = '';
fee: number;
displayName: string = '';
accountNumber: string;
micrAccountNumber: string;
accountCategory: string;
routingNumber: string;
accountType = AccountTypes.Checking;
accountOwnerType = AccountOwnerTypes.Personal;
permissions = new Array<Permission>();
isFrozen = false;
selected = false;
isMicroDepositVerificationPending = false;
requireMfaOnPaymentCreation = false;
constructor(cfg?: ITemplate) {
if (!cfg) {
return;
}
this.id = cfg.id ? cfg.id : undefined;
this.isMicroDepositVerificationPending = cfg.isMicroDepositVerificationPending
? cfg.isMicroDepositVerificationPending
: false;
this.isFrozen = cfg.isFrozen ? cfg.isFrozen : false;
this.name = cfg.name ? cfg.name : '';
this.displayName = cfg.displayName ? cfg.displayName : '';
this.accountNumber = cfg.accountNumber ? cfg.accountNumber : undefined;
this.accountCategory = cfg.accountCategory
? cfg.accountCategory
: AccountCategory.CustomerEntered;
this.micrAccountNumber = cfg.micrAccountNumber ? cfg.micrAccountNumber : undefined;
this.routingNumber = cfg.routingNumber ? cfg.routingNumber : undefined;
this.accountType = cfg.accountType ? cfg.accountType : AccountTypes.Checking;
this.accountOwnerType = cfg.accountOwnerType
? cfg.accountOwnerType
: AccountOwnerTypes.Personal;
this.permissions = cfg.permissions
? cfg.permissions.map((p) => new Permission(p))
: new Array<Permission>();
this.requireMfaOnPaymentCreation = cfg.requireMfaOnPaymentCreation;
this.fee = cfg.fee;
}
get canCredit(): boolean {
return this.permissions.filter((p) => p.canCredit).length > 0;
}
get canDebit(): boolean {
return this.permissions.filter((p) => p.canDebit).length > 0;
}
get needsVerified(): boolean {
return this.isMicroDepositVerificationPending;
}
}