public PaymentResult SendSmsPaymentToNumber(int orderId, string phoneNumber) { ISmsPaymentService service = SmsPaymentServiceSetting.GetSmsmPaymentServite(); if (service == null) { return(new PaymentResult { ErrorDescription = "Сервис отправки Sms не работает, обратитесь в РПО." }); } string realPhoneNumber = "8" + PhoneUtils.RemoveNonDigit(phoneNumber); return(service.SendPayment(orderId, realPhoneNumber)); }
public PaymentInfoDTO CreateOrderPayment(string authKey, int orderId, string phoneNumber) { ISmsPaymentService smsPaymentService = smsPaymentChannelFactory.CreateChannel(); if (smsPaymentService == null) { logger.Warn($"Невозможно создать платеж для заказа {orderId}. {nameof(smsPaymentService)} is null"); return(new PaymentInfoDTO(orderId, PaymentStatus.None)); } PaymentResult paymentResult = smsPaymentService.SendPayment(orderId, phoneNumber); if (paymentResult == null || paymentResult.Status == PaymentResult.MessageStatus.Error) { return(new PaymentInfoDTO(orderId, PaymentStatus.None)); } if (paymentResult.PaymentStatus == null) { return(new PaymentInfoDTO(orderId, PaymentStatus.None)); } else { switch (paymentResult.PaymentStatus.Value) { case SmsPaymentStatus.WaitingForPayment: return(new PaymentInfoDTO(orderId, PaymentStatus.WaitingForPayment)); case SmsPaymentStatus.Paid: return(new PaymentInfoDTO(orderId, PaymentStatus.Paid)); case SmsPaymentStatus.Cancelled: return(new PaymentInfoDTO(orderId, PaymentStatus.Cancelled)); default: return(new PaymentInfoDTO(orderId, PaymentStatus.None)); } } }