public async Task<PaymentInstrumentResponse> GetPaymentInstrumentListAsync(PaymentInstrumentRequest request)
        {
            PaymentInstrumentResponse _response = new PaymentInstrumentResponse();
            HttpClient httpClient = setupHttpClient();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            string url = "api/bridge/payment/getpaymentinstrumentlist";
            try
            {
                var response = await httpClient.PostAsJsonAsync(url, request);
                _response = await response.Content.ReadAsAsync<PaymentInstrumentResponse>();
            }
            catch (Exception ex)
            {
                string error = "Failed to retrieve payment instrument list.\n" +
                               (ex.InnerException == null ? "" : ex.InnerException.Message);
                _log.Error(error);
                _response.StatusCode = "Error";
                _response.StatusDetail = error;
            }

            return _response;
        }
Example #2
0
        private string PaymentInstrumentJson()
        {
            using (StructureMap.IContainer cont = NestedContainer)
            {
                string json = "";

                var pir = new PaymentInstrumentRequest
                {
                    Id = Guid.NewGuid(),
                    DistributorCostCenterId = Using<IConfigService>(cont).Load().CostCentreId,
                    TransactionRefId = Guid.NewGuid().ToString(),
                    ClientRequestResponseType =
                        ClientRequestResponseType.PaymentInstrument,
                    SubscriberId = "tel:" + DistributorSubscriberNo,
                    DateCreated = DateTime.Now,
                    paymentInstrumentType = PaymentInstrumentType.all
                };
                _clientRequestResponses.Add(pir);

                json = JsonConvert.SerializeObject(pir, new IsoDateTimeConverter());
                return json;
            }
        }