Example #1
0
        private async Task <PaymentStatusResponse> GetPaymentStatus(string token)
        {
            var paymentStatusRequest = new PaymentStatusRequest(_setting.Value.MerchantId, _setting.Value.MerchantPassword, token);
            var httpClient           = _httpClientFactory.CreateClient();
            var nganLuongUrl         = _setting.Value.IsSandbox ? "https://sandbox.nganluong.vn:8088/nl35/service/order/check" : "https://www.nganluong.vn/service/order/check";
            var requestMesage        = new HttpRequestMessage(HttpMethod.Post, nganLuongUrl)
            {
                Content = paymentStatusRequest.MakePostContent()
            };
            var response = await httpClient.SendAsync(requestMesage);

            response.EnsureSuccessStatusCode();
            var contentString = await response.Content.ReadAsStringAsync();

            var paymentStatusResponse = JsonConvert.DeserializeObject <PaymentStatusResponse>(contentString);

            return(paymentStatusResponse);
        }