public async Task <IActionResult> Notify([ModelBinder(BinderType = typeof(PayFastNotifyModelBinder))] PayFastNotify payFastNotifyViewModel) { if (payFastNotifyViewModel != null) { Ok(); } int CustomerID = (int)TempData["CustomerID"]; payFastNotifyViewModel.SetPassPhrase(this.payFastSettings.PassPhrase); var calculatedSignature = payFastNotifyViewModel.GetCalculatedSignature(); var isValid = payFastNotifyViewModel.signature == calculatedSignature; logger.LogInformation($"Signature Validation Result: {isValid}"); var payfastValidator = new PayFastValidator(this.payFastSettings, payFastNotifyViewModel, this.HttpContext.Connection.RemoteIpAddress); var merchantIdValidationResult = payfastValidator.ValidateMerchantId(); logger.LogInformation($"Merchant Id Validation Result: {merchantIdValidationResult}"); var ipAddressValidationResult = await payfastValidator.ValidateSourceIp(); logger.LogInformation($"Ip Address Validation Result: {ipAddressValidationResult}"); // Currently seems that the data validation only works for success if (payFastNotifyViewModel.payment_status == PayFastStatics.CompletePaymentConfirmation) { var dataValidationResult = await payfastValidator.ValidateData(); logger.LogInformation($"Data Validation Result: {dataValidationResult}"); } if (payFastNotifyViewModel.payment_status == PayFastStatics.CancelledPaymentConfirmation) { logger.LogInformation($"Subscription was cancelled"); } repo.CustomerPaymentReceived(payFastNotifyViewModel.m_payment_id); return(Ok()); }