Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addition of installment and other improvements on class architecture #1

Merged
merged 2 commits into from
May 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea/
atlassian-ide-plugin.xml
/composer.lock
/vendor
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ php:
- 5.5

before_script:
- composer install
- composer install --no-dev

script: phpunit --bootstrap tests/bootstrap.php --configuration tests/phpunit.xml
14 changes: 13 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,26 @@
"authors": [
{
"name": "Daniel Costa",
"email": "danielcosta@gmail.com"
"email": "danielcosta@gmail.com",
"homepage": "https://github.com/danielcosta"
},
{
"name": "Alexandre Xavier",
"email": "alexandre.rodrigues.xv@gmail.com",
"homepage": "https://github.com/alexandre-xavier"
}
],
"support": {
"issues": "https://github.com/danielcosta/redecard-ecommerce/issues"
},
"require": {
"php": ">=5.3.0",
"jms/serializer": "0.*",
"nategood/httpful": "0.2.*"
},
"require-dev": {
"phpunit/phpunit": "4.2.*@dev"
},
"minimum-stability": "dev",
"autoload": {
"psr-0": {
Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Class Client
*
* @package RedeCard\Ecommerce
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Client {

Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/AbstractEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package RedeCard\Ecommerce
* @author Carlos Cima
* @author Thiago Risso
* @author Daniel Costa
* @author Daniel Costa <danielcosta@gmail.com>
*/
class AbstractEntity {

Expand Down
15 changes: 7 additions & 8 deletions src/RedeCard/Ecommerce/Entity/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace RedeCard\Ecommerce\Entity;

use RedeCard\Ecommerce\Entity\Authentication\AcquirerCode;
use RedeCard\Ecommerce\Entity\Enum\AuthenticationTypeEnum;
use RedeCard\Ecommerce\Exception\InvalidAuthenticationTypeException;
use RedeCard\Ecommerce\Entity\Enum\AuthenticationType;
use RedeCard\Ecommerce\Exception\RedeCardEcommerceException;

/**
* Class Authentication
*
* @package RedeCard\Ecommerce\Entity
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Authentication extends AbstractEntity {

Expand Down Expand Up @@ -46,20 +46,19 @@ class Authentication extends AbstractEntity {
* @param int $client Client ID or AcquirerCode
* @param string $password Password
* @param string $type Authentication Type
* @throws \RedeCard\Ecommerce\Exception\InvalidAuthenticationTypeException
*/
public function __construct($client, $password, $type = AuthenticationTypeEnum::ACQUIRER)
public function __construct($client, $password, $type = AuthenticationType::ACQUIRER)
{
switch ($type) {
case AuthenticationTypeEnum::ACQUIRER:
case AuthenticationType::ACQUIRER:
$acquirer = new AcquirerCode($client);
$this->setAcquirerCode($acquirer);
break;
case AuthenticationTypeEnum::CLIENT:
case AuthenticationType::CLIENT:
$this->setClient($client);
break;
default:
throw new InvalidAuthenticationTypeException('Invalid authentication type');
throw new RedeCardEcommerceException('Invalid authentication type');
}
$this->setPassword($password);
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Esta funcionalidade é limitada com base no adquirente do estabelecimento comercial.
*
* @package RedeCard\Ecommerce\Entity\Authentication
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class AcquirerCode extends AbstractEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace RedeCard\Ecommerce\Entity\Enum;

/**
* Class AuthenticationTypeEnum
* Class AuthenticationType
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class AuthenticationTypeEnum {
class AuthenticationType {

/**
* Este método usa uma instância de Authentication\AcquirerCode como parâmetro de autenticação
Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Enum/CaptureMethodEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Capture Method Enumerator
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class CaptureMethodEnum {

Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Enum/CardAccountTypeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Card Account Type Enumerator
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class CardAccountTypeEnum {

Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Enum/CardSchemeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Card Scheme Enumerator
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class CardSchemeEnum {

Expand Down
8 changes: 4 additions & 4 deletions src/RedeCard/Ecommerce/Entity/Enum/CountryEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace RedeCard\Ecommerce\Entity\Enum;

use RedeCard\Ecommerce\Exception\InvalidCountryException;
use RedeCard\Ecommerce\Exception\RedeCardEcommerceException;

/**
* Class CountryEnum
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
* @link http://unstats.un.org/unsd/methods/m49/m49alpha.htm
*/
class CountryEnum {
Expand All @@ -27,15 +27,15 @@ class CountryEnum {
* @param $iso3Code
*
* @return string
* @throws \RedeCard\Ecommerce\Exception\InvalidCountryException
* @throws \RedeCard\Ecommerce\Exception\RedeCardEcommerceException
*/
public static function getNumericalCodeByIso3Code($iso3Code)
{
if (isset(self::$numericalCodes[$iso3Code])) {
return self::$numericalCodes[$iso3Code];
}

throw new InvalidCountryException('Invalid ISO 3 country code');
throw new RedeCardEcommerceException('Invalid ISO 3 country code');
}

}
4 changes: 2 additions & 2 deletions src/RedeCard/Ecommerce/Entity/Enum/Currency/Iso4217Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*
* @package RedeCard\Ecommerce\Entity\Enum\Currency
* @author Carlos Cima
* @author Alexandre Xavier
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Alexandre Xavier <alexandre.rodrigues.xv@gmail.com>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Iso4217Enum {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Class ExtendedPolicyAttributeEnum
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class ExtendedPolicyAttributeEnum {

Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Enum/MethodEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Transaction Method Enumerator
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class MethodEnum {

Expand Down
12 changes: 6 additions & 6 deletions src/RedeCard/Ecommerce/Entity/Enum/StatusEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace RedeCard\Ecommerce\Entity\Enum;

use RedeCard\Ecommerce\Exception\InvalidStatusException;
use RedeCard\Ecommerce\Exception\RedeCardEcommerceException;

/**
* Class StatusEnum
*
* Transaction Status Enumerator
*
* @package RedeCard\Ecommerce\Entity\Enum
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class StatusEnum {

Expand All @@ -26,28 +26,28 @@ class StatusEnum {
* @param $id
*
* @return mixed
* @throws \RedeCard\Ecommerce\Exception\InvalidStatusException
* @throws \Exception
*/
public function getStatusByCode($id)
{
if (isset($this->codes[$id])) {
return $this->codes[$id];
}
throw new InvalidStatusException('Invalid status code');
throw new RedeCardEcommerceException('Invalid status code');
}

/**
* @param $id
*
* @return mixed
* @throws \RedeCard\Ecommerce\Exception\InvalidStatusException
* @throws \Exception
*/
public function getDescriptionByCode($id)
{
if (isset($this->descriptions[$id])) {
return $this->descriptions[$id];
}
throw new InvalidStatusException('Invalid status code');
throw new RedeCardEcommerceException('Invalid status code');
}

}
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Class Request
*
* @package RedeCard\Ecommerce\Entity
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Request extends AbstractEntity {

Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Class Response
*
* @package RedeCard\Ecommerce\Entity
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Response extends AbstractEntity {

Expand Down
2 changes: 1 addition & 1 deletion src/RedeCard/Ecommerce/Entity/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Class Transaction
*
* @package RedeCard\Ecommerce\Entity
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Transaction {

Expand Down
7 changes: 3 additions & 4 deletions src/RedeCard/Ecommerce/Entity/Transaction/CardTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use RedeCard\Ecommerce\Entity\AbstractEntity;
use RedeCard\Ecommerce\Entity\Transaction\CardTransaction\Card;
use RedeCard\Ecommerce\Entity\Enum\MethodEnum;
use RedeCard\Ecommerce\Exception\InvalidMethodException;
use RedeCard\Ecommerce\Exception\RedeCardEcommerceException;

/**
* Class CardTransaction
*
* @package RedeCard\Ecommerce\Entity\Transaction
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class CardTransaction extends AbstractEntity {

Expand Down Expand Up @@ -73,7 +73,6 @@ public function getAuthCode()

/**
* @param string $method
* @throws \RedeCard\Ecommerce\Exception\InvalidMethodException
*/
public function setMethod($method)
{
Expand All @@ -86,7 +85,7 @@ public function setMethod($method)
return $this;
break;
default:
throw new InvalidMethodException('Invalid card transaction Method. Only "auth", "cancel", "fulfill" or "pre" allowed.');
throw new RedeCardEcommerceException('Invalid card transaction Method. Only "auth", "cancel", "fulfill" or "pre" allowed.');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use RedeCard\Ecommerce\Entity\AbstractEntity;
use RedeCard\Ecommerce\Entity\Transaction\CardTransaction\Card\Cv2Avs;
use RedeCard\Ecommerce\Entity\Enum\CardAccountTypeEnum;
use RedeCard\Ecommerce\Exception\InvalidCardAccountTypeException;
use RedeCard\Ecommerce\Exception\RedeCardEcommerceException;

/**
* Class Card
*
* @package RedeCard\Ecommerce\Entity\Transaction\CardTransaction
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Card extends AbstractEntity {

Expand Down Expand Up @@ -55,7 +55,6 @@ public function __construct()

/**
* @param string $cardAccountType
* @throws \RedeCard\Ecommerce\Exception\InvalidCardAccountTypeException
*/
public function setCardAccountType($cardAccountType)
{
Expand All @@ -66,7 +65,7 @@ public function setCardAccountType($cardAccountType)
return $this;
break;
default:
throw new InvalidCardAccountTypeException('Invalid Card Account Type. Only "credit" or "debit" allowed.');
throw new RedeCardEcommerceException('Invalid Card Account Type. Only "credit" or "debit" allowed.');
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class Cv2Avs
*
* @package RedeCard\Ecommerce\Entity\Transaction\CardTransaction\Card
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Cv2Avs {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Class ExtendedPolicy
*
* @package RedeCard\Ecommerce\Entity\Transaction\CardTransaction\Card\Cv2Avs
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class ExtendedPolicy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Class ExtendedPolicyAttributes
*
* @package RedeCard\Ecommerce\Entity\Transaction\CardTransaction\Card\Cv2Avs
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class ExtendedPolicyAttributes {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Class Cv2AvsResult
*
* @package RedeCard\Ecommerce\Entity\Transaction\CardTransaction
* @author Daniel Costa <daniel.costa@mobly.com.br>
* @author Daniel Costa <danielcosta@gmail.com>
*/
class Cv2AvsResult {

Expand Down
Loading