Fixes for payment links

This commit is contained in:
David Bomba 2023-07-04 09:20:58 +10:00
parent d40da3c7f2
commit e1d50eff70
2 changed files with 8 additions and 9 deletions

View File

@ -522,17 +522,18 @@ class Payment extends BaseModel
event(new PaymentWasVoided($this, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}
// public function getLink()
// {
// return route('client.payments.show', $this->hashed_id);
// }
public function getLink() :string
{
// if (Ninja::isHosted()) {
// $domain = isset($this->company->portal_domain) ? $this->company->portal_domain : $this->company->domain();
// } else {
// $domain = config('ninja.app_url');
// }
if (Ninja::isHosted()) {
$domain = isset($this->company->portal_domain) ? $this->company->portal_domain : $this->company->domain();
$domain = $this->company->domain();
} else {
$domain = config('ninja.app_url');
$domain = strlen($this->company->portal_domain) > 5 ? $this->company->portal_domain : config('ninja.app_url');
}
return $domain.'/client/payment/'.$this->client->contacts()->first()->contact_key.'/'.$this->hashed_id.'?next=/client/payments/'.$this->hashed_id;

View File

@ -101,7 +101,6 @@ trait Inviteable
break;
case 'iframe':
return $domain.'/client/'.$entity_type.'/'.$this->key;
//return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key;
break;
case 'domain':
return $domain.'/client/'.$entity_type.'/'.$this->key;
@ -127,7 +126,6 @@ trait Inviteable
break;
case 'iframe':
return $domain.'/client/';
//return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key;
break;
case 'domain':
return $domain.'/client/';