/
texts.js
100 lines (77 loc) · 2.98 KB
/
texts.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*jslint node: true */
'use strict';
const desktopApp = require('ocore/desktop_app.js');
const conf = require('ocore/conf');
const moment = require('moment');
exports.invalidDate = () => {
return 'Invalid date entered';
};
exports.criticalWeather = () => {
return 'The insurance is denied due to critical weather.';
};
exports.flight = () => {
return `Please write the flight number and date in DD.MM.YYYY format.\n\nExample: BA950 ${moment().add(4, 'days').format("DD.MM.YYYY")}`;
};
exports.delay = () => {
let timeButtons = '';
conf.delayTime.forEach((value) => {
timeButtons += `[${value.text}](command:${value.minutes} minutes)\t`;
});
return `Choose the delay time. You'll be paid if the actual delay is larger or the flight is canceled.\n${timeButtons}`;
};
exports.compensation = () => {
return `How much do you want to receive in case of flight delay? (${conf.defaultAssetName})`;
};
exports.insertMyAddress = () => {
return 'To continue, send me your address (click ... and Insert my address).';
};
exports.edit = () => {
return `What would you like to change?
[Flight](command:flight)\t[Delay](command:delay)\t[Compensation](command:compensation)`;
};
exports.total = (flight, delay, compensation, price) => {
return `Flight: ${flight}\nDelay: ${delay} minutes\nCompensation: ${compensation} ${conf.defaultAssetName}\n-----------------------------\nPrice: ${price} ${conf.defaultAssetName}\n[Buy](command:${flight} ${delay} minutes ${compensation} buy)\t[Edit](command:edit)`;
};
exports.arrivedOnTime = () => {
return 'Congratulations, your flight arrived on time.';
};
exports.pleaseUnlock = () => {
return 'Your flight was delayed, please withdraw your funds from the insurance smart address.';
};
exports.weSentPayment = () =>{
return 'Your flight was delayed, we sent you your compensation.';
};
//errors
exports.errorInitSql = () => {
return 'please import insurance.sql file\n';
};
exports.errorEmail = () => {
return `please specify admin_email and from_email in your ${desktopApp.getAppDataDir()}/conf.json\n`;
};
exports.errorFlightstats = () => {
return `please specify flightstats.appId, flightstats.appKey and profitMargin\n`;
};
exports.errorMaxCompensation = () => {
return `Max compensation: ${conf.maxCompensation} ${conf.defaultAssetName}`;
};
exports.errorMinCompensation = () => {
return `Min compensation: ${conf.minCompensation} ${conf.defaultAssetName}`;
};
exports.errorValidAddress = () => {
return 'Please send a valid address';
};
exports.errorValidDate = () => {
return 'Please enter a valid date in the format DD.MM.YYYY';
};
exports.errorOfferContract = () => {
return 'An error occurred while creating the contract, please try again in 10 minutes.';
};
exports.errorNonInsurable = () => {
return 'Unfortunately we do not insure this flight.';
};
exports.errorMinDaysBeforeFlight = (days) => {
return "Minimum days before flight: " + days;
};
exports.errorMaxMonthsBeforeFlight = (months) => {
return "Maximum months before flight: " + months;
};