Exemplo n.º 1
0
        public async Task <string> ChageToUser(IFormCollection formData)
        {
            // Claimを取得する。
            MyBaseAsyncApiController.GetClaims(
                out string userName, out string roles, out string scopes, out string ipAddress);

            // ユーザの検索
            ApplicationUser user = await UserManager.FindByNameAsync(userName);

            if (user != null)
            {
                // 変数
                string currency = formData["currency"];
                string amount   = formData["amount"];

                if (Config.CanEditPayment &&
                    Config.EnableEditingOfUserAttribute)
                {
                    // 課金の処理
                    JObject jobj = await WebAPIHelper.GetInstance()
                                   .ChargeToOnlinePaymentCustomersAsync(user.PaymentInformation, currency, amount);

                    return("OK");
                }
            }

            return("NG");
        }
Exemplo n.º 2
0
        public async Task <string> TestChageToUser(FormDataCollection formData)
        {
            // 変数
            string currency = formData["currency"];
            string amount   = formData["amount"];

            if (ASPNETIdentityConfig.CanEditPayment &&
                ASPNETIdentityConfig.EnableEditingOfUserAttribute &&
                ASPNETIdentityConfig.IsDebug)
            {
                // ユーザの検索
                ApplicationUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

                // 課金のテスト処理
                JObject jobj = await WebAPIHelper.GetInstance().ChargeToOnlinePaymentCustomersAsync(user.PaymentInformation, currency, amount);

                return("OK");
            }
            else
            {
                return("NG");
            }
        }