public IResponse Parse(string response) { var code = response.Substring(0, response.IndexOf(' ')); var text = response.Substring(response.IndexOf(' ')); return(_responseCreator.Create(code, text)); }
public TResponse Begin <TPayment, TResponse>( TPayment payment, IStartPaymentStrategy <TPayment, TResponse> paymentStrategy, IResponseCreator <TResponse> responseCreator) where TPayment : OnlinePayment where TResponse : IStartOnlinePaymentResponse { if (!IsItemValidToPurchase(payment)) { var errorResponse = responseCreator.Create(); errorResponse.AddError("Invalid item being paid for"); return(errorResponse); } var populatedOnlinePayment = GetPopulatedPayment(payment); var response = paymentStrategy.StartPayment(populatedOnlinePayment); _repository.Create(populatedOnlinePayment); return(response); }