Beispiel #1
0
        public async Task <VPATranslateResponse> testvpaEnquiry(VPAEnquiryRequest vrequest)
        {
            VPATranslateResponse vpaTranslateResponse = new VPATranslateResponse();
            Limit l = new Limit();

            l.amount   = 200;
            l.hasLimit = true;

            AssociatedVpas av = new AssociatedVpas();

            av.vpaId = "merchant2@bank3";
            av.limit = l;

            ContactInformation c = new ContactInformation();

            c.email = "*****@*****.**";
            c.phone = "08012345678";

            List <AssociatedVpas> avs = new List <AssociatedVpas>();

            avs.Add(av);

            IndividualInformation i = new IndividualInformation();

            i.bvn        = "12345678900987654123";
            i.firstName  = vrequest.instructedInstitutionCode;
            i.lastName   = "Olu";
            i.middleName = "Musa";

            MerchantInformation m = new MerchantInformation();

            m.companyName = "Jumia";
            m.rcNumber    = "RC1234";
            m.tin         = "";

            VPATranslateResponse v = new VPATranslateResponse();

            v.accountCurrency    = "NGN";
            v.accountName        = "Emeka Olu";
            v.accountNumber      = "0123456789";
            v.associatedVpas     = avs;
            v.contactInformation = c;
            v.error                 = "";
            v.errorDescription      = "";
            v.hasAssociatedVpas     = true;
            v.httpStatusCode        = 200;
            v.individualInformation = i;
            v.merchantInformation   = m;
            v.pspId                 = "bank1";
            v.vpaId                 = vrequest.targetVPA;
            v.vpaType               = "Individual";

            string json = JsonHelper.toJson(v);

            try
            {
                var    content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
                string result  = await content.ReadAsStringAsync();

                //vpaTranslateResponse = (VPATranslateResponse)JsonConvert.DeserializeObject(content);
                vpaTranslateResponse = JsonHelper.fromJson <VPATranslateResponse>(result);
            }
            catch (Exception ec)
            {
                testLogException(new VPAEnquiryException()
                {
                    action    = "Error deserializing translate response: " + json,
                    exception = ec.ToString(),
                    requestId = "Test",
                    logTime   = DateTime.Now
                });
            }
            return(vpaTranslateResponse);
        }
Beispiel #2
0
        public string testLogtranslate(string vpaid)
        {
            BsonValue bs = new BsonValue();

            try
            {
                // Open database (or create if not exits)
                using (var db = new LiteDatabase(@"MyData.db"))
                {
                    // Get requests collection
                    var translates = db.GetCollection <VPATranslateResponse>("translates");

                    Limit l = new Limit();
                    l.amount   = 200;
                    l.hasLimit = true;

                    AssociatedVpas av = new AssociatedVpas();
                    av.vpaId = "merchant2@bank3";
                    av.limit = l;

                    ContactInformation c = new ContactInformation();
                    c.email = "*****@*****.**";
                    c.phone = "08012345678";

                    List <AssociatedVpas> avs = new List <AssociatedVpas>();
                    avs.Add(av);

                    IndividualInformation i = new IndividualInformation();
                    i.bvn        = "12345678900987654123";
                    i.firstName  = "Emeka";
                    i.lastName   = "Olu";
                    i.middleName = "Musa";

                    MerchantInformation m = new MerchantInformation();
                    m.companyName = "Jumia";
                    m.rcNumber    = "RC1234";
                    m.tin         = "";

                    VPATranslateResponse v = new VPATranslateResponse();
                    v.accountCurrency    = "NGN";
                    v.accountName        = "Emeka Olu";
                    v.accountNumber      = "0123456789";
                    v.associatedVpas     = avs;
                    v.contactInformation = c;
                    v.error                 = "";
                    v.errorDescription      = "";
                    v.hasAssociatedVpas     = true;
                    v.httpStatusCode        = 200;
                    v.individualInformation = i;
                    v.merchantInformation   = m;
                    v.pspId                 = "bank1";
                    v.vpaId                 = vpaid;
                    v.vpaType               = "Individual";

                    // Insert new customer document (Id will be auto-incremented)
                    bs = translates.Insert(v);
                }
            }
            catch (Exception ex)
            {
            }
            return(bs.ToString());
        }