Skip to content

Commit

Permalink
feat: cria classe para os dados de boleto
Browse files Browse the repository at this point in the history
  • Loading branch information
valdeir2000 committed Aug 19, 2020
1 parent b0c09e7 commit 3c06ec9
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
@@ -0,0 +1,47 @@
<?php

namespace ValdeirPsr\PagSeguro\Domains\PaymentMethod;

abstract class AbstractPaymentMethod
{
/** @var int Tipo de pagamento (Somente leitura) */
protected $type;

/** @var int Código de pagamento (Somente leitura) */
protected $code;

/** @var string Nome do método de pagamento */
protected $method;

/**
* @param string $method
*/
public function __construct(string $method)
{
$this->method = $method;
}

/**
* @return int
*/
public function getType(): int
{
return $this->$type;
}

/**
* @return int
*/
public function getCode(): int
{
return $this->code;
}

/**
* @return string
*/
public function getMethod(): string
{
return $this->method;
}
}
@@ -0,0 +1,22 @@
<?php

namespace ValdeirPsr\PagSeguro\Domains\PaymentMethod;

class Boleto extends AbstractPaymentMethod
{
/** @var string Link do boleto (somente leitura) */
private $paymentLink;

public function __construct()
{
parent::__construct('boleto');
}

/**
* @return string
*/
public function getPaymentLink(): string
{
return $this->paymentLink;
}
}
@@ -0,0 +1,25 @@
<?php

use PHPUnit\Framework\TestCase;
use ValdeirPsr\PagSeguro\Domains\PaymentMethod\Boleto;

class BoletoTest extends TestCase
{
/**
* @test
*/
public function newInstance()
{
$instance = new Boleto();
$this->assertInstanceOf(Boleto::class, $instance);
}

/**
* @test
*/
public function getMethodShouldReturnBoleto()
{
$instance = new Boleto();
$this->assertEquals('boleto', $instance->getMethod());
}
}

0 comments on commit 3c06ec9

Please sign in to comment.