/** * @return array */ public function toArray() { $mandate = array_filter(get_object_vars($this)); if ($this->customer_bank_account instanceof CustomerBankAccount) { unset($mandate['customer_bank_account']); $mandate['links']['customer_bank_account'] = $this->customer_bank_account->getId(); } if ($this->creditor instanceof Creditor) { unset($mandate['creditor']); $mandate['links']['creditor'] = $this->creditor->getId(); } return $mandate; }
/** @depends test_it_can_create_a_customer_bank_account */ function test_it_can_get_a_single_bank_account(CustomerBankAccount $old) { $new = $this->api->getCustomerBankAccount($old->getId()); $this->assertInstanceOf('GoCardless\\Pro\\Models\\CustomerBankAccount', $new); $this->assertEquals($old->toArray(), $new->toArray()); }