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 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); }