user()->isAdmin()) { StripeUpdatePaymentMethods::dispatch(auth()->user()->company()); return response()->json(['message' => 'Processing'], 200); } return response()->json(['message' => 'Unauthorized'], 403); } public function import() { // return response()->json(['message' => 'Processing'], 200); if (auth()->user()->isAdmin()) { ImportStripeCustomers::dispatch(auth()->user()->company()); return response()->json(['message' => 'Processing'], 200); } return response()->json(['message' => 'Unauthorized'], 403); } public function verify() { if (auth()->user()->isAdmin()) { MultiDB::findAndSetDbByCompanyKey(auth()->user()->company()->company_key); $company_gateway = CompanyGateway::where('company_id', auth()->user()->company()->id) ->where('is_deleted', 0) ->whereIn('gateway_key', $this->stripe_keys) ->first(); return $company_gateway->driver(new Client)->verifyConnect(); } return response()->json(['message' => 'Unauthorized'], 403); } public function disconnect(string $company_gateway_id) { $company_gateway = CompanyGateway::where('company_id', auth()->user()->company()->id) ->where('id', $this->decodePrimaryKey($company_gateway_id)) ->whereIn('gateway_key', $this->stripe_keys) ->firstOrFail(); return $company_gateway->driver()->disconnect(); } }