Exemplo n.º 1
0
        public IActionResult GetPaymentInfo()
        {
            var tenantID = CookieHandler.GetCurrentUserID(Request.Cookies["AuthToken"]);
            var tenant   = Methods.Methods.GetTenant(tenantID);

            //New tenants with no previous payment method
            if (tenant.StripeID == "")
            {
                return(Json(new { success = false }));
            }

            //Tenants who has a payment method on file, but needs to verify a bank account
            if (tenant.StripeIsVerified == false)
            {
                BankAccount bank = StripeService.GetBankAccount(tenant);
                return(Json(new { success = true, isVerified = false, paymentInfo = bank }));
            }

            //Tenant who has payment method on file, and ready to make payments.
            if (tenant.StripeIsVerified == true)
            {
                BankAccount bank = StripeService.GetBankAccount(tenant);
                return(Json(new { success = true, isVerified = true, paymentInfo = bank }));
            }
            return(BadRequest());
        }