JSFiddle - React, Tailwind, and code Playground
by milosdakic
JavaScript
var Provider = new Class({
Implements: Options,
options: {
name: '',
plans: [],
country: null,
banks: []
},
initialize: function(info,plans) {
this.setOptions(info);
this.setPlans(plans);
},
setName: function(name) {
this.options.name = name;
},
getName: function() {
return this.options.name;
},
getCountry: function() {
return this.options.country;
},
setCountry: function(country) {
this.options.country = country;
},
getBanks: function() {
return this.options.banks;
},
setBanks: function(banks) {
this.options.banks = banks;
},
hasPlans: function() {
return this.options.plans.length > 0 ? true : false;
},
countPlans: function() {
return this.options.plans.length;
},
getPlans: function() {
return this.options.plans;
},
setPlans: function(plans) {
this.options.plans = banks;
}
});
var Plan = new Class({
Implements: Options,
options: {
title: '',
transactions: 0,
cost: 0,
monthly: 0,
yearly: 0
},
initialize: function(info) {
this.setOptions(info);
if (this.options.yearly && !this.options.monthly) {
this.options.monthly = (this.options.yearly/12).round(2);
} else if (this.options.monthly && !this.options.yrealy) {
this.options.yearly = (this.options.monthly*12).round(2);
}
},
getTitle: function() {
return this.options.title;
},
getTransactions: function() {
return this.options.transactions;
},
getMonthly: function() {
return this.options.monthly;
},
getYearly: function() {
return this.options.yearly;
},
getCost: function() {
return this.options.cost;
}
});
var plans = [new Plan({title:'Basic'})];
var provider = new Provider({name: 'eWay'},plans);