Example #1
0
        public void VerifyTestCall()
        {
            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

            // TOKENIZE
            Dictionary <String, String> inputParams = new Dictionary <string, string>();

            inputParams.Add("number", "5424180279791732");
            inputParams.Add("nameOnCard", "mastercard");
            inputParams.Add("expiryYear", "2021");
            inputParams.Add("expiryMonth", "04");

            TokenizeCall tokenizeCall = new TokenizeCall(config, inputParams);
            Dictionary <String, String> tokenizeResult = tokenizeCall.Execute();

            Dictionary <String, String> authParams = new Dictionary <String, String>();

            authParams.Add("amount", "0");
            authParams.Add("channel", Channel.ECOM.GetCode());
            authParams.Add("country", CountryCode.PL.GetCode());
            authParams.Add("currency", CurrencyCode.PLN.GetCode());
            authParams.Add("paymentSolutionId", "500");
            authParams.Add("customerId", tokenizeResult["customerId"]);
            authParams.Add("specinCreditCardToken", tokenizeResult["cardToken"]);
            authParams.Add("specinCreditCardCVV", "111");
            authParams.Add("merchantNotificationUrl", "http://localhost:8080/api/TransactionResultCallback");

            //Do verify
            VerifyCall call = new VerifyCall(config, authParams);
            Dictionary <String, String> result = call.Execute();

            Assert.AreEqual(result["result"], "success");
        }
        public async Task <object> Post()
        {
            /* Get request paramters from HttpContent object, parse it to dictionary format*/
            HttpContent requestContent = Request.Content;
            string      res            = requestContent.ReadAsStringAsync().Result;
            Dictionary <String, String> requestData = Tools.requestToDictionary(res);

            /*Init appliction configuration, get a config object*/
            string merchantID = Properties.Settings.Default.merchantId;
            string password   = Properties.Settings.Default.password;
            string merchantNotificationUrl = Properties.Settings.Default.merchantNotificationUrl;
            string allowOriginUrl          = Properties.Settings.Default.allowOriginUrl;
            string merchantLandingPageUrl  = Properties.Settings.Default.merchantLandingPageUrl;
            string environment             = Properties.Settings.Default.TurnkeySdkConfig;

            ApplicationConfig config = new ApplicationConfig(merchantID, password, allowOriginUrl, merchantNotificationUrl,
                                                             merchantLandingPageUrl, environment);

            /*Execute the action call and get the response*/
            VerifyCall verify = new VerifyCall(config, requestData);
            Dictionary <string, string> response = verify.Execute();

            //return the response data to web page
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }