Browse Source

Dealer slection initial changes

Release
Hema Janoti 1 year ago
parent
commit
07c46388dc
  1. 149
      Source/DealerSelection.Api.Models/LsqData.cs
  2. 149
      Source/DealerSelection.Api.Models/LsqSuccessData.cs
  3. 8
      Source/DealerSelection.Api.Models/WebEngageEvent.cs
  4. 2
      Source/DealerSelection.Api/AssignDealerApi.cs
  5. 20
      Source/DealerSelection.Api/BatchJobApi.cs
  6. 9
      Source/DealerSelection.Api/CCAvenueApi.cs
  7. 49
      Source/DealerSelection.Api/CommonUtil/CustomConfig.cs
  8. 76
      Source/DealerSelection.Api/MulesoftApi.cs
  9. 8
      Source/DealerSelection.Api/YellowAIApi.cs
  10. 2
      Source/DealerSelection.Infrastructure/BatchJob/IRepository.cs
  11. 23
      Source/DealerSelection.Infrastructure/BatchJob/Repository.cs
  12. 4
      Source/DealerSelection.Infrastructure/Mulesoft/IRepository.cs
  13. 2
      Source/DealerSelection.Infrastructure/Mulesoft/MulesoftCustomerInfoDto.cs
  14. 86
      Source/DealerSelection.Infrastructure/Mulesoft/Repository.cs
  15. 6
      Source/DealerSelection.Interface/IBatchJobApi.cs
  16. 16
      Source/DealerSelection.WebApi/Controllers/BatchJobController.cs
  17. 31
      Source/DealerSelection.WebApi/appsettings.json
  18. 9
      Source/WebJobService/Program.cs
  19. 5
      Source/WebJobService/Service.cs
  20. 2
      Source/WebJobService/WebJobService.csproj

149
Source/DealerSelection.Api.Models/LsqData.cs

@ -0,0 +1,149 @@
using Newtonsoft.Json;
namespace DealerSelection.Api.Models;
public class LsqData
{
public LsqData(string bu, string model_Code, string color, string customer_Name,
string location_of_the_customer
, string dealer_Code, string mobile, string otp_verified, string pincode
, string enquiry_mode, string source, string sub_source, string referral_URL
, string composite_Key, string enquiry_Classification
, string auto_model, string bu_Sub_type, string sitcore_Booking_ID
, string booking_Status, string cc_Avenue_Transaction_ID, string booking_receipt_Number
, string booking_amount_TRM, string test_ride_date, string test_ride_slot
, string test_ride_location, string utmSource, string utmMedium, string sourceCampaign
, string utmContent, string consentToWhatsapp, string leadPlatform)
{
BU = bu;
ModelCode = model_Code;
Color = color;
CustomerName = customer_Name;
Locationofthecustomer = location_of_the_customer;
DealerCode = dealer_Code;
MobileNumber = mobile;
OtpVerified = otp_verified;
PinCode = pincode;
EnquiryMode = enquiry_mode;
Source = source;
SubSource = sub_source;
ReferralURL = referral_URL;
CompositeKey = composite_Key;
EnquiryClassification = enquiry_Classification;
AutoModel = auto_model;
BuSubtype = bu_Sub_type;
SitecoreBookingID = sitcore_Booking_ID;
BookingStatus = booking_Status;
CCAvenueTransactionID = cc_Avenue_Transaction_ID;
BookingReceiptNumber = booking_receipt_Number;
BookingAmountTRM = booking_amount_TRM;
TestRideDate = test_ride_date;
TestRideSlot = test_ride_slot;
TestRideLocation = test_ride_location;
UtmSource = utmSource;
UtmMedium = utmMedium;
SourceCampaign = sourceCampaign;
UtmContent = utmContent;
ConsentToWhatsapp = consentToWhatsapp;
LeadPlatform = leadPlatform;
}
[JsonProperty("bu")]
public string BU { get; }
[JsonProperty("model_Code")]
public string ModelCode { get; }
[JsonProperty("color")]
public string Color { get; }
[JsonProperty("customer_Name")]
public string CustomerName { get; }
[JsonProperty("location_of_the_customer")]
public string Locationofthecustomer { get; }
[JsonProperty("dealer_Code")]
public string DealerCode { get; }
[JsonProperty("mobile")]
public string MobileNumber { get; }
[JsonProperty("otp_verified")]
public string OtpVerified { get; }
[JsonProperty("pincode")]
public string PinCode { get; }
[JsonProperty("enquiry_mode")]
public string EnquiryMode { get; }
[JsonProperty("source")]
public string Source { get; }
[JsonProperty("sub_source")]
public string SubSource { get; }
[JsonProperty("referral_URL")]
public string ReferralURL { get; }
[JsonProperty("composite_Key")]
public string CompositeKey { get; }
[JsonProperty("enquiry_Classification")]
public string EnquiryClassification { get; }
[JsonProperty("auto_model")]
public string AutoModel { get; }
[JsonProperty("bu_Sub_type")]
public string BuSubtype { get; }
[JsonProperty("sitcore_Booking_ID")]
public string SitecoreBookingID { get; }
[JsonProperty("booking_Status")]
public string BookingStatus { get; }
[JsonProperty("cc_Avenue_Transaction_ID")]
public string CCAvenueTransactionID { get; }
[JsonProperty("booking_receipt_Number")]
public string BookingReceiptNumber { get; }
[JsonProperty("booking_amount_TRM")]
public string BookingAmountTRM { get; }
[JsonProperty("test_ride_date")]
public string TestRideDate { get; }
[JsonProperty("test_ride_slot")]
public string TestRideSlot{ get; }
[JsonProperty("test_ride_location")]
public string TestRideLocation { get; }
[JsonProperty("utmSource")]
public string UtmSource { get; }
[JsonProperty("utmMedium")]
public string UtmMedium { get; }
[JsonProperty("sourceCampaign")]
public string SourceCampaign { get; }
[JsonProperty("utmContent")]
public string UtmContent { get; }
[JsonProperty("consentToWhatsapp")]
public string ConsentToWhatsapp { get; }
[JsonProperty("leadPlatform")]
public string LeadPlatform { get; }
}

149
Source/DealerSelection.Api.Models/LsqSuccessData.cs

@ -0,0 +1,149 @@
using Newtonsoft.Json;
namespace DealerSelection.Api.Models;
public class LsqSuccessData
{
public LsqSuccessData(string bu, string model_Code, string color, string customer_Name,
string location_of_the_customer
, string dealer_Code, string mobile, string otp_verified, string pincode
, string enquiry_mode, string source, string sub_source, string referral_URL
, string composite_Key, string enquiry_Classification
, string auto_model, string bu_Sub_type, string sitcore_Booking_ID
, string booking_Status, string cc_Avenue_Transaction_ID, string booking_receipt_Number
, string booking_amount_TRM, string test_ride_date, string test_ride_slot
, string test_ride_location, string utmSource, string utmMedium, string sourceCampaign
, string utmContent, string consentToWhatsapp, string leadPlatform, string isDefaultDealer)
{
BU= bu;
ModelCode= model_Code;
Color= color;
CustomerName= customer_Name;
Locationofthecustomer= location_of_the_customer;
DealerCode= dealer_Code;
MobileNumber= mobile;
OtpVerified= otp_verified;
PinCode= pincode;
EnquiryMode= enquiry_mode;
Source= source;
SubSource= sub_source;
ReferralURL= referral_URL;
CompositeKey= composite_Key;
EnquiryClassification = enquiry_Classification;
AutoModel= auto_model;
BuSubtype = bu_Sub_type;
SitecoreBookingID = sitcore_Booking_ID;
BookingStatus = booking_Status;
CCAvenueTransactionID = cc_Avenue_Transaction_ID;
BookingReceiptNumber = booking_receipt_Number;
BookingAmountTRM= booking_amount_TRM;
TestRideDate= test_ride_date;
TestRideSlot = test_ride_slot;
TestRideLocation= test_ride_location;
UtmSource = utmSource;
UtmMedium= utmMedium;
SourceCampaign= sourceCampaign;
UtmContent = utmContent;
ConsentToWhatsapp= consentToWhatsapp;
LeadPlatform= leadPlatform;
IsDefaultDealer= isDefaultDealer;
}
[JsonProperty("bu")]
public string BU { get; }
[JsonProperty("model_Code")]
public string ModelCode { get; }
[JsonProperty("color")]
public string Color { get; }
[JsonProperty("customer_Name")]
public string CustomerName { get; }
[JsonProperty("location_of_the_customer")]
public string Locationofthecustomer { get; }
[JsonProperty("dealer_Code")]
public string DealerCode { get; }
[JsonProperty("mobile")]
public string MobileNumber { get; }
[JsonProperty("otp_verified")]
public string OtpVerified { get; }
[JsonProperty("pincode")]
public string PinCode { get; }
[JsonProperty("enquiry_mode")]
public string EnquiryMode { get; }
[JsonProperty("source")]
public string Source { get; }
[JsonProperty("sub_source")]
public string SubSource { get; }
[JsonProperty("referral_URL")]
public string ReferralURL { get; }
[JsonProperty("composite_Key")]
public string CompositeKey { get; }
[JsonProperty("enquiry_Classification")]
public string EnquiryClassification { get; }
[JsonProperty("auto_model")]
public string AutoModel { get; }
[JsonProperty("bu_Sub_type")]
public string BuSubtype { get; }
[JsonProperty("sitcore_Booking_ID")]
public string SitecoreBookingID { get; }
[JsonProperty("booking_Status")]
public string BookingStatus { get; }
[JsonProperty("cc_Avenue_Transaction_ID")]
public string CCAvenueTransactionID { get; }
[JsonProperty("booking_receipt_Number")]
public string BookingReceiptNumber { get; }
[JsonProperty("booking_amount_TRM")]
public string BookingAmountTRM { get; }
[JsonProperty("test_ride_date")]
public string TestRideDate { get; }
[JsonProperty("test_ride_slot")]
public string TestRideSlot{ get; }
[JsonProperty("test_ride_location")]
public string TestRideLocation { get; }
[JsonProperty("utmSource")]
public string UtmSource { get; }
[JsonProperty("utmMedium")]
public string UtmMedium { get; }
[JsonProperty("sourceCampaign")]
public string SourceCampaign { get; }
[JsonProperty("utmContent")]
public string UtmContent { get; }
[JsonProperty("consentToWhatsapp")]
public string ConsentToWhatsapp { get; }
[JsonProperty("leadPlatform")]
public string LeadPlatform { get; }
[JsonProperty("isDefaultDealer")]
public string IsDefaultDealer { get; }
}

8
Source/DealerSelection.Api.Models/WebEngageEvent.cs

@ -6,7 +6,7 @@ public class WebEngageEventData
{
public WebEngageEventData(string bookingID, string bookingStatus, string bookingAmount, string bookingReceiptLink,string dealerFlag, string fullName, string phoneNumber,
string motorcycleName, string motorcycleCode, string location, string dealerName,
string dealerPhoneNumber)
string dealerPhoneNumber,string bookingCompletionDate)
{
BookingID = bookingID;
BookingStatus = bookingStatus;
@ -19,7 +19,8 @@ public class WebEngageEventData
MotorcycleCode = motorcycleCode;
Location = location;
DealerName = dealerName;
DealerPhoneNumber = dealerPhoneNumber;
DealerPhoneNumber = dealerPhoneNumber;
BookingCompletionDate= bookingCompletionDate;
}
@ -61,6 +62,9 @@ public class WebEngageEventData
[JsonProperty("Dealer Phone Number")]
public string DealerPhoneNumber { get; }
[JsonProperty("BookingCompletionDate")]
public string BookingCompletionDate { get; }
}
public class WebEngageEvent
{

2
Source/DealerSelection.Api/AssignDealerApi.cs

@ -129,7 +129,7 @@ public class AssignDealerApi : IAssignDealerApi
// Send Message to Webengage to Initiate BOT
WebEngageEventData eventData = new WebEngageEventData(customerInfo.BookingId, "SUCCESS", customerInfo.AmountPaid, "", "N",
customerInfo.CustomerName, customerInfo.MobileNumber, customerInfo.ModelName, customerInfo.ModelCode, customerInfo.CustomerLat, "", "");
customerInfo.CustomerName, customerInfo.MobileNumber, customerInfo.ModelName, customerInfo.ModelCode, customerInfo.CustomerLat, "", "",customerInfo.CompletionDate.ToString());
WebEngageEvent events = new WebEngageEvent(customerInfo.MobileNumber, cfg.WebengageEventName, eventData);
await WebEngageEventsAPICall(events, cfg, customerInfo.RecordId);
}

20
Source/DealerSelection.Api/BatchJobApi.cs

@ -5,6 +5,7 @@ using DealerSelection.Api.Interface;
using DealerSelection.Api.Models.Enum;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using static iTextSharp.text.pdf.AcroFields;
public class BatchJobApi : IBatchJobApi
{
@ -38,5 +39,24 @@ public class BatchJobApi : IBatchJobApi
}
}
public async Task LeadCreateApiCall(int buId)
{
try
{
List<MulesoftCustomerInfoDto> lsqCustomerDataList =
await Repository.GetDataForLsqPush(buId);
foreach (var lsqCustomerData in lsqCustomerDataList)
{
await MulesoftApi.InsertLSQData(lsqCustomerData);
// await MulesoftApi.CallBookingApi(buId, lsqCustomerData);
}
}
catch (Exception ex)
{
_logger.LogError("PendingStatusUpdateApi LeadCreateApiCall " + ex.Message.ToString());
}
}
}

9
Source/DealerSelection.Api/CCAvenueApi.cs

@ -109,7 +109,14 @@ public class CCAvenueApi : ICCAvenueApi
catch (Exception ex)
{
_logger.LogError($"DS Api:-BU:- {customerInfo.BuId} + RefundOrder Error for bookingId:- {bookingId} - {ex.StackTrace}");
throw ex;
RefundStatusResponse _refundStatusResponse = new();
{
_refundStatusResponse.refund_status = 1;
_refundStatusResponse.reason = ex.Message;
};
response = new RefundApiResponse("1", _refundStatusResponse);
response.Status = "1";
//throw ex;
}
}
else

49
Source/DealerSelection.Api/CommonUtil/CustomConfig.cs

@ -34,6 +34,10 @@ namespace DealerSelection.Api.CommonUtil
public static CustomCfg GetCustomCfg(int buId)
{
CustomCfg cfg = new CustomCfg();
cfg.WebEngageLicenseCode = ConfigurationHelper.GetSetting<string>("WebEngageLicenseCode", true);
cfg.WebEngageAuthToken = ConfigurationHelper.GetSetting<string>("WebEngageAuthToken", true);
cfg.WebengageApiHost = ConfigurationHelper.GetSetting<string>("WebengageApiHost", true);
switch (buId)
{
case 1:
@ -41,20 +45,41 @@ namespace DealerSelection.Api.CommonUtil
cfg.CCAvenueAccessCode = ConfigurationHelper.GetSetting<string>("KtmCfg:CCAvenueAccessCode", true);
cfg.CCAvenueMerchantCode = ConfigurationHelper.GetSetting<string>("KtmCfg:CCAvenueMerchantCode", true);
cfg.CCAvenueWorkingKey = ConfigurationHelper.GetSetting<string>("KtmCfg:CCAvenueWorkingKey", true);
cfg.WebengageEventName = ConfigurationHelper.GetSetting<string>("KtmCfg:WebengageEventName", true);
cfg.WebEngageLicenseCode = ConfigurationHelper.GetSetting<string>("KtmCfg:WebEngageLicenseCode", true);
cfg.WebEngageAuthToken = ConfigurationHelper.GetSetting<string>("KtmCfg:WebEngageAuthToken", true);
cfg.WebengageApiHost = ConfigurationHelper.GetSetting<string>("KtmCfg:WebengageApiHost", true);
cfg.WebengageEventName = ConfigurationHelper.GetSetting<string>("KtmCfg:WebengageEventName", true);
cfg.BuId = buId;
cfg.DeafaultDealerCode = ConfigurationHelper.GetSetting<string>("KtmCfg:DefaultDealerCode", true);
//cfg.ClientId = ConfigurationHelper.GetSetting<string>("KtmCfg:ClientId", true);
//cfg.ClientSecret = ConfigurationHelper.GetSetting<string>("KtmCfg:ClientSecret", true);
// cfg.Key = ConfigurationHelper.GetSetting<string>("KtmCfg:Key", true);
// cfg.Audience = ConfigurationHelper.GetSetting<string>("KtmCfg:Audience", true);
// cfg.Issuer = ConfigurationHelper.GetSetting<string>("KtmCfg:Issuer", true);
// cfg.Role = ConfigurationHelper.GetSetting<string>("KtmCfg:Role", true);
// cfg.ExpireMinutes = ConfigurationHelper.GetSetting<string>("KtmCfg:ExpireMinutes", true);
break;
break;
case 2:
cfg.BuCode = ConfigurationHelper.GetSetting<string>("BajajCfg:BuCode", true);
cfg.CCAvenueAccessCode = ConfigurationHelper.GetSetting<string>("BajajCfg:CCAvenueAccessCode", true);
cfg.CCAvenueMerchantCode = ConfigurationHelper.GetSetting<string>("BajajCfg:CCAvenueMerchantCode", true);
cfg.CCAvenueWorkingKey = ConfigurationHelper.GetSetting<string>("BajajCfg:CCAvenueWorkingKey", true);
cfg.WebengageEventName = ConfigurationHelper.GetSetting<string>("BajajCfg:WebengageEventName", true);
cfg.BuId = buId;
cfg.DeafaultDealerCode = ConfigurationHelper.GetSetting<string>("BajajCfg:DefaultDealerCode", true);
break;
case 3:
cfg.BuCode = ConfigurationHelper.GetSetting<string>("TriumphCfg:BuCode", true);
cfg.CCAvenueAccessCode = ConfigurationHelper.GetSetting<string>("TriumphCfg:CCAvenueAccessCode", true);
cfg.CCAvenueMerchantCode = ConfigurationHelper.GetSetting<string>("TriumphCfg:CCAvenueMerchantCode", true);
cfg.CCAvenueWorkingKey = ConfigurationHelper.GetSetting<string>("TriumphCfg:CCAvenueWorkingKey", true);
cfg.WebengageEventName = ConfigurationHelper.GetSetting<string>("TriumphCfg:WebengageEventName", true);
cfg.BuId = buId;
cfg.DeafaultDealerCode = ConfigurationHelper.GetSetting<string>("TriumphCfg:DefaultDealerCode", true);
break;
case 4:
cfg.BuCode = ConfigurationHelper.GetSetting<string>("HusqvarnaCfg:BuCode", true);
cfg.CCAvenueAccessCode = ConfigurationHelper.GetSetting<string>("HusqvarnaCfg:CCAvenueAccessCode", true);
cfg.CCAvenueMerchantCode = ConfigurationHelper.GetSetting<string>("HusqvarnaCfg:CCAvenueMerchantCode", true);
cfg.CCAvenueWorkingKey = ConfigurationHelper.GetSetting<string>("HusqvarnaCfg:CCAvenueWorkingKey", true);
cfg.WebengageEventName = ConfigurationHelper.GetSetting<string>("HusqvarnaCfg:WebengageEventName", true);
cfg.BuId = buId;
cfg.DeafaultDealerCode = ConfigurationHelper.GetSetting<string>("HusqvarnaCfg:DefaultDealerCode", true);
break;
default:
cfg.BuId = buId;
break;

76
Source/DealerSelection.Api/MulesoftApi.cs

@ -162,7 +162,11 @@ public class MulesoftApi : IMulesoftApi
{
try
{
await UpdateDetails(customerInfo, DealerSelectionJobStatus.Complete);
if (customerInfo.Status == "Successful")
{
await UpdateDetails(customerInfo, DealerSelectionJobStatus.Complete);
}
var responseApi = await CallLSQBookingApi(customerInfo);
}
@ -192,7 +196,7 @@ public class MulesoftApi : IMulesoftApi
string mx_Composite_Key = string.Empty, enquiryClassification = string.Empty,
autoModel = string.Empty, dealerCode = string.Empty, status = string.Empty,
bookingId = string.Empty, cCTransactionId = string.Empty, receiptId = string.Empty,
amountPaid = string.Empty, leadPlatform = "Website", isSuccessBooking = "True", isDefaultDealer="No";
amountPaid = string.Empty, leadPlatform = "Website", isSuccessBooking = "True", isDefaultDealer = "No";
string utmSource = GetUTMDetails(customerInfo.ReferralUrl, "utm_source");
@ -223,57 +227,51 @@ public class MulesoftApi : IMulesoftApi
receiptId = customerInfo.ReceiptId;
amountPaid = customerInfo.AmountPaid;
if (customerInfo.IsRegisterInterestRequest || string.IsNullOrWhiteSpace(customerInfo.DealerCode) || string.IsNullOrWhiteSpace(customerInfo.ModelCode))
if (customerInfo.DealerCode == cfg.DeafaultDealerCode)
{
enquiryClassification = "Cold";
autoModel = "No";
dealerCode = string.Empty;
isDefaultDealer = "Yes";
}
else
string pincode = customerInfo.PinCode;
//default pincode value, incase pincode column is empty for the record
if (string.IsNullOrEmpty(pincode))
pincode = "400070";
dynamic message = null;
if (customerInfo.Status == "Successful" && !string.IsNullOrWhiteSpace(customerInfo.DealerCode)
&& !string.IsNullOrWhiteSpace(customerInfo.ModelCode))
{
enquiryClassification = "Hot";
autoModel = "Yes";
LsqSuccessData lsqData = new LsqSuccessData(cfg.BuCode, customerInfo.ModelCode, customerInfo.ColorCode, customerInfo.CustomerName
, "", dealerCode, customerInfo.MobileNumber, "true", pincode, "Digital"
, mx_Source_Of_Enquiry, mx_Enquiry_Sub_source, "", mx_Composite_Key, enquiryClassification
, autoModel, "", bookingId, status, cCTransactionId, receiptId, amountPaid
, "", "", "", utmSource, utmMedium, sourceCampaign, utmContent, customerInfo.IsWhatsappOptIn.ToString()
, leadPlatform, isDefaultDealer);
message = JsonConvert.SerializeObject(lsqData);
}
if (customerInfo.Status != "Successful")
else
{
enquiryClassification = "Cold";
autoModel = "No";
status = string.Empty;
bookingId = string.Empty;
cCTransactionId = string.Empty;
receiptId = string.Empty;
amountPaid = string.Empty;
isSuccessBooking = "False";
isDefaultDealer = "";
}
if(customerInfo.DealerCode==cfg.DeafaultDealerCode)
{
isDefaultDealer = "Yes";
}
string pincode = customerInfo.PinCode;
//default pincode value, incase pincode column is empty for the record
if (string.IsNullOrEmpty(pincode))
pincode = "400070";
string message = "{\"bu\": \"" + cfg.BuCode + "\", \"model_Code\": \"" + customerInfo.ModelCode + "\"," +
"\"color\": \"" + customerInfo.ColorCode + "\"," +
"\"customer_Name\": \"" + customerInfo.CustomerName + "\"" +
", \"location_of_the_customer\": \"\", \"dealer_Code\": \"" + dealerCode + "\", " +
"\"mobile\": \"" + customerInfo.MobileNumber + "\"" +
", \"otp_verified\": \"true\", \"pincode\": \"" + pincode + "\"," +
" \"enquiry_mode\": \"Digital\"" +
", \"source\": \"" + mx_Source_Of_Enquiry + "\", \"sub_source\": \"" + mx_Enquiry_Sub_source + "\"," +
" \"referral_URL\": \"\"" +
", \"composite_Key\": \"" + mx_Composite_Key + "\", \"enquiry_Classification\": \"" + enquiryClassification + "\"," +
" \"auto_model\": \"" + autoModel + "\"" +
", \"bu_Sub_type\": \"\", \"sitcore_Booking_ID\": \"" + bookingId + "\", " +
"\"booking_Status\": \"" + status + "\"" +
", \"cc_Avenue_Transaction_ID\": \"" + cCTransactionId + "\"," +
" \"booking_receipt_Number\": \"" + receiptId + "\"," +
" \"booking_amount_TRM\": \"" + amountPaid + "\"," +
" \"test_ride_date\": \"\", \"test_ride_slot\": \"\"" +
", \"test_ride_location\": \"\"," +
"\"utmSource\": \"" + utmSource + "\", \"utmMedium\":\"" + utmMedium + "\"," +
" \"sourceCampaign\": \"" + sourceCampaign + "\", \"utmContent\":\"" + utmContent + "\"," +
" \"consentToWhatsapp\": \"" + customerInfo.IsWhatsappOptIn + "\",\"leadPlatform\": \"" + leadPlatform + "\" ,\"isDefaultDealer\": \"" + isDefaultDealer + "\"}";
LsqData lsqData = new LsqData(cfg.BuCode, customerInfo.ModelCode, customerInfo.ColorCode, customerInfo.CustomerName
, "", "", customerInfo.MobileNumber, "true", pincode, "Digital"
, mx_Source_Of_Enquiry, mx_Enquiry_Sub_source, "", mx_Composite_Key, enquiryClassification
, autoModel, "", bookingId, status, cCTransactionId, receiptId, amountPaid
, "", "", "", utmSource, utmMedium, sourceCampaign, utmContent, customerInfo.IsWhatsappOptIn.ToString()
, leadPlatform);
message = JsonConvert.SerializeObject(lsqData);
}

8
Source/DealerSelection.Api/YellowAIApi.cs

@ -3,6 +3,7 @@ using DealerSelection.Api.Interface;
using DealerSelection.Api.Models;
using DealerSelection.Api.Models.Enum;
using DealerSelection.Common.Exceptions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Text.RegularExpressions;
using CustomerDetailRepo = DealerSelection.Api.Infrastructure.CustomerDetail;
@ -46,6 +47,11 @@ public class YellowAIApi : IYellowAIApi
customerDetailInfo.DealerSelectedMode = DealerSelectedMode.Bot.ToString();
await MulesoftApi.InsertLSQData(customerDetailInfo);
}
else
{
_logger.LogWarning($"No Data found : {request.RequestDetail()}.");
throw new ValidationException("No Data Found");
}
}
else
{
@ -57,7 +63,7 @@ public class YellowAIApi : IYellowAIApi
catch(Exception ex)
{
_logger.LogError($"Some error occured: {ex.StackTrace}.");
throw new ValidationException($"Some error occured: {ex.StackTrace}.");
throw new Exception($"Some error occured: {ex.Message}.");
}
_logger.LogInformation($"DS Api:-UpdateSelectedDealer End :- MobileNumber {request.MobileNumber} BuCode {request.BuCode} BuSubType {request.BuSubType}" +

2
Source/DealerSelection.Infrastructure/BatchJob/IRepository.cs

@ -6,4 +6,6 @@ namespace DealerSelection.Api.Infrastructure.BatchJob;
public interface IRepository
{
Task<List<MulesoftCustomerInfoDto>> Get24HrOldRecordsForJobProcessing();
Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId);
}

23
Source/DealerSelection.Infrastructure/BatchJob/Repository.cs

@ -34,4 +34,27 @@ public class Repository : RepositoryBaseDapperAsync, IRepository
}
}
public async Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId)
{
try
{
using (SqlConnection cxn = await OpenCxnAsync())
{
IEnumerable<MulesoftCustomerInfoDto> lsqDto = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.GetDataForLsqPush,
new
{
buId
},
commandType: CommandType.StoredProcedure);
return lsqDto.ToList();
}
}
catch (Exception ex)
{
_logger.LogError("BU:- " + buId.ToString() + "Error at Repository:Mulesoft in GetDataForLsqPush " + ex.Message.ToString());
throw new UnexpectedDataException($"Error at Repository:Mulesoft in GetDataForLsqPush for BuId: {buId}.", ex);
}
}
}

4
Source/DealerSelection.Infrastructure/Mulesoft/IRepository.cs

@ -3,8 +3,8 @@ namespace DealerSelection.Api.Infrastructure.Mulesoft;
public interface IRepository
{
Task<MulesoftCustomerInfoDto> GetCustomerInfo(int buId, string bookingId);
//Task<MulesoftCustomerInfoDto> GetCustomerInfo(int buId, string bookingId);
Task UpdateMulesoftResponse(int buId,int recordId,string bookingId,string message,string isSuccessBooking, LeadData leadData);
Task InsertAndUpdateDealerRecord(DealerDetailDto dto);
Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId);
// Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId);
}

2
Source/DealerSelection.Infrastructure/Mulesoft/MulesoftCustomerInfoDto.cs

@ -29,6 +29,8 @@ public class MulesoftCustomerInfoDto
public string CustomerLong { get; set; }
public string DealerSelectedMode { get; set; }
public DateTime CompletionDate { get; set; }
}
public class LeadData

86
Source/DealerSelection.Infrastructure/Mulesoft/Repository.cs

@ -14,28 +14,28 @@ public class Repository : RepositoryBaseDapperAsync, IRepository
_logger = logger;
}
public async Task<MulesoftCustomerInfoDto> GetCustomerInfo(int buId, string bookingId)
{
try
{
using (SqlConnection cxn = await OpenCxnWithMappingAsync<MulesoftCustomerInfoDto>())
{
IEnumerable<MulesoftCustomerInfoDto> cusotmerInfo = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.GetCustomerInfoOnBookingId,
new
{
buId,
bookingId
},
commandType: CommandType.StoredProcedure);
return cusotmerInfo.ToList().FirstOrDefault();
}
}
catch (Exception ex)
{
_logger.LogError($"DS Repo:-BU:- " + buId.ToString() + " Error at Repository:Mulesoft in GetCustomerInfo." + ex.Message.ToString());
throw new UnexpectedDataException($"Error at Repository:Mulesoft in GetCustomerInfo for BuId: {buId} and BookingId: {bookingId}.", ex);
}
}
//public async Task<MulesoftCustomerInfoDto> GetCustomerInfo(int buId, string bookingId)
//{
// try
// {
// using (SqlConnection cxn = await OpenCxnWithMappingAsync<MulesoftCustomerInfoDto>())
// {
// IEnumerable<MulesoftCustomerInfoDto> cusotmerInfo = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.GetCustomerInfoOnBookingId,
// new
// {
// buId,
// bookingId
// },
// commandType: CommandType.StoredProcedure);
// return cusotmerInfo.ToList().FirstOrDefault();
// }
// }
// catch (Exception ex)
// {
// _logger.LogError($"DS Repo:-BU:- " + buId.ToString() + " Error at Repository:Mulesoft in GetCustomerInfo." + ex.Message.ToString());
// throw new UnexpectedDataException($"Error at Repository:Mulesoft in GetCustomerInfo for BuId: {buId} and BookingId: {bookingId}.", ex);
// }
//}
public async Task UpdateMulesoftResponse(int buId, int recordId, string bookingId, string message, string isSuccessBooking, LeadData leadData)
{
@ -109,26 +109,26 @@ public class Repository : RepositoryBaseDapperAsync, IRepository
}
}
public async Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId)
{
try
{
using (SqlConnection cxn = await OpenCxnAsync())
{
IEnumerable<MulesoftCustomerInfoDto> lsqDto = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.GetDataForLsqPush,
new
{
buId
},
commandType: CommandType.StoredProcedure);
return lsqDto.ToList();
}
}
catch (Exception ex)
{
_logger.LogError($"DS Repo-BU:- " + buId.ToString() + "Error at Repository:Mulesoft in GetDataForLsqPush " + ex.Message.ToString());
throw new UnexpectedDataException($"Error at Repository:Mulesoft in GetDataForLsqPush for BuId: {buId}.", ex);
}
//public async Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId)
//{
// try
// {
// using (SqlConnection cxn = await OpenCxnAsync())
// {
// IEnumerable<MulesoftCustomerInfoDto> lsqDto = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.GetDataForLsqPush,
// new
// {
// buId
// },
// commandType: CommandType.StoredProcedure);
// return lsqDto.ToList();
// }
// }
// catch (Exception ex)
// {
// _logger.LogError($"DS Repo-BU:- " + buId.ToString() + "Error at Repository:Mulesoft in GetDataForLsqPush " + ex.Message.ToString());
// throw new UnexpectedDataException($"Error at Repository:Mulesoft in GetDataForLsqPush for BuId: {buId}.", ex);
// }
}
//}
}

6
Source/DealerSelection.Interface/IBatchJobApi.cs

@ -2,6 +2,8 @@
public interface IBatchJobApi
{
Task Process24HrOldRecords();
Task Process24HrOldRecords();
Task LeadCreateApiCall(int buId);
}

16
Source/DealerSelection.WebApi/Controllers/BatchJobController.cs

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.ComponentModel.DataAnnotations;
namespace DealerSelection.WebApi.Controllers;
@ -29,4 +30,19 @@ public class BatchJobController : ControllerBase
{
await Api.Process24HrOldRecords();
}
/// <summary>
/// Update Booking Status
/// </summary>
/// <param name="buId"></param>
/// <returns></returns>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[SwaggerOperation(Tags = new[] { "BatchJob" })]
[Route("PartialFullLeadPush/{buId}")]
public async Task PartialFullLeadPush([Required] int buId)
{
await Api.LeadCreateApiCall(buId);
}
}

31
Source/DealerSelection.WebApi/appsettings.json

@ -34,6 +34,9 @@
"MuleSoftCacheGetActiveState": "30",
"MuleSoftCacheGetActiveCity": "30",
"MuleSoftCacheModelDetails": "30",
"WebEngageLicenseCode": "~71680635",
"WebEngageAuthToken": "3b5e4004-cef4-4bde-86c6-c8a9944cd846",
"WebengageApiHost": "https://api.webengage.com/v1/accounts/",
"KtmCfg": {
"Buid": 1,
"BuCode": "PB",
@ -41,10 +44,7 @@
"CCAvenueAccessCode": "AVLM05KI16AB00MLBA",
"CCAvenueMerchantCode": "350479",
"CCAvenueWorkingKey": "F40694C5358CF9D2826C4545D6FAE337",
"WebengageEventName": "KTM Booking Dealer Status",
"WebEngageLicenseCode": "~71680635",
"WebEngageAuthToken": "3b5e4004-cef4-4bde-86c6-c8a9944cd846",
"WebengageApiHost": "https://api.webengage.com/v1/accounts/"
"WebengageEventName": "KTM Booking Dealer Status"
},
"BajajCfg": {
"Buid": 2,
@ -53,10 +53,25 @@
"CCAvenueAccessCode": "AVNL05KI17AO76LNOA",
"CCAvenueMerchantCode": "350479",
"CCAvenueWorkingKey": "6FD791AC3A7177E9139215B32278AFDB",
"WebengageEventName": "BA - Booking Status",
"WebEngageLicenseCode": "~71680635",
"WebEngageAuthToken": "3b5e4004-cef4-4bde-86c6-c8a9944cd846",
"WebengageApiHost": "https://api.webengage.com/v1/accounts/"
"WebengageEventName": ""
},
"TriumphCfg": {
"Buid": 3,
"BuCode": "TRM",
"DefaultDealerCode": "Bajaj",
"CCAvenueAccessCode": "AVEB04KE93CJ71BEJC",
"CCAvenueMerchantCode": "284786",
"CCAvenueWorkingKey": "C3673417B0712B2A4FE9618F7723C850",
"WebengageEventName": ""
},
"HusqvarnaCfg": {
"Buid": 4,
"BuCode": "PB",
"DefaultDealerCode": "Bajaj",
"CCAvenueAccessCode": "AVRE05KK36CL99ERLC",
"CCAvenueMerchantCode": "350479",
"CCAvenueWorkingKey": "BA1433F7A2D39F01CA9EE95ED5218A72",
"WebengageEventName": ""
},
"Logging": {
"LogLevel": {

9
Source/WebJobService/Program.cs

@ -27,12 +27,14 @@ public class Program : ServiceRegistry
var config = builder.Build();
var aiUrl = config["AZURE_LOGGING"];
Console.WriteLine("Logging AddApplicationInsights started");
registry.AddLogging(x => x.AddApplicationInsights(
configureTelemetryConfiguration: (config) => config.ConnectionString =
aiUrl, configureApplicationInsightsLoggerOptions: (options) => { }
).AddFilter<ApplicationInsightsLoggerProvider>("traces", LogLevel.Trace));
Console.WriteLine("Logging AddApplicationInsights Ended");
registry.For<IRepository>()
.Use<Repository>()
@ -66,11 +68,12 @@ public class Program : ServiceRegistry
var container = new Container(registry);
Console.WriteLine("Logging Run Started");
IService service = container.GetInstance<IService>();
service.Run();
Console.WriteLine("Logging Run Ended");
// Handling finalizing when process is ended
}

5
Source/WebJobService/Service.cs

@ -24,8 +24,9 @@ public class Service : IService
public void Run()
{
_logger.LogError($"WJ:-Service Started");
// GetRecordToProcess().Wait();
_logger.LogInformation($"WJ:-Service Started at {DateTime.Now} ");
Console.WriteLine("ILogger Started");
GetRecordToProcess().Wait();
_logger.LogInformation($"WJ:-Service Completed");
}

2
Source/WebJobService/WebJobService.csproj

@ -40,8 +40,10 @@
<PackageReference Include="Lamar" Version="12.1.0" />
<PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="12.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.35" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.22.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

Loading…
Cancel
Save