Ejemplo 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*/
            VoidCall voidCall = new VoidCall(config, requestData);
            Dictionary <string, string> response = voidCall.Execute();

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

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

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

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

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

            authParams.Add("amount", "20.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");

            AuthCall authCall = new AuthCall(config, authParams);
            Dictionary <String, String> authResult = authCall.Execute();

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

            if (authResult["result"] == "success" && authResult["status"] == "NOT_SET_FOR_CAPTURE")
            {
                // CAPTURE
                Dictionary <String, String> captrueInputParams = new Dictionary <String, String>();
                captrueInputParams.Add("originalMerchantTxId", authResult["merchantTxId"]);
                captrueInputParams.Add("amount", "20.0");

                CaptureCall captureCall = new CaptureCall(config, captrueInputParams);
                Dictionary <String, String> captureResult = captureCall.Execute();
                if (captureResult["result"] == "success")
                {
                    // VOID
                    Dictionary <String, String> inputParams = new Dictionary <String, String>();
                    inputParams.Add("originalMerchantTxId", authResult["merchantTxId"]);
                    //inputParams.Add("country", "FR");
                    //inputParams.Add("currency", "EUR");

                    VoidCall call = new VoidCall(config, inputParams);
                    Dictionary <String, String> result = call.Execute();

                    Assert.AreEqual(result["result"], "success");
                }
            }
        }
        protected void Init(O data, T newValue, MethodInfo getter, MethodInfo setter, bool updateTree, bool updatePanel, VoidCall changed)
        {
            this.data        = data;
            this.newValue    = newValue;
            this.updatePanel = updatePanel;
            this.updateTree  = updateTree;

            this.get     = (Func <T>)Delegate.CreateDelegate(typeof(Func <T>), data, getter);
            this.set     = (Action <T>)Delegate.CreateDelegate(typeof(Action <T>), data, setter);
            this.changed = changed;
        }
        public ChangeValueTool(O data, T newValue, string getMethodName, string setMethodName, bool updateTree,
                               bool updatePanel, VoidCall changed)
        {
            var type = data != null?data.GetType() : typeof(O);

            var getter = type.GetMethod(getMethodName);
            var setter = type.GetMethod(setMethodName);

            if (typeof(T).IsAssignableFrom(getter.ReturnType) && setter.GetParameters().Length == 1 && typeof(T).IsAssignableFrom(setter.GetParameters()[0].ParameterType))
            {
                Init(data, newValue, getter, setter, updateTree, updatePanel, changed);
            }
        }
        public ChangeValueTool(O data, T newValue, string propertyName, bool updateTree,
                               bool updatePanel, VoidCall changed)

        {
            var type = data != null?data.GetType() : typeof(O);

            var property = type.GetProperty(propertyName);

            if (property != null && typeof(T).IsAssignableFrom(property.PropertyType))
            {
                Init(data, newValue, property.GetGetMethod(), property.GetSetMethod(), updateTree, updatePanel, changed);
            }
        }
 private static void Update(bool updateTree, bool updatePanel, VoidCall changed)
 {
     if (changed != null)
     {
         changed();
     }
     if (updateTree)
     {
         Controller.Instance.updateStructure();
     }
     if (updatePanel)
     {
         Controller.Instance.updatePanel();
     }
 }
 public ChangeValueTool(O data, T newValue, string getMethodName, string setMethodName, VoidCall changed) :
     this(data, newValue, getMethodName, setMethodName, false, true, changed)
 {
 }
 public ChangeValueTool(O data, T newValue, string propertyName, VoidCall changed) :
     this(data, newValue, propertyName, false, true, changed)
 {
 }
Ejemplo n.º 9
0
 static ObjectCall toObjectCall(VoidCall pVoidCall)
 {
     return (GameObject pObject) => pVoidCall();
 }
Ejemplo n.º 10
0
 public void addButtonUpVoidReceiver(VoidCall pPickEvent)
 {
     buttonUpEvent += toObjectCall(pPickEvent);
 }