/** @test */
 function it_has_a_shortcut_to_fill_uk_bank_details()
 {
     $account = new CustomerBankAccount();
     $customer = new Customer();
     $account->withAccountDetails('John Doe', '12345678', '112233', 'GB', $customer);
     $this->assertEquals('John Doe', $account->getAccountHolderName());
     $this->assertEquals('12345678', $account->getAccountNumber());
     $this->assertEquals('112233', $account->getSortCode());
     $this->assertEquals('GB', $account->getCountryCode());
     $this->assertAttributeSame($customer, 'customer', $account);
 }
Example #2
0
 /**
  * Look up the name and reachability of a bank.
  *
  * @see https://developer.gocardless.com/pro/#helper-endpoints-bank-details-lookups
  *
  * @param CustomerBankAccount $account Customer Bank Account
  *
  * @return array
  */
 public function lookupBankDetails(CustomerBankAccount $account)
 {
     $request = ['iban' => $account->getIban()];
     if (!$account->hasIban()) {
         $request = ['account_number' => $account->getAccountNumber(), 'branch_code' => $account->getBranchCode(), 'country_code' => $account->getCountryCode()];
     }
     return $this->post(self::BANK_DETAILS_LOOKUPS, $request);
 }