Exemplo n.º 1
0
        private void DoAction()
        {
#if USES_BILLING
            try
            {
                BillingTransaction _transaction = BillingUtils.restoredPurchasesList[atIndex.Value];

                // Update properties
                productIdentifier.Value     = _transaction.ProductIdentifier;
                transactionDate.Value       = _transaction.TransactionDateLocal.ToString(dateTimeFormat.Value);
                transactionIdentifier.Value = _transaction.TransactionIdentifier;
                transactionReceipt.Value    = _transaction.TransactionReceipt;
                error.Value           = _transaction.Error;
                rawPurchaseData.Value = _transaction.RawPurchaseData;
            }
            catch (System.Exception _exception)
            {
                Debug.Log(_exception.Message);

                Fsm.Event(failedEvent);

                return;
            }
#endif
        }
Exemplo n.º 2
0
    private void OnDidFinishTransaction(BillingTransaction _transaction)
    {
        if (_transaction != null)
        {
            if (_transaction.VerificationState == eBillingTransactionVerificationState.SUCCESS)
            {
                if (_transaction.TransactionState == eBillingTransactionState.PURCHASED)
                {
                    // Your code to handle purchased products
                    switch (_transaction.ProductIdentifier)
                    {
                    case "1000_gears":
                        GearManager.instance.AddGears(1000);
                        prompt.SetPrompt("Gears Purchased!", "You have purchased 1000 Gears.");
                        break;

                    case "5000_gears":
                        GearManager.instance.AddGears(5000);
                        prompt.SetPrompt("Gears Purchased!", "You have purchased 5000 Gears.");
                        break;

                    case "10000_gears":
                        GearManager.instance.AddGears(10000);
                        prompt.SetPrompt("Gears Purchased!", "You have purchased 10000 Gears.");
                        break;
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    void cbBuy(RcBilling.E_BILLING_RESULT eResult, BillingTransaction billing)
    {
        Debug.Log("RcUIRemoveAd:cbBuy=" + eResult);

        switch (eResult)
        {
        case RcBilling.E_BILLING_RESULT.Cancel:
            // 취소.
            break;

        case RcBilling.E_BILLING_RESULT.Already:
            ProcessNoAds();
            break;

        case RcBilling.E_BILLING_RESULT.Success:
            RcBI.Inst.Buy("remove_banner");
            UIManager.Inst.PopupMessage(Localization.Get("remove_ad"), 2.0f);

            ProcessNoAds();
            break;

        case RcBilling.E_BILLING_RESULT.Failed:
            // 실패.
            break;
        }

        base.OnTouched();
    }
Exemplo n.º 4
0
    public bool HasProduct(string strIdentifier)
    {
        // 이미 구입한 상품인지 검사.

        bool   ret    = false;
        string errMsg = "";

        BillingTransaction billing = null;

        if (true == m_hashHasProducts.TryGetValue(strIdentifier, out billing))
        {
            if (string.IsNullOrEmpty(billing.Error))
            {
                ret = true;
            }
            else
            {
                errMsg = billing.Error;
            }
        }

                #if DEBUG_MODE
        Debug.Log(string.Format("RcBilling:HasProduct={0} ret={1} err={2}", strIdentifier, ret, errMsg));
                #endif

        return(ret);
    }
Exemplo n.º 5
0
        public static void RestoreCompletedTransactions()
        {
            CheckIfInitialised();

            if (registeredProducts == null)
            {
                Console.LogError(Constants.kDebugTag, "[EditorStore] Restore purchases can be done only after getting products information from store.");
                return;
            }

            List <BillingTransaction> _restoredTransactions = new List <BillingTransaction>();

            foreach (BillingProduct _curProduct in registeredProducts)
            {
                if (IsProductPurchased(_curProduct.ProductIdentifier))
                {
                    BillingTransaction _transaction = GetTransactionDetails(_curProduct.ProductIdentifier, eBillingTransactionState.RESTORED, null);

                    // Add it to list of restored transactions
                    _restoredTransactions.Add(_transaction);
                }
            }

            // Send callback
            SendFinishedTransactionCallback(_restoredTransactions.ToArray());
        }
Exemplo n.º 6
0
        public static void RestorePurchases()
        {
            CheckIfInitialised();

            if (registeredProducts == null)
            {
                Console.LogError(Constants.kDebugTag, "[EditorStore] Restore purchases can be done only after getting products information from store.");
                return;
            }

            List <BillingTransaction> _restoredTransactions = new List <BillingTransaction>();

            foreach (BillingProduct _curProduct in registeredProducts)
            {
                if (IsProductPurchased(_curProduct.ProductIdentifier))
                {
                    BillingTransaction _transaction = CreateTransactionObject(_curProduct.ProductIdentifier, eBillingTransactionState.RESTORED, null);

                    // Add it to list of restored transactions
                    _restoredTransactions.Add(_transaction);
                }
            }

            PostTransactionEvent(kRestoreFinishedEventName, _restoredTransactions.ToArray());
        }
Exemplo n.º 7
0
    void cbBuy(RcBilling.E_BILLING_RESULT eResult, BillingTransaction billing)
    {
        Debug.Log("RCUIBuyGem:cbBuy()" + eResult);
        // UIManager.Inst.Alert("cbBuy=" + eResult);
        // DebugPanel.Log("cbBuy=", eResult);

        switch (eResult)
        {
        case RcBilling.E_BILLING_RESULT.Cancel:
            // 취소.
            break;

        case RcBilling.E_BILLING_RESULT.Success:

            // 성공. 캐시 증가
            RcSaveData.Inst.gem += 500;
            RcSaveData.Inst.SaveGem();

            UIManager.Inst.PopupMessage("GEM +500", 2.0f);

            RcBI.Inst.Buy("gem_500");

            // 구입하고 초기화 안하면 구입 목록에 안나옴!
            RcBilling.Inst.Init(cbBillingInit);
            break;

        case RcBilling.E_BILLING_RESULT.Failed:
            // 실패.
            break;
        }

        base.OnTouched();
    }
Exemplo n.º 8
0
    void cbBuy(RcBilling.E_BILLING_RESULT eResult, BillingTransaction billing)
    {
        Debug.Log("RcUIRemoveAd:cbBuy=" + eResult);

        switch (eResult)
        {
        case RcBilling.E_BILLING_RESULT.Cancel:
            // 취소.
            UIManager.Inst.PopupMessage("noads Cancel", 3f);
            break;

        case RcBilling.E_BILLING_RESULT.Success:
            UIManager.Inst.PopupMessage("noads success", 3f);
            // 성공.
            RcBI.Inst.Buy("remove_banner");
            ProcessNoAds();
            break;

        case RcBilling.E_BILLING_RESULT.Already:
            UIManager.Inst.PopupMessage("noads already", 3f);
            ProcessNoAds();
            break;

        case RcBilling.E_BILLING_RESULT.Failed:
            // 실패.
            UIManager.Inst.PopupMessage("noads failed", 3f);
            break;
        }
    }
Exemplo n.º 9
0
    private void OnDidFinishTransaction(BillingTransaction _transaction)
    {
        Debug.Log("Receive purchase result.\n" +
                  "Product Identifier = " + _transaction.ProductIdentifier + "\n" +
                  "Transaction State = " + _transaction.TransactionState + "\n" +
                  "Verification State = " + _transaction.VerificationState + "\n" +
                  "Transaction Date[UTC] = " + _transaction.TransactionDateUTC + "\n" +
                  "Transaction Date[Local] = " + _transaction.TransactionDateLocal + "\n" +
                  "Transaction Identifier = " + _transaction.TransactionIdentifier + "\n" +
                  "Transaction Receipt = " + _transaction.TransactionReceipt + "\n" +
                  "Error = " + _transaction.Error.GetPrintableString());
        if (m_LoadingLayer != null)
        {
            m_LoadingLayer.SetVisible(false);
        }

        if (_transaction == null)
        {
            return;
        }

        if (_transaction.VerificationState == eBillingTransactionVerificationState.SUCCESS &&
            _transaction.TransactionState == eBillingTransactionState.PURCHASED)
        {
            this.GotProduct(_transaction.ProductIdentifier);
        }
    }
Exemplo n.º 10
0
        public static void RestoreCompletedTransactions()
        {
            CheckIfInitialised();

            if (registeredProducts == null)
            {
                Console.LogError(Constants.kDebugTag, "[EditorStore] Restore purchases can be done only after getting products information from store");
                return;
            }

            int _totalProducts = registeredProducts.Count;
            List <BillingTransaction> _restoredTransactions = new List <BillingTransaction>();

            for (int _iter = 0; _iter < _totalProducts; _iter++)
            {
                BillingProduct _product = registeredProducts[_iter];

                if (IsProductPurchased(_product.ProductIdentifier))
                {
                    BillingTransaction _transaction = GetTransactionDetails(_product.ProductIdentifier, eBillingTransactionState.RESTORED, null);

                    // Add it to list of restored transactions
                    _restoredTransactions.Add(_transaction);
                }
            }

            // Send callback
            SendFinishedTransactionCallback(_restoredTransactions);
        }
Exemplo n.º 11
0
        private static void OnTransactionFailed(string _productID, string _errorDescription)
        {
            BillingTransaction _newTransaction = CreateTransactionObject(_productID, eBillingTransactionState.FAILED, _errorDescription);

            PostTransactionEvent(kProductPurchaseFinishedEventName, new BillingTransaction[1] {
                _newTransaction
            });
        }
Exemplo n.º 12
0
        private static void OnTransactionFailed(string _productID, string _errorDescription)
        {
            BillingTransaction _newTransaction = GetTransactionDetails(_productID, eBillingTransactionState.FAILED, _errorDescription);

            // Send callback
            SendFinishedTransactionCallback(new BillingTransaction[1] {
                _newTransaction
            });
        }
        public Task <BillingTransaction> Create(BillingTransaction billingTransaction, int receiptNo, ApplicationUser currentUser)
        {
            var taskResult = Task.Run(() =>
            {
                using (var context = new DbContext())
                {
                    if (billingTransaction.Society != null)
                    {
                        billingTransaction.SocietyId = billingTransaction.Society.Id;
                        billingTransaction.Society   = null;
                    }

                    var bill = context
                               .Bills
                               .FirstOrDefault(b => b.ReceiptNo == receiptNo && b.SocietyId == billingTransaction.SocietyId);

                    if (bill == null)
                    {
                        throw new Exception("No bill found for the receipt number");
                    }

                    var max = context.BillingTransactions.Count(b => b.SocietyId == billingTransaction.SocietyId) > 0
                        ? context.BillingTransactions.Where(b => b.SocietyId == billingTransaction.SocietyId).Max(b => b.TransactionNo)
                        : 0;

                    var transact = new BillingTransaction();

                    transact.TransactionNo = max + 1;
                    transact.Date          = DateTime.Now;
                    transact.Amount        = billingTransaction.Amount;
                    transact.Reference     = billingTransaction.Reference;
                    transact.Mode          = billingTransaction.Mode;
                    transact.Description   = billingTransaction.Description;
                    transact.AuthorizedBy  = currentUser.UserName;
                    transact.Bank          = billingTransaction.Bank;
                    transact.Branch        = billingTransaction.Branch;
                    transact.ChequeNo      = billingTransaction.ChequeNo;
                    transact.ChequeDate    = billingTransaction.ChequeDate;

                    transact.CreatedDate = billingTransaction.CreatedDate;

                    transact.FlatId    = bill.FlatId;
                    transact.SocietyId = bill.SocietyId;
                    transact.Name      = bill.Name;

                    context.BillingTransactions.Add(transact);
                    context.SaveChanges();

                    return(transact);
                }
            });

            return(taskResult);
        }
Exemplo n.º 14
0
        private static void OnConfirmingPurchase(BillingProduct _product)
        {
            if (!_product.IsConsumable)
            {
                EditorPrefs.SetInt(_product.ProductIdentifier, 1);
            }

            BillingTransaction _newTransaction = CreateTransactionObject(_product.ProductIdentifier, eBillingTransactionState.PURCHASED, null);

            PostTransactionEvent(kProductPurchaseFinishedEventName, new BillingTransaction[1] {
                _newTransaction
            });
        }
 private void OnDidFinishProductPurchase(BillingTransaction _transaction)
 {
     if (_transaction.TransactionState == eBillingTransactionState.PURCHASED)
     {
         AndroidDebug.debug("OnDidFinishProductPurchase -  Purchased - " + _transaction.ProductIdentifier);
         CallDelegateForPurchasedProductIdentifier(_transaction.ProductIdentifier, PURCHASED);
     }
     else if (_transaction.TransactionState == eBillingTransactionState.FAILED)
     {
         AndroidDebug.debug("OnDidFinishProductPurchase -  FAILED - " + _transaction.ProductIdentifier);
         ShowAlertview("Sorry!!!", "Something wrong.");
     }
 }
Exemplo n.º 16
0
 private void OnDidFinishTransaction(BillingTransaction _transaction)
 {
     if (_transaction != null)
     {
         if (_transaction.VerificationState == eBillingTransactionVerificationState.SUCCESS)
         {
             if (_transaction.TransactionState == eBillingTransactionState.PURCHASED)
             {
                 // Your code to handle purchased products
             }
         }
     }
 }
Exemplo n.º 17
0
        private static void OnConfirmingPurchase(BillingProduct _product)
        {
            // Non consummable purchases are tracked
            if (!_product.IsConsumable)
            {
                EditorPrefs.SetInt(_product.ProductIdentifier, 1);
            }

            BillingTransaction _newTransaction = GetTransactionDetails(_product.ProductIdentifier, eBillingTransactionState.PURCHASED, null);

            // Send callback
            SendFinishedTransactionCallback(new BillingTransaction[1] {
                _newTransaction
            });
        }
Exemplo n.º 18
0
 public static void CustomVerificationFinished(BillingTransaction _transaction)
 {
     if (_transaction.TransactionState == eBillingTransactionState.RESTORED)
     {
         PostTransactionEvent(kRestoreFinishedEventName, new BillingTransaction[1] {
             _transaction
         });
     }
     else
     {
         PostTransactionEvent(kProductPurchaseFinishedEventName, new BillingTransaction[1] {
             _transaction
         });
     }
 }
Exemplo n.º 19
0
        public static IDictionary CreateJSONObject(BillingTransaction _transaction)
        {
            IDictionary _transactionJsonDict = new Dictionary <string, object>();

            _transactionJsonDict[kProductIdentifier]     = _transaction.ProductIdentifier;
            _transactionJsonDict[kTransactionDate]       = _transaction.TransactionDateUTC.ToJavaTimeFromDateTime();
            _transactionJsonDict[kTransactionIdentifier] = _transaction.TransactionIdentifier;
            _transactionJsonDict[kTransactionReceipt]    = _transaction.TransactionReceipt;
            _transactionJsonDict[kTransactionState]      = GetTransactionState(_transaction.TransactionState);
            _transactionJsonDict[kVerificationState]     = GetValidationState(_transaction.VerificationState);
            _transactionJsonDict[kError]           = _transaction.Error;
            _transactionJsonDict[kRawPurchaseData] = _transaction.RawPurchaseData;

            return(_transactionJsonDict);
        }
Exemplo n.º 20
0
        private static BillingTransaction GetTransactionDetails(string _productID, eBillingTransactionState _transactionState, string _error)
        {
            BillingTransaction _transaction;

            if (_transactionState == eBillingTransactionState.FAILED)
            {
                _transaction = new BillingTransaction(_productID, System.DateTime.MinValue, null, null, _transactionState, eBillingTransactionVerificationState.NOT_CHECKED, _error);
            }
            else
            {
                _transaction = new BillingTransaction(_productID, System.DateTime.UtcNow, "transactionIdentifier", "receipt", _transactionState, eBillingTransactionVerificationState.SUCCESS, null);
            }

            return(_transaction);
        }
Exemplo n.º 21
0
 private void OnDidFinishTransaction(BillingTransaction _transaction)
 {
     if (_transaction != null)
     {
         if (_transaction.VerificationState == eBillingTransactionVerificationState.SUCCESS)
         {
             if (_transaction.TransactionState == eBillingTransactionState.PURCHASED)
             {
                 if (_transaction.ProductIdentifier == "removeads")
                 {
                     GameManager.Instance.RemoveAds();
                 }
             }
         }
     }
 }
Exemplo n.º 22
0
        public static IDictionary CreateJSONObject(BillingTransaction _transaction)
        {
            SKPaymentTransactionState _skTransactionState = ConvertToSKTransactionState(_transaction.TransactionState);

            IDictionary _transactionJsonDict = new Dictionary <string, object>();

            _transactionJsonDict[kTransactionDate]    = _transaction.TransactionDateUTC.ToStringUsingZuluFormat();
            _transactionJsonDict[kVerificationState]  = (int)_transaction.VerificationState;
            _transactionJsonDict[kTransactionID]      = _transaction.TransactionIdentifier;
            _transactionJsonDict[kTransactionReceipt] = _transaction.TransactionReceipt;
            _transactionJsonDict[kTransactionState]   = (int)_skTransactionState;
            _transactionJsonDict[kProductID]          = _transaction.ProductIdentifier;
            _transactionJsonDict[kError] = _transaction.Error;

            return(_transactionJsonDict);
        }
Exemplo n.º 23
0
        /// <summary>
        ///
        /// </summary>
        public void OnPurchaseSucceeded(BillingTransaction item)
        {
            if (item == null || !string.IsNullOrEmpty(item.Error))
            {
                OnPurchaseFailed(item == null ? "Unkown Billing Error." : item.Error, 1);
                return;
            }

            string transactionId = item.TransactionIdentifier;

            #if UNITY_EDITOR
            //allow for multiple test purchases with unique transactions
            transactionId = (System.DateTime.UtcNow - new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc)).TotalSeconds.ToString();
            #endif

            callback.OnPurchaseSucceeded(item.ProductIdentifier, item.TransactionReceipt, transactionId);
        }
        private void OnDidFinishProductPurchase(BillingTransaction _transaction)
        {
            // Update properties
            productIdentifier.Value     = _transaction.ProductIdentifier;
            transactionDate.Value       = _transaction.TransactionDateLocal.ToString(dateTimeFormat.Value);
            transactionIdentifier.Value = _transaction.TransactionIdentifier;
            transactionReceipt.Value    = _transaction.TransactionReceipt;
            error.Value           = _transaction.Error;
            rawPurchaseData.Value = _transaction.RawPurchaseData;

            // Send event
            if (_transaction.VerificationState == eBillingTransactionVerificationState.FAILED)
            {
                Fsm.Event(failedEvent);

                return;
            }
            else if (_transaction.VerificationState == eBillingTransactionVerificationState.SUCCESS)
            {
                switch (_transaction.TransactionState)
                {
                case eBillingTransactionState.FAILED:
                    Fsm.Event(failedEvent);
                    break;

                case eBillingTransactionState.PURCHASED:
                    Fsm.Event(purchasedEvent);
                    break;

                case eBillingTransactionState.RESTORED:
                    Fsm.Event(restoredEvent);
                    break;

                case eBillingTransactionState.REFUNDED:
                    Fsm.Event(refundedEvent);
                    break;

                default:
                    LogWarning("[Billing] Unhandled transactions state.");
                    break;
                }

                return;
            }
        }
Exemplo n.º 25
0
        public static IDictionary CreateJSONObject(BillingTransaction _transaction)
        {
            IDictionary _transactionJsonDict = new Dictionary <string, object>();

            IDictionary _originalJson = new Dictionary <string, object>();

            _originalJson[kPurchaseTime]  = _transaction.TransactionDateUTC.ToJavaTimeFromDateTime();
            _originalJson[kOrderID]       = _transaction.TransactionIdentifier;
            _originalJson[kPurchaseState] = GetConvertedPurchaseState(_transaction.TransactionState);
            _originalJson[kProductID]     = _transaction.ProductIdentifier;

            _transactionJsonDict[kOriginalJSON]            = _originalJson;
            _transactionJsonDict[kPurchaseValidationState] = GetValidationState(_transaction.VerificationState);
            _transactionJsonDict[kSignature] = _transaction.TransactionReceipt;
            _transactionJsonDict[kError]     = _transaction.Error;

            return(_transactionJsonDict);
        }
        public static IDictionary CreateJSONObject(BillingTransaction _transaction)
        {
            IDictionary _transactionJsonDict						= new Dictionary<string, object>();

            IDictionary _originalJson								= new Dictionary<string, object>();

            _originalJson[kPurchaseTime]							= _transaction.TransactionDateUTC.ToJavaTimeFromDateTime();
            _originalJson[kOrderID]									= _transaction.TransactionIdentifier;
            _originalJson[kPurchaseState]							= GetConvertedPurchaseState(_transaction.TransactionState);
            _originalJson[kProductID]								= _transaction.ProductIdentifier;

            _transactionJsonDict[kOriginalJSON]						= _originalJson;
            _transactionJsonDict[kPurchaseValidationState]			= GetValidationState(_transaction.VerificationState);
            _transactionJsonDict[kSignature]						= _transaction.TransactionReceipt;
            _transactionJsonDict[kError]							= _transaction.Error;

            return _transactionJsonDict;
        }
Exemplo n.º 27
0
    void OnBillingBuyCB(E_BILLING_RESULT eResult, BillingTransaction billing)
    {
        switch (eResult)
        {
        case E_BILLING_RESULT.Cancel:
            // 취소.
            break;

        case E_BILLING_RESULT.Success:
            // 성공.
            break;

        case E_BILLING_RESULT.Failed:
            // 실패.
            break;

        case E_BILLING_RESULT.Already:
            // 이미 구입
            break;
        }
    }
		public static void CustomVerificationFinished (BillingTransaction _transaction)
		{
			Console.LogError(Constants.kDebugTag, Constants.kFeatureNotSupported);
		}
		public static IDictionary CreateJSONObject (BillingTransaction _transaction)
		{
			SKPaymentTransactionState _skTransactionState	= ConvertToSKTransactionState(_transaction.TransactionState);

			IDictionary _transactionJsonDict			= new Dictionary<string, object>();
			_transactionJsonDict[kTransactionDate]		= _transaction.TransactionDateUTC.ToStringUsingZuluFormat();
			_transactionJsonDict[kVerificationState]	= (int)_transaction.VerificationState;
			_transactionJsonDict[kTransactionID]		= _transaction.TransactionIdentifier;
			_transactionJsonDict[kTransactionReceipt]	= _transaction.TransactionReceipt;
			_transactionJsonDict[kTransactionState]		= (int)_skTransactionState;
			_transactionJsonDict[kProductID]			= _transaction.ProductIdentifier;
			_transactionJsonDict[kError]				= _transaction.Error;

			return _transactionJsonDict;
		}
Exemplo n.º 30
0
		public static void CustomVerificationFinished (BillingTransaction _transaction)
		{
			Console.LogError(Constants.kDebugTag, Constants.kErrorMessage);
		}
Exemplo n.º 31
0
        public bool insert(BillingTransaction transaction, out int transactionID)
        {
            bool isSuccess = false;

            transactionID = -1;
            try
            {
                string sql = @"INSERT INTO TransactionTable ([customer_type],[customer_name],[customer_id],[bill_number],[transaction_date],[total_amount],[discount],[VAT] )
                    VALUES (@customer_type,
                    @customer_name,
                    @customer_id,
                    @bill_number,
                    @transaction_date,
                    @total_amount,
                    @discount,
                    @VAT
                    )";

                // creating sql command to pass the value
                SqlCommand cmd = new SqlCommand(sql, DbClass.con);

                //passing data to parameter
                //NOTE ?? operator gives assigns the value of the right side if the ledt side value is null.
                cmd.Parameters.AddWithValue("@customer_type", transaction.customerType ?? string.Empty);
                cmd.Parameters.AddWithValue("@customer_name", transaction.customerName ?? string.Empty);
                cmd.Parameters.AddWithValue("@customer_id", transaction.customerId ?? string.Empty);
                cmd.Parameters.AddWithValue("@bill_number", transaction.billNumber);
                cmd.Parameters.AddWithValue("@transaction_date", transaction.transactionDate);
                cmd.Parameters.AddWithValue("@total_amount", transaction.totalAmount);
                cmd.Parameters.AddWithValue("@discount", transaction.discount);
                cmd.Parameters.AddWithValue("@VAT", transaction.VAT);



                DbClass.openConnection();
                //SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                //// ExecuteScalar returns the value of the first column of the first row, if executed successfully the value wont be null
                //object obj = cmd.ExecuteScalar();
                //if (obj != null)
                //{
                //    transactionID = int.Parse(obj.ToString());
                //    isSuccess = true;

                //}

                //else
                //{
                //    isSuccess = false;
                //}

                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }

                else
                {
                    isSuccess = false;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            finally
            {
                DbClass.closeConnection();
            }

            return(isSuccess);
        }
Exemplo n.º 32
0
 public Task <BillingTransaction> Create(BillingTransaction billingTransaction, int receiptNo, ApplicationUser currentUser)
 {
     return(_billingTransactionRepository.Create(billingTransaction, receiptNo, currentUser));
 }
Exemplo n.º 33
0
		private static BillingTransaction GetTransactionDetails (string _productID, eBillingTransactionState _transactionState, string _error)
		{
			BillingTransaction _transaction;

			if (_transactionState == eBillingTransactionState.FAILED)
			{
				_transaction = new BillingTransaction(_productID, System.DateTime.MinValue, null, null, _transactionState, eBillingTransactionVerificationState.NOT_CHECKED, _error);
			}
			else
			{
				_transaction = new BillingTransaction(_productID, System.DateTime.UtcNow, "transactionIdentifier", "receipt", _transactionState, eBillingTransactionVerificationState.SUCCESS, null);
			}

			return _transaction;
		}
Exemplo n.º 34
0
 public static void CustomVerificationFinished(BillingTransaction _transaction)
 {
     Console.LogError(Constants.kDebugTag, Constants.kFeatureNotSupported);
 }
Exemplo n.º 35
0
    void OnDidFinishTransaction(BillingTransaction _transaction)
    {
                #if DEBUG_MODE
        Debug.Log("RcBilling:OnDidFinishTransaction=" + _transaction + " error=" + _transaction.Error.GetPrintableString());
                #endif

        /*
         *
         * Product Identifier       = com.flerogames.cl.flyinglarva.donut1
         * Transaction Date[UTC]    = 07/05/2016 14:47:27
         * Transaction Identifier   = ffkihfoeobikcigcfbgmhbcf.AO-J1OyKIfFnwvBUJH3NE67RSvpEbUwOQ34L3ntrNP_6BwP9nYQjFB0j5TGVugRbFXPRegBVHFgrnJFBkKJK94ajjflyQ6T9EB40kJmoLchVr7z9N7pz_J6-aVtJq6H_vBBaSNZWvOIivnlBkLgOjz5-FeOOZnLUGufM4Rc0iZRl50uFELtjx9I
         * Transaction Receipt  = BBM7LYh1gIgBcn4yAhIEBv3gAj8ifME7XrEiflB27zuoraXZVzcK2X65kNrEspEHEMUeGqnMQeN8r/xWhc+Y4vYDM9ACGc82Nuwi2HQPQK/gkeW1HUlIeR+XI4gr2AMxIxCsPjRU/IimXON+rysAlkUFl/KLl1SF1v4bPbgKbIi4fLG6XIcp9uqFD8WrrFXBw6TxH7RWml1u7LBXq+PWe2wU1yb1EZl9CLbgxW1LljhdZ3PBkd2HWs1/UBTqtk8H6JwAtll1Tvr581eE1cvyLg6VfXdQQ7ZTnBFUy0DU6PtwxoiqxNS5yZyG/PFW4ncAy+kBtxG9kvbz2dUxfW+rqg==
         *
         * {
         *      "packageName":"com.flerogames.cl.flyinglarva",
         *      "productId":"com.flerogames.cl.flyinglarva.donut1",
         *      "purchaseTime":1467730047159,
         *      "purchaseState":0,
         *      "purchaseToken":"ffkihfoeobikcigcfbgmhbcf.AO-J1OyKIfFnwvBUJH3NE67RSvpEbUwOQ34L3ntrNP_6BwP9nYQjFB0j5TGVugRbFXPRegBVHFgrnJFBkKJK94ajjflyQ6T9EB40kJmoLchVr7z9N7pz_J6-aVtJq6H_vBBaSNZWvOIivnlBkLgOjz5-FeOOZnLUGufM4Rc0iZRl50uFELtjx9I"
         * }
         *
         */

        if (null == _transaction)
        {
            if (null != m_OnCallbackBuy)
            {
                m_OnCallbackBuy(E_BILLING_RESULT.Failed, null);
            }
        }
        else
        {
                        #if DEBUG_MODE
            Debug.Log("Product Identifier = " + _transaction.ProductIdentifier);
            Debug.Log("Transaction State = " + _transaction.TransactionState);
            Debug.Log("Verification State = " + _transaction.VerificationState);
            Debug.Log("Transaction Date[UTC] = " + _transaction.TransactionDateUTC);
            Debug.Log("Transaction Date[Local] = " + _transaction.TransactionDateLocal);
            Debug.Log("Transaction Identifier = " + _transaction.TransactionIdentifier);
            Debug.Log("Transaction Receipt = " + _transaction.TransactionReceipt);
            Debug.Log("Error = " + _transaction.Error.GetPrintableString());
            Debug.Log("RawPurchaseData = " + _transaction.RawPurchaseData);
                        #endif

            if (!string.IsNullOrEmpty(_transaction.Error))
            {
#if UNITY_EDITOR
                if (_transaction.Error.Contains("cancelled"))
#else
                if (_transaction.Error.Contains("-1005"))
#endif
                {
                    if (null != m_OnCallbackBuy)
                    {
                        m_OnCallbackBuy(E_BILLING_RESULT.Cancel, _transaction);
                    }
                    return;
                }
            }

            switch (_transaction.VerificationState)
            {
            case eBillingTransactionVerificationState.NOT_CHECKED:
            case eBillingTransactionVerificationState.SUCCESS:
                if (eBillingTransactionState.PURCHASED == _transaction.TransactionState)
                {
                    if (null != m_OnCallbackBuy)
                    {
                        m_OnCallbackBuy(E_BILLING_RESULT.Success, _transaction);
                    }
                }
                else
                {
                    if (null != m_OnCallbackBuy)
                    {
                        m_OnCallbackBuy(E_BILLING_RESULT.Failed, _transaction);
                    }
                }
                break;

            case eBillingTransactionVerificationState.FAILED:
                if (null != m_OnCallbackBuy)
                {
                    m_OnCallbackBuy(E_BILLING_RESULT.Failed, _transaction);
                }
                break;
            }
        }
    }
		private static void SendFinishedTransactionCallback (BillingTransaction[] _finishedTransaction)
		{
			if (NPBinding.Billing != null)
				NPBinding.Billing.InvokeMethod(kDidFinishBillingTransactionEventName, new object[] {
					_finishedTransaction,
					null
				}, new Type[] {
					typeof(BillingTransaction[]),
					typeof(string)
				});
		}