Skip to content

Bug in AccountHolder Class #101

@abolabo

Description

@abolabo

Hi,
i had tried to use bank_trasfer method to create new transfer.
One of parameters is an instance of AccountHolder class.
I got an error Bad request. Invalid field user.email for this endpoint.

So, see in the contructor, email can be null. (i do not pass email in the constructor btw)
public function __construct(
string $legal_name,
string $email = null
)

Then method
public function toArray(): array
{
return [
"legal_name" => $this->legal_name,
"email" => $this->email // returns email anyway
];
}

Add condition, if email length>0 then set property 'email' for output array.

	public function toArray(): array
	{
		$output = [
			"legal_name" => $this->legal_name,
		]; 
		if($this->email){
			$output["email"] = $this->email;
		}
		return $output;
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions