Пример #1
0
 public void HandleFinishTransaction(ProductDefinition product, GooglePurchase googlePurchase, GoogleBillingResult billingResult, string purchaseToken)
 {
     if (!m_ProcessedPurchaseToken.Contains(purchaseToken))
     {
         if (billingResult.responseCode == GoogleBillingResponseCode.k_Ok)
         {
             m_ProcessedPurchaseToken.Add(purchaseToken);
             CallPurchaseSucceededUpdateReceipt(product, googlePurchase, purchaseToken);
         }
         else if (IsResponseCodeInRecoverableState(billingResult))
         {
             FinishTransaction(product, purchaseToken);
         }
         else
         {
             m_StoreCallback?.OnPurchaseFailed(
                 new PurchaseFailureDescription(
                     product.storeSpecificId,
                     PurchaseFailureReason.Unknown,
                     billingResult.debugMessage + " {code: " + billingResult.responseCode + ", M: GPSFTS.HFT}"
                     )
                 );
         }
     }
 }
Пример #2
0
 void purchaseSucceededEvent(GooglePurchase purchase)
 {
     if (Debug.isDebugBuild)
     {
         Debug.Log("purchaseSucceededEvent: " + purchase);
     }
 }
Пример #3
0
    void android_purchaseSucceededEvent(GooglePurchase purchase)
    {
        if (purchase.purchaseState == GooglePurchase.GooglePurchaseState.Purchased)
        {
            if (purchase.productId == BillingItemsIds.coin_01)
            {
                WalletController.addCoins(100f);
            }
            else if (purchase.productId == BillingItemsIds.coin_02)
            {
                WalletController.addCoins(1000f);
            }
            else if (purchase.productId == BillingItemsIds.coin_03)
            {
                WalletController.addCoins(10000f);
            }
            else if (purchase.productId == BillingItemsIds.coin_04)
            {
                WalletController.addCoins(100000f);
            }

            BillingManager.consumeItem(purchase.productId);

            StoreInterface.updateCoin();
        }
    }
Пример #4
0
    void purchaseSucceededEvent(GooglePurchase purchase)
    {
        Debug.Log("purchaseSucceededEvent: " + purchase);

        if (purchase.productId == "com.joywinggames.maydayaos001")
        {
            StartCoroutine(Manager.GetComponent <PurchaseManager>().SendPurchasedLog20(purchasedData, purchasedSiganture));
        }
        if (purchase.productId == "com.joywinggames.maydayaos002")
        {
            StartCoroutine(Manager.GetComponent <PurchaseManager>().SendPurchasedLog50(purchasedData, purchasedSiganture));
        }
        if (purchase.productId == "com.joywinggames.maydayaos003")
        {
            StartCoroutine(Manager.GetComponent <PurchaseManager>().SendPurchasedLog100(purchasedData, purchasedSiganture));
        }
        if (purchase.productId == "com.joywinggames.maydayaos004")
        {
            StartCoroutine(Manager.GetComponent <PurchaseManager>().SendPurchasedLog300(purchasedData, purchasedSiganture));
        }
        if (purchase.productId == "com.joywinggames.maydayaos005")
        {
            StartCoroutine(Manager.GetComponent <PurchaseManager>().SendPurchasedLog1000(purchasedData, purchasedSiganture));
        }
    }
    // 소모하지 않은 내역있다마 소모 처리하기
    void CheckConsumePayment()
    {
        UserEditor.Getsingleton.EditLog("NONE Consumed Product count :  " + lst_NoneConsumedProduct.Count);


        if (lst_NoneConsumedProduct.Count > 0)
        {
            //로딩바 돌리자
            Loadmanager.instance.LoadingUI(true);

            for (int i = 0; i < lst_NoneConsumedProduct.Count; i++)
            {
                UserEditor.Getsingleton.EditLog("NONE Consumed Product :  " + lst_NoneConsumedProduct[i].productId + " / " + "product State : " + lst_NoneConsumedProduct[i].purchaseState);

                GooglePurchase nonConsumePt = lst_NoneConsumedProduct[i];



                if (nonConsumePt.purchaseState == GooglePurchase.GooglePurchaseState.Purchased)
                {
                    UserEditor.Getsingleton.EditLog("구매 완료했던 내역 소모처리 :  " + nonConsumePt);

                    //웹서버에 구매영수증 보냄
                    webRequest.ShopBuyItem(Get_GemShopIdx(lst_NoneConsumedProduct[i].productId), lst_NoneConsumedProduct[i].originalJson,
                                           lst_NoneConsumedProduct[i].signature, () => callback_complete_NoneConsumeProduct(nonConsumePt));
                }
                //임시
                //GoogleIAB.consumeProduct(lst_NoneConsumedProduct[i].productId);
            }
        }
    }
Пример #6
0
    void queryInventorySucceededEvent(List <GooglePurchase> purchases, List <GoogleSkuInfo> skus)
    {
        Debug.Log(string.Format("queryInventorySucceededEvent. total purchases: {0}, total skus: {1}", purchases.Count, skus.Count));
        for (int i = 0; i < skus.Count; i++)
        {
            GoogleSkuInfo sku = skus[i];
            foreach (ShopGoldInfo info in mGoldList)
            {
                if (info.productCode.Equals(sku.productId))
                {
                    info.priceDesc = sku.price;
                }
            }
        }
        IsSupported = true;
        InitGoldList();
//		Prime31.Utils.logObject( purchases );
//		Prime31.Utils.logObject( skus );
        if (purchases.Count > 0)
        {
            mPurchase = purchases[0];
            foreach (ShopGoldInfo info in mGoldList)
            {
                if (info.productCode.Equals(mPurchase.productId))
                {
                    mItemcode = info.productCode;
                    mItemname = info.productName;
                    purchaseSucceededEvent(mPurchase);
                    break;
                }
            }
        }
    }
Пример #7
0
 internal GoogleConsumeResponseListener(ProductDefinition product, GooglePurchase purchase, Action <ProductDefinition, GooglePurchase, IGoogleBillingResult, string> onConsumeResponseAction)
     : base(k_AndroidConsumeResponseListenerClassName)
 {
     m_Product           = product;
     m_Purchase          = purchase;
     m_OnConsumeResponse = onConsumeResponseAction;
 }
 void purchaseSucceededEvent(GooglePurchase purchase)
 {
     Debug.Log("purchaseSucceededEvent: " + purchase);
     //GameObject.Find("Axis/Camera/Match").SendMessage("GetPurchaseData",purchase.originalJson);
     //GameObject.Find("Axis/Camera/Match").SendMessage("GetPurchaseBuyCode",purchase.orderId);
     //GoogleIAB.consumeProduct(Productid);
 }
Пример #9
0
        void OnReceiptVerificationComplete()
        {
            Debug.Log("OnReceiptVerificationComplete");
            KongregateAPI kongregate = KongregateAPI.GetAPI();
            // we keep a list of transactions here so that we don't run into race conditions
            Dictionary <string, object> stillInVerification = new Dictionary <string, object> ();

            foreach (var transactionId in mTransactionsInVerification.Keys)
            {
                string status = kongregate.Mtx.ReceiptVerificationStatus(transactionId);
                if (status != KongregateAPI.RECEIPT_VERIFICATION_STATUS_PROCESSING)
                {
                    Debug.Log("Verification for " + transactionId + " is " + status);
                                        #if UNITY_IPHONE
                    if (status == KongregateAPI.RECEIPT_VERIFICATION_STATUS_VALID)
                    {
                        StoreKitTransaction transaction = (StoreKitTransaction)mTransactionsInVerification[transactionId];
                        KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_SUCCESS,
                                                                        transactionId, getPurchaseFields());

                        // Below is an alternative iOS FinishPurchase() call. This version may be used if your plugin
                        // does not make the transaction Id available or finishes the transaction before passing control
                        // back to Unity. FinishPurchase() is preferred because purchase details may be pulled directly from
                        // the transaction.

                        // KongregateAPI.GetAPI().Analytics.FinishPurchaseWithProductId(KongregateAPI.PURCHASE_SUCCESS,
                        //  transaction.productIdentifier, transaction.base64EncodedTransactionReceipt, getPurchaseFields());
                    }
                    else if (status == KongregateAPI.RECEIPT_VERIFICATION_STATUS_INVALID)
                    {
                        KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_RECEIPT_FAIL,
                                                                        transactionId, getPurchaseFields());
                    }
                    // call to finish the transaction regardless of it we are valid or not
                    StoreKitBinding.finishPendingTransaction(transactionId);
                                        #elif UNITY_ANDROID
                    GooglePurchase transaction = (GooglePurchase)mTransactionsInVerification [transactionId];
                    if (status == KongregateAPI.RECEIPT_VERIFICATION_STATUS_VALID)
                    {
                        KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_SUCCESS,
                                                                        transaction.originalJson, getPurchaseFields(), transaction.signature);
                    }
                    else if (status == KongregateAPI.RECEIPT_VERIFICATION_STATUS_INVALID)
                    {
                        KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_RECEIPT_FAIL,
                                                                        transaction.originalJson, getPurchaseFields());
                    }
                    // call to finish transaction regardless of it we are valid or not
                    GoogleIAB.consumeProduct(transaction.productId);
                                        #endif
                    mPurchaseReady = true;
                }
                else
                {
                    Debug.Log("Still waiting on verification for " + transactionId);
                    stillInVerification [transactionId] = mTransactionsInVerification [transactionId];
                }
            }
            mTransactionsInVerification = stillInVerification;
        }
Пример #10
0
    public void RemoveRcoveryItemData(GooglePurchase ConsumeItem)
    {
        this.m_bRecovery = false;
        if (this.m_RecoveryItem != null)
        {
            this.m_RecoveryItem = null;
        }
        this.m_PurchaseList.Remove(ConsumeItem.productId);
        if (NrTSingleton <GameGuideManager> .Instance.ExecuteGuide)
        {
            GameGuideDlg gameGuideDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.GAMEGUIDE_DLG) as GameGuideDlg;

            if (gameGuideDlg != null)
            {
                if (NrTSingleton <GameGuideManager> .Instance.ContinueCheck(GameGuideType.PURCHASE_RESTORE))
                {
                    gameGuideDlg.SetTalkText();
                }
                else
                {
                    gameGuideDlg.ClickClose(null);
                }
            }
        }
        else
        {
            NrTSingleton <GameGuideManager> .Instance.RemoveGuide(GameGuideType.PURCHASE_RESTORE);
        }
    }
 internal GoogleAcknowledgePurchaseListener(ProductDefinition product, GooglePurchase purchase, Action <ProductDefinition, GooglePurchase, GoogleBillingResult> onAcknowledgePurchaseResponseAction)
     : base(k_AndroidAcknowledgePurchaseResponseListenerClassName)
 {
     m_Product  = product;
     m_Purchase = purchase;
     m_OnAcknowledgePurchaseResponse = onAcknowledgePurchaseResponseAction;
 }
Пример #12
0
    void queryInventorySucceededEvent(List <GooglePurchase> purchases, List <GoogleSkuInfo> skus)
    {
        Dictionary <string, PurchaseData> inventory = new Dictionary <string, PurchaseData>();

        Prime31.Utils.logObject(purchases);
        Prime31.Utils.logObject(skus);

        ShopEvents.purchasedProductIds = new ArrayList();

        for (int i = 0; i < purchases.Count; i++)
        {
            GooglePurchase purchase = purchases[i];
            ShopEvents.purchasedProductIds.Add(purchase.productId);
        }

        for (int i = 0; i < skus.Count; i++)
        {
            GoogleSkuInfo sku          = skus[i];
            PurchaseData  purchaseData = new PurchaseData();
            string        productId    = sku.productId;
            string        id           = GetIdFromProductId(productId);

            purchaseData.id          = id;
            purchaseData.name        = sku.title;
            purchaseData.description = sku.description;
            purchaseData.price       = sku.price;
            purchaseData.productId   = productId;
            inventory.Add(id, purchaseData);
        }
        ShopEvents.QueryInventorySucceeded(inventory);
    }
Пример #13
0
 // Fired when a purchase succeeds
 public void purchaseSucceededEvent(GooglePurchase purchase)
 {
     Debug.Log("GoogleIABManager:purchaseSucceededEvent product: " + purchase.productId);
     SetContentAccessPermissions(purchase.productId);
     GoogleIAB.consumeProduct(purchase.productId);
     purchaseProcessCompleted = true;
     //HandleSuccess();
 }
Пример #14
0
 void ApplyOnPurchases(IEnumerable <AndroidJavaObject> purchases, IGoogleBillingResult billingResult, Action <GooglePurchase, string> action)
 {
     foreach (var purchase in purchases)
     {
         GooglePurchase googlePurchase = GooglePurchaseHelper.MakeGooglePurchase(m_GoogleCachedQuerySkuDetailsService.GetCachedQueriedSkus().ToList(), purchase);
         action(googlePurchase, billingResult.debugMessage);
     }
 }
Пример #15
0
 void ApplyOnPurchases(IEnumerable <AndroidJavaObject> purchases, Action <GooglePurchase> action)
 {
     foreach (var purchase in purchases)
     {
         GooglePurchase googlePurchase = GooglePurchaseHelper.MakeGooglePurchase(m_GoogleCachedQuerySkuDetailsService.GetCachedQueriedSkus().ToList(), purchase);
         action(googlePurchase);
     }
 }
Пример #16
0
 public void queryInventorySucceeded(string json)
 {
     if (GoogleIABManager.queryInventorySucceededEvent != null)
     {
         Dictionary <string, object> dictionary = json.dictionaryFromJson();
         GoogleIABManager.queryInventorySucceededEvent(GooglePurchase.fromList(dictionary["purchases"] as List <object>), GoogleSkuInfo.fromList(dictionary["skus"] as List <object>));
     }
 }
Пример #17
0
 public void ConsumeFailedItemData(GooglePurchase ConsumeItem)
 {
     this.RemoveRcoveryItemData(ConsumeItem);
     if (!this.m_ConsumeFailedList.Contains(ConsumeItem))
     {
         this.m_ConsumeFailedList.Add(ConsumeItem);
     }
 }
Пример #18
0
    void purchaseSucceededEvent(GooglePurchase purchase)
    {
        ShopEvents.purchasedProductIds.Add(purchase.productId);
        string id = GetIdFromProductId(purchase.productId);

        ShopEvents.PurchaseSucceeded(id);
        Debug.Log("purchaseSucceededEvent: " + purchase);
    }
Пример #19
0
 void CallPurchaseSucceededUpdateReceipt(ProductDefinition product, GooglePurchase googlePurchase, string purchaseToken)
 {
     m_StoreCallback?.OnPurchaseSucceeded(
         product.storeSpecificId,
         googlePurchase.receipt,
         purchaseToken
         );
 }
Пример #20
0
 void purchaseSucceededEvent(GooglePurchase purchase)
 {
     Debug.Log("purchaseSucceededEvent: " + purchase.packageName + " | " + purchase.orderId + " | " + purchase.productId + ", token: " + purchase.purchaseToken);
     InAppPersistenceManager.instance.SetPurchaseInfo(purchase.productId, InAppPersistenceManager.InAppPersistenceState.purchase_verification_pending);
     productID = purchase.productId;
     BillingManager.instance.HandlePurchase(null, productID); //modificado porque no tenemos backend
     //BillingManager.instance.CallVerificationBackendService(Trunk.verificationURL + Trunk.userToken, productID, purchase.purchaseToken, "1", onVerificationSucceeded, onVerificationError);
 }
Пример #21
0
 public void queryInventorySucceeded(string json)
 {
     if (queryInventorySucceededEvent != null)
     {
         var dict = json.dictionaryFromJson();
         queryInventorySucceededEvent(GooglePurchase.fromList(dict["purchases"] as List <object>), GoogleSkuInfo.fromList(dict["skus"] as List <object>));
     }
 }
Пример #22
0
    //////////////////// B. 결제 성공 / 실패 ////////////////////////////////////////////////////////////

    /* 결제 성공 시 호출되는 콜백 함수.
     * GoogleIAB.purchaseProduct(purchaseKey); 실행 후 호출되는 콜백 함수.
     * 반드시 소비 요청  GoogleIAB.consumeProduct(productId); 을 해야 재구매가 가능.
     */
    #region
    void purchaseSucceededEvent(GooglePurchase purchase)
    {
        Debug.Log("purchaseSucceededEvent: " + purchase);


        // 해당 Product ID 의 소비 요청 반드시 시작 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.
        GoogleIAB.consumeProduct(purchase.productId);
    }
 void purchaseSucceededEvent(GooglePurchase purchase)
 {
     Debug.Log("purchaseSucceededEvent: " + purchase);
     gpderID     = purchase.orderId;
     gpproduceID = purchase.productId;
     Debug.Log("order id is :" + gpderID);
     iabPurchaseFinish(0, "purchase Success");
     GoogleIAB.consumeProduct(purchase.productId);
 }
Пример #24
0
    // This is invoked automatically when succesful purchase is ready to be processed
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    {
        // NOTE: this code does not account for purchases that were pending and are
        // delivered on application start.
        // Production code should account for such case:
        // More: https://docs.unity3d.com/ScriptReference/Purchasing.PurchaseProcessingResult.Pending.html

        if (!IsInitialized)
        {
            return(PurchaseProcessingResult.Complete);
        }

        // Test edge case where product is unknown
        if (e.purchasedProduct == null)
        {
            Debug.LogWarning("Attempted to process purchasewith unknown product. Ignoring");
            return(PurchaseProcessingResult.Complete);
        }

        // Test edge case where purchase has no receipt
        if (string.IsNullOrEmpty(e.purchasedProduct.receipt))
        {
            Debug.LogWarning("Attempted to process purchase with no receipt: ignoring");
            return(PurchaseProcessingResult.Complete);
        }

        Debug.Log("Processing transaction: " + e.purchasedProduct.transactionID);

        // Deserialize receipt
        var googleReceipt = GooglePurchase.FromJson(e.purchasedProduct.receipt);

        // Invoke receipt validation
        // This will not only validate a receipt, but will also grant player corresponding items
        // only if receipt is valid.
        PlayFabClientAPI.ValidateGooglePlayPurchase(new ValidateGooglePlayPurchaseRequest()
        {
            // Pass in currency code in ISO format
            CurrencyCode = e.purchasedProduct.metadata.isoCurrencyCode,
            // Convert and set Purchase price
            PurchasePrice = (uint)(e.purchasedProduct.metadata.localizedPrice * 100),
            // Pass in the receipt
            ReceiptJson = googleReceipt.PayloadData.json,
            // Pass in the signature
            Signature = googleReceipt.PayloadData.signature
        }, result => {
            UpdatePremiumCurrency();
            Debug.Log("Validation successful!");
        },
                                                    error =>
        {
            Debug.Log("Validation failed: " + error.GenerateErrorReport());
        }
                                                    );

        return(PurchaseProcessingResult.Complete);
    }
Пример #25
0
 void OnPurchaseFailed(GooglePurchase googlePurchase, string debugMessage)
 {
     m_GooglePurchaseCallback.OnPurchaseFailed(
         new PurchaseFailureDescription(
             googlePurchase.sku,
             PurchaseFailureReason.Unknown,
             debugMessage + " {M: GPUL.OPF}"
             )
         );
 }
Пример #26
0
 void OnPurchaseCanceled(GooglePurchase googlePurchase)
 {
     m_GooglePurchaseCallback.OnPurchaseFailed(
         new PurchaseFailureDescription(
             googlePurchase.sku,
             PurchaseFailureReason.UserCancelled,
             GoogleBillingStrings.errorUserCancelled
             )
         );
 }
Пример #27
0
 void OnPurchaseAlreadyOwned(GooglePurchase googlePurchase)
 {
     m_GooglePurchaseCallback.OnPurchaseFailed(
         new PurchaseFailureDescription(
             googlePurchase.sku,
             PurchaseFailureReason.DuplicateTransaction,
             GoogleBillingStrings.errorItemAlreadyOwned
             )
         );
 }
Пример #28
0
    void PurchaseSucceeded(GooglePurchase purchase)
    {
        // cache the purchase to use when the skuInfo is discovered
        savedPurchase = purchase;

        // get the sku info in order to complete logging the transaction
        GoogleIABManager.queryInventorySucceededEvent += GetSkuInfo;
        GoogleIABManager.queryInventoryFailedEvent    += GetSkuFailed;
        StartCoroutine(GetProductInfo(0.5f));         //delay call to give developers time to do processing themselves
    }
Пример #29
0
    //////////////////// C. 소비 요청 성공 / 실패 ////////////////////////////////////////////////////////////

    /*
     * 소비 요청 성공 시 호출되는 콜백 함수.
     */
    #region
    void consumePurchaseSucceededEvent(GooglePurchase purchase)
    {
        Debug.Log("consumePurchaseSucceededEvent: " + purchase);
        Debug.Log("purchase.orderId=" + purchase.orderId);
        Debug.Log("purchase.productId=" + purchase.productId);

        g.isPurchaseSucceed = true;
        g.purchaseOrderId   = purchase.orderId;
        g.purchaseProductId = purchase.productId;
    }
Пример #30
0
    void PurchaseSucceeded(GooglePurchase purchase)
    {
        // get the sku info in order to complete logging the transaction
        string[] skus = { purchase.productId };
        GoogleIABManager.queryInventorySucceededEvent += GetSkuInfo;
        GoogleIAB.queryInventory(skus);

        // cache the purchase to use when the skuInfo is discovered
        savedPurchase = purchase;
    }
Пример #31
0
        // fired when a purchase succeeds, Android version.
        // Optionally: verify new product transaction online
        private void PurchaseSucceeded(GooglePurchase prod)
        {
            string id = GetIAPIdentifier(prod.productId);

            if ((verificationType == VerificationType.onPurchase || verificationType == VerificationType.both)
                && !string.IsNullOrEmpty(serverUrl))
            {
                MakeRequest(prod);
                return;
            }

            PurchaseVerified(id);
        }
Пример #32
0
 // online verification request (Android version)
 // here we build the POST request to our external server,
 // that will forward the request to Google's servers
 private void MakeRequest(GooglePurchase prod)
 {
     Dictionary<string, string> dic = new Dictionary<string, string>();
     dic.Add("store", "Android");
     dic.Add("pid", prod.productId);
     dic.Add("tid", prod.orderId);
     dic.Add("rec", prod.purchaseToken);
     IAPObject obj = GetIAPObject(prod.productId);
     if (obj != null && obj.type == IAPType.subscription)
         dic.Add("type", "subs");
     StartCoroutine(WaitForRequest(dic));
 }
Пример #33
0
 void consumePurchaseSucceededEvent(GooglePurchase purchase)
 {
     Debug.Log("consumePurchaseSucceededEvent: " + purchase);
     AddCoins(shop.GetVirtualCurrency(purchase.productId));
     ShopStatus.text = "Success : " + purchase.productId;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void purchaseSucceededEvent( GooglePurchase purchase )
 {
     Debug.Log( "purchaseSucceededEvent: " + purchase );
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void consumePurchaseSucceededEvent( GooglePurchase purchase )
 {
     Debug.Log( "consumePurchaseSucceededEvent: " + purchase );
 }
Пример #36
0
 // immediately consume after purchase
 void purchaseSucceededEvent(GooglePurchase purchase)
 {
     Debug.Log("znop: purchaseSucceededEvent: " + purchase);
     GoogleIAB.consumeProduct(purchase.productId);
     ShopStatus.text = "Success : " + purchase.productId;
 }
Пример #37
0
 void purchaseSucceededEvent( GooglePurchase purchase )
 {
     QueryInventory();
 }
    void PurchaseSucceeded(GooglePurchase purchase)
    {
        // cache the purchase to use when the skuInfo is discovered
        savedPurchase = purchase;

        // get the sku info in order to complete logging the transaction
        GoogleIABManager.queryInventorySucceededEvent += GetSkuInfo;
        GoogleIABManager.queryInventoryFailedEvent += GetSkuFailed;
        StartCoroutine(GetProductInfo(0.5f)); //delay call to give developers time to do processing themselves
    }
Пример #39
0
	private void PurchaseSuccessful(GooglePurchase purchase)
	{
		Debug.Log("****PURCHASE SUCCESSFUL");
		if(purchase.developerPayload == CONSUMABLE_PAYLOAD)
			ConsumeProduct(purchase.productId);

		if(_callback != null)
			_callback(IAPState.Success, "");
	}
Пример #40
0
 // fired after a successful consumption (see PurchaseVerified()).
 // Method that fires the purchase succeeded action
 private void ConsumeSucceeded(GooglePurchase prod)
 {
     purchaseSucceededEvent(GetIAPIdentifier(prod.productId));
 }
Пример #41
0
	void queryInventorySucceededEvent( List<GooglePurchase> purchases, List<GoogleSkuInfo> skus )
	{
		Debug.Log( string.Format( "queryInventorySucceededEvent. total purchases: {0}, total skus: {1}", purchases.Count, skus.Count ) );
		for(int i = 0; i < skus.Count; i++){
			GoogleSkuInfo sku = skus[i];
			foreach(ShopGoldInfo info in mGoldList){
				if(info.productCode.Equals(sku.productId))
					info.priceDesc = sku.price;
			}
		}
		IsSupported = true;
		InitGoldList();
//		Prime31.Utils.logObject( purchases );
//		Prime31.Utils.logObject( skus );
		if(purchases.Count > 0){
			mPurchase = purchases[0];
			foreach(ShopGoldInfo info in mGoldList){
				if(info.productCode.Equals(mPurchase.productId)){
					mItemcode = info.productCode;
					mItemname = info.productName;
					purchaseSucceededEvent(mPurchase);
					break;
				}
			}						
		}
	}	
	protected void OnVerificationSuccess(GooglePurchase purchase)
	{
#if UNITY_ANDROID
		GoogleIABManager.purchaseCompleteAwaitingVerificationEvent -= OnProductAwaitingVerificationAndroid;
		GoogleIABManager.purchaseSucceededEvent -= OnVerificationSuccess;
		GoogleIABManager.purchaseFailedEvent -= OnProductFailed;
		
		GoogleIAB.consumeProduct(purchase.productId);
#endif				

		OnVerificationSuccess();
	}
Пример #43
0
	void purchaseSucceededEvent( GooglePurchase purchase )
	{	
		UtilMgr.DismissLoading();
		mIAPEvent = new InAppPurchaseEvent(FinishIAP);

		byte[] bytes = System.Text.Encoding.UTF8.GetBytes(purchase.originalJson);
		string basedJson = System.Convert.ToBase64String(bytes);
		bytes = System.Text.Encoding.UTF8.GetBytes(purchase.signature);
		string basedSign = System.Convert.ToBase64String(bytes);
//		NetMgr.InAppPurchase(false, purchase.productId, basedJson, basedSign, mIAPEvent);
		NetMgr.InAppPurchase(false, purchase.productId, basedSign, basedJson, mIAPEvent);
		
		Debug.Log( "purchaseSucceededEvent: " + purchase );
	}
Пример #44
0
	void consumePurchaseSucceededEvent( GooglePurchase purchase )
	{
		UtilMgr.DismissLoading();
		mDoneIAP();
	}
 void PurchaseSucceeded( GooglePurchase purchase )
 {
     DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
     DateTime purchaseTime = start.AddMilliseconds(purchase.purchaseTime).ToLocalTime();
     FuseAPI.RegisterInAppPurchase((FuseAPI.PurchaseState)purchase.purchaseState, purchase.purchaseToken, purchase.productId, purchase.orderId, purchaseTime, purchase.developerPayload);
 }