Beispiel #1
0
        public void SimplePayTest()
        {
            IPayResult result = null;

            FB.Canvas.Pay("testProduct", callback: (r) => (result = r));
            Assert.IsNotNull(result);
        }
    protected void HandlePayResult(IPayResult result)
    {
        bool bSuccess = false;

        if (result == null)
        {
            //this.Status = "Null";
        }

        // Some platforms return the empty string instead of null.
        if (!string.IsNullOrEmpty(result.Error))
        {
            //this.Status = "Error";
        }
        else if (result.Cancelled)
        {
            //this.Status = "Cancelled";
        }
        else if (!string.IsNullOrEmpty(result.RawResult))
        {
            //this.Status = "Success";
            bSuccess = true;
            if (mDebug)
            {
                AN_PoupsProxy.ShowToast(result.RawResult);
            }
        }
        else
        {
            //this.Status = "Empty";
        }
        SDKMgr.Instance.SDKCallback.PayCallback(bSuccess);
    }
Beispiel #3
0
        public static IPayResult BuildSwiftPassWeChatPayResult()
        {
            if (_swiftPassWechatPayResult == null)
            {
                _swiftPassWechatPayResult = new SwiftPassWeChatPayResult();
            }

            return(_swiftPassWechatPayResult);
        }
Beispiel #4
0
        public static IPayResult BuildAllinpayResult()
        {
            if (_allinpayResult == null)
            {
                _allinpayResult = new AllinpayResult();
            }

            return(_allinpayResult);
        }
Beispiel #5
0
        public static IPayResult BuildWeChatPayResult()
        {
            if (_wechatPayResult == null)
            {
                _wechatPayResult = new WeChatPayResult();
            }

            return(_wechatPayResult);
        }
Beispiel #6
0
        public static IPayResult BuildSimulatePayResult()
        {
            if (_simulatePayResult == null)
            {
                _simulatePayResult = new SimulatePayResult();
            }

            return(_simulatePayResult);
        }
Beispiel #7
0
        public void SimplePayTest()
        {
            IPayResult result = null;

            FB.Canvas.Pay(
                "testProduct",
                callback : delegate(IPayResult r)
            {
                result = r;
            });
            Assert.IsNotNull(result);
        }
Beispiel #8
0
        public void CancelPayTest()
        {
            IPayResult result = null;

            var extras = new Dictionary <string, object>()
            {
                { ResultBase.ErrorCodeKey, ResultBase.CancelDialogCode },
            };

            this.Mock.ResultExtras = extras;
            FB.Canvas.Pay("testProduct", callback: (r) => (result = r));
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Cancelled);
        }
Beispiel #9
0
        public void ErrorPayTest()
        {
            IPayResult result = null;

            var extras = new Dictionary <string, object>()
            {
                { ResultBase.ErrorCodeKey, 1L },
                { ResultBase.ErrorMessageKey, "Test error message" },
            };

            this.Mock.ResultExtras = extras;
            FB.Canvas.Pay("testProduct", callback: (r) => (result = r));
            Assert.IsNotNull(result);
            Assert.AreEqual(result.ErrorCode, extras[PayResult.ErrorCodeKey]);
            Assert.AreEqual(result.Error, extras[PayResult.ErrorMessageKey]);
        }
Beispiel #10
0
 void LoginCallback(IPayResult result)
 {
     if (result.Error != null)
     {
         lastResponse = "Error Response:\n" + result.Error;
     }
     else if (!FB.IsLoggedIn)
     {
         lastResponse = "Login cancelled by Player";
     }
     else
     {
         lastResponse = "Login was successful!";
         if (loginForSharing)
         {
             loginForSharing = false;
             Share();
         }
     }
     Debug.Log(lastResponse);
 }
        //overriding the payment request with Facebook-specific return type and transaction id.
        private void OnPurchaseResult(IPayResult result)
        {
            if (result.ResultDictionary == null || result.ResultDictionary.Count == 0)
            {
                return;
            }
            if (!result.ResultDictionary.ContainsKey("payment_id"))
            {
                return;
            }

            PayForPurchaseRequest request = new PayForPurchaseRequest()
            {
                OrderId               = orderId,
                ProviderName          = storeId,
                Currency              = "RM",
                ProviderTransactionId = result.ResultDictionary["payment_id"].ToString()
            };

            PlayFabClientAPI.PayForPurchase(request, OnPurchaseResult, OnPurchaseFailed);
        }