Exemplo n.º 1
0
        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*/
            GetAvailablePaymentSolutionsCall gaps     = new GetAvailablePaymentSolutionsCall(config, requestData);
            Dictionary <string, string>      response = gaps.Execute();

            //return the response data to web page
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Exemplo n.º 2
0
        public void GetAvailablePaymentSolutionsTestCall()
        {
            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

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

            inputParams.Add("country", CountryCode.FR.GetCode());
            inputParams.Add("currency", CurrencyCode.EUR.GetCode());

            //Do  GetAvailablePaymentSolutions
            GetAvailablePaymentSolutionsCall call   = new GetAvailablePaymentSolutionsCall(config, inputParams);
            Dictionary <String, String>      result = call.Execute();


            Assert.AreEqual(result["result"], "success");
        }