Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void sendSmsBySmsc(SMS smsDto, LoginPasswordInterface loginPassword) throws SmsSenderException {
- String phones= smsDto.getRecipients().stream().map(phone -> phone.replaceAll("[^0-9?!\\.]", "")).collect(Collectors.joining(","));
- Smsc sd= new Smsc(loginPassword.getLogin(), loginPassword.getPassword());
- String[] res = sd.send_sms(phones, smsDto.getMessageBody(), 0, "", "",0, smsDto.getSenderId(), "");
- /*
- * @return array (<id>, <количество sms>, <стоимость>, <баланс>) в случае успешной отправки
- * или массив (<id>, -<код ошибки>) в случае ошибки
- */
- if(res!=null){
- if(res.length == 2){
- log.error("sms send error. ID = "+res[0]+".Code = " + res[1]);
- throw new SmsSenderException("error Code: " + res[1]);
- } else if(res.length == 4){
- log.info("sms was sent. Id = "+res[0]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement