82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
using CsvHelper.Configuration.Attributes;
|
|
using LCU.Library.Internal.IncentiveApiModels.Enums;
|
|
|
|
namespace LCU.API.Internal.Operations.IncentiveApi.Models.Allied;
|
|
|
|
public class AlliedSaleRow
|
|
{
|
|
[Name("Quoter")]
|
|
public string Quoter { get; set; }
|
|
[Name("Issuer")]
|
|
public string Issuer { get; set; }
|
|
[Name("Origin")]
|
|
public string Origin { get; set; }
|
|
[Name("Product_Type")]
|
|
public string ProductType { get; set; }
|
|
[Name("Status")]
|
|
public string Status { get; set; }
|
|
[Name("Sale_Date")]
|
|
public string SaleDate { get; set; }
|
|
[Name("Sale_Effective_Date")]
|
|
public string SaleEffectiveDate { get; set; }
|
|
[Name("Cancellation_Date")]
|
|
public string CancellationDate { get; set; }
|
|
[Name("Cancellation_Reason")]
|
|
public string CancellationReason { get; set; }
|
|
[Name("Cancelled_By")]
|
|
public string CancelledBy { get; set; }
|
|
[Name("Sales_Contract_Number")]
|
|
public string SalesContractNumber { get; set; }
|
|
[Name("Buyer")]
|
|
public string Buyer { get; set; }
|
|
[Name("Account_Number")]
|
|
public string AccountNumber { get; set; }
|
|
[Name("LOS_LOAN_APP_ID_TX")]
|
|
public string LosLoanAppIdTx { get; set; }
|
|
[Name("Program_Type")]
|
|
public string ProgramType { get; set; }
|
|
[Name("Buyer_Cost")]
|
|
public string BuyerCost { get; set; }
|
|
[Name("Flagged_Reasons")]
|
|
public string FlaggedReasons { get; set; }
|
|
|
|
public string DetermineAccountNumber()
|
|
{
|
|
var accountNumber = "";
|
|
if (!string.IsNullOrEmpty(AccountNumber))
|
|
{
|
|
accountNumber = AccountNumber;
|
|
}
|
|
else
|
|
{
|
|
accountNumber = SalesContractNumber ?? "";
|
|
}
|
|
|
|
if (accountNumber.Contains("-"))
|
|
{
|
|
var transform = accountNumber.Split("-");
|
|
if (transform?.Length == 2)
|
|
{
|
|
return transform[0].Trim();
|
|
}
|
|
}
|
|
|
|
return accountNumber;
|
|
}
|
|
|
|
public Product DetermineAlliedProduct()
|
|
{
|
|
if (string.Equals(ProductType.Trim(), "mbp", StringComparison.CurrentCultureIgnoreCase))
|
|
{
|
|
return Product.MechanicalBreakdownProtection;
|
|
}
|
|
|
|
if (string.Equals(ProductType.Trim(), "gap", StringComparison.CurrentCultureIgnoreCase))
|
|
{
|
|
return Product.GAPInsurance;
|
|
}
|
|
|
|
throw new Exception($"Allied should only pass MBP or GAP for product, but received {ProductType}");
|
|
}
|
|
}
|