Esempio n. 1
0
        private void GetPurchaseUpdatesResponseCallback(GetPurchaseUpdatesResponse eventName)
        {
            if (eventName.Status == "NOT_SUPPORTED")
            {
                EB.Debug.LogError("GetPurchaseUpdatesResponseCallback: NOT_SUPPORTED");
                return;
            }

            if (eventName.Status == "FAILED")
            {
                EB.Debug.LogError("GetPurchaseUpdatesResponseCallback: FAILED");
                return;
            }

            EB.Debug.Log("GetPurchaseUpdatesResponseCallback. receipts count: {0}", eventName.Receipts.Count);
            foreach (var receipt in eventName.Receipts)
            {
                EB.Debug.Log("Purchase Update Receipt: {0}", receipt.ToJson());
                PurchaseResponseCallback(new PurchaseResponse()
                {
                    AmazonUserData  = eventName.AmazonUserData,
                    Status          = eventName.Status,
                    PurchaseReceipt = receipt,
                });
            }

            if (eventName.HasMore)
            {
                ResetInput input = new ResetInput()
                {
                    Reset = false
                };
                _iapService.GetPurchaseUpdates(input);
            }
        }
Esempio n. 2
0
        private IEnumerator RequestAmazonUserId()
        {
            EB.Debug.Log("Getting Amazon User ID");
            int   retryCount  = 0;
            float waitSeconds = 1.0f;

            while (retryCount < kMaxRetryCount && string.IsNullOrEmpty(_userId))
            {
                _iapService.GetUserData();
                yield return(new WaitForSeconds(waitSeconds));

                waitSeconds *= 2.0f;
                retryCount++;
            }
            if (!string.IsNullOrEmpty(_userId))
            {
                Coroutines.Run(RetryPendingPurchases());

                ResetInput input = new ResetInput()
                {
                    Reset = false
                };
                _iapService.GetPurchaseUpdates(input);
            }
            EB.Debug.Log("RequestAmazonUserId Finished - Result: {0}", (string.IsNullOrEmpty(_userId) ? "failed." : _userId));
        }
Esempio n. 3
0
        private void CheckUpgrade()
        {
            var reset_input = new ResetInput();

            reset_input.Reset = true;
            this.amazonIapV2.GetPurchaseUpdates(reset_input);
            this.FetchingIsUpgraded = true;
        }
Esempio n. 4
0
 public override Empty TestResetFields(ResetInput input)
 {
     _number = input.Int32Value;
     _field1 = input.Int64Value;
     _field2 = input.StringValue;
     _field3 = input.BoolValue;
     State.Int64Info.Value  = Number;
     State.StringInfo.Value = String;
     return(new Empty());
 }
Esempio n. 5
0
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task ResetCustomer(ResetInput input)
        {
            var customer = await _customerRepository.FirstOrDefaultAsync(input.Id);

            if (customer == null)
            {
                throw new UserFriendlyException("当前客户信息不存在");
            }
            customer.Password = input.Password;
        }
    public IActionResult OnGet(string code = null)
    {
        if (code is null)
        {
            return(BadRequest());
        }

        Input = new()
        {
            Code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code))
        };

        return(Page());
    }
Esempio n. 7
0
        //
        public void RestorePurchase()
        {
            if (!CoreUtility.Me.ShowInternetConnection())
            {
                return;
            }
#if (UNITY_IOS && !STOREKIT) || (UNITY_ANDROID && !GOOGLEIAB)
            PopupMessages.Me.InAppNotIntegratedMessage();
            return;
#endif

            isRestore            = true;
            isRestoreItemSuccess = false;
            PopupMessages.Me.RestoreProcessMessage();

            #region iOS Methods
#if UNITY_IOS && STOREKIT
#if !UNITY_EDITOR
            StoreKitBinding.restoreCompletedTransactions();
#endif
#if UNITY_EDITOR
            ASKRestoreTransactionsFailed("Not works in editor mode");
#endif
#endif
            #endregion
            //
            #region Android => Google Play Mathods
#if UNITY_ANDROID && !AMAZONSTORE && GOOGLEIAB
#if !UNITY_EDITOR
            GoogleIAB.queryInventory(inappids);
#endif
#if UNITY_EDITOR
            IABQueryInventoryFailed("Not works in editor mode");
#endif
#endif
            #endregion
            //
            #region Android => Amazon Store Methods
#if UNITY_ANDROID && !UNITY_EDITOR && AMAZONSTORE
#if !UNITY_EDITOR
            ResetInput resetInput = new ResetInput();
            resetInput.Reset = false;
            iapService.GetPurchaseUpdates(resetInput);
#endif
#if UNITY_EDITOR
            MarketPlaceNotSuported();
#endif
#endif
            #endregion
        }
 public override Empty TestResetFields(ResetInput input)
 {
     _number = input.Int32Value;
     _field1 = input.Int64Value;
     _field2 = input.StringValue;
     _field3 = input.BoolValue;
     State.Int64Info.Value  = Number;
     State.StringInfo.Value = String;
     dict  = new Dictionary <long, long>();
     _list = new List <int> {
         1
     };
     return(new Empty());
 }
Esempio n. 9
0
    public void GetProductUpdates()
    {
                #if AMAZON_BILLING_ENABLED
        // Construct object passed to operation as input
        ResetInput request = new ResetInput();

        // Set input value
        request.Reset = true;

        // Call synchronous operation with input object
        RequestOutput response = iapService.GetPurchaseUpdates(request);

        // Get return value
        string requestIdString = response.RequestId;

        Debug.Log("requestIdString " + requestIdString);
                #endif
    }
Esempio n. 10
0
        public async Task <JsonResult> ResetPassword([FromBody] ResetInput input)
        {
            var sb = new StringBuilder();

            foreach (char x in input.Token)
            {
                if (x == '@')
                {
                    sb.Append('/');
                }
                else
                {
                    sb.Append(x);
                }
            }
            var user = await _userManager.FindByEmailAsync(input.Email);

            SimpleResult result;

            if (user != null)
            {
                var reset = await _userManager.ResetPasswordAsync(user, sb.ToString(), input.Password);

                //await _userManager.RemovePasswordAsync(user);
                //await _userManager.AddPasswordAsync(user, input.Password);
                result = new SimpleResult
                {
                    IsSuccess = reset.Succeeded
                };
            }
            else
            {
                result = new SimpleResult
                {
                    IsSuccess    = false,
                    ErrorMessage = "Invalid Email"
                };
            }

            return(await GenerateResult(result, _userSettings));
        }
Esempio n. 11
0
        /// <summary>
        ///  initiates a request to retrieve updates about items the customer has purchased and/or cancelled.
        /// </summary>
        /// <param name="itemType">not required for Amazon</param>
        /// <returns></returns>
        private async Task <List <PurchaseReceipt> > GetPurchaseReceipts()
        {
            var taskCompletionSource = new TaskCompletionSource <List <PurchaseReceipt> >();

            if (context == null)
            {
                context = AmazonIapV2Impl.Instance;
            }


            // Construct object passed to operation as input
            var request = new ResetInput();

            // Set input value
            request.Reset = true;

            // Call synchronous operation with input object
            string requestId = context.GetPurchaseUpdates(request).RequestId;
            // Get return value
            GetPurchaseUpdatesResponseDelegator delegator = null;

            delegator = new GetPurchaseUpdatesResponseDelegator(async response =>
            {
                await Task.Run(() =>
                {
                    if (response.RequestId == requestId)
                    {
                        var receipts = GetPurchasesUpdateEventHandler(response);

                        var sucess = taskCompletionSource.TrySetResult(receipts);
                        //await Task.Delay(TimeSpan.FromMilliseconds(1));an.FromMilliseconds(1));
                        context.RemoveGetPurchaseUpdatesResponseListener(delegator.responseDelegate);
                    }
                });
            });
            // Register for an event
            context.AddGetPurchaseUpdatesResponseListener(delegator.responseDelegate);

            return(await taskCompletionSource.Task);
        }