Skip to content

Commit

Permalink
feat: suportar pagamentos recorrentes
Browse files Browse the repository at this point in the history
  • Loading branch information
edson-nascimento committed May 2, 2024
1 parent 2415ac9 commit c50a681
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@phpstan",
"@phpunit"
],
"test:unit":"phpunit --configuration phpunit.xml --testdox --exclude e2e",
"test:unit":"phpunit --configuration phpunit.xml --testdox --exclude-group e2e",
"test:e2e":"phpunit --configuration phpunit.xml --testdox --group e2e",
"test:coverage":"phpunit --configuration phpunit.xml --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
},
Expand Down
61 changes: 61 additions & 0 deletions src/Getnet/API/Credit.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Getnet\API;

use Getnet\API\Exception\GetnetException;

/**
* Class Credit
*
Expand All @@ -19,6 +21,14 @@ class Credit implements \JsonSerializable
// Pagamento parcelado com juros
const TRANSACTION_TYPE_INSTALL_WITH_INTEREST = "INSTALL_WITH_INTEREST";

const COF_ONE_CLICK = 'ONE_CLICK';

const COF_ONE_CLICK_PAYMENT = 'ONE_CLICK_PAYMENT';

const COF_RECURRING = 'RECURRING';

const COF_RECURRING_PAYMENT = 'RECURRING_PAYMENT';

private $authenticated;

private $delayed;
Expand All @@ -39,6 +49,11 @@ class Credit implements \JsonSerializable

private $cardholder_mobile;

// Tipo do COF (Credential On File).
private $credentials_on_file_type;

private $transaction_id;

/**
*
* @return mixed
Expand Down Expand Up @@ -252,4 +267,50 @@ public function setCardholderMobile($cardholder_mobile)

return $this;
}

/**
*
* @return mixed
*/
public function getCredentialsOnFileType()
{
return $this->credentials_on_file_type;
}

/**
*
* @param mixed $credentials_on_file_type
*/
public function setCredentialsOnFileType($credentials_on_file_type)
{
if (!in_array($credentials_on_file_type, [
static::COF_ONE_CLICK, static::COF_ONE_CLICK_PAYMENT, static::COF_RECURRING, static::COF_RECURRING_PAYMENT
]))
throw new GetnetException('Escolha uma forma de recorrência válida');

$this->credentials_on_file_type = $credentials_on_file_type;

return $this;
}

/**
*
* @return mixed
*/
public function getTransactionId()
{
return $this->transaction_id;
}

/**
*
* @param mixed $transaction_id
*/
public function setTransactionId($transaction_id)
{
$this->transaction_id = (string) $transaction_id;

return $this;
}

}

0 comments on commit c50a681

Please sign in to comment.