コード例 #1
0
        public static void getBuyDirectInfo(this Sprite that,
                                            Client client, string facebookuserid,

                                            string item_name = "Operation Heat Zeeker - Shotgun",
                                            string itemKey   = "Shotgun3",

                                            Action <Uri> yield_paypalurl = null
                                            )
        {
            Console.WriteLine("before getBuyDirectInfo " + new { client.connectUserId, facebookuserid });

            // error: { errorID = 0, error = NotImplementedException: __CallSite.Create, e = [UncaughtErrorEvent type="uncaughtError" bubbles=true cancelable=true eventPhase=2] }

            var purchaseArguments = new DynamicContainer {
                Subject = new object()
            };

            purchaseArguments["currency"]  = "USD";
            purchaseArguments["item_name"] = item_name + " [for http://www.facebook.com/profile.php?id=" + facebookuserid + "]";

            var item = new item_object();

            // .99 USD
            item.itemKey = itemKey;

            var items = new object[] { item };

            Action <dynamic> callback = info =>
            {
                string paypalurl = info.paypalurl;

                Console.WriteLine("getBuyDirectInfo callback " + new { paypalurl });

                var uri = new Uri(paypalurl);

                if (yield_paypalurl != null)
                {
                    yield_paypalurl(uri);
                }
            };

            Action <PlayerIOError> errorHandler = e =>
            {
                Console.WriteLine("getBuyDirectInfo errorHandler " + e);


                //that.content.bg_shotgun.Fill = System.Windows.Media.Brushes.Red;
            };


            Console.WriteLine("just before getBuyDirectInfo");

            // error: { errorID = 0, message = Unable to connect to the API due to securityError. Please verify that your internet connection is working! }
            // getBuyDirectInfo errorHandler Error: Items with keys [shotgun1] do not exist in PayVaultItems
            // etBuyDirectInfo errorHandler Error: Missing 'currency' in purchaseArguments. It should be a currency code supported by PayPal, such as 'USD'. The price is found in the PayVault items property 'Price[currency]', such as 'PriceUSD'

            client.payVault.getBuyDirectInfo(
                provider: "paypal",
                purchaseArguments: purchaseArguments.Subject,
                items: items,
                callback: callback.ToFunction(),
                errorHandler: errorHandler.ToFunction()
                );

            Console.WriteLine("after getBuyDirectInfo");
        }
コード例 #2
0
        public static void getBuyDirectInfo(this Sprite that,
            Client client, string facebookuserid,

            string item_name = "Operation Heat Zeeker - Shotgun",
            string itemKey = "Shotgun3",

            Action<Uri> yield_paypalurl = null
            )
        {
            Console.WriteLine("before getBuyDirectInfo " + new { client.connectUserId, facebookuserid });

            // error: { errorID = 0, error = NotImplementedException: __CallSite.Create, e = [UncaughtErrorEvent type="uncaughtError" bubbles=true cancelable=true eventPhase=2] }

            var purchaseArguments = new DynamicContainer { Subject = new object() };

            purchaseArguments["currency"] = "USD";
            purchaseArguments["item_name"] = item_name + " [for http://www.facebook.com/profile.php?id=" + facebookuserid + "]";

            var item = new item_object();

            // .99 USD
            item.itemKey = itemKey;

            var items = new object[] { item };

            Action<dynamic> callback = info =>
            {
                string paypalurl = info.paypalurl;

                Console.WriteLine("getBuyDirectInfo callback " + new { paypalurl });

                var uri = new Uri(paypalurl);

                if (yield_paypalurl != null)
                    yield_paypalurl(uri);
            };

            Action<PlayerIOError> errorHandler = e =>
            {
                Console.WriteLine("getBuyDirectInfo errorHandler " + e);


                //that.content.bg_shotgun.Fill = System.Windows.Media.Brushes.Red;
            };


            Console.WriteLine("just before getBuyDirectInfo");

            // error: { errorID = 0, message = Unable to connect to the API due to securityError. Please verify that your internet connection is working! }
            // getBuyDirectInfo errorHandler Error: Items with keys [shotgun1] do not exist in PayVaultItems
            // etBuyDirectInfo errorHandler Error: Missing 'currency' in purchaseArguments. It should be a currency code supported by PayPal, such as 'USD'. The price is found in the PayVault items property 'Price[currency]', such as 'PriceUSD'

            client.payVault.getBuyDirectInfo(
                provider: "paypal",
                purchaseArguments: purchaseArguments.Subject,
                items: items,
                callback: callback.ToFunction(),
                errorHandler: errorHandler.ToFunction()
            );

            Console.WriteLine("after getBuyDirectInfo");
        }