Example #1
0
 public void Init(Action <string, bool> callback)
 {
     EB.Debug.Log("AlipaySDKManager.Init");
     if (mInitialized)
     {
         EB.Debug.LogWarning("AlipaySDKManager.Init: Initialized");
         callback(null, true);
         return;
     }
     if (Application.platform != RuntimePlatform.Android)
     {
         callback(null, false);
         return;
     }
     mInitCallback      += callback;
     Hub.RunInBackground = true;
     new GameObject("alipay_plugin_listener", typeof(SparxAlipaySDKManager));
     AlipaySDK.Init();
 }
Example #2
0
        public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int> callback)
        {
            EB.Debug.Log("AlipaySDKManager.Pay");
            if (!mInitialized)
            {
                //EB.Debug.LogError("AlipaySDKManager.Pay: not initialized");
                //callback(AlipaySDKResultCode.Failed);
                //return;
                IAPInit();
            }
            mPayCallback += callback;

            object extraInfo = EB.JSON.Parse(transaction.payload);
            string info      = EB.Dot.String("ret", extraInfo, string.Empty);

            int    je   = (int)item.cost;
            string mark = transaction.transactionId;
            string name = item.longName;

            EB.Debug.Log("AlipaySDKManager.Pay: je = {0}, mark={1}, name = {2}", je, mark, name);
            AlipaySDK.Pay(info);
        }
Example #3
0
 public void Login(Action <string, object> callback)
 {
     EB.Debug.Log("AlipaySDKManager.Login");
     if (!mInitialized)
     {
         EB.Debug.LogError("AlipaySDKManager.Login: not initialized");
         callback("AlipaySDKManager not initialized", null);
         return;
     }
     if (mLoggedIn)
     {
         Hashtable data = new Hashtable()
         {
             { "sessionid", mSid },
             { "accountid", mAid }
         };
         callback(null, data);
         return;
     }
     mAuthCallback      += callback;
     Hub.RunInBackground = true;
     AlipaySDK.Login(string.Empty);
 }