/// <summary> /// Формирует ответ клиенту на основании ответа полученного от Мобикома /// </summary> /// <param name="response">Полученный от Мобикома ответ</param> /// <param name="payment">Платеж, состояние которого запрашивает клиент</param> /// <returns></returns> private Resp CreateNLogStateResponse(UniplatServiceData.Payment payment, MobicomStatusResponse response) { var paymentId = payment.Id.ToString(); MobicomMessage initialResponse = LogMobicomStatusResponse(response); Func <int, string, Resp> createAndSaveDebitStateResp = (i, com) => CreateAndSaveResp(paymentId, i, com, "GetDebitState", initialResponse); string name = "InProcess"; int code = 0; // Если ошибка в запросе if (response.Result.code.HasValue && response.Result.code.Value != 0) { name = "ProtocolError"; code = response.Result.code.Value; payment.StatusDescription = response.Result.comment; } // Если ошибка при инициации платежа else if (response.Start.Result.code.HasValue && response.Start.Result.code.Value != 0) { name = null; code = response.Start.Result.code.Value; payment.StatusDescription = response.Start.Result.comment; } // Если установлен статус платежа else if (response.Payment.result.HasValue) { name = null; code = response.Payment.result.Value; } var status = GetOrCreateStatus(name, code, response.Client.Phone.provider); payment.Status = status; payment.StatusTime = DateTime.Now; return(createAndSaveDebitStateResp(status.PartnerCode, status.PartnerDescription)); }
private void NotifyPartner(UniplatServiceData.Payment payment) { }