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;
 }
示例#2
0
 /**
  * @return bool
  */
 public function getGatewayToken()
 {
     $accountGateway = $this->account->getGatewayByType(GATEWAY_TYPE_TOKEN);
     if (!$accountGateway) {
         return false;
     }
     return AccountGatewayToken::clientAndGateway($this->id, $accountGateway->id)->first();
 }