示例#1
0
 /// <summary>
 /// Sample string request
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public static string SampleStringRequest(this CRCRequest obj)
 {
     return("{\n\t\"Request\": \"{'@REQUEST_ID': '1','REQUEST_PARAMETERS': {   'REPORT_PARAMETERS': {      '@REPORT_ID': '6416',      '@SUBJECT_TYPE': '1', "
            + "     '@RESPONSE_TYPE': '5'   },   'INQUIRY_REASON': {      '@CODE': '1'   },   "
            + "'APPLICATION': {      '@PRODUCT': '017',      '@NUMBER': '232',      '@AMOUNT': '15000',      '@CURRENCY': 'NGN'   }},"
            + "'SEARCH_PARAMETERS': {   '@SEARCH-TYPE': '4',   'BVN_NO': '22151192670' }}\",\n\t\"UserName\": \"" + obj.Username + "\",\n\t\"Password\": \"" + obj.Password + "\"\n}\n\n");
 }
示例#2
0
        /// <summary>
        /// Test Extension Populates the Object with the Sample Request Parameters
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static CRCRequest SampleRequest(this CRCRequest obj)
        {
            string req = SampleStringRequest(obj);

            obj.Request = req;
            var sample = JsonConvert.DeserializeObject <CRCRequest>(req);
            var val    = sample.Request;

            //val = val.Replace("'@", "'").Replace("\"@", "\""); //Remove @ Symbol prefix from string
            sample.QueryParams = JsonConvert.DeserializeObject <QueryParams>(val); //Populate QueryParams with string
            return(sample);
        }
示例#3
0
        static void Main(string[] args)
        {
            ConfigureServices();
            string user = configuration["crc_username"];
            string pass = configuration["crc_password"];
            //Create a new Request And Populate it with the Sample Request

            var request = new CRCRequest {
                Username = user, Password = pass
            }.SampleRequest();

            var t = request.Send(true);

            t.Wait();
            CRCResponse response = t.Result;

            //Acess the results
            //response.ConsumerHitResponse.BODY.
            Console.ReadLine();
        }