public void UpdateSMSLog_Input_smsStatus_smsContent() { long logId = 11; SMSChargeStatus chargeStatus = SMSChargeStatus.Sent; string content = "sms message"; SMSDirection smsDirection = SMSDirection.Receive; SMSChannelLog smsChannelLog = new SMSChannelLog { ID = 11, ChargeStatus = SMSChargeStatus.Initial }; MockDbContext.Setup(s => s.Single <SMSChannelLog>(It.IsAny <Expression <Func <IMSIInfo, bool> > >())).Returns(smsChannelLog); MockDbContext.Setup(s => s.Update <SMSChannelLog>(It.IsAny <SMSChannelLog>())).Returns(1); MockDbContext.Setup(s => s.Add <SMSLog>(It.IsAny <SMSLog>())).Returns(1); this.SMSService.UpdateSMSLog(logId, chargeStatus, content, smsDirection, false, "", "", "", ""); }
public ActionResult SMSLog(long logId, SMSChargeStatus chargeStatus, string content, SMSDirection smsDirection, bool?isSent, string targetPhoneNo, string orderNo, string outOrderNo, string partenerNo) { if (logId != 0) { this.SMSService.UpdateSMSLog(logId, chargeStatus, content, smsDirection, isSent.GetValueOrDefault(), targetPhoneNo, orderNo, outOrderNo, partenerNo); return(Content("success")); } return(Content("error")); }
public void UpdateSMSLog(long logId, SMSChargeStatus chargeStatus, string content, SMSDirection smsDirection, bool isSent, string targetPhoneNo, string orderNo, string outOrderNo, string partenerNo) { if (chargeStatus != SMSChargeStatus.NotChange) { var smsChannelLog = this.Single <SMSChannelLog>(s => s.ID == logId); if (smsChannelLog != null) { smsChannelLog.ChargeStatus = chargeStatus; this.Update <SMSChannelLog>(smsChannelLog, false); } } if (chargeStatus == SMSChargeStatus.Sent && !string.IsNullOrEmpty(orderNo)) { var order = this.Single <Order>(s => s.OrderNo == orderNo); if (order != null) { order.CardPaymentRequestStatus = CardPaymentRequestStatus.Success; order.OrderStatus = OrderStatus.Processing; order.OutOrderNo = outOrderNo; order.PartenerNo = partenerNo; this.Update <Order>(order, false); SMSCallbackLogic(order); } } if (chargeStatus == SMSChargeStatus.Success && !string.IsNullOrEmpty(orderNo)) { var order = this.Single <Order>(s => s.OrderNo == orderNo); if (order != null) { order.OrderStatus = OrderStatus.Successed; this.Update <Order>(order, false); SMSCallbackLogic(order); } } if (!string.IsNullOrEmpty(content) && logId != 0) { var smsLog = new SMSLog() { ChannelLogId = logId, Content = content, Direction = smsDirection, IsSent = isSent, TargetPhoneNo = targetPhoneNo, }; this.Add <SMSLog>(smsLog); } }