public function testAdvancedCreateAccount() { $country = 'US'; $currency = 'usd'; $routingNumber = '110000000'; $state = 'IN'; $address = '5555 Test Dr.'; $businessName = 'Test'; $firstName = 'Aaron'; $lastName = 'Woodland'; $type = 'individual'; $dob = new \DateTime('1975-01-01'); $managed = true; $cvc = true; $avs = true; $delayDays = 3; $interval = 'daily'; $bankAccountRequest = new CreateExternalAccountRequest('000123456789', $country, $currency); $bankAccountRequest->setRoutingNumber($routingNumber); $addressRequest = new CreateAddressRequest(); $addressRequest->setState($state); $addressRequest->setLine1($address); $legalEntity = new CreateLegalEntityRequest(); $legalEntity->setBusinessName($businessName); $legalEntity->setFirstName($firstName); $legalEntity->setLastName($lastName); $legalEntity->setAddress($addressRequest); $legalEntity->setType($type); $legalEntity->setDob(new CreateDOBRequest($dob)); $tosAcceptance = new CreateTOSAcceptance(); $tosAcceptance->setDate(new \DateTime()); $tosAcceptance->setIp('127.0.0.1'); $accountRequest = new CreateAccountRequest(); $accountRequest->setManaged($managed); $accountRequest->setExternalAccount($bankAccountRequest); $accountRequest->setLegalEntity($legalEntity); $accountRequest->setTosAcceptance($tosAcceptance); $declineCharge = new CreateDeclineChargeRequest(true, true); $accountRequest->setDeclineChargeOn($declineCharge); $transferSchedule = new CreateTransferScheduleRequest(); $transferSchedule->setDelayDays($delayDays); $transferSchedule->setInterval($interval); $accountRequest->setTransferSchedule($transferSchedule); $response = $this->accounts->createAccount($accountRequest); $this->assertInstanceOf(Accounts::ACCOUNT_RESPONSE_CLASS, $response); foreach ($response->getExternalAccounts()->getData() as $account) { $this->assertInstanceOf('Stripe\\Response\\Accounts\\ExternalAccountResponse', $account); $this->assertEquals($country, $account->getCountry()); $this->assertEquals($currency, $account->getCurrency()); $this->assertEquals($routingNumber, $account->getRoutingNumber()); } $this->assertInstanceOf('Stripe\\Response\\LegalEntity\\LegalEntityResponse', $response->getLegalEntity()); $this->assertInstanceOf('Stripe\\Response\\LegalEntity\\AddressResponse', $response->getLegalEntity()->getAddress()); $this->assertInstanceOf('Stripe\\Response\\LegalEntity\\DOBResponse', $response->getLegalEntity()->getDob()); $this->assertEquals($state, $response->getLegalEntity()->getAddress()->getState()); $this->assertEquals($address, $response->getLegalEntity()->getAddress()->getLine1()); $this->assertEquals($businessName, $response->getLegalEntity()->getBusinessName()); $this->assertEquals($firstName, $response->getLegalEntity()->getFirstName()); $this->assertEquals($lastName, $response->getLegalEntity()->getLastName()); $this->assertEquals($type, $response->getLegalEntity()->getType()); $this->assertEquals($managed, $response->isManaged()); $this->assertInstanceOf('Stripe\\Response\\Accounts\\DeclineChargeOnResponse', $response->getDeclineChargeOn()); $this->assertEquals($cvc, $response->getDeclineChargeOn()->isCvcFailure()); $this->assertEquals($avs, $response->getDeclineChargeOn()->isAvsFailure()); $this->assertInstanceOf('Stripe\\Response\\Accounts\\TransferScheduleResponse', $response->getTransferSchedule()); $this->assertEquals($delayDays, $response->getTransferSchedule()->getDelayDays()); $this->assertEquals($interval, $response->getTransferSchedule()->getInterval()); $this->client->delete('accounts/' . $response->getId()); }