File

src/app/models/template.model.ts

Index

Properties
Accessors

Constructor

constructor(cfg?: ITemplate)
Parameters :
Name Type Optional
cfg ITemplate Yes

Properties

accountCategory
Type : string
accountNumber
Type : string
accountOwnerType
Default value : AccountOwnerTypes.Personal
accountType
Default value : AccountTypes.Checking
displayName
Type : string
Default value : ''
fee
Type : number
id
Type : string
isFrozen
Default value : false
isMicroDepositVerificationPending
Default value : false
micrAccountNumber
Type : string
name
Type : string
Default value : ''
permissions
Default value : new Array<Permission>()
requireMfaOnPaymentCreation
Default value : false
routingNumber
Type : string
selected
Default value : false

Accessors

canCredit
getcanCredit()
canDebit
getcanDebit()
needsVerified
getneedsVerified()
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;
  }
}

results matching ""

    No results matching ""