All files / src/models method.js

100% Statements 5/5
100% Branches 8/8
100% Functions 3/3
100% Lines 5/5
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58                                            12x   12x                   12x               2x                   2x          
import Model from 'model';
 
/**
 * The `Method` model
 */
export default class Method extends Model {
  static IDEAL = 'ideal';
  static CREDITCARD = 'creditcard';
  static BANCONTACT = 'bancontact';
  static SOFORT = 'sofort';
  static BANKTRANSFER = 'banktransfer';
  static DIRECTDEBIT = 'directdebit';
  static BITCOIN = 'bitcoin';
  static PAYPAL = 'paypal';
  static BELFIUS = 'belfius';
  static PAYSAFECARD = 'paysafecard';
  static PODIUMCADEAUKAART = 'podiumcadeaukaart';
  static KBC = 'kbc';
  static GIFTCARD = 'giftcard';
  static INGHOMEPAY = 'inghomepay';
 
  constructor(props) {
    super(props);
 
    const defaults = {
      resource: 'method',
      id: null,
      description: null,
      image: {
        size1x: null,
        size2x: null,
      },
    };
 
    Object.assign(this, defaults, props);
  }
 
  /**
   * Get minimum amount of payment method
   * @returns {Number}
   */
  getMinimumAmount() {
    return parseFloat(
      this.amount && this.amount.minimum ? this.amount.minimum : '0',
    );
  }
 
  /**
   * Get maximum amount of payment method
   * @returns {Number}
   */
  getMaximumAmount() {
    return parseFloat(
      this.amount && this.amount.maximum ? this.amount.maximum : '0',
    );
  }
}