public async void SendPaymentConfirmationSms(PaymentData pd, ImisPayment payment) { // Language lang = payment.Language.ToLower() == "en" || payment.Language.ToLower() == "english" || payment.Language.ToLower() == "primary" ? Language.Primary : Language.Secondary; ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, payment.Language); List <SmsContainer> message = new List <SmsContainer>(); var txtmsg = string.Format( sms.GetMessage("PaymentConfirmationSMS"), // template payment.Location, // Product location pd.control_number, // invoice number pd.received_amount, // amount paid pd.receipt_identification, // receipt number DateTime.Parse(pd.payment_date).ToString(), // payment date pd.transaction_identification // transaction number ); message.Add(new SmsContainer() { Message = txtmsg, Recipient = pd.payer_phone_number }); var fileName = "PaymentConfirmationSms_" + pd.payer_phone_number; string test = await sms.SendSMS(message, fileName); payment.UpdateLastSMSSentDateAsync(); }
public async void SendMatchSms(List <MatchSms> Ids) { List <SmsContainer> message = new List <SmsContainer>(); foreach (var m in Ids) { bool shoulSendSms = LocalDefault.ShouldSendSms(_configuration, m.DateLastSms, m.MatchedDate); if (shoulSendSms) { var txtmsgTemplate = string.Empty; string othersCount = string.Empty; ImisPayment _pay = new ImisPayment(_configuration, _hostingEnvironment, _loggerFactory); _pay.GetPaymentInfo(m.PaymentId); //Language lang = _pay.Language.ToLower() == "en" || _pay.Language.ToLower() == "english" || _pay.Language.ToLower() == "primary" ? Language.Primary : Language.Secondary; ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, _pay.Language); if (_pay.PaymentId != 0) { if (_pay.InsureeProducts.Count > 1) { txtmsgTemplate = sms.GetMessage("PaidAndNotMatchedV2"); othersCount = Convert.ToString(_pay.InsureeProducts.Count - 1); } else { txtmsgTemplate = sms.GetMessage("PaidAndNotMatched"); } var familyproduct = _pay.InsureeProducts.FirstOrDefault(); var txtmsg = string.Format(txtmsgTemplate, _pay.PaidAmount, DateTime.UtcNow.ToString("dd-MM-yyyy"), _pay.ControlNum, familyproduct.InsureeNumber, familyproduct.InsureeName, familyproduct.ProductCode, familyproduct.ProductName, othersCount); message.Add(new SmsContainer() { Message = txtmsg, Recipient = _pay.PhoneNumber }); _pay.UpdateLastSMSSentDateAsync(); } else { throw new Exception(); } var fileName = "PayNotMatched_"; string test = await sms.SendSMS(message, fileName); } } }
public async void SendPaymentSms(ImisPayment payment) { // Language lang = payment.Language.ToLower() == "en" || payment.Language.ToLower() == "english" || payment.Language.ToLower() == "primary" ? Language.Primary : Language.Secondary; ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, payment.Language); List <SmsContainer> message = new List <SmsContainer>(); var familyproduct = payment.InsureeProducts.FirstOrDefault(); if (familyproduct.PolicyActivated) { var txtmsg = string.Format(sms.GetMessage("PaidAndActivated"), payment.PaidAmount, DateTime.UtcNow.ToString("dd-MM-yyyy"), payment.ControlNum, familyproduct.InsureeNumber, familyproduct.InsureeName, familyproduct.ProductCode, familyproduct.ProductName, familyproduct.EffectiveDate.Value.ToShortDateString(), familyproduct.ExpiryDate.Value.ToShortDateString(), payment.PaidAmount); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); } else { decimal transferFee = 0; if (payment.typeOfPayment != null) { transferFee = payment.determineTransferFee(payment.ExpectedAmount, (TypeOfPayment)payment.typeOfPayment); } var txtmsg = string.Format(sms.GetMessage("PaidAndNotActivated"), payment.PaidAmount, DateTime.UtcNow.ToString("dd-MM-yyyy"), payment.ControlNum, familyproduct.InsureeNumber, familyproduct.InsureeName, familyproduct.ProductCode, familyproduct.ProductName, payment.GetToBePaidAmount(payment.ExpectedAmount, transferFee), payment.OutStAmount); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); } var fileName = "PayStatSms_" + payment.PhoneNumber; string test = await sms.SendSMS(message, fileName); payment.UpdateLastSMSSentDateAsync(); }
public IActionResult Get_CommissionsChf([FromBody] ChfGetCommissionInputs model) { if (!ModelState.IsValid) { var error = ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage; return(BadRequest(new { success = false, message = error })); } USSDGetCommissionInputs commision = new USSDGetCommissionInputs() { enrolment_officer_code = model.officer_code, insurance_product_code = model.product_code, mode = CommissionMode.Paid, year = model.year, month = model.month, payer = model.payer }; JsonResult resp = (JsonResult)base.Get_Commissions(commision); DataMessage message = (DataMessage)resp.Value; var commissionString = JsonConvert.SerializeObject(message.Data); var commissionAmount = JsonConvert.DeserializeObject <List <CommissionAmount> >(commissionString).FirstOrDefault(); var response = new GetCommissionResponse(message.Code, false, 0).Message; Language language = Language.Secondary; if (model.language == 2) { language = Language.Primary; } ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, language); var txtmsgTemplate = sms.GetMessage("CommissionInformSms"); var txtmsg = string.Format(txtmsgTemplate, new DateTime(Convert.ToInt32(model.year), Convert.ToInt32(model.month), 1).ToString("MMMM", CultureInfo.CreateSpecificCulture("en")), model.year, commissionAmount.Amount ); sms.QuickSms(txtmsg, model.msisdn); if (!response.ErrorOccured) { return(Ok(new { success = true, message = response.MessageValue })); } else { return(BadRequest(new { success = false, message = response.MessageValue })); } }
public async void ControlNumberAssignedSms(ImisPayment payment) { //Language lang = payment.Language.ToLower() == "en" || payment.Language.ToLower() == "english" || payment.Language.ToLower() == "primary" ? Language.Primary : Language.Secondary; ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, payment.Language); var txtmsgTemplate = string.Empty; string othersCount = string.Empty; if (payment.InsureeProducts.Count > 1) { txtmsgTemplate = sms.GetMessage("ControlNumberAssignedV2"); othersCount = Convert.ToString(payment.InsureeProducts.Count - 1); } else { txtmsgTemplate = sms.GetMessage("ControlNumberAssigned"); } decimal transferFee = 0; if (payment.typeOfPayment != null) { transferFee = payment.determineTransferFee(payment.ExpectedAmount, (TypeOfPayment)payment.typeOfPayment); } var txtmsg = string.Format(txtmsgTemplate, payment.ControlNum, DateTime.UtcNow.ToString("dd-MM-yyyy"), DateTime.UtcNow.ToString("dd-MM-yyyy"), payment.InsureeProducts.FirstOrDefault().InsureeNumber, payment.InsureeProducts.FirstOrDefault().InsureeName, payment.InsureeProducts.FirstOrDefault().ProductCode, payment.InsureeProducts.FirstOrDefault().ProductName, payment.GetToBePaidAmount(payment.ExpectedAmount, transferFee), othersCount); List <SmsContainer> message = new List <SmsContainer>(); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); var fileName = "CnAssigned_" + payment.PhoneNumber; string test = await sms.SendSMS(message, fileName); }
public async void ControlNumberAssignedSms(IPaymentRepository payment) { ImisSms sms = new ImisSms(_configuration, WebRootPath, ContentRootPath, payment.Language); var txtmsgTemplate = string.Empty; string othersCount = string.Empty; if (payment.InsureeProducts.Count > 1) { txtmsgTemplate = sms.GetMessage("ControlNumberAssignedV2"); othersCount = Convert.ToString(payment.InsureeProducts.Count - 1); } else { txtmsgTemplate = sms.GetMessage("ControlNumberAssigned"); } decimal transferFee = 0; if (payment.typeOfPayment != null) { transferFee = payment.determineTransferFee(payment.ExpectedAmount, (TypeOfPayment)payment.typeOfPayment); } var txtmsg = string.Format(txtmsgTemplate, payment.ControlNum, DateTime.UtcNow.ToLongDateString(), DateTime.UtcNow.ToLongTimeString(), payment.InsureeProducts.FirstOrDefault().InsureeNumber, payment.InsureeProducts.FirstOrDefault().InsureeName, payment.InsureeProducts.FirstOrDefault().ProductCode, payment.InsureeProducts.FirstOrDefault().ProductName, payment.GetToBePaidAmount(payment.ExpectedAmount, transferFee), othersCount); List <SmsContainer> message = new List <SmsContainer>(); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); var fileName = "CnAssigned_" + payment.PhoneNumber; string test = await sms.SendSMS(message, fileName); }
public async void SendPaymentCancellationSms(ImisPayment payment) { ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, payment.Language); List <SmsContainer> message = new List <SmsContainer>(); var txtmsg = string.Format( sms.GetMessage("CancellationSms"), // template payment.ControlNum, // invoice number DateTime.Now.ToString() // payment cancellation date ); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); var fileName = "PaymentCancellationSms_" + payment.PhoneNumber; string test = await sms.SendSMS(message, fileName); payment.UpdateLastSMSSentDateAsync(); }
public async void SendMatchSms(ImisPayment payment) { // Language lang = payment.Language.ToLower() == "en" || payment.Language.ToLower() == "english" || payment.Language.ToLower() == "primary" ? Language.Primary : Language.Secondary; ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, payment.Language); List <SmsContainer> message = new List <SmsContainer>(); var txtmsgTemplate = string.Empty; string othersCount = string.Empty; if (payment.InsureeProducts.Count > 1) { txtmsgTemplate = sms.GetMessage("PaidAndNotMatchedV2"); othersCount = Convert.ToString(payment.InsureeProducts.Count - 1); } else { txtmsgTemplate = sms.GetMessage("PaidAndNotMatched"); } var familyproduct = payment.InsureeProducts.FirstOrDefault(); var txtmsg = string.Format(txtmsgTemplate, payment.PaidAmount, DateTime.UtcNow.ToString("dd-MM-yyyy"), payment.ControlNum, familyproduct.InsureeNumber, familyproduct.InsureeName, familyproduct.ProductCode, familyproduct.ProductName, othersCount); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); var fileName = "PayNotMatched_" + payment.PhoneNumber; string test = await sms.SendSMS(message, fileName); }
public async void ControlNumberNotassignedSms(IPaymentRepository payment, string error) { //Language lang = payment.Language.ToLower() == "en" || payment.Language.ToLower() == "english" || payment.Language.ToLower() == "primary" ? Language.Primary : Language.Secondary; ImisSms sms = new ImisSms(Configuration, WebRootPath, ContentRootPath, payment.Language); var txtmsgTemplate = string.Empty; string othersCount = string.Empty; if (payment.InsureeProducts.Count > 1) { txtmsgTemplate = sms.GetMessage("ControlNumberErrorV2"); othersCount = Convert.ToString(payment.InsureeProducts.Count - 1); } else { txtmsgTemplate = sms.GetMessage("ControlNumberError"); } var txtmsg = string.Format(txtmsgTemplate, payment.ControlNum, DateTime.UtcNow.ToLongDateString(), DateTime.UtcNow.ToLongTimeString(), payment.InsureeProducts.FirstOrDefault().InsureeNumber, payment.InsureeProducts.FirstOrDefault().ProductCode, error, othersCount); List <SmsContainer> message = new List <SmsContainer>(); message.Add(new SmsContainer() { Message = txtmsg, Recipient = payment.PhoneNumber }); var fileName = "CnError_" + payment.PhoneNumber; string test = await sms.SendSMS(message, fileName); }
public async Task <IActionResult> GetChf([FromBody] ChfGetCoverageModel model) { if (new ValidationBase().InsureeNumber(model.insureeNumber) != ValidationResult.Success) { return(BadRequest(new { success = false, message = "1:Wrong format or missing insurance number of insuree" })); } JsonResult resp = (JsonResult)base.Get(model.insureeNumber); DataMessage message = (DataMessage)resp.Value; var response = new GetCoverageResponse(message.Code, message.ErrorOccured, model.language).Message; if (!message.ErrorOccured) { var coverage = new ChfCoverage(); try { var covstring = JsonConvert.SerializeObject(message.Data); coverage = JsonConvert.DeserializeObject <ChfCoverage>(covstring); } catch (Exception) { throw; } Language language = Language.Secondary; if (model.language == 2) { language = Language.Primary; } ImisSms sms = new ImisSms(_configuration, _hostingEnvironment, language); var txtmsgTemplate = sms.GetMessage("EnquireInformSms"); var txtmsg = string.Format(txtmsgTemplate, coverage.OtherNames, coverage.LastNames, coverage.BirthDate, model.insureeNumber, coverage.CoverageProducts.FirstOrDefault().ProductCode, coverage.CoverageProducts.FirstOrDefault().Status, coverage.CoverageProducts.FirstOrDefault().EffectiveDate, coverage.CoverageProducts.FirstOrDefault().ExpiryDate ); for (int i = 1; i > coverage.CoverageProducts.Count; i++) { var cov = coverage.CoverageProducts[i]; var txt = string.Format(txtmsgTemplate, string.Empty, string.Empty, string.Empty, string.Empty, cov.ProductCode, cov.Status, cov.EffectiveDate, cov.ExpiryDate ); txtmsg += ":-" + txtmsg.Split(":-")[1]; } sms.QuickSms(txtmsg, model.msisdn); return(Ok(new { success = true, message = response.MessageValue })); } else { return(BadRequest(new { success = false, message = response.MessageValue })); } }