/** * @return MethodInterface */ public function getPaymentMethod() { $data = $this->data['paymentMethod']; if (!array_key_exists('type', $data) || !array_key_exists('code', $data)) { throw new \RuntimeException('Payment Method expected type and code'); } $method = MethodFactory::factory($data['type'], $data['code']); return $method; }
/** * Deposit Account */ public function testDepositAccount() { $method = MethodFactory::factory(MethodInterface::TYPE_DEPOSIT_ACCOUNT, DepositAccountInterface::BANCO_DO_BRASIL); $className = '\\laravel\\pagseguro\\Payment\\Method\\DepositAccount\\DepositAccountInterface'; $this->assertInstanceOf($className, $method); $this->assertEquals(MethodInterface::TYPE_DEPOSIT_ACCOUNT, $method->getType()); $this->assertEquals(DepositAccountInterface::BANCO_DO_BRASIL, $method->getCode()); $this->assertEquals('Depósito em conta', $method->getTypeName()); $this->assertEquals('Banco do Brasil', $method->getName()); $this->assertEquals('Depósito em conta Banco do Brasil', $method->getFullName()); }