Beispiel #1
0
        /// <summary>
        /// Creates the top up benefit.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public async Task <APIResponse> CreateTopUpBenefit(CreateTopUpBenefitRequest request)
        {
            try
            {
                var client = httpClientFactory.CreateClient(VendorServiceOperation.serviceName);

                var         param       = JsonConvert.SerializeObject(request);
                HttpContent contentPost = new StringContent(param, Encoding.UTF8, "application/json");

                var response = await client.PostAsync(servicesConfig.Vendor +
                                                      VendorServiceOperation.CreateTopUpBenefit(), contentPost);

                return(JsonConvert.DeserializeObject <APIResponse>(await response.Content.ReadAsStringAsync()));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'CreateTopUpBenefit()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }