I have a json body with 1 different property in 3 different situations
I tried some custom methods but none of them worked. This is my jsonBody
var postParameters = new CredoPayRequest()
{
amount = amount,
birthDate = Dob,
currency = "GEL",
currencyRate = 1,
depositId = credoPayId,
fee = 0,
paymentDate = trx_date,
personalNumber = personalNumber,
terminalId = terminalId.ToString(),
transactionId = invoiceID
};
depositId is the thing which will be different in different ways sometimes it will be depositId sometimes utilityId and loanId . what can i do to just change that value and not create 3 different bodies ? My Class is
public class CredoPayRequest
{
public string personalNumber { get; set; }
public string transactionId { get; set; }
public string terminalId { get; set; }
public string paymentDate { get; set; }
public string birthDate { get; set; }
public string amount { get; set; }
public int fee { get; set; }
public string currency { get; set; }
public int currencyRate { get; set; }
public string accountId { get; set; }
public string depositId { get; set; }
public string utilityId { get; set; }
}
Utility must be like this:
var postParameters = new CredoPayRequest()
{
amount = amount,
birthDate = Dob,
currency = "GEL",
currencyRate = 1,
utilityId = credoPayId,
fee = 0,
paymentDate = trx_date,
personalNumber = personalNumber,
terminalId = terminalId.ToString(),
transactionId = invoiceID
};
then accounts must be
var postParameters = new CredoPayRequest()
{
amount = amount,
birthDate = Dob,
currency = "GEL",
currencyRate = 1,
accountId = credoPayId,
fee = 0,
paymentDate = trx_date,
personalNumber = personalNumber,
terminalId = terminalId.ToString(),
transactionId = invoiceID
};