Пример #1
0
        static void Main(string[] args)
        {
            Interswitch.Init(clientId, clientSecret, "http://qa.interswitchng.com");
            var token = Interswitch.GetToken();

            Console.WriteLine(token);
            object data = new
            {
                frontEndPartner         = "455",
                paymentMethodIdentifier = "E192F3F3B3BA4596BC9704C44EA801BC",
                amount                 = 500000,
                channel                = "ATM",
                macData                = "78e0ec06bdccacab629fbe725fc753364b8af4a15e3ebd1e5fd5c0d8b5e4d332",
                oneTimePin             = "1234",
                pinBlock               = "865d73eec7385017",
                secure                 = "814caf1b0d2951c3454cade6a27d2bddd5546126fae7d39889d26a95dc573adbfdd8d60a286cea90f71916e1577b7dd1ad3d98436ecbec50206fc100adf93793715fd0be7926f5029bf068da7b7f22f13127ba304b0431a59360b45f989e313db0f35d1f15dc9867606fec20c7fe55d464b12c5d4c35030cdc82c8db1ceff718f78577b1a74a7f4b50cd90eb58f4eed96a903412ce1e8a7c89d0e5b559635941dbfd2204777a26a09d8f9a099867c779f0426cf1357ebb6966f872dedfd92d4520f711719d1c57bb74d982b20af0dc9c6d0b95ff4b677f587aab9c67409d3d453a04cf33fa3c55b58eb27898a827bffd8d88fd185fe5075561832f6e70316628",
                subscriberId           = "2348124888436",
                tokenLifeTimeInMinutes = 1440,
                ttid            = 809,
                providerToken   = "LEBUCODE",
                transactionType = "payment"
            };
            var paycodeTokens = Interswitch.Send("/cardless-service/api/v1/cardless-services/tokens", "POST", data).Result;

            Console.WriteLine(paycodeTokens);

            Console.WriteLine("########################################################");
            var paycodeConfig = Interswitch.Send("/cardless-service/api/v1/admin/config", "GET", null).Result;

            Console.WriteLine(paycodeConfig);
            Console.ReadKey();
        }
 public QuickTellerDriver(string clientId, string clientSecret, string terminalId, string frontendPartnerId = "WEMA", string env = "staging")
 {
     this.ClientId          = clientId;
     this.ClientSecret      = clientSecret;
     this.FrontEndPartnerId = frontendPartnerId;
     Interswitch.Init(clientId, clientSecret, frontendPartnerId);
     this.TerminalId         = terminalId;
     Environment             = env;
     Interswitch.Environment = GetEnvironment(Environment);
 }
        static void Main(string[] args)
        {
            Interswitch.Init(clientId, clientSecret);
            var token = Interswitch.GetToken();

            Console.WriteLine(token);
            #region
            Console.WriteLine("************ Secure Data Starts here ****************");
            string[] secureData = Interswitch.GetSecureData("2347012345678", "1436", "6280511000000095", "1111", "111", "5004", "GTB00199212");
            Console.WriteLine(secureData[0]);
            Console.WriteLine(secureData[1]);

            hashMapSecure = new List <KeyValuePair <string, string> >();
            hashMapSecure.AddRange(new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>(Constants.ContentType, "application/json"),
                new KeyValuePair <string, string>("SignatureMethod", "SHA1"),
                new KeyValuePair <string, string>("terminalId", "3IWP0001")
            }
                                   );
            object doEnquiry = new
            {
                PaymentCode    = "10803",
                CustomerId     = "08124888436",
                CustomerEmail  = "*****@*****.**",
                CustomerMobile = "2348056731575",
                PageFlowValues = "",
                TerminalId     = "3IWP0076"
            };

            hashMap = new List <KeyValuePair <string, string> >();
            hashMap.AddRange(new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>(Constants.ContentType, "application/json"),
                new KeyValuePair <string, string>("SignatureMethod", "SHA1"),
                new KeyValuePair <string, string>("terminalId", "3IWP0001")
            }
                             );

            Console.WriteLine("Do Enquiry ....");
            var     enquiryResponse = Interswitch.Send("/quicktellerservice/api/v3/Transactions/DoInquiry", "GET", doEnquiry, token, hashMapSecure).Result;
            JObject json            = JObject.Parse(enquiryResponse.ToString());
            Console.WriteLine(json.GetValue("TransactionRef"));
            Console.WriteLine(enquiryResponse);
            Console.WriteLine("Do Enquiry done ....");


            #region
            object securePayment = new
            {
                TransactionRef = json.GetValue("TransactionRef"),
                SecureData     = secureData[1],
                PinData        = secureData[0],
                Msisdn         = "2348052678744",
                bankCbnCode    = "058",
                amount         = "100"
            };

            Console.WriteLine("****************************");
            Console.WriteLine("Send Payment with secure ....");
            var secureResponse = Interswitch.Send("/quicktellerservice/api/v3/Transactions/sendtransaction", "GET", securePayment, token, hashMap).Result;
            Console.WriteLine(secureResponse);
            Console.WriteLine("Send Payment with secure done ....");
            #endregion

            Console.WriteLine("************ Secure Data Ends here ****************");


            Console.WriteLine("##############################################");
            Console.WriteLine("#************ Pay Code Starts here **********#");
            var payCode = Interswitch.Send("/cardless-service/api/v1/cardless-services/tokens", "POST", securePayment, token, hashMap).Result;
            Console.WriteLine(payCode);
            Console.WriteLine("************ Pay Code Ends here ****************");
            #endregion
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Interswitch.Init(clientId, clientSecret, "https://qa.interswitchng.com");

            #region -- Get Token --
            var token = Interswitch.GetToken();
            #endregion

            #region --  Get Auth Data With Certificate --
            var certificatePath         = Environment.CurrentDirectory + "\\paymentgateway.cert";
            var authdataWithCertificate = Interswitch.GetAuthData("5060990580000217499", "1111", "2004", "111", certificatePath);
            Console.WriteLine("*******************************");
            Console.WriteLine("auth data With Certificate ");
            Console.WriteLine(authdataWithCertificate);
            Console.WriteLine("*******************************");
            #endregion

            #region -- Get Auth Data using Modulus and Exponent --
            var authdataWithModulusExponent = Interswitch.GetAuthData("5060990580000217499", "1111", "2004", "111", mod, pubExponent);
            Console.WriteLine("*******************************");
            Console.WriteLine("Auth Data with Modulus and Exponent");
            Console.WriteLine(authdataWithModulusExponent);
            Console.WriteLine("*******************************");
            #endregion

            #region --  Get Auth Data
            var authdata = Interswitch.GetAuthData("5060990580000217499", "1111", "2004", "111");
            Console.WriteLine("*******************************");
            Console.WriteLine("Auth Data ");
            Console.WriteLine(authdata);
            Console.WriteLine("*******************************");
            #endregion

            #region -- Initializing Payment Parameters --
            var rand = new Random();

            object paymentRequest = new
            {
                customerId     = "1234567890",
                amount         = "100",
                transactionRef = rand.Next(99999999),
                currency       = "NGN",
                authData       = authdata
            };
            #endregion

            #region  -- Sending Payment Without token --
            Console.WriteLine("****************************");
            Console.WriteLine("First overload method started ....");
            var response = Interswitch.Send("/api/v2/purchases", "POST", paymentRequest).Result;
            Console.WriteLine(response);
            Console.WriteLine("First overload method done ....");
            Console.WriteLine("****************************");
            Console.WriteLine("****************************");
            #endregion

            #region -- Sending Payment With Token --
            Console.WriteLine("Second overload method started ....");
            object paymentRequest2 = new
            {
                customerId     = "1234567890",
                amount         = "100",
                transactionRef = rand.Next(99999999),
                currency       = "NGN",
                authData       = authdata
            };

            var response2 = Interswitch.Send("/api/v2/purchases", "POST", paymentRequest2, token).Result;
            Console.WriteLine(response2);
            Console.WriteLine("Second overload method done ....");

            Console.WriteLine("****************************");
            #endregion

            #region -- Sending Payment With Token & Custom Headers --
            hashMap = new List <KeyValuePair <string, string> >();
            hashMap.AddRange(new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>(Constants.ContentType, "application/json"),
                new KeyValuePair <string, string>("SignatureMethod", "SHA1")
            }
                             );
            paymentRequest = new
            {
                customerId     = "1234567890",
                amount         = "120",
                transactionRef = rand.Next(99999999),
                currency       = "NGN",
                authData       = authdata
            };;
            var paymentWithTokenHeadersResponse = Interswitch.Send("/api/v2/purchases", "POST", paymentRequest, token, hashMap).Result;
            Console.WriteLine(paymentWithTokenHeadersResponse);
            Console.WriteLine("Sending Payment With Token & Custom Headers done ....");
            Console.WriteLine("****************************");

            Console.ReadKey();
            #endregion

            #region -- Sending Payment With Token, Custom Headers & Signed Parameter --
            hashMap = new List <KeyValuePair <string, string> >();
            hashMap.AddRange(new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>(Constants.ContentType, "application/json"),
                new KeyValuePair <string, string>("SignatureMethod", "SHA1")
            }
                             );

            var paymentWithTokenHeadersSignedParamentResponse = Interswitch.Send("/api/v2/purchases", "POST", paymentRequest, token, hashMap, "").Result;
            Console.WriteLine(paymentWithTokenHeadersSignedParamentResponse);
            Console.WriteLine(" Sending Payment With Token, Custom Headers & Signed Parameter done ....");
            Console.WriteLine("****************************");

            Console.ReadKey();
            #endregion
        }