company_key = $company_key; $this->company_gateway_id = $company_gateway_id; $this->client_id = $client_id; $this->customer_id = $customer_id; } public function handle() { if($this->company->id !== config('ninja.ninja_default_company_id')) return; MultiDB::findAndSetDbByCompanyKey($this->company_key); $company = Company::where('company_key', $this->company_key)->first(); $company_gateway = CompanyGateway::find($this->company_gateway_id); $stripe = $company_gateway->driver()->init(); $customer = $company_gateway->getCustomer($this->customer_id); $client = Client::withTrashed()->find($this->client_id); //Else create a new record $data['name'] = $client->present()->name(); $data['phone'] = substr($client->present()->phone(), 0, 20); $data['address']['line1'] = $client->address1; $data['address']['line2'] = $client->address2; $data['address']['city'] = $client->city; $data['address']['postal_code'] = $client->postal_code; $data['address']['state'] = $client->state; $data['address']['country'] = $client->country ? $client->country->iso_3166_2 : ''; \Stripe\Customer::update($this->customer_id, $data, $stripe->stripe_connect_auth); } }