public IActionResult Post(FinaliseTransactionRequest dto)
        {
            var    paymentReponse = MockProcessPayment(dto);
            string url            = "https://localhost:44345/BankPayment?bankSimTransactionId=" + paymentReponse.BankSimTransactionId;

            return(Created(url, paymentReponse));
        }
示例#2
0
        public Task <FinaliseTransactionResponse> Charge(FinaliseTransactionRequest dto)
        {
            var response                    = _postToSecureHttpEndpointWithRetries.Post(apiClientUrl: "https://localhost:44345/BankPayment", idServerUrl: "https://localhost:5001", "bankSimClient", "secret", "BankSimApi", dto);
            var responseContent             = response.Content.ReadAsStringAsync().Result;
            var deserializedResponseContent = JsonConvert.DeserializeObject <FinaliseTransactionResponse>(responseContent);

            //if (response.IsSuccessStatusCode)
            return(Task.FromResult(deserializedResponseContent));
        }
        private FinaliseTransactionResponse MockProcessPayment(FinaliseTransactionRequest dto)
        {
            // idempotency check

            // encapsulate entity setup and validationChecks
            //payment.Setup(values)

            //process payment
            return(new FinaliseTransactionResponse()
            {
                BankSimTransactionId = Guid.NewGuid().ToString(), Success = true
            });
        }