Skip to content

$gateway->findCustomer()->send()->getCustomerData() returns null #48

Open
@Mark-H

Description

@Mark-H

While the readme isn't clear about what is and what isn't expected behaviour, I landed on the following code to check if a customer id exists:

$id = '...';
$existingCustomer = $this->instance->findCustomer($id)->send();
if ($customer = $existingCustomer->getCustomerData()) {
    return $customer->id;
}

However, getCustomerData() returns null.

This seems to be due the implementation in CustomerResponse, which is looking for $this->data->customer. In the findCustomer request however, the customer object is $this->data (so getData() does get me what I need).

https://github.com/thephpleague/omnipay-braintree/blob/master/src/Message/CustomerResponse.php#L12-L14

(Note I'm on v1.1.2 and currently unable of upgrading to Omnipay 3 due to the PHP requirement, but from a very brief look at the v2 code that doesn't seem to have changed)

What's expected here? Should getCustomerData work in the findCustomer request, or is the documentation that says getData should be used missing?

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