public void ConsumePurchaseWithToken(string token)
        {
            if (iapAvailable != true)
            {
                OnObtainProductInfoFailure?.Invoke(IAP_NOT_AVAILABLE);
                return;
            }

            ConsumeOwnedPurchaseReq consumeOwnedPurchaseReq = new ConsumeOwnedPurchaseReq
            {
                PurchaseToken = token
            };

            ITask <ConsumeOwnedPurchaseResult> task = iapClient.ConsumeOwnedPurchase(consumeOwnedPurchaseReq);

            task.AddOnSuccessListener((result) =>
            {
                Debug.Log("HMSP: consumePurchase");
                OnConsumePurchaseSuccess?.Invoke();
            }).AddOnFailureListener((exception) =>
            {
                Debug.Log("HMSP: Error on consumePurchase");
                OnConsumePurchaseFailure?.Invoke(exception);
            });
        }
示例#2
0
        public void ConsumePurchaseWithToken(string token)
        {
            if (iapAvailable != true)
            {
                OnObtainProductInfoFailure?.Invoke(IAP_NOT_AVAILABLE);
                return;
            }

            ConsumeOwnedPurchaseReq consumeOwnedPurchaseReq = new ConsumeOwnedPurchaseReq
            {
                PurchaseToken = token
            };

            ITask <ConsumeOwnedPurchaseResult> task = iapClient.ConsumeOwnedPurchase(consumeOwnedPurchaseReq);

            task.AddOnSuccessListener((result) =>
            {
                Debug.Log("[HMSIAPManager] consumePurchase");
                OnConsumePurchaseSuccess?.Invoke();
            }).AddOnFailureListener((exception) =>
            {
                Debug.LogError("[HMSIAPManager] ConsumePurchaseWithToken failed. CauseMessage: " + exception.WrappedCauseMessage + ", ExceptionMessage: " + exception.WrappedExceptionMessage);
                OnConsumePurchaseFailure?.Invoke(exception);
            });
        }
        private void ConsumeOwnedPurchase(IIapClient iapClient, String purchaseToken)
        {
            ConsumeOwnedPurchaseReq req = new ConsumeOwnedPurchaseReq();

            req.PurchaseToken = purchaseToken;

            Log.Info(TAG, "call consumeOwnedPurchase");
            Task task = iapClient.ConsumeOwnedPurchase(req);

            task.AddOnSuccessListener(new ConsumListenerImp()).AddOnFailureListener(new ConsumListenerImp());
        }
示例#4
0
    private void ConsumePurchase(string token)
    {
        ConsumeOwnedPurchaseReq consumeOwnedPurchaseReq = new ConsumeOwnedPurchaseReq();

        consumeOwnedPurchaseReq.PurchaseToken = token;

        ITask <ConsumeOwnedPurchaseResult> task = iapClient.ConsumeOwnedPurchase(consumeOwnedPurchaseReq);

        task.AddOnSuccessListener((result) =>
        {
            Debug.Log("HMSP: consumePurchase");
        }).AddOnFailureListener((exception) =>
        {
            Debug.Log("HMSP: Error on consumePurchase");
        });
    }
示例#5
0
        void IStore.FinishTransaction(ProductDefinition product, string transactionId)
        {
            if (this.purchasedData.TryGetValue(product.storeSpecificId, out var data))
            {
                var token   = data.PurchaseToken;
                var request = new ConsumeOwnedPurchaseReq();
                request.PurchaseToken = token;

                var task = iapClient.ConsumeOwnedPurchase(request);
                task.AddOnSuccessListener((result) =>
                {
                    this.purchasedData.Remove(product.storeSpecificId);
                });

                task.AddOnFailureListener((exception) =>
                {
                    UnityEngine.Debug.Log("Comsume failed " + exception.Message + " " + exception.StackTrace);
                });
            }
        }