public AuthoriseResponse Respond(AuthStatus authStatus) { var cardNumber = new CardNumber(CardNumber); var response = new AuthoriseResponse() { Amount = Amount, CurrencyCode = CurrencyCode, AuthStatus = authStatus, TransactionId = Guid.NewGuid(), CardNetwork = cardNumber.CardNetwork, CardNumberEnding = cardNumber.Last4Digits(), TimeStampUtc = DateTime.UtcNow }; return(response); }
public static AuthoriseResponse CreateFailedResponse(AuthoriseRequest request, int retryAttempts) { var cardNumber = new CardNumber(request.CardNumber); var result = new AuthoriseResponse { Amount = request.Amount, CurrencyCode = request.CurrencyCode, AuthStatus = AuthStatus.Error, TransactionId = Guid.NewGuid(), CardNetwork = cardNumber.CardNetwork, CardNumberEnding = cardNumber.Last4Digits(), RetryAttempts = retryAttempts, TimeStampUtc = DateTime.UtcNow }; return(result); }
public static Transaction Create(AuthoriseResponse authoriseResponse, CardNumber cardNumber, UserAccount userAccount) { var transaction = new Transaction { TransactionId = authoriseResponse.TransactionId, Amount = authoriseResponse.Amount, AuthStatus = authoriseResponse.AuthStatus, CardNetwork = authoriseResponse.CardNetwork, CardNumber = cardNumber, CardNumberEnding = cardNumber.Last4Digits(), ClientId = userAccount.ClientId, UserId = userAccount.Id, CurrencyCode = authoriseResponse.CurrencyCode, TimeStampUtc = authoriseResponse.TimeStampUtc, RetryAttempts = authoriseResponse.RetryAttempts, ProcessingTimeMs = authoriseResponse.ProcessingTimeMs }; return(transaction); }