public function customer($clientId = false)
{
if ($this->customer) {
return $this->customer;
}
if (!$clientId) {
$clientId = $this->client()->id;
}
$this->customer = AccountGatewayToken::clientAndGateway($clientId, $this->accountGateway->id)->with('payment_methods')->first();
if ($this->customer && $this->invitation) {
$this->customer = $this->checkCustomerExists($this->customer) ? $this->customer : null;
}
return $this->customer;
}