public function toArray() { $account = array_filter(get_object_vars($this)); if ($this->customer instanceof Customer) { unset($account['customer']); $account['links'] = ['customer' => $this->customer->getId()]; } return $account; }
/** * @see https://developer.gocardless.com/pro/#customers-update-a-customer * @param Customer $customer * * @return Customer */ public function updateCustomer(Customer $customer) { $response = $this->put(self::CUSTOMERS, $customer->toArrayForUpdating(), $customer->getId()); return Customer::fromArray($response); }
/** * @depends it_can_create_a_customer * @depends test_it_can_create_a_customer_bank_account */ function test_it_can_return_customer_bank_accounts_for_a_specific_customer(Customer $customer, CustomerBankAccount $old) { $accounts = $this->api->listCustomerBankAccounts(['customer' => $customer->getId()]); $this->assertCount(1, $accounts); $this->assertInternalType('array', $accounts); $this->assertInstanceOf('GoCardless\\Pro\\Models\\CustomerBankAccount', $accounts[0]); $this->assertEquals($old->getId(), $accounts[0]->getId()); }