@andrey4emk/npm-app-back-b24 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sendMessage/smsgold.js +9 -1
package/package.json
CHANGED
package/sendMessage/smsgold.js
CHANGED
|
@@ -9,7 +9,15 @@ class Smsgold {
|
|
|
9
9
|
this.pass = process.env.SMSGOLD_PASS;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
async sendSms(
|
|
12
|
+
async sendSms(messageData) {
|
|
13
|
+
const { phone, message } = messageData;
|
|
14
|
+
// Проверяем наличие необходимых данных
|
|
15
|
+
if (!this.user || !this.pass) {
|
|
16
|
+
return { error: true, message: "Отсутствуют учетные данные SMSGold", result: null };
|
|
17
|
+
}
|
|
18
|
+
if (!phone || !message) {
|
|
19
|
+
return { error: true, message: "Отсутствуют номер телефона или текст сообщения", result: null };
|
|
20
|
+
}
|
|
13
21
|
try {
|
|
14
22
|
let body = new URLSearchParams({
|
|
15
23
|
user: this.user,
|