All files / src/models mandate.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                    8x   8x                           8x               2x      
import Model from 'model';
 
/**
 * The `Mandate` model
 */
export default class Mandate extends Model {
  static STATUS_VALID = 'valid';
  static STATUS_INVALID = 'invalid';
 
  constructor(props) {
    super(props);
 
    const defaults = {
      resource: 'mandate',
      id: null,
      status: null,
      method: null,
      details: null,
      mandateReference: null,
      signatureDate: null,
      createdAt: null,
      _links: {
        customer: null,
      },
    };
 
    Object.assign(this, defaults, props);
  }
 
  /**
   * If the mandate is valid
   * @returns {boolean}
   */
  isValid() {
    return this.status === Mandate.STATUS_VALID;
  }
}