-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.js
58 lines (47 loc) · 1.02 KB
/
model.js
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
const BalanceResponse = class {
constructor(response) {
this._amount = response.amount;
this._currency = response.type;
}
get amount() {
return this._amount;
}
get currency() {
return this._currency;
}
}
const SMSResponse = class {
constructor(response, message) {
this._message = message;
this._balance = response.remaining_balance;
this._total = response.total_sms;
this._sended_number_list = response.phone_number_list;
this._failed_number_list = response.bad_phone_number_list;
}
get total_price() {
let totalPrice = 0;
for (const number of this._sended_number_list) {
totalPrice += number.price;
}
return totalPrice;
}
get message() {
return this._message;
}
get balance() {
return this._balance;
}
get total() {
return this._total;
}
get sended_number_list() {
return this._sended_number_list;
}
get failed_number_list() {
return this._failed_number_list;
}
}
module.exports = {
BalanceResponse,
SMSResponse
}