I am attempting to create a model for SagePay notifications. I know that the MVC model binder will automatically bind all of my properties based on the POST names.
The SagePay system passes the following form names:
Status
VendorTxCode
VPSTxId
VPSSignature
StatusDetail
AVSCV2
AddressResult
PostCodeResult
CV2Result
GiftAid
3DSecureStatus
CAVV
AddressStatus
PayerStatus
CardType
Last4Digits
DeclineCode
ExpiryDate
FraudResponse
BankAuthCode
I have created the following class.
public class NotificationModel
{
public string Status { get; set; }
public string VendorTxCode { get; set; }
public string VPSTxId { get; set; }
public string VPSSignature { get; set; }
public string StatusDetail { get; set; }
public string AVSCV2 { get; set; }
public string AddressResult { get; set; }
public string PostCodeResult { get; set; }
public string CV2Result { get; set; }
public string GiftAid { get; set; }
// When binding the model will MVC ignore the underscore?
public string _3DSecureStatus { get; set; }
public string CAVV { get; set; }
public string AddressStatus { get; set; }
public string PayerStatus { get; set; }
public string CardType { get; set; }
public string Last4Digits { get; set; }
public string DeclineCode { get; set; }
public string ExpiryDate { get; set; }
public string FraudResponse { get; set; }
public string BankAuthCode { get; set; }
}
Unfortunately a c# property name can't begin with a number. How can I get the model binder to automatically bind the 3DSecureStatus post name to a property?