Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cria classe para os dados de boleto
- Loading branch information
1 parent
b0c09e7
commit 3c06ec9
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
upload/system/library/PagSeguro/src/Domains/PaymentMethod/AbstractPaymentMethod.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
upload/system/library/PagSeguro/src/Domains/PaymentMethod/Boleto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
upload/system/library/PagSeguro/tests/unit/Domains/PaymentMethod/BoletoTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |