diff --git a/README.md b/README.md
index caadc2b..7abe33d 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ This is the repository of Pagar.me's payment module core for all supported e-com
- [Pagar.me Magento payment module for Magento 2.3+](https://github.com/pagarme/magento2).
## Dependencies
-* ``PHP`` Version 5.6+
+* ``PHP`` Version 7.1+
## Install
Require by composer
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 3145c9b..a818905 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -28,12 +28,12 @@ stages:
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpCurrentVersion)
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpCurrentVersion)
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpCurrentVersion)
- sudo apt-get install php-xdebug
+ sudo apt-get install php7.2-xdebug
php -version
displayName: Build PHP Version $(phpCurrentVersion)
- script: |
- sudo apt-get install php-xdebug
+ sudo apt-get install php7.2-xdebug
php -version
displayName: Install PHP extensions
diff --git a/composer.json b/composer.json
index d9b179c..e328432 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "pagarme/ecommerce-module-core",
"description": "Core component for Pagar.me e-commerce platform modules.",
"license": "MIT",
- "version": "1.0.0",
+ "version": "1.1.0",
"authors": [
{
"name":"Open Source Team"
@@ -10,7 +10,7 @@
],
"type": "library",
"require": {
- "php": ">=5.6",
+ "php": ">=7.1",
"monolog/monolog": "~1.6",
"mundipagg/mundiapi": "^3.0",
"ext-json": "*"
diff --git a/src/Hub/Commands/InstallCommand.php b/src/Hub/Commands/InstallCommand.php
index 9a52e4e..540f274 100644
--- a/src/Hub/Commands/InstallCommand.php
+++ b/src/Hub/Commands/InstallCommand.php
@@ -18,6 +18,8 @@ public function execute()
$moduleConfig->setHubInstallId($this->getInstallId());
+ $moduleConfig->setHubEnvironment($this->getType());
+
$moduleConfig->setPublicKey(
$this->getAccountPublicKey()
);
diff --git a/src/Hub/Factories/HubCommandFactory.php b/src/Hub/Factories/HubCommandFactory.php
index f4a24e4..83885c5 100644
--- a/src/Hub/Factories/HubCommandFactory.php
+++ b/src/Hub/Factories/HubCommandFactory.php
@@ -31,8 +31,8 @@ public function createFromStdClass($object)
/**
*
- * @var AbstractCommand $command
-*/
+ * @var AbstractCommand $command
+ */
$command = new $commandClass();
$command->setAccessToken(
@@ -48,7 +48,10 @@ public function createFromStdClass($object)
);
$publicKeyClass = PublicKey::class;
- if ($command->getType()->equals(CommandType::Sandbox())) {
+ if (
+ $command->getType()->equals(CommandType::Sandbox())
+ || $command->getType()->equals(CommandType::Development())
+ ) {
$publicKeyClass = TestPublicKey::class;
}
diff --git a/src/Hub/Services/HubIntegrationService.php b/src/Hub/Services/HubIntegrationService.php
index 6a08cd1..d25a8d5 100644
--- a/src/Hub/Services/HubIntegrationService.php
+++ b/src/Hub/Services/HubIntegrationService.php
@@ -49,8 +49,9 @@ public function endHubIntegration(
$installToken = $tokenRepo->findByPagarmeId(new HubInstallToken($installToken));
- if (is_a($installToken, InstallToken::class)
- && !$installToken->isExpired()
+ if (
+ is_a($installToken, InstallToken::class)
+ && !$installToken->isExpired()
&& !$installToken->isUsed()
) {
$body = [
@@ -100,4 +101,4 @@ public function executeCommandFromPost($body)
$command = $commandFactory->createFromStdClass($body);
$command->execute();
}
-}
\ No newline at end of file
+}
diff --git a/src/Kernel/Abstractions/AbstractModuleCoreSetup.php b/src/Kernel/Abstractions/AbstractModuleCoreSetup.php
index 1dcb4c9..8d56dbe 100644
--- a/src/Kernel/Abstractions/AbstractModuleCoreSetup.php
+++ b/src/Kernel/Abstractions/AbstractModuleCoreSetup.php
@@ -4,6 +4,7 @@
use Pagarme\Core\Kernel\Aggregates\Configuration;
use Pagarme\Core\Kernel\Repositories\ConfigurationRepository;
+use MundiAPILib\Configuration as MundiAPIConfiguration;
use ReflectionClass;
abstract class AbstractModuleCoreSetup
@@ -72,6 +73,15 @@ public static function bootstrap($platformRoot = null)
static::$platformRoot = $platformRoot;
static::updateModuleConfiguration();
+
+ static::$instance->setApiBaseUrl();
+ }
+ }
+
+ protected static function setApiBaseUrl()
+ {
+ if (static::$moduleConfig->isHubEnabled()) {
+ MundiAPIConfiguration::$BASEURI = 'https://hubapi.mundipagg.com/core/v1';
}
}
@@ -98,7 +108,7 @@ protected static function updateModuleConfiguration()
static::$moduleConfig->setStoreId(static::getCurrentStoreId());
}
- if(
+ if (
static::$moduleConfig->getStoreId() != static::getDefaultStoreId() &&
$savedConfig === null
) {
@@ -241,7 +251,7 @@ public static function getModuleConcreteDir()
public static function setModuleConcreteDir($concreteModuleDir)
{
- if(!isset(self::$moduleConcreteDir)) {
+ if (!isset(self::$moduleConcreteDir)) {
self::$moduleConcreteDir = $concreteModuleDir;
}
}
@@ -288,4 +298,3 @@ public static function getStoreTimezone()
*/
abstract protected function getPlatformStoreTimezone();
}
-
diff --git a/src/Kernel/Aggregates/Configuration.php b/src/Kernel/Aggregates/Configuration.php
index 524472d..dff881d 100644
--- a/src/Kernel/Aggregates/Configuration.php
+++ b/src/Kernel/Aggregates/Configuration.php
@@ -62,6 +62,12 @@ final class Configuration extends AbstractEntity
*/
private $hubInstallId;
+ /**
+ *
+ * @var string
+ */
+ private $hubEnvironment;
+
/** @var string */
private $cardOperation;
@@ -315,6 +321,16 @@ public function getHubInstallId()
return $this->hubInstallId;
}
+ public function setHubEnvironment($hubEnvironment)
+ {
+ $this->hubEnvironment = $hubEnvironment;
+ }
+
+ public function getHubEnvironment()
+ {
+ return $this->hubEnvironment;
+ }
+
/**
*
* @param bool $boletoEnabled
@@ -711,6 +727,7 @@ public function jsonSerialize()
"boletoCreditCardEnabled" => $this->boletoCreditCardEnabled,
"testMode" => $this->testMode,
"hubInstallId" => $this->isHubEnabled() ? $this->hubInstallId->getValue() : null,
+ "hubEnvironment" => $this->hubEnvironment,
"addressAttributes" => $this->getAddressAttributes(),
"keys" => $this->keys,
"cardOperation" => $this->cardOperation,
diff --git a/src/Kernel/Factories/ConfigurationFactory.php b/src/Kernel/Factories/ConfigurationFactory.php
index f89cb40..575f58d 100644
--- a/src/Kernel/Factories/ConfigurationFactory.php
+++ b/src/Kernel/Factories/ConfigurationFactory.php
@@ -124,6 +124,10 @@ public function createFromJsonData($json)
);
}
+ if (!empty($data->hubEnvironment)) {
+ $config->setHubEnvironment($data->hubEnvironment);
+ }
+
if (!empty($data->keys) ) {
if (!isset($data->publicKey)) {
$index = Configuration::KEY_PUBLIC;
diff --git a/src/Kernel/Factories/Configurations/PixConfigFactory.php b/src/Kernel/Factories/Configurations/PixConfigFactory.php
index 19559a4..c8bd1c5 100644
--- a/src/Kernel/Factories/Configurations/PixConfigFactory.php
+++ b/src/Kernel/Factories/Configurations/PixConfigFactory.php
@@ -27,6 +27,17 @@ public function createFromDbData($data)
$pixConfig->setExpirationQrCode($data->expirationQrCode);
}
+ if (!empty($data->additionalInformation)) {
+ $additionalInformationArray = json_decode(
+ json_encode($data->additionalInformation),
+ true
+ );
+
+ $pixConfig->setAdditionalInformation(
+ $additionalInformationArray
+ );
+ }
+
if (!empty($data->bankType)) {
$pixConfig->setBankType(
$data->bankType
diff --git a/src/Kernel/I18N/ENUS.php b/src/Kernel/I18N/ENUS.php
index c04e2d8..faebf4c 100644
--- a/src/Kernel/I18N/ENUS.php
+++ b/src/Kernel/I18N/ENUS.php
@@ -43,14 +43,18 @@ protected function getTable()
"The card '%s' couldn't be deleted." => null,
"Different paid amount for this invoice. Paid value: %.2f" => null,
"The %s should not be empty!" => null,
+ "The %s is invalid!" => null,
"street" => null,
"number" => null,
"neighborhood" => null,
+ "zipCode" => null,
"city" => null,
"country" => null,
"state" => null,
+ "phone" => null,
"document" => null,
"Can't create order." => null,
+ "Can't create payment. Please review the information and try again." => null,
'Invalid address configuration. Please fill the address configuration on admin panel.' => null,
'week' => null,
'weeks' => null,
@@ -85,6 +89,11 @@ protected function getTable()
'Antifraud reproved' => null,
'Antifraud pending' => null,
'Waiting manual analise in antifraud' => null,
+ "Can't connect to the payment service. Please contact the store administrator." => null,
+ "The sum of payments is different than the order amount! Review the information and try again." => null,
+ "The sum of payments is greater than the order amount! Review the information and try again." => null,
+ "The card brand '%s' or the amount %.2f doesn't allow %d installment(s)! Please review the information and try again." => null,
+ "Passed value:" => null,
];
}
-}
\ No newline at end of file
+}
diff --git a/src/Kernel/I18N/PTBR.php b/src/Kernel/I18N/PTBR.php
index f8e55df..6561ebc 100644
--- a/src/Kernel/I18N/PTBR.php
+++ b/src/Kernel/I18N/PTBR.php
@@ -42,15 +42,19 @@ protected function getTable()
"The card '%s' was deleted." => "O cartão '%s' foi deletado.",
"The card '%s' couldn't be deleted." => "O cartão '%s' não pôde ser deletado.",
"Different paid amount for this invoice. Paid value: %.2f" => "Esta Invoice foi paga com um valor diferente do Grand Total do pedido. Valor pago: %.2f",
- "The %s should not be empty!" => "O campo %s não deve estar vazio",
+ "The %s should not be empty!" => "O campo %s é obrigatório!",
+ "The %s is invalid!" => "Campo %s inválido!",
"street" => "rua",
"number" => "número",
"neighborhood" => "bairro",
+ "zipCode" => "CEP",
"city" => "cidade",
"country" => "país",
"state" => "estado",
- "document" => "CPF",
- "Can't create order." => "Não foi possível criar o pedido",
+ "phone" => "telefone",
+ "document" => "CPF/CNPJ",
+ "Can't create order." => "Não foi possível criar o pedido.",
+ "Can't create payment. Please review the information and try again." => "Não foi possível realizar o pagamento. Por favor revise os dados e tente novamente.",
'Invalid address configuration. Please fill the address configuration on admin panel.' => 'Configurações de endereço inválidas. Preencha as configurações de endereço no painel de administração',
'week' => "semana",
'weeks' => "semanas",
@@ -86,6 +90,11 @@ protected function getTable()
'Antifraud reproved' => 'Reprovado no antifraude',
'Antifraud pending' => 'Analise pendente no antifraude',
'Waiting manual analise in antifraud' => 'Aguardando análise manual em antifraude',
+ "Can't connect to the payment service. Please contact the store administrator." => "Não foi possivel conectar com o serviço de pagamento. Por favor contate o administrador da loja.",
+ "The sum of payments is different than the order amount! Review the information and try again." => "A soma dos pagamentos é diferente do valor do pedido! Verifique as informações de sua compra e tente novamente.",
+ "The sum of payments is greater than the order amount! Review the information and try again." => "A soma dos pagamentos é maior do que o valor do pedido! Verifique as informações de sua compra e tente novamente.",
+ "The card brand '%s' or the amount %.2f doesn't allow %d installment(s)! Please review the information and try again." => "A bandeira do cartão '%s' ou o valor %.2f não permite %d parcela(s)! Por favor revise os dados e tente novamente.",
+ "Passed value:" => "Valor informado:",
];
}
-}
\ No newline at end of file
+}
diff --git a/src/Kernel/Services/APIService.php b/src/Kernel/Services/APIService.php
index 6065181..75778c2 100644
--- a/src/Kernel/Services/APIService.php
+++ b/src/Kernel/Services/APIService.php
@@ -223,6 +223,7 @@ private function getCustomerController()
private function getMundiPaggApiClient()
{
+ $i18n = new LocalizationService();
$config = MPSetup::getModuleConfiguration();
$secretKey = null;
@@ -231,6 +232,15 @@ private function getMundiPaggApiClient()
}
$password = '';
+ if (empty($secretKey)) {
+ $message = $i18n->getDashboard(
+ "Can't connect to the payment service. " .
+ "Please contact the store administrator."
+ );
+
+ throw new \Exception($message, 400);
+ }
+
Configuration::$basicAuthPassword = '';
return new MundiAPIClient($secretKey, $password);
diff --git a/src/Kernel/Services/ChargeService.php b/src/Kernel/Services/ChargeService.php
index 8a73d1f..00a95e2 100644
--- a/src/Kernel/Services/ChargeService.php
+++ b/src/Kernel/Services/ChargeService.php
@@ -120,7 +120,9 @@ public function capture(Charge $charge, $amount = 0)
$orderHandlerService = new OrderHandler();
- $order->setCustomer($charge->getCustomer());
+ if (!empty($charge->getCustomer())) {
+ $order->setCustomer($charge->getCustomer());
+ }
$orderHandlerService->handle($order);
@@ -215,8 +217,7 @@ public function getNotFailedOrCanceledCharges(array $listCharge)
$listCharge,
function (Charge $charge) {
return (
- ($charge->getStatus()->getStatus() == 'failed')
- );
+ ($charge->getStatus()->getStatus() == 'failed'));
}
);
@@ -224,12 +225,11 @@ function (Charge $charge) {
$listChargesPaid = array_filter(
$listCharge,
function (Charge $charge) {
- return (
- $charge->getStatus()->getStatus() == 'paid' ||
+ return ($charge->getStatus()->getStatus() == 'paid' ||
$charge->getStatus()->getStatus() == 'underpaid' ||
- $charge->getStatus()->getStatus() == 'pending'
- );
- });
+ $charge->getStatus()->getStatus() == 'pending');
+ }
+ );
}
return $listChargesPaid;
@@ -255,16 +255,16 @@ public function prepareHistoryComment(ChargeInterface $charge)
$extraValue = $charge->getPaidAmount() - $charge->getAmount();
if ($extraValue > 0) {
$history .= ". " . $i18n->getDashboard(
- "Extra amount paid: %.2f",
- $moneyService->centsToFloat($extraValue)
- );
+ "Extra amount paid: %.2f",
+ $moneyService->centsToFloat($extraValue)
+ );
}
if ($extraValue < 0) {
$history .= ". " . $i18n->getDashboard(
- "Remaining amount: %.2f",
- $moneyService->centsToFloat(abs($extraValue))
- );
+ "Remaining amount: %.2f",
+ $moneyService->centsToFloat(abs($extraValue))
+ );
}
$refundedAmount = $charge->getRefundedAmount();
@@ -297,9 +297,9 @@ public function prepareHistoryComment(ChargeInterface $charge)
);
$history .= ' ' . $i18n->getDashboard(
- 'Refunded amount: %.2f',
- $amountInCurrency
- );
+ 'Refunded amount: %.2f',
+ $amountInCurrency
+ );
$history .= " (" . $i18n->getDashboard('until now') . ")";
diff --git a/src/Kernel/Services/OrderService.php b/src/Kernel/Services/OrderService.php
index feeb3cf..55f7c1c 100644
--- a/src/Kernel/Services/OrderService.php
+++ b/src/Kernel/Services/OrderService.php
@@ -19,6 +19,7 @@
use Pagarme\Core\Kernel\Factories\ChargeFactory;
use Pagarme\Core\Payment\Aggregates\Order as PaymentOrder;
use Exception;
+use Pagarme\Core\Kernel\ValueObjects\ChargeStatus;
final class OrderService
{
@@ -100,6 +101,49 @@ public function updateAcquirerData(Order $order)
$dataService->updateAcquirerData($order);
}
+ private function chargeAlreadyCanceled($charge)
+ {
+ return
+ $charge->getStatus()->equals(ChargeStatus::canceled()) ||
+ $charge->getStatus()->equals(ChargeStatus::failed());
+ }
+
+ private function addReceivedChargeMessages($messages, $charge, $result)
+ {
+ if (!is_null($result)) {
+ $messages[$charge->getPagarmeId()->getValue()] = $result;
+ }
+
+ return $messages;
+ }
+
+ private function updateChargeInOrder($order, $charge)
+ {
+ if (!empty($order)) {
+ $order->updateCharge($charge);
+ }
+ }
+
+ public function cancelChargesAtPagarme(array $charges, Order $order = null)
+ {
+ $messages = [];
+ $APIService = new APIService();
+
+ foreach ($charges as $charge) {
+ if ($this->chargeAlreadyCanceled($charge)) {
+ continue;
+ }
+
+ $result = $APIService->cancelCharge($charge);
+
+ $messages = $this->addReceivedChargeMessages($messages, $charge, $result);
+
+ $this->updateChargeInOrder($order, $charge);
+ }
+
+ return $messages;
+ }
+
public function cancelAtPagarme(Order $order)
{
$orderRepository = new OrderRepository();
@@ -112,21 +156,10 @@ public function cancelAtPagarme(Order $order)
return;
}
- $APIService = new APIService();
-
- $charges = $order->getCharges();
- $results = [];
- foreach ($charges as $charge) {
- $result = $APIService->cancelCharge($charge);
- if ($result !== null) {
- $results[$charge->getPagarmeId()->getValue()] = $result;
- }
- $order->updateCharge($charge);
- }
-
- $i18n = new LocalizationService();
+ $results = $this->cancelChargesAtPagarme($order->getCharges(), $order);
if (empty($results)) {
+ $i18n = new LocalizationService();
$order->setStatus(OrderStatus::canceled());
$order->getPlatformOrder()->setStatus(OrderStatus::canceled());
@@ -155,10 +188,15 @@ public function cancelAtPagarme(Order $order)
return;
}
+ $this->addMessagesToPlatformHistory($results, $order);
+ }
+
+ public function addMessagesToPlatformHistory($results, $order)
+ {
+ $i18n = new LocalizationService();
$history = $i18n->getDashboard("Some charges couldn't be canceled at Pagarme. Reasons:");
$history .= "
";
- foreach ($results as $chargeId => $reason)
- {
+ foreach ($results as $chargeId => $reason) {
$history .= "- $chargeId : $reason
";
}
$history .= '
';
@@ -166,6 +204,22 @@ public function cancelAtPagarme(Order $order)
$order->getPlatformOrder()->save();
}
+ public function addChargeMessagesToLog($platformOrder, $orderInfo, $errorMessages)
+ {
+
+ if (!empty($errorMessages)) {
+ return;
+ }
+
+ foreach ($errorMessages as $chargeId => $reason) {
+ $this->logService->orderInfo(
+ $platformOrder->getCode(),
+ "Charge $chargeId couldn't be canceled at Pagarme. Reason: $reason",
+ $orderInfo
+ );
+ }
+ }
+
public function cancelAtPagarmeByPlatformOrder(PlatformOrderInterface $platformOrder)
{
$orderId = $platformOrder->getPagarmeId();
@@ -196,57 +250,68 @@ public function createOrderAtPagarme(PlatformOrderInterface $platformOrder)
'Creating order.',
$orderInfo
);
+
//set pending
$platformOrder->setState(OrderState::stateNew());
$platformOrder->setStatus(OrderStatus::pending());
//build PaymentOrder based on platformOrder
- $order = $this->extractPaymentOrderFromPlatformOrder($platformOrder);
+ $paymentOrder = $this->extractPaymentOrderFromPlatformOrder($platformOrder);
$i18n = new LocalizationService();
- //Send through the APIService to Pagarme
+ //Send through the APIService to pagarme
$apiService = new APIService();
- $response = $apiService->createOrder($order);
+ $response = $apiService->createOrder($paymentOrder);
- $originalResponse = $response;
$forceCreateOrder = MPSetup::getModuleConfiguration()->isCreateOrderEnabled();
- if (!$forceCreateOrder && !$this->checkResponseStatus($response)) {
+ if (!$forceCreateOrder && !$this->wasOrderChargedSuccessfully($response)) {
$this->logService->orderInfo(
$platformOrder->getCode(),
"Can't create order. - Force Create Order: {$forceCreateOrder} | Order or charge status failed",
$orderInfo
);
+
+ $charges = $this->createChargesFromResponse($response);
+ $errorMessages = $this->cancelChargesAtPagarme($charges);
+
+ $this->addChargeMessagesToLog($platformOrder, $orderInfo, $errorMessages);
+
$this->persistListChargeFailed($response);
- $message = $i18n->getDashboard("Can't create order.");
+ $message = $i18n->getDashboard(
+ "Can't create payment. " .
+ "Please review the information and try again."
+ );
throw new \Exception($message, 400);
}
$platformOrder->save();
$orderFactory = new OrderFactory();
- $response = $orderFactory->createFromPostData($response);
-
- $response->setPlatformOrder($platformOrder);
+ $order = $orderFactory->createFromPostData($response);
+ $order->setPlatformOrder($platformOrder);
- $handler = $this->getResponseHandler($response);
- $handler->handle($response, $order);
+ $handler = $this->getResponseHandler($order);
+ $handler->handle($order, $paymentOrder);
$platformOrder->save();
- if ($forceCreateOrder && !$this->checkResponseStatus($originalResponse)) {
+ if (!$this->wasOrderChargedSuccessfully($response)) {
$this->logService->orderInfo(
$platformOrder->getCode(),
"Can't create order. - Force Create Order: {$forceCreateOrder} | Order or charge status failed",
$orderInfo
);
- $message = $i18n->getDashboard("Can't create order.");
+ $message = $i18n->getDashboard(
+ "Can't create payment. " .
+ "Please review the information and try again."
+ );
throw new \Exception($message, 400);
}
- return [$response];
+ return [$order];
} catch (\Exception $e) {
$this->logService->orderInfo(
$platformOrder->getCode(),
@@ -278,6 +343,8 @@ private function getResponseHandler($response)
public function extractPaymentOrderFromPlatformOrder(
PlatformOrderInterface $platformOrder
) {
+ $i18n = new LocalizationService();
+
$moduleConfig = MPSetup::getModuleConfiguration();
$moneyService = new MoneyService();
@@ -301,14 +368,19 @@ public function extractPaymentOrderFromPlatformOrder(
$order->addPayment($payment);
}
+ $orderInfo = $this->getOrderInfo($platformOrder);
+
if (!$order->isPaymentSumCorrect()) {
- $message = 'The sum of payments is different than the order amount!';
+ $message = $i18n->getDashboard(
+ "The sum of payments is different than the order amount! " .
+ "Review the information and try again."
+ );
$this->logService->orderInfo(
$platformOrder->getCode(),
$message,
$orderInfo
);
- throw new \Exception($message,400);
+ throw new \Exception($message, 400);
}
$items = $platformOrder->getItemCollection();
@@ -337,17 +409,21 @@ public function getOrderInfo(PlatformOrderInterface $platformOrder)
return $orderInfo;
}
+ private function responseHasNoChargesOrFailed($response)
+ {
+ return !isset($response['status']) ||
+ !isset($response['charges']) ||
+ $response['status'] == 'failed';
+ }
+
/**
* @param $response
* @return boolean
*/
- private function checkResponseStatus($response)
+ private function wasOrderChargedSuccessfully($response)
{
- if (
- !isset($response['status']) ||
- !isset($response['charges']) ||
- $response['status'] == 'failed'
- ) {
+
+ if ($this->responseHasNoChargesOrFailed($response)) {
return false;
}
@@ -371,17 +447,33 @@ private function persistListChargeFailed($response)
return;
}
- $chargeFactory = new ChargeFactory();
+ $charges = $this->createChargesFromResponse($response);
$chargeService = new ChargeService();
+ foreach ($charges as $charge) {
+ $chargeService->save($charge);
+ }
+ }
+
+ private function createChargesFromResponse($response)
+ {
+ if (empty($response['charges'])) {
+ return [];
+ }
+
+ $charges = [];
+ $chargeFactory = new ChargeFactory();
+
foreach ($response['charges'] as $chargeResponse) {
$order = ['order' => ['id' => $response['id']]];
$charge = $chargeFactory->createFromPostData(
array_merge($chargeResponse, $order)
);
- $chargeService->save($charge);
+ $charges[] = $charge;
}
+
+ return $charges;
}
/**
diff --git a/src/Kernel/ValueObjects/Configuration/PixConfig.php b/src/Kernel/ValueObjects/Configuration/PixConfig.php
index 4429bc6..3488a3e 100644
--- a/src/Kernel/ValueObjects/Configuration/PixConfig.php
+++ b/src/Kernel/ValueObjects/Configuration/PixConfig.php
@@ -22,6 +22,11 @@ class PixConfig extends AbstractValueObject
*/
private $bankType;
+ /**
+ * @var array
+ */
+ private $additionalInformation;
+
/**
* @return bool
*/
@@ -94,6 +99,24 @@ public function setBankType($bankType)
return $this;
}
+ /**
+ * @return array
+ */
+ public function getAdditionalInformation()
+ {
+ return $this->additionalInformation;
+ }
+
+ /**
+ * @param array $additionalInformation
+ * @return PixConfig
+ */
+ public function setAdditionalInformation($additionalInformation)
+ {
+ $this->additionalInformation = $additionalInformation;
+ return $this;
+ }
+
/**
* To check the structural equality of value objects,
* this method should be implemented in this class children.
@@ -106,7 +129,8 @@ protected function isEqual($object)
return
$this->enabled === $object->isEnabled() &&
$this->bankType === $object->getBankType() &&
- $this->expirationQrCode === $object->getExpirationQrCode();
+ $this->expirationQrCode === $object->getExpirationQrCode() &&
+ $this->additionalInformation === $object->getAdditionalInformation();
}
/**
@@ -122,7 +146,8 @@ public function jsonSerialize()
"enabled" => $this->enabled,
"title" => $this->getTitle(),
"bankType" => $this->getBankType(),
- "expirationQrCode" => $this->getExpirationQrCode()
+ "expirationQrCode" => $this->getExpirationQrCode(),
+ "additionalInformation" => $this->getAdditionalInformation()
];
}
-}
\ No newline at end of file
+}
diff --git a/src/Kernel/ValueObjects/TransactionStatus.php b/src/Kernel/ValueObjects/TransactionStatus.php
index 6fead5e..a04fb2d 100644
--- a/src/Kernel/ValueObjects/TransactionStatus.php
+++ b/src/Kernel/ValueObjects/TransactionStatus.php
@@ -24,10 +24,13 @@ final class TransactionStatus extends AbstractValueObject
const WAITING_PAYMENT = 'waiting_payment';
const PENDING_REFUND = 'pending_refund';
const EXPIRED = 'expired';
+ const PENDING_REVIEW = 'pending_review';
+ const ANALYZING = 'analyzing';
+ const WAITING_CAPTURE = 'waiting_capture';
/**
*
- * @var string
+ * @var string
*/
private $status;
@@ -126,6 +129,21 @@ public static function expired()
return new self(self::EXPIRED);
}
+ public static function pendingReview()
+ {
+ return new self(self::PENDING_REVIEW);
+ }
+
+ public static function analyzing()
+ {
+ return new self(self::ANALYZING);
+ }
+
+ public static function waitingCapture()
+ {
+ return new self(self::WAITING_CAPTURE);
+ }
+
/**
*
* @return string
@@ -170,4 +188,4 @@ public function jsonSerialize()
{
return $this->status;
}
-}
\ No newline at end of file
+}
diff --git a/src/Maintenance/Assets/integrityData b/src/Maintenance/Assets/integrityData
index 10c8a3c..28e520b 100644
--- a/src/Maintenance/Assets/integrityData
+++ b/src/Maintenance/Assets/integrityData
@@ -1 +1 @@
-{"Hub\/Aggregates\/InstallToken.php":"5341135ffe910a81e476bc9e78090b23","Hub\/Commands\/AbstractCommand.php":"82efe6cbe6a97c2d2a33a36e77a3a202","Hub\/Commands\/CommandType.php":"ff024dbe6e5d7ccc766515017aa96abc","Hub\/Commands\/InstallCommand.php":"31102a22c9da9e23a58b0c8c8ee9d301","Hub\/Commands\/UninstallCommand.php":"2428247911fec877c004cf85612e4f35","Hub\/Commands\/UpdateCommand.php":"428e417c92248c6b0f1214b9d28550c5","Hub\/Factories\/HubCommandFactory.php":"7a3f42ac47571451cce5ee9c5599dc29","Hub\/Factories\/InstallTokenFactory.php":"e9083822532853de4c3415b332d0571e","Hub\/Repositories\/InstallTokenRepository.php":"1fa8e1a58f6852797c8ecc5e7ceee8e3","Hub\/Services\/HubIntegrationService.php":"cd00d94b142e6e4c7f17803210a864e7","Hub\/ValueObjects\/HubInstallToken.php":"724b064c805ec7299057b53bb3e22c7a","Kernel\/Abstractions\/AbstractCreditmemoDecorator.php":"c334d0ae26a50f08d3d9c79160a25a8d","Kernel\/Abstractions\/AbstractDataService.php":"e27984fafb564cbd5f9faba496a69d37","Kernel\/Abstractions\/AbstractDatabaseDecorator.php":"3a1e14b542229213aaa32f425dfcd340","Kernel\/Abstractions\/AbstractEntity.php":"cb44dc593450a5039441d78e58bb9658","Kernel\/Abstractions\/AbstractI18NTable.php":"c0b466591a7c1d52f379ca3eafc01dbc","Kernel\/Abstractions\/AbstractInvoiceDecorator.php":"b5ea428ca851d96a7c3685ab2b989c7b","Kernel\/Abstractions\/AbstractModuleCoreSetup.php":"5ce63ec35a9a8e999f288d9859502190","Kernel\/Abstractions\/AbstractPlatformOrderDecorator.php":"70d1998a80b19d52af476c6d6283b3a1","Kernel\/Abstractions\/AbstractRepository.php":"91ce586e235291bd485600669771defd","Kernel\/Abstractions\/AbstractValueObject.php":"abe14f2cc0b060f43e6fdcb8817f8977","Kernel\/Aggregates\/Charge.php":"1cd01ae71cb367c78fb80dfee86e7967","Kernel\/Aggregates\/Configuration.php":"b3c69e1a26b287999bf1357f2d621c5a","Kernel\/Aggregates\/LogObject.php":"4e714ea35cc865cb9c493a79b9825622","Kernel\/Aggregates\/Order.php":"d335e3a91798e186eadc64fc305f3ebb","Kernel\/Aggregates\/Transaction.php":"8dc96cbd644e59c18a144f5b33451576","Kernel\/Exceptions\/AbstractPagarmeCoreException.php":"e29ef673d0be36a9904cf490858e9f17","Kernel\/Exceptions\/InvalidClassException.php":"2eddc12d45231893d20960ffb23e3ddd","Kernel\/Exceptions\/InvalidOperationException.php":"8866e471204e317d065d6b0288a8ee64","Kernel\/Exceptions\/InvalidParamException.php":"d268d85c47cb6597e50307c2bea2d728","Kernel\/Exceptions\/NotFoundException.php":"2b657b0102ec297421b6532e144e5b8a","Kernel\/Factories\/ChargeFactory.php":"026adfc1e34ed8b06b3a07dfe20b3e03","Kernel\/Factories\/ConfigurationFactory.php":"62ba649ce64622751b79ecaa6a4274c8","Kernel\/Factories\/Configurations\/DebitConfigFactory.php":"d7b25a13bd3aba0b605eb7f10d03c5e3","Kernel\/Factories\/Configurations\/PixConfigFactory.php":"5adbf9c8ccac4b3dc71693389d99dedb","Kernel\/Factories\/Configurations\/RecurrenceConfigFactory.php":"d1ee9c9088ea6bc20c54179a5be5b50d","Kernel\/Factories\/Configurations\/VoucherConfigFactory.php":"1fff26fff6c5e2f7591dc677aeb852ba","Kernel\/Factories\/LogObjectFactory.php":"bc8a91f02e3617f30e2fcf40e8caf233","Kernel\/Factories\/OrderFactory.php":"88f96a874b63dceac7a43b66d37c93e4","Kernel\/Factories\/TransactionFactory.php":"3e2488bfe79aa7ba8e33c8c42596625a","Kernel\/Helper\/StringFunctionsHelper.php":"89bf836658c9f605baa7f832b950371d","Kernel\/I18N\/ENUS.php":"1e1db7016491de8b41ca4b8135580ca3","Kernel\/I18N\/PTBR.php":"c08e0947ada84d6fa8f4db3881801a6a","Kernel\/Interfaces\/ChargeInterface.php":"f3eaf300eab12c7fc64e0af295535230","Kernel\/Interfaces\/CommandInterface.php":"a5aef4eb7d2731fbcf231a32c5ab55f8","Kernel\/Interfaces\/FactoryCreateFromDbDataInterface.php":"d37e7e5e525c0c707db769669a23a3f3","Kernel\/Interfaces\/FactoryCreateFromPostDataInterface.php":"9d34a239580cf8e76e242e635af70dfb","Kernel\/Interfaces\/FactoryInterface.php":"04d5a9ece5558fac665232bb42c5bd23","Kernel\/Interfaces\/I18NTableInterface.php":"2f3d5a10af229f7f976709f8c8e0e8ca","Kernel\/Interfaces\/PlatformCreditmemoInterface.php":"7c62d406b71d404417cdcba99f93c36c","Kernel\/Interfaces\/PlatformCustomerInterface.php":"d919aa4f5fede9f1270aae4edbbe9fa7","Kernel\/Interfaces\/PlatformInvoiceInterface.php":"1915d126ad8bf65c97aeb982eac451f0","Kernel\/Interfaces\/PlatformOrderInterface.php":"cc571391af2a6d63eff5e4a2688a85ad","Kernel\/Interfaces\/PlatformPaymentMethodInterface.php":"89ef5b97a2c1b4a3b54a5a81c402d133","Kernel\/Interfaces\/PlatformProductInterface.php":"b29b66f3ea134ee9af46bcd2397737c3","Kernel\/Interfaces\/SensibleDataInterface.php":"41476787d525b5f70691c616f36e0698","Kernel\/Log\/JsonPrettyFormatter.php":"f2b4e08982334ae1428a7a47def35517","Kernel\/Repositories\/ChargeRepository.php":"c99f89afc2fa55a00356a327581cd20c","Kernel\/Repositories\/ConfigurationRepository.php":"5e1766c7a0b5d8933fe1b8555a80ead1","Kernel\/Repositories\/OrderRepository.php":"dfcda4b4c450ec9a0d5c6bfe71faa089","Kernel\/Repositories\/TransactionRepository.php":"bedf6e44751fe4a12e9f573bd11136d4","Kernel\/Responses\/ServiceResponse.php":"1b0094603ad857844b31c3e21adb5514","Kernel\/Services\/APIService.php":"199ddefcf2c51813f3eb898faae86a18","Kernel\/Services\/ChargeService.php":"62c7ecd0a865088e1c45ae5ee610a284","Kernel\/Services\/FactoryService.php":"5c5ec9e561ca2ff012a0d385d9e4bbc2","Kernel\/Services\/InstallmentService.php":"dd5e8c6fbdb29ce5a00b81c12276ac9c","Kernel\/Services\/InvoiceService.php":"1949d2195f9301c01b25e183ba88cc63","Kernel\/Services\/LocalizationService.php":"0560a3cc2a044f8468c028e326793ba0","Kernel\/Services\/LogService.php":"37a5fc831dd52c6b6dc723ff704fd5fe","Kernel\/Services\/MoneyService.php":"e04032fac15debc7f6294564e247d1b9","Kernel\/Services\/OrderCreationService.php":"2757641a3550f3d7b6c15be42223759f","Kernel\/Services\/OrderLogService.php":"4f2b5fa901a26a674c5747675671936c","Kernel\/Services\/OrderService.php":"ad31c9645d2b77c752bc06667848ba8e","Kernel\/Services\/VersionService.php":"582bf4342b1ca42607051be8a6240afa","Kernel\/ValueObjects\/AbstractValidString.php":"3b5c6e23af73f94b87582cd2942316a2","Kernel\/ValueObjects\/CardBrand.php":"7606dc6d66c58312ed93b69811a43d0d","Kernel\/ValueObjects\/ChargeStatus.php":"fd2d92f70c9af9b4820c1fe8a8bef0d8","Kernel\/ValueObjects\/Configuration\/AddressAttributes.php":"5c50fe0bc7ef25bc4060aa9d933a6108","Kernel\/ValueObjects\/Configuration\/CardConfig.php":"762843142b97640c9e79f88a53cc26b8","Kernel\/ValueObjects\/Configuration\/DebitConfig.php":"3b6ac54a8743b9be4849b75af1e28d06","Kernel\/ValueObjects\/Configuration\/PixConfig.php":"4dec9f05c3f590f544e1bc9144dbd2c4","Kernel\/ValueObjects\/Configuration\/RecurrenceConfig.php":"2e4388c571272b3fc8d26930d5171d88","Kernel\/ValueObjects\/Configuration\/VoucherConfig.php":"249f64f75165dd7f8680b40519548062","Kernel\/ValueObjects\/Installment.php":"90e0a6d2b991189a44137343182310e4","Kernel\/ValueObjects\/InvoiceState.php":"602a28f4a80d7e82e9ff8a2fb7d7dbfe","Kernel\/ValueObjects\/Key\/AbstractPublicKey.php":"2b0fdc48806d02ee7237de01fbf28b0a","Kernel\/ValueObjects\/Key\/AbstractSecretKey.php":"9d393da4f2a217bccf7568b47660bf2a","Kernel\/ValueObjects\/Key\/HubAccessTokenKey.php":"30a24808433082111a8564062173b459","Kernel\/ValueObjects\/Key\/PublicKey.php":"e462fcc7238160ac3536a14d5df89fb7","Kernel\/ValueObjects\/Key\/SecretKey.php":"0c8318be1c9ca428ee85e864fc053a9e","Kernel\/ValueObjects\/Key\/TestPublicKey.php":"599d7ad6fc3942e0e91f570e32771959","Kernel\/ValueObjects\/Key\/TestSecretKey.php":"615cb61ea46bcd0609d39d57dbc0bf8f","Kernel\/ValueObjects\/NumericString.php":"accf55bbee949c95c92a8cf29e3d6c4c","Kernel\/ValueObjects\/OrderState.php":"3cfe4260e9d4f1edf4511cce6f5e818e","Kernel\/ValueObjects\/OrderStatus.php":"6103f4da77f9330eafc397d5154b1748","Kernel\/ValueObjects\/PaymentMethod.php":"510d2c8069e250583d9e82cc5822165f","Kernel\/ValueObjects\/TransactionStatus.php":"25c6920cbf03aacb2339c595d5977db4","Kernel\/ValueObjects\/TransactionType.php":"e5396f302a595458bc4af199fffc1b1a","Kernel\/ValueObjects\/VersionInfo.php":"1e9d6a61249f463622f2e9f9ae9cb044","Maintenance\/Assets\/integrityData":"9e077ba6ac29a8c69ecb951db149b560","Maintenance\/Interfaces\/InfoRetrieverServiceInterface.php":"65579fdc5f9c10349ca6f6829ee854ac","Maintenance\/Interfaces\/InstallDataSourceInterface.php":"b3b0302cbed0616cf50789446d7f6923","Maintenance\/Interfaces\/ModuleInstallTypeInterface.php":"c48556d81b17790827e571d3d3736722","Maintenance\/Services\/ConfigInfoRetrieverService.php":"a75a28b62955b5b9681acd59ed0b0fd1","Maintenance\/Services\/InfoBuilderService.php":"1093d1e405fbe8b7b0c3805760d8e5e5","Maintenance\/Services\/InstallDataSource\/AbstractInstallDataSource.php":"fc2ed0f66e1406f952b4f9f352726be7","Maintenance\/Services\/InstallDataSource\/ComposerInstallDataSource.php":"96e6d060f57edbd1215904052976230b","Maintenance\/Services\/InstallDataSource\/CoreInstallDataSource.php":"d33a9eb6e3f5151e59c745159a41bc31","Maintenance\/Services\/InstallDataSource\/ModmanInstallDataSource.php":"b16d4f3e9459c12ea4205603cf697db7","Maintenance\/Services\/IntegrityInfoRetrieverService.php":"6126bec6c5690cafdac4a3a3930438bb","Maintenance\/Services\/LogDownloadInfoRetrieverService.php":"ff93dcf9e8b95cce968102205879d5b4","Maintenance\/Services\/LogInfoRetrieverService.php":"cc5303883505bf6b3b24d527e3b48c6a","Maintenance\/Services\/OrderInfoRetrieverService.php":"10c9e1c20827931ef00a4da1ae0f5705","Maintenance\/Services\/PhpInfoRetrieverService.php":"3b98725ca0aad938db9a2363c031d28b","Maintenance\/Services\/VersionInfoRetrieverService.php":"c23e993c55b17f5ba8305f7d9d9cb322","Payment\/Aggregates\/Address.php":"fe10d60964d5d69d84334b75f475300e","Payment\/Aggregates\/Customer.php":"de752a43ccd87f6d6be6914f5b787740","Payment\/Aggregates\/Item.php":"aecd8e4755279f131b7a750a688f7969","Payment\/Aggregates\/Order.php":"2b85b6e036bc6a9a72c65ff96c19fabd","Payment\/Aggregates\/Payments\/AbstractCreditCardPayment.php":"89e2a0bc8773549ed9c2e32f03a350d1","Payment\/Aggregates\/Payments\/AbstractPayment.php":"b36e05115cf16ad692535068a70e724d","Payment\/Aggregates\/Payments\/BoletoPayment.php":"23a19f98c42e4659e952a6fd35aad2bf","Payment\/Aggregates\/Payments\/NewCreditCardPayment.php":"b1b243ebc9e3112a03d5cc8a185a40ea","Payment\/Aggregates\/Payments\/NewDebitCardPayment.php":"7cc4a922cdf4f27c6c77a4d836d7100e","Payment\/Aggregates\/Payments\/NewVoucherPayment.php":"153b09ac53c7f6adcb1934182e3cf52e","Payment\/Aggregates\/Payments\/PixPayment.php":"5019d1372891a5214845ce4c78c34445","Payment\/Aggregates\/Payments\/SavedCreditCardPayment.php":"f72fd63fa8f85c24fe3d3c1d48d77e5b","Payment\/Aggregates\/Payments\/SavedDebitCardPayment.php":"15b78a233115990d62dc2887134aa5fb","Payment\/Aggregates\/Payments\/SavedVoucherCardPayment.php":"b759753dcd6735d4324d68a75c050f54","Payment\/Aggregates\/SavedCard.php":"1f7143e1342216f9674285a58bf3b9a7","Payment\/Aggregates\/Shipping.php":"1ae1fbae69e3c6153cbc4a926f1d22db","Payment\/Factories\/AddressFactory.php":"5a9168cfeba58a149ed0e5928bf4cd33","Payment\/Factories\/CustomerFactory.php":"d3b7df96e67b49da413e696a743a4735","Payment\/Factories\/PaymentFactory.php":"699eb599c2fcfd68173fb165f7a36b9b","Payment\/Factories\/SavedCardFactory.php":"2ba2742cd7a9b3caf147b0a7297cb301","Payment\/Interfaces\/ConvertibleToSDKRequestsInterface.php":"9813c393070b7204aa7f3dce61adb922","Payment\/Interfaces\/HaveOrderInterface.php":"44de6e697be96616c90c54b4c2a7aaec","Payment\/Interfaces\/ResponseHandlerInterface.php":"ab00f67583f80f8abd5dbf771171d621","Payment\/Repositories\/CustomerRepository.php":"15e0092a517810769e5b47f7bda72cf5","Payment\/Repositories\/SavedCardRepository.php":"892d211fb9ba29732569272f2ceb631c","Payment\/Services\/CardService.php":"7af9e47d37c140444087c7041262b093","Payment\/Services\/CustomerService.php":"fcd1b353fd0958eedaca4b05750e973e","Payment\/Services\/OrderService.php":"60cd18ccc8d4e8da2c074b54fcbd74f7","Payment\/Services\/ResponseHandlers\/AbstractResponseHandler.php":"0408186ed550aaa9029398efd5b6a0ca","Payment\/Services\/ResponseHandlers\/ErrorExceptionHandler.php":"cb5a5671b98be1bdd55913c801463f1d","Payment\/Services\/ResponseHandlers\/OrderHandler.php":"2d258d1e6f47c6faa7dfafa5b52907f5","Payment\/Services\/ValidationService.php":"09d08b3e79c94c7e3a3f5da2d5add187","Payment\/Traits\/WithAmountTrait.php":"b97480b5801d1d2a6484133052577c66","Payment\/Traits\/WithCustomerTrait.php":"822ff921babb6d7682187099c073b99f","Payment\/Traits\/WithOrderTrait.php":"012ed7974e1b01d77d639b879970e35c","Payment\/ValueObjects\/AbstractCardIdentifier.php":"6806d15bfeacc32d67f92d711bcfa20b","Payment\/ValueObjects\/BoletoBank.php":"0b2874f92d51a64b274e6bdcb4b8c815","Payment\/ValueObjects\/CardId.php":"319c01525cb57684629a64c2220cbd03","Payment\/ValueObjects\/CardToken.php":"ca8230e7109d19c4dd93bb2291044ba3","Payment\/ValueObjects\/CustomerPhones.php":"181f290c410719471c705470fe3fefe8","Payment\/ValueObjects\/CustomerType.php":"243768b5e73ba1983948eda24861f02d","Payment\/ValueObjects\/Discounts.php":"913a01c774dcec60632e57a722fd249e","Payment\/ValueObjects\/PaymentMethod.php":"07c58db394d405823545955660aefec5","Payment\/ValueObjects\/Phone.php":"111ef9a4be2a4f65dc574c608d6ede27","Payment\/ValueObjects\/PixBank.php":"2d1a484aabe857f3d0e351898ac74394","Recurrence\/Aggregates\/Charge.php":"5830cac70f2111dc9d115ac5a7a3fa03","Recurrence\/Aggregates\/Cycle.php":"82c88c90ed99623051123315b5d82e45","Recurrence\/Aggregates\/Increment.php":"33f35fe76a480ed723133fffd7fb5799","Recurrence\/Aggregates\/Invoice.php":"c14dbc49f1134f037a574ce78869ee74","Recurrence\/Aggregates\/Plan.php":"ed7e29ef333e970d178eb475aceb456d","Recurrence\/Aggregates\/ProductSubscription.php":"c49cf864318750045b8cf3de5072e28d","Recurrence\/Aggregates\/Repetition.php":"9c5f62ab15b88917076c9b2ee0c49b3e","Recurrence\/Aggregates\/SubProduct.php":"eb388a87517960f9484d59e5d228a8eb","Recurrence\/Aggregates\/Subscription.php":"48056c5685f798a848c68bc965054bfd","Recurrence\/Aggregates\/SubscriptionItem.php":"f8d37b62630dbad3d25e64a6c1463d85","Recurrence\/Factories\/ChargeFactory.php":"6a493c10ed79e669153311bbd705369b","Recurrence\/Factories\/CycleFactory.php":"456f7314552bb645542b8c9c6872c178","Recurrence\/Factories\/InvoiceFactory.php":"84497013e51e5f16df76a346887c55af","Recurrence\/Factories\/PlanFactory.php":"3ba0a5d013aaaa4ed7ba68feccd81d01","Recurrence\/Factories\/ProductSubscriptionFactory.php":"c718c8a0ec22c583e44b7eb90d170f69","Recurrence\/Factories\/RepetitionFactory.php":"8386714bc1073808b1561df0730bbd2e","Recurrence\/Factories\/SubProductFactory.php":"702fcb488af08dea4bfc5f9563e10569","Recurrence\/Factories\/SubscriptionFactory.php":"17ff338d617c98d4c2017d42547f27cd","Recurrence\/Factories\/SubscriptionItemFactory.php":"1fb53888d0200b73276b9a4e86ccea24","Recurrence\/Factories\/TreatFactoryChargeDataBase.php":"6c020ff946561260d356e3bc63cfd907","Recurrence\/Interfaces\/ProductPlanInterface.php":"4ed5f01600781702feabd6b29504b7a6","Recurrence\/Interfaces\/ProductSubscriptionInterface.php":"74a516248c9cd4e167364d8793d6ef1a","Recurrence\/Interfaces\/RecurrenceEntityInterface.php":"6062f84770e5723c904d37f4ac58afe6","Recurrence\/Interfaces\/RepetitionInterface.php":"60aa5b9d53720108ad85260da6f9b2b6","Recurrence\/Interfaces\/SubProductEntityInterface.php":"2b33869aebc490e8879413f835f425b0","Recurrence\/Repositories\/ChargeRepository.php":"b559086fa511761ad8d19861b498664f","Recurrence\/Repositories\/PlanRepository.php":"7fe02dd140faa3958d0b6c22284d810d","Recurrence\/Repositories\/ProductSubscriptionRepository.php":"426cebcda4c8d847b44b0a04fe4a579b","Recurrence\/Repositories\/RepetitionRepository.php":"142ede6c7508a460e574b94195c4df07","Recurrence\/Repositories\/SubProductRepository.php":"087210a80ae2aaaad517cefda0cc1413","Recurrence\/Repositories\/SubscriptionItemRepository.php":"bc290905c688d31cb858272f43b5020f","Recurrence\/Repositories\/SubscriptionRepository.php":"688024ed48ef0dae06b06d1430c3a882","Recurrence\/Services\/CartRules\/CompatibleRecurrenceProducts.php":"007cd41a95a14a511d216e6996686d4a","Recurrence\/Services\/CartRules\/CurrentProduct.php":"ad8ba1b25f7fbbd463c1d02961a86150","Recurrence\/Services\/CartRules\/JustOneProductPlanInCart.php":"c4d90b76dd158bc7ba03e5ce90892fe8","Recurrence\/Services\/CartRules\/JustProductPlanInCart.php":"575d911f1c7bfec4e624dae7fc3645a0","Recurrence\/Services\/CartRules\/JustSelfProductPlanInCart.php":"d83ae9ee51105bb8d84db3b0d119a2a1","Recurrence\/Services\/CartRules\/MoreThanOneRecurrenceProduct.php":"c32cfcc24d6716faefc567518498aecc","Recurrence\/Services\/CartRules\/NormalWithRecurrenceProduct.php":"0b9ba576ef5e15e8a10d14f7776e6766","Recurrence\/Services\/CartRules\/ProductListInCart.php":"bb744cc37a248af0ceff3c1f01f75f24","Recurrence\/Services\/CartRules\/RuleInterface.php":"06613af172ecc9c5e3780001e1b3eed4","Recurrence\/Services\/InvoiceService.php":"7b7549fa85ec7023ee7c09cfcaa6283c","Recurrence\/Services\/PlanService.php":"4bb3bac716bc903b69ec9848a2133397","Recurrence\/Services\/ProductSubscriptionService.php":"9f808f566641150585844f96fd7828f1","Recurrence\/Services\/RecurrenceService.php":"1a0a2f54e89e34fdcc47b90bc8cc848f","Recurrence\/Services\/RepetitionService.php":"1029f8f52ecad23acb194bf5ef5acf84","Recurrence\/Services\/ResponseHandlers\/AbstractResponseHandler.php":"8e48ae84704c6843fcb01fca2f415d26","Recurrence\/Services\/ResponseHandlers\/ChargeHandler.php":"bca0ac3d57603f0c168beffa86d6ea15","Recurrence\/Services\/ResponseHandlers\/ErrorExceptionHandler.php":"cb5a5671b98be1bdd55913c801463f1d","Recurrence\/Services\/ResponseHandlers\/SubscriptionHandler.php":"1c860e5ca987d702509e9476e0b2cd70","Recurrence\/Services\/RulesCheckoutService.php":"89257ec62e4fcbe030d3301beeec3fd5","Recurrence\/Services\/SubProductService.php":"43e02ef2a5de35892ffdc7b20eccad56","Recurrence\/Services\/SubscriptionItemService.php":"fa48b1a6ca242786a75e7bb4e8cbcb61","Recurrence\/Services\/SubscriptionService.php":"6780b9ce252c557735385ce782ae720a","Recurrence\/ValueObjects\/IntervalValueObject.php":"3409042b385a1f642c1af53bb39094ce","Recurrence\/ValueObjects\/InvoiceIdValueObject.php":"49246d7607454cb3a7397c059f28f9c4","Recurrence\/ValueObjects\/InvoiceStatus.php":"5198f162eb153ed66c8a686d356de634","Recurrence\/ValueObjects\/PlanId.php":"58fb91452e24853852260d2c0613991b","Recurrence\/ValueObjects\/PlanItemId.php":"bc164882a582c65ca97df65f39b72afd","Recurrence\/ValueObjects\/PricingSchemeValueObject.php":"8ebdd0f0b448d00a114940d1b109458c","Recurrence\/ValueObjects\/SubscriptionItemId.php":"c6073580e7876195d8fcf778040a20cc","Recurrence\/ValueObjects\/SubscriptionStatus.php":"f8349e2bcdea7a3e10cb96557e054568","Webhook\/Aggregates\/Webhook.php":"ff88f74b179f8f454ad5554407c3a0fe","Webhook\/Exceptions\/UnprocessableWebhookException.php":"dbc7fb3b222819996c6cff30b7a1c4d1","Webhook\/Exceptions\/WebhookAlreadyHandledException.php":"ce3cf9c87890a153678494bffa42abea","Webhook\/Exceptions\/WebhookHandlerNotFoundException.php":"4ac94bb65bfa4829adc84852875098c7","Webhook\/Factories\/WebhookFactory.php":"198f8b2a574d5eebacfdcf11bd3aff01","Webhook\/Repositories\/WebhookRepository.php":"dccfe3663d569d5e1168cb808f289f60","Webhook\/Services\/AbstractHandlerService.php":"3ecafba1820468ade67a3bb96590cac9","Webhook\/Services\/ChargeHandlerService.php":"53fdcb44be4d9fc76fe2fe208b7929f2","Webhook\/Services\/ChargeOrderService.php":"aeeb60b42d9aca613cb3c0286075d62d","Webhook\/Services\/ChargeRecurrenceService.php":"ea84e85b82f707bf651bc8bb89782ee7","Webhook\/Services\/InvoiceHandlerService.php":"ae6c15eea29f99f88e5940eb392e2f3c","Webhook\/Services\/InvoiceRecurrenceService.php":"a1e3e50e8e2df73df2052b0a3069897e","Webhook\/Services\/SubscriptionHandlerService.php":"1ea069e5c057ed3358598e4613ca4928","Webhook\/Services\/WebhookReceiverService.php":"283d2c5b94f16f0d51a5f00ab08b1670","Webhook\/ValueObjects\/WebhookId.php":"92d5d4b45d934ce6c6f45dfa3b1bfaa4","Webhook\/ValueObjects\/WebhookType.php":"a4261156605b1dbf2136978270ebfaef"}
\ No newline at end of file
+{"Hub\/Aggregates\/InstallToken.php":"5341135ffe910a81e476bc9e78090b23","Hub\/Commands\/AbstractCommand.php":"82efe6cbe6a97c2d2a33a36e77a3a202","Hub\/Commands\/CommandType.php":"ff024dbe6e5d7ccc766515017aa96abc","Hub\/Commands\/InstallCommand.php":"9476098734120b212edf68772dd1d942","Hub\/Commands\/UninstallCommand.php":"2428247911fec877c004cf85612e4f35","Hub\/Commands\/UpdateCommand.php":"428e417c92248c6b0f1214b9d28550c5","Hub\/Factories\/HubCommandFactory.php":"f685fddaac49bb92f3a47832cb06d956","Hub\/Factories\/InstallTokenFactory.php":"e9083822532853de4c3415b332d0571e","Hub\/Repositories\/InstallTokenRepository.php":"1fa8e1a58f6852797c8ecc5e7ceee8e3","Hub\/Services\/HubIntegrationService.php":"c6871cab093324a907a24dd17a18a8ac","Hub\/ValueObjects\/HubInstallToken.php":"724b064c805ec7299057b53bb3e22c7a","Kernel\/Abstractions\/AbstractCreditmemoDecorator.php":"c334d0ae26a50f08d3d9c79160a25a8d","Kernel\/Abstractions\/AbstractDataService.php":"e27984fafb564cbd5f9faba496a69d37","Kernel\/Abstractions\/AbstractDatabaseDecorator.php":"3a1e14b542229213aaa32f425dfcd340","Kernel\/Abstractions\/AbstractEntity.php":"cb44dc593450a5039441d78e58bb9658","Kernel\/Abstractions\/AbstractI18NTable.php":"c0b466591a7c1d52f379ca3eafc01dbc","Kernel\/Abstractions\/AbstractInvoiceDecorator.php":"b5ea428ca851d96a7c3685ab2b989c7b","Kernel\/Abstractions\/AbstractModuleCoreSetup.php":"5d83618073f3365883c1d0d883acdf7c","Kernel\/Abstractions\/AbstractPlatformOrderDecorator.php":"70d1998a80b19d52af476c6d6283b3a1","Kernel\/Abstractions\/AbstractRepository.php":"91ce586e235291bd485600669771defd","Kernel\/Abstractions\/AbstractValueObject.php":"abe14f2cc0b060f43e6fdcb8817f8977","Kernel\/Aggregates\/Charge.php":"1cd01ae71cb367c78fb80dfee86e7967","Kernel\/Aggregates\/Configuration.php":"1ed35da8c7ed25e0f6fafcde6ca77be7","Kernel\/Aggregates\/LogObject.php":"4e714ea35cc865cb9c493a79b9825622","Kernel\/Aggregates\/Order.php":"d335e3a91798e186eadc64fc305f3ebb","Kernel\/Aggregates\/Transaction.php":"8dc96cbd644e59c18a144f5b33451576","Kernel\/Exceptions\/AbstractPagarmeCoreException.php":"e29ef673d0be36a9904cf490858e9f17","Kernel\/Exceptions\/InvalidClassException.php":"2eddc12d45231893d20960ffb23e3ddd","Kernel\/Exceptions\/InvalidOperationException.php":"8866e471204e317d065d6b0288a8ee64","Kernel\/Exceptions\/InvalidParamException.php":"d268d85c47cb6597e50307c2bea2d728","Kernel\/Exceptions\/NotFoundException.php":"2b657b0102ec297421b6532e144e5b8a","Kernel\/Factories\/ChargeFactory.php":"026adfc1e34ed8b06b3a07dfe20b3e03","Kernel\/Factories\/ConfigurationFactory.php":"5c61cf08141cfcac11673566ccc244f6","Kernel\/Factories\/Configurations\/DebitConfigFactory.php":"d7b25a13bd3aba0b605eb7f10d03c5e3","Kernel\/Factories\/Configurations\/PixConfigFactory.php":"e2aeb10216330241eb476d8f70155f09","Kernel\/Factories\/Configurations\/RecurrenceConfigFactory.php":"d1ee9c9088ea6bc20c54179a5be5b50d","Kernel\/Factories\/Configurations\/VoucherConfigFactory.php":"1fff26fff6c5e2f7591dc677aeb852ba","Kernel\/Factories\/LogObjectFactory.php":"bc8a91f02e3617f30e2fcf40e8caf233","Kernel\/Factories\/OrderFactory.php":"88f96a874b63dceac7a43b66d37c93e4","Kernel\/Factories\/TransactionFactory.php":"3e2488bfe79aa7ba8e33c8c42596625a","Kernel\/Helper\/StringFunctionsHelper.php":"89bf836658c9f605baa7f832b950371d","Kernel\/I18N\/ENUS.php":"49177eeb4084ac8f960162ec85a74c95","Kernel\/I18N\/PTBR.php":"90690dccc2be0551ba1b9459368d050f","Kernel\/Interfaces\/ChargeInterface.php":"f3eaf300eab12c7fc64e0af295535230","Kernel\/Interfaces\/CommandInterface.php":"a5aef4eb7d2731fbcf231a32c5ab55f8","Kernel\/Interfaces\/FactoryCreateFromDbDataInterface.php":"d37e7e5e525c0c707db769669a23a3f3","Kernel\/Interfaces\/FactoryCreateFromPostDataInterface.php":"9d34a239580cf8e76e242e635af70dfb","Kernel\/Interfaces\/FactoryInterface.php":"04d5a9ece5558fac665232bb42c5bd23","Kernel\/Interfaces\/I18NTableInterface.php":"2f3d5a10af229f7f976709f8c8e0e8ca","Kernel\/Interfaces\/PlatformCreditmemoInterface.php":"7c62d406b71d404417cdcba99f93c36c","Kernel\/Interfaces\/PlatformCustomerInterface.php":"d919aa4f5fede9f1270aae4edbbe9fa7","Kernel\/Interfaces\/PlatformInvoiceInterface.php":"1915d126ad8bf65c97aeb982eac451f0","Kernel\/Interfaces\/PlatformOrderInterface.php":"cc571391af2a6d63eff5e4a2688a85ad","Kernel\/Interfaces\/PlatformPaymentMethodInterface.php":"89ef5b97a2c1b4a3b54a5a81c402d133","Kernel\/Interfaces\/PlatformProductInterface.php":"b29b66f3ea134ee9af46bcd2397737c3","Kernel\/Interfaces\/SensibleDataInterface.php":"41476787d525b5f70691c616f36e0698","Kernel\/Log\/JsonPrettyFormatter.php":"f2b4e08982334ae1428a7a47def35517","Kernel\/Repositories\/ChargeRepository.php":"c99f89afc2fa55a00356a327581cd20c","Kernel\/Repositories\/ConfigurationRepository.php":"5e1766c7a0b5d8933fe1b8555a80ead1","Kernel\/Repositories\/OrderRepository.php":"dfcda4b4c450ec9a0d5c6bfe71faa089","Kernel\/Repositories\/TransactionRepository.php":"bedf6e44751fe4a12e9f573bd11136d4","Kernel\/Responses\/ServiceResponse.php":"1b0094603ad857844b31c3e21adb5514","Kernel\/Services\/APIService.php":"e0e050d8575a90851c4aa63d7579d709","Kernel\/Services\/ChargeService.php":"d6e8ca9e365f9f11351b8019c4244fba","Kernel\/Services\/FactoryService.php":"5c5ec9e561ca2ff012a0d385d9e4bbc2","Kernel\/Services\/InstallmentService.php":"dd5e8c6fbdb29ce5a00b81c12276ac9c","Kernel\/Services\/InvoiceService.php":"1949d2195f9301c01b25e183ba88cc63","Kernel\/Services\/LocalizationService.php":"0560a3cc2a044f8468c028e326793ba0","Kernel\/Services\/LogService.php":"37a5fc831dd52c6b6dc723ff704fd5fe","Kernel\/Services\/MoneyService.php":"e04032fac15debc7f6294564e247d1b9","Kernel\/Services\/OrderCreationService.php":"2757641a3550f3d7b6c15be42223759f","Kernel\/Services\/OrderLogService.php":"4f2b5fa901a26a674c5747675671936c","Kernel\/Services\/OrderService.php":"f3432a01b5e28bea6f44833e72be16f4","Kernel\/Services\/VersionService.php":"582bf4342b1ca42607051be8a6240afa","Kernel\/ValueObjects\/AbstractValidString.php":"3b5c6e23af73f94b87582cd2942316a2","Kernel\/ValueObjects\/CardBrand.php":"7606dc6d66c58312ed93b69811a43d0d","Kernel\/ValueObjects\/ChargeStatus.php":"fd2d92f70c9af9b4820c1fe8a8bef0d8","Kernel\/ValueObjects\/Configuration\/AddressAttributes.php":"5c50fe0bc7ef25bc4060aa9d933a6108","Kernel\/ValueObjects\/Configuration\/CardConfig.php":"762843142b97640c9e79f88a53cc26b8","Kernel\/ValueObjects\/Configuration\/DebitConfig.php":"3b6ac54a8743b9be4849b75af1e28d06","Kernel\/ValueObjects\/Configuration\/PixConfig.php":"1aab24bce7e4e6d004c73cebc9523c63","Kernel\/ValueObjects\/Configuration\/RecurrenceConfig.php":"2e4388c571272b3fc8d26930d5171d88","Kernel\/ValueObjects\/Configuration\/VoucherConfig.php":"249f64f75165dd7f8680b40519548062","Kernel\/ValueObjects\/Installment.php":"90e0a6d2b991189a44137343182310e4","Kernel\/ValueObjects\/InvoiceState.php":"602a28f4a80d7e82e9ff8a2fb7d7dbfe","Kernel\/ValueObjects\/Key\/AbstractPublicKey.php":"2b0fdc48806d02ee7237de01fbf28b0a","Kernel\/ValueObjects\/Key\/AbstractSecretKey.php":"9d393da4f2a217bccf7568b47660bf2a","Kernel\/ValueObjects\/Key\/HubAccessTokenKey.php":"30a24808433082111a8564062173b459","Kernel\/ValueObjects\/Key\/PublicKey.php":"e462fcc7238160ac3536a14d5df89fb7","Kernel\/ValueObjects\/Key\/SecretKey.php":"0c8318be1c9ca428ee85e864fc053a9e","Kernel\/ValueObjects\/Key\/TestPublicKey.php":"599d7ad6fc3942e0e91f570e32771959","Kernel\/ValueObjects\/Key\/TestSecretKey.php":"615cb61ea46bcd0609d39d57dbc0bf8f","Kernel\/ValueObjects\/NumericString.php":"accf55bbee949c95c92a8cf29e3d6c4c","Kernel\/ValueObjects\/OrderState.php":"3cfe4260e9d4f1edf4511cce6f5e818e","Kernel\/ValueObjects\/OrderStatus.php":"6103f4da77f9330eafc397d5154b1748","Kernel\/ValueObjects\/PaymentMethod.php":"510d2c8069e250583d9e82cc5822165f","Kernel\/ValueObjects\/TransactionStatus.php":"e3aa3544cb48e036e7a52c969cda96b8","Kernel\/ValueObjects\/TransactionType.php":"e5396f302a595458bc4af199fffc1b1a","Kernel\/ValueObjects\/VersionInfo.php":"1e9d6a61249f463622f2e9f9ae9cb044","Maintenance\/Assets\/integrityData":"a92e2239d1de739101e846f108f28933","Maintenance\/Interfaces\/InfoRetrieverServiceInterface.php":"65579fdc5f9c10349ca6f6829ee854ac","Maintenance\/Interfaces\/InstallDataSourceInterface.php":"b3b0302cbed0616cf50789446d7f6923","Maintenance\/Interfaces\/ModuleInstallTypeInterface.php":"c48556d81b17790827e571d3d3736722","Maintenance\/Services\/ConfigInfoRetrieverService.php":"a75a28b62955b5b9681acd59ed0b0fd1","Maintenance\/Services\/InfoBuilderService.php":"1093d1e405fbe8b7b0c3805760d8e5e5","Maintenance\/Services\/InstallDataSource\/AbstractInstallDataSource.php":"fc2ed0f66e1406f952b4f9f352726be7","Maintenance\/Services\/InstallDataSource\/ComposerInstallDataSource.php":"96e6d060f57edbd1215904052976230b","Maintenance\/Services\/InstallDataSource\/CoreInstallDataSource.php":"d33a9eb6e3f5151e59c745159a41bc31","Maintenance\/Services\/InstallDataSource\/ModmanInstallDataSource.php":"b16d4f3e9459c12ea4205603cf697db7","Maintenance\/Services\/IntegrityInfoRetrieverService.php":"6126bec6c5690cafdac4a3a3930438bb","Maintenance\/Services\/LogDownloadInfoRetrieverService.php":"ff93dcf9e8b95cce968102205879d5b4","Maintenance\/Services\/LogInfoRetrieverService.php":"cc5303883505bf6b3b24d527e3b48c6a","Maintenance\/Services\/OrderInfoRetrieverService.php":"10c9e1c20827931ef00a4da1ae0f5705","Maintenance\/Services\/PhpInfoRetrieverService.php":"3b98725ca0aad938db9a2363c031d28b","Maintenance\/Services\/VersionInfoRetrieverService.php":"c23e993c55b17f5ba8305f7d9d9cb322","Payment\/Aggregates\/Address.php":"c24f2674d8f16ad4b0b6167b5ee26036","Payment\/Aggregates\/Customer.php":"0a3596eefc48b6ec5cb423bb2d842a53","Payment\/Aggregates\/Item.php":"aecd8e4755279f131b7a750a688f7969","Payment\/Aggregates\/Order.php":"43ca0a46dfc68e5c28b16617993ef783","Payment\/Aggregates\/Payments\/AbstractCreditCardPayment.php":"3ed50c374dd20021cbb033d488a20906","Payment\/Aggregates\/Payments\/AbstractPayment.php":"b36e05115cf16ad692535068a70e724d","Payment\/Aggregates\/Payments\/BoletoPayment.php":"23a19f98c42e4659e952a6fd35aad2bf","Payment\/Aggregates\/Payments\/NewCreditCardPayment.php":"b1b243ebc9e3112a03d5cc8a185a40ea","Payment\/Aggregates\/Payments\/NewDebitCardPayment.php":"7cc4a922cdf4f27c6c77a4d836d7100e","Payment\/Aggregates\/Payments\/NewVoucherPayment.php":"153b09ac53c7f6adcb1934182e3cf52e","Payment\/Aggregates\/Payments\/PixPayment.php":"5019d1372891a5214845ce4c78c34445","Payment\/Aggregates\/Payments\/SavedCreditCardPayment.php":"f72fd63fa8f85c24fe3d3c1d48d77e5b","Payment\/Aggregates\/Payments\/SavedDebitCardPayment.php":"15b78a233115990d62dc2887134aa5fb","Payment\/Aggregates\/Payments\/SavedVoucherCardPayment.php":"b759753dcd6735d4324d68a75c050f54","Payment\/Aggregates\/SavedCard.php":"1f7143e1342216f9674285a58bf3b9a7","Payment\/Aggregates\/Shipping.php":"1ae1fbae69e3c6153cbc4a926f1d22db","Payment\/Factories\/AddressFactory.php":"5a9168cfeba58a149ed0e5928bf4cd33","Payment\/Factories\/CustomerFactory.php":"d3b7df96e67b49da413e696a743a4735","Payment\/Factories\/PaymentFactory.php":"c80e235842fb66117d3d9d5e2407aeca","Payment\/Factories\/SavedCardFactory.php":"2ba2742cd7a9b3caf147b0a7297cb301","Payment\/Interfaces\/ConvertibleToSDKRequestsInterface.php":"9813c393070b7204aa7f3dce61adb922","Payment\/Interfaces\/HaveOrderInterface.php":"44de6e697be96616c90c54b4c2a7aaec","Payment\/Interfaces\/ResponseHandlerInterface.php":"ab00f67583f80f8abd5dbf771171d621","Payment\/Repositories\/CustomerRepository.php":"15e0092a517810769e5b47f7bda72cf5","Payment\/Repositories\/SavedCardRepository.php":"892d211fb9ba29732569272f2ceb631c","Payment\/Services\/CardService.php":"7af9e47d37c140444087c7041262b093","Payment\/Services\/CustomerService.php":"fcd1b353fd0958eedaca4b05750e973e","Payment\/Services\/OrderService.php":"60cd18ccc8d4e8da2c074b54fcbd74f7","Payment\/Services\/ResponseHandlers\/AbstractResponseHandler.php":"0408186ed550aaa9029398efd5b6a0ca","Payment\/Services\/ResponseHandlers\/ErrorExceptionHandler.php":"cb5a5671b98be1bdd55913c801463f1d","Payment\/Services\/ResponseHandlers\/OrderHandler.php":"b06caa7ef30fa402bc71a17d169ed709","Payment\/Services\/ValidationService.php":"09d08b3e79c94c7e3a3f5da2d5add187","Payment\/Traits\/WithAmountTrait.php":"b97480b5801d1d2a6484133052577c66","Payment\/Traits\/WithCustomerTrait.php":"822ff921babb6d7682187099c073b99f","Payment\/Traits\/WithOrderTrait.php":"012ed7974e1b01d77d639b879970e35c","Payment\/ValueObjects\/AbstractCardIdentifier.php":"6806d15bfeacc32d67f92d711bcfa20b","Payment\/ValueObjects\/BoletoBank.php":"0b2874f92d51a64b274e6bdcb4b8c815","Payment\/ValueObjects\/CardId.php":"319c01525cb57684629a64c2220cbd03","Payment\/ValueObjects\/CardToken.php":"ca8230e7109d19c4dd93bb2291044ba3","Payment\/ValueObjects\/CustomerPhones.php":"181f290c410719471c705470fe3fefe8","Payment\/ValueObjects\/CustomerType.php":"243768b5e73ba1983948eda24861f02d","Payment\/ValueObjects\/Discounts.php":"913a01c774dcec60632e57a722fd249e","Payment\/ValueObjects\/PaymentMethod.php":"07c58db394d405823545955660aefec5","Payment\/ValueObjects\/Phone.php":"8e3087cf8bad0724ff3e6a9ddb545785","Payment\/ValueObjects\/PixBank.php":"2d1a484aabe857f3d0e351898ac74394","Recurrence\/Aggregates\/Charge.php":"5830cac70f2111dc9d115ac5a7a3fa03","Recurrence\/Aggregates\/Cycle.php":"82c88c90ed99623051123315b5d82e45","Recurrence\/Aggregates\/Increment.php":"33f35fe76a480ed723133fffd7fb5799","Recurrence\/Aggregates\/Invoice.php":"c14dbc49f1134f037a574ce78869ee74","Recurrence\/Aggregates\/Plan.php":"ed7e29ef333e970d178eb475aceb456d","Recurrence\/Aggregates\/ProductSubscription.php":"c49cf864318750045b8cf3de5072e28d","Recurrence\/Aggregates\/Repetition.php":"9c5f62ab15b88917076c9b2ee0c49b3e","Recurrence\/Aggregates\/SubProduct.php":"eb388a87517960f9484d59e5d228a8eb","Recurrence\/Aggregates\/Subscription.php":"48056c5685f798a848c68bc965054bfd","Recurrence\/Aggregates\/SubscriptionItem.php":"f8d37b62630dbad3d25e64a6c1463d85","Recurrence\/Factories\/ChargeFactory.php":"6a493c10ed79e669153311bbd705369b","Recurrence\/Factories\/CycleFactory.php":"456f7314552bb645542b8c9c6872c178","Recurrence\/Factories\/InvoiceFactory.php":"84497013e51e5f16df76a346887c55af","Recurrence\/Factories\/PlanFactory.php":"3ba0a5d013aaaa4ed7ba68feccd81d01","Recurrence\/Factories\/ProductSubscriptionFactory.php":"c718c8a0ec22c583e44b7eb90d170f69","Recurrence\/Factories\/RepetitionFactory.php":"8386714bc1073808b1561df0730bbd2e","Recurrence\/Factories\/SubProductFactory.php":"702fcb488af08dea4bfc5f9563e10569","Recurrence\/Factories\/SubscriptionFactory.php":"17ff338d617c98d4c2017d42547f27cd","Recurrence\/Factories\/SubscriptionItemFactory.php":"1fb53888d0200b73276b9a4e86ccea24","Recurrence\/Factories\/TreatFactoryChargeDataBase.php":"6c020ff946561260d356e3bc63cfd907","Recurrence\/Interfaces\/ProductPlanInterface.php":"4ed5f01600781702feabd6b29504b7a6","Recurrence\/Interfaces\/ProductSubscriptionInterface.php":"74a516248c9cd4e167364d8793d6ef1a","Recurrence\/Interfaces\/RecurrenceEntityInterface.php":"6062f84770e5723c904d37f4ac58afe6","Recurrence\/Interfaces\/RepetitionInterface.php":"60aa5b9d53720108ad85260da6f9b2b6","Recurrence\/Interfaces\/SubProductEntityInterface.php":"2b33869aebc490e8879413f835f425b0","Recurrence\/Repositories\/ChargeRepository.php":"b559086fa511761ad8d19861b498664f","Recurrence\/Repositories\/PlanRepository.php":"7fe02dd140faa3958d0b6c22284d810d","Recurrence\/Repositories\/ProductSubscriptionRepository.php":"426cebcda4c8d847b44b0a04fe4a579b","Recurrence\/Repositories\/RepetitionRepository.php":"142ede6c7508a460e574b94195c4df07","Recurrence\/Repositories\/SubProductRepository.php":"087210a80ae2aaaad517cefda0cc1413","Recurrence\/Repositories\/SubscriptionItemRepository.php":"bc290905c688d31cb858272f43b5020f","Recurrence\/Repositories\/SubscriptionRepository.php":"688024ed48ef0dae06b06d1430c3a882","Recurrence\/Services\/CartRules\/CompatibleRecurrenceProducts.php":"007cd41a95a14a511d216e6996686d4a","Recurrence\/Services\/CartRules\/CurrentProduct.php":"ad8ba1b25f7fbbd463c1d02961a86150","Recurrence\/Services\/CartRules\/JustOneProductPlanInCart.php":"c4d90b76dd158bc7ba03e5ce90892fe8","Recurrence\/Services\/CartRules\/JustProductPlanInCart.php":"575d911f1c7bfec4e624dae7fc3645a0","Recurrence\/Services\/CartRules\/JustSelfProductPlanInCart.php":"d83ae9ee51105bb8d84db3b0d119a2a1","Recurrence\/Services\/CartRules\/MoreThanOneRecurrenceProduct.php":"c32cfcc24d6716faefc567518498aecc","Recurrence\/Services\/CartRules\/NormalWithRecurrenceProduct.php":"0b9ba576ef5e15e8a10d14f7776e6766","Recurrence\/Services\/CartRules\/ProductListInCart.php":"bb744cc37a248af0ceff3c1f01f75f24","Recurrence\/Services\/CartRules\/RuleInterface.php":"06613af172ecc9c5e3780001e1b3eed4","Recurrence\/Services\/InvoiceService.php":"7b7549fa85ec7023ee7c09cfcaa6283c","Recurrence\/Services\/PlanService.php":"4bb3bac716bc903b69ec9848a2133397","Recurrence\/Services\/ProductSubscriptionService.php":"9f808f566641150585844f96fd7828f1","Recurrence\/Services\/RecurrenceService.php":"1a0a2f54e89e34fdcc47b90bc8cc848f","Recurrence\/Services\/RepetitionService.php":"1029f8f52ecad23acb194bf5ef5acf84","Recurrence\/Services\/ResponseHandlers\/AbstractResponseHandler.php":"8e48ae84704c6843fcb01fca2f415d26","Recurrence\/Services\/ResponseHandlers\/ChargeHandler.php":"bca0ac3d57603f0c168beffa86d6ea15","Recurrence\/Services\/ResponseHandlers\/ErrorExceptionHandler.php":"cb5a5671b98be1bdd55913c801463f1d","Recurrence\/Services\/ResponseHandlers\/SubscriptionHandler.php":"1c860e5ca987d702509e9476e0b2cd70","Recurrence\/Services\/RulesCheckoutService.php":"89257ec62e4fcbe030d3301beeec3fd5","Recurrence\/Services\/SubProductService.php":"43e02ef2a5de35892ffdc7b20eccad56","Recurrence\/Services\/SubscriptionItemService.php":"fa48b1a6ca242786a75e7bb4e8cbcb61","Recurrence\/Services\/SubscriptionService.php":"129d85db00925158338e40cc6a6da3ae","Recurrence\/ValueObjects\/IntervalValueObject.php":"3409042b385a1f642c1af53bb39094ce","Recurrence\/ValueObjects\/InvoiceIdValueObject.php":"49246d7607454cb3a7397c059f28f9c4","Recurrence\/ValueObjects\/InvoiceStatus.php":"5198f162eb153ed66c8a686d356de634","Recurrence\/ValueObjects\/PlanId.php":"58fb91452e24853852260d2c0613991b","Recurrence\/ValueObjects\/PlanItemId.php":"bc164882a582c65ca97df65f39b72afd","Recurrence\/ValueObjects\/PricingSchemeValueObject.php":"8ebdd0f0b448d00a114940d1b109458c","Recurrence\/ValueObjects\/SubscriptionItemId.php":"c6073580e7876195d8fcf778040a20cc","Recurrence\/ValueObjects\/SubscriptionStatus.php":"f8349e2bcdea7a3e10cb96557e054568","Webhook\/Aggregates\/Webhook.php":"ff88f74b179f8f454ad5554407c3a0fe","Webhook\/Exceptions\/UnprocessableWebhookException.php":"dbc7fb3b222819996c6cff30b7a1c4d1","Webhook\/Exceptions\/WebhookAlreadyHandledException.php":"ce3cf9c87890a153678494bffa42abea","Webhook\/Exceptions\/WebhookHandlerNotFoundException.php":"4ac94bb65bfa4829adc84852875098c7","Webhook\/Factories\/WebhookFactory.php":"198f8b2a574d5eebacfdcf11bd3aff01","Webhook\/Repositories\/WebhookRepository.php":"dccfe3663d569d5e1168cb808f289f60","Webhook\/Services\/AbstractHandlerService.php":"3ecafba1820468ade67a3bb96590cac9","Webhook\/Services\/ChargeHandlerService.php":"53fdcb44be4d9fc76fe2fe208b7929f2","Webhook\/Services\/ChargeOrderService.php":"aeeb60b42d9aca613cb3c0286075d62d","Webhook\/Services\/ChargeRecurrenceService.php":"ea84e85b82f707bf651bc8bb89782ee7","Webhook\/Services\/InvoiceHandlerService.php":"ae6c15eea29f99f88e5940eb392e2f3c","Webhook\/Services\/InvoiceRecurrenceService.php":"a1e3e50e8e2df73df2052b0a3069897e","Webhook\/Services\/SubscriptionHandlerService.php":"1ea069e5c057ed3358598e4613ca4928","Webhook\/Services\/WebhookReceiverService.php":"283d2c5b94f16f0d51a5f00ab08b1670","Webhook\/ValueObjects\/WebhookId.php":"92d5d4b45d934ce6c6f45dfa3b1bfaa4","Webhook\/ValueObjects\/WebhookType.php":"a4261156605b1dbf2136978270ebfaef"}
\ No newline at end of file
diff --git a/src/Payment/Aggregates/Address.php b/src/Payment/Aggregates/Address.php
index ab02536..e2af13f 100644
--- a/src/Payment/Aggregates/Address.php
+++ b/src/Payment/Aggregates/Address.php
@@ -206,8 +206,19 @@ public function getZipCode()
*/
public function setZipCode($zipCode)
{
- $zipCode = str_replace('-', '', $zipCode);
- $this->zipCode = substr($zipCode, 0, 16);
+ $zipCode = trim($zipCode);
+
+ if (empty($zipCode)) {
+ $inputName = $this->i18n->getDashboard('zipCode');
+ $message = $this->i18n->getDashboard(
+ "The %s should not be empty!",
+ $inputName
+ );
+
+ throw new \Exception($message, 400);
+ }
+
+ $this->zipCode = $this->formatZipCode($zipCode);
return $this;
}
@@ -227,7 +238,9 @@ public function getCity()
*/
public function setCity($city)
{
- $this->city = substr($city, 0, 64);
+ $this->city = trim(
+ substr($city, 0, 64)
+ );
if (empty($this->city)) {
@@ -365,4 +378,19 @@ public function convertToSDKRequest()
return $addressRequest;
}
-}
\ No newline at end of file
+
+ private function formatZipCode($zipCode)
+ {
+ $zipCode = str_replace('-', '', $zipCode);
+
+ $brazilianZipCodeLength = 8;
+ if (strtoupper($this->country) === 'BR') {
+ $zipCode = sprintf("%0${brazilianZipCodeLength}s", $zipCode);
+ $zipCode = substr($zipCode, 0, $brazilianZipCodeLength);
+ return $zipCode;
+ }
+
+ $zipCode = substr($zipCode, 0, 16);
+ return $zipCode;
+ }
+}
diff --git a/src/Payment/Aggregates/Customer.php b/src/Payment/Aggregates/Customer.php
index d9b6c19..6a0c3ac 100644
--- a/src/Payment/Aggregates/Customer.php
+++ b/src/Payment/Aggregates/Customer.php
@@ -82,17 +82,11 @@ public function getEmail()
*/
public function setEmail($email)
{
- $this->email = substr($email, 0, 64);
+ $email = trim($email);
+ $email = substr($email, 0, 64);
- if (empty($this->email)) {
-
- $message = $this->i18n->getDashboard(
- "The %s should not be empty!",
- "email"
- );
-
- throw new \Exception($message, 400);
- }
+ $this->validateEmail($email);
+ $this->email = $email;
return $this;
}
@@ -241,4 +235,25 @@ public function convertToSDKRequest()
return $customerRequest;
}
-}
\ No newline at end of file
+
+ private function validateEmail($email)
+ {
+ if (empty($email)) {
+ $message = $this->i18n->getDashboard(
+ "The %s should not be empty!",
+ "email"
+ );
+
+ throw new \Exception($message, 400);
+ }
+
+ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
+ $message = $this->i18n->getDashboard(
+ "The %s is invalid!",
+ "email"
+ );
+
+ throw new \Exception($message, 400);
+ }
+ }
+}
diff --git a/src/Payment/Aggregates/Order.php b/src/Payment/Aggregates/Order.php
index 6be0863..ae86aa3 100644
--- a/src/Payment/Aggregates/Order.php
+++ b/src/Payment/Aggregates/Order.php
@@ -4,6 +4,7 @@
use MundiAPILib\Models\CreateOrderRequest;
use Pagarme\Core\Kernel\Abstractions\AbstractEntity;
+use Pagarme\Core\Kernel\Services\LocalizationService;
use Pagarme\Core\Payment\Aggregates\Payments\AbstractPayment;
use Pagarme\Core\Payment\Aggregates\Payments\SavedCreditCardPayment;
use Pagarme\Core\Payment\Interfaces\ConvertibleToSDKRequestsInterface;
@@ -163,16 +164,19 @@ public function isPaymentSumCorrect()
*/
private function blockOverPaymentAttempt(AbstractPayment $payment)
{
+ $i18n = new LocalizationService();
+
$currentAmount = $payment->getAmount();
foreach ($this->payments as $currentPayment) {
$currentAmount += $currentPayment->getAmount();
}
if ($currentAmount > $this->amount) {
- throw new \Exception(
- 'The sum of payment amounts is bigger than the amount of the order!',
- 400
+ $message = $i18n->getDashboard(
+ "The sum of payments is greater than the order amount! " .
+ "Review the information and try again."
);
+ throw new \Exception($message, 400);
}
}
diff --git a/src/Payment/Aggregates/Payments/AbstractCreditCardPayment.php b/src/Payment/Aggregates/Payments/AbstractCreditCardPayment.php
index 1874db6..c40ef9e 100644
--- a/src/Payment/Aggregates/Payments/AbstractCreditCardPayment.php
+++ b/src/Payment/Aggregates/Payments/AbstractCreditCardPayment.php
@@ -7,6 +7,7 @@
use Pagarme\Core\Kernel\Abstractions\AbstractModuleCoreSetup as MPSetup;
use Pagarme\Core\Kernel\Exceptions\InvalidParamException;
use Pagarme\Core\Kernel\Services\InstallmentService;
+use Pagarme\Core\Kernel\Services\LocalizationService;
use Pagarme\Core\Kernel\Services\MoneyService;
use Pagarme\Core\Kernel\ValueObjects\CardBrand;
use Pagarme\Core\Payment\ValueObjects\AbstractCardIdentifier;
@@ -88,6 +89,8 @@ public function setInstallments($installments)
*/
private function validateIfIsRealInstallment($installments)
{
+ $i18n = new LocalizationService();
+
//get valid installments for this brand.
$installmentService = new InstallmentService();
$validInstallments = $installmentService->getInstallmentsFor(
@@ -105,8 +108,10 @@ private function validateIfIsRealInstallment($installments)
//invalid installment
$moneyService = new MoneyService();
- $exception = "The card brand '%s' or the amount %.2f doesn't allow the %dx installments!";
- $exception = sprintf(
+ $exception =
+ "The card brand '%s' or the amount %.2f doesn't allow " .
+ "%d installment(s)! Please review the information and try again.";
+ $exception = $i18n->getDashboard(
$exception,
$this->brand->getName(),
$moneyService->centsToFloat($this->amount),
diff --git a/src/Payment/Factories/PaymentFactory.php b/src/Payment/Factories/PaymentFactory.php
index a85c4bf..76258c0 100644
--- a/src/Payment/Factories/PaymentFactory.php
+++ b/src/Payment/Factories/PaymentFactory.php
@@ -117,8 +117,7 @@ private function createBasePayments(
$cardData,
$cardDataIndex,
$config
- )
- {
+ ) {
$payment = $this->createBaseCardPayment($cardData, $cardDataIndex);
if ($payment === null) {
@@ -190,8 +189,7 @@ private function createCustomer($paymentData)
private function getAmountWithInterestForCreditCard(
AbstractCreditCardPayment $payment,
$config
- )
- {
+ ) {
$installmentService = new InstallmentService();
$validInstallments = $installmentService->getInstallmentsFor(
@@ -266,6 +264,13 @@ private function createPixPayments($data)
$payment->setCustomer($customer);
}
+ $additionalInformation =
+ $this->moduleConfig->getPixConfig()->getAdditionalInformation();
+
+ if (!empty($additionalInformation)) {
+ $payment->setAdditionalInformation($additionalInformation);
+ }
+
$payment->setAmount($value->amount);
$payments[] = $payment;
@@ -290,10 +295,8 @@ private function createBaseCardPayment($data, $method)
$payment->setSaveOnSuccess($data->saveOnSuccess);
}
return $payment;
- } catch(\Exception $e) {
-
+ } catch (\Exception $e) {
} catch (\Throwable $e) {
-
}
try {
@@ -309,10 +312,8 @@ private function createBaseCardPayment($data, $method)
$payment->setOwner($owner);
return $payment;
- } catch(\Exception $e) {
-
+ } catch (\Exception $e) {
} catch (\Throwable $e) {
-
}
return null;
@@ -356,4 +357,4 @@ private function getNewPaymentMethod($method)
return new NewCreditCardPayment();
}
-}
\ No newline at end of file
+}
diff --git a/src/Payment/Services/ResponseHandlers/OrderHandler.php b/src/Payment/Services/ResponseHandlers/OrderHandler.php
index af84868..ad02d83 100644
--- a/src/Payment/Services/ResponseHandlers/OrderHandler.php
+++ b/src/Payment/Services/ResponseHandlers/OrderHandler.php
@@ -43,7 +43,11 @@ public function handle($createdOrder, PaymentOrder $paymentOrder = null)
$orderRepository->save($createdOrder);
$customerService = new CustomerService();
- $customerService->saveCustomer($createdOrder->getCustomer());
+ if (!empty($createdOrder->getCustomer())) {
+ $customerService->saveCustomer(
+ $createdOrder->getCustomer()
+ );
+ }
return $this->$statusHandler($createdOrder);
}
@@ -64,7 +68,7 @@ private function handleOrderStatusProcessing(Order $order)
$platformOrder->addHistoryComment(
$i18n->getDashboard(
'Order waiting for online retries at Pagarme.' .
- ' PagarmeId: ' . $order->getPagarmeId()->getValue()
+ ' PagarmeId: ' . $order->getPagarmeId()->getValue()
),
$sender
);
@@ -176,7 +180,7 @@ private function completePayment(Order $order, $invoice)
$platformOrder->addHistoryComment(
$i18n->getDashboard('Order paid.') .
- ' PagarmeId: ' . $order->getPagarmeId()->getValue(),
+ ' PagarmeId: ' . $order->getPagarmeId()->getValue(),
$sender
);
}
@@ -243,7 +247,6 @@ private function handleOrderStatusFailed(Order $order)
$acquirerMessages .=
"{$charge->getPagarmeId()->getValue()} => '{$lastTransaction->getAcquirerMessage()}', ";
$historyData[$charge->getPagarmeId()->getValue()] = $lastTransaction->getAcquirerMessage();
-
}
$acquirerMessages = rtrim($acquirerMessages, ', ');
diff --git a/src/Payment/ValueObjects/Phone.php b/src/Payment/ValueObjects/Phone.php
index faa9a49..9e34d78 100644
--- a/src/Payment/ValueObjects/Phone.php
+++ b/src/Payment/ValueObjects/Phone.php
@@ -24,10 +24,11 @@ final class Phone extends AbstractValueObject implements ConvertibleToSDKRequest
public function __construct($phone)
{
$phone = preg_replace('/(?!\d)./', '', $phone);
+ $phone = sprintf("%05s", $phone);
$this->countryCode = new NumericString(55);
$this->areaCode = new NumericString(substr($phone, 0, 2));
- $this->number = new NumericString(substr($phone, 2, 12));
+ $this->number = new NumericString(substr($phone, 2, 11));
}
/**
diff --git a/src/Recurrence/Services/SubscriptionService.php b/src/Recurrence/Services/SubscriptionService.php
index c321a25..2e33065 100644
--- a/src/Recurrence/Services/SubscriptionService.php
+++ b/src/Recurrence/Services/SubscriptionService.php
@@ -81,7 +81,10 @@ public function createSubscriptionAtPagarme(PlatformOrderInterface $platformOrde
$forceCreateOrder = MPSetup::getModuleConfiguration()->isCreateOrderEnabled();
if ($subscriptionResponse === null) {
- $message = $i18n->getDashboard("Can't create order.");
+ $message = $i18n->getDashboard(
+ "Can't create payment. " .
+ "Please review the information and try again."
+ );
throw new \Exception($message, 400);
}
@@ -103,7 +106,10 @@ public function createSubscriptionAtPagarme(PlatformOrderInterface $platformOrde
}
if (!$forceCreateOrder) {
- $message = $i18n->getDashboard("Can't create order.");
+ $message = $i18n->getDashboard(
+ "Can't create payment. " .
+ "Please review the information and try again."
+ );
throw new \Exception($message, 400);
}
}
@@ -122,7 +128,10 @@ public function createSubscriptionAtPagarme(PlatformOrderInterface $platformOrde
$forceCreateOrder &&
!$this->checkResponseStatus($originalSubscriptionResponse)
) {
- $message = $i18n->getDashboard("Can't create order.");
+ $message = $i18n->getDashboard(
+ "Can't create payment. " .
+ "Please review the information and try again."
+ );
throw new \Exception($message, 400);
}
diff --git a/tests/Hub/Factories/HubCommandFactoryTest.php b/tests/Hub/Factories/HubCommandFactoryTest.php
new file mode 100644
index 0000000..0493d18
--- /dev/null
+++ b/tests/Hub/Factories/HubCommandFactoryTest.php
@@ -0,0 +1,64 @@
+factory = new HubCommandFactory();
+
+ $this->payload = json_decode('{
+ "access_token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "account_id": "acc_XXXXXXXXXXXXXXXX",
+ "account_public_key": "pk_test_XXXXXXXXXXXXXXXX",
+ "install_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
+ "merchant_id": "merch_XXXXXXXXXXXXXXXX",
+ "additional_data": {},
+ "type": "Development",
+ "actions": [],
+ "events": [],
+ "command": "Install"
+ }');
+ }
+
+ public function testShouldCreateHubInstallCommand()
+ {
+ $hubInstall = $this->factory->createFromStdClass($this->payload);
+ $this->assertInstanceOf(AbstractCommand::class, $hubInstall);
+ }
+
+ public function testHubDevelopmentShouldUsePKTest()
+ {
+ $hubInstall = $this->factory->createFromStdClass($this->payload);
+ $this->assertEquals(CommandType::Development(), $hubInstall->getType());
+ $this->assertInstanceOf(TestPublicKey::class, $hubInstall->getAccountPublicKey());
+ }
+
+ public function testHubSandboxShouldUsePKTest()
+ {
+ $this->payload->type = "Sandbox";
+ $hubInstall = $this->factory->createFromStdClass($this->payload);
+ $this->assertEquals(CommandType::Sandbox(), $hubInstall->getType());
+ $this->assertInstanceOf(TestPublicKey::class, $hubInstall->getAccountPublicKey());
+ }
+
+ public function testHubProductionShouldUsePKLive()
+ {
+ $this->payload->account_public_key = "pk_XXXXXXXXXXXXXXXX";
+ $this->payload->type = "Production";
+ $hubInstall = $this->factory->createFromStdClass($this->payload);
+ $this->assertEquals(CommandType::Production(), $hubInstall->getType());
+ $this->assertInstanceOf(PublicKey::class, $hubInstall->getAccountPublicKey());
+ }
+}
\ No newline at end of file
diff --git a/tests/Kernel/Aggregates/ConfigurationTests.php b/tests/Kernel/Aggregates/ConfigurationTests.php
index e9442bc..547522c 100644
--- a/tests/Kernel/Aggregates/ConfigurationTests.php
+++ b/tests/Kernel/Aggregates/ConfigurationTests.php
@@ -30,4 +30,24 @@ public function testIsUnabled()
$this->assertInternalType('bool', $this->configuration->isEnabled());
$this->assertEquals(false, $this->configuration->isEnabled());
}
+
+ public function testHubEnvironmentStartsNull()
+ {
+ $this->assertInternalType('null', $this->configuration->getHubEnvironment());
+ $this->assertEquals('', $this->configuration->getHubEnvironment());
+ }
+
+ public function testHubEnvironmentIsSandbox()
+ {
+ $this->configuration->setHubEnvironment('Sandbox');
+ $this->assertInternalType('string', $this->configuration->getHubEnvironment());
+ $this->assertEquals('Sandbox', $this->configuration->getHubEnvironment());
+ }
+
+ public function testHubEnvironmentIsProduction()
+ {
+ $this->configuration->setHubEnvironment('Production');
+ $this->assertInternalType('string', $this->configuration->getHubEnvironment());
+ $this->assertEquals('Production', $this->configuration->getHubEnvironment());
+ }
}
diff --git a/tests/Kernel/Factories/Configurations/PixConfigFactoryTest.php b/tests/Kernel/Factories/Configurations/PixConfigFactoryTest.php
new file mode 100644
index 0000000..fa89e48
--- /dev/null
+++ b/tests/Kernel/Factories/Configurations/PixConfigFactoryTest.php
@@ -0,0 +1,79 @@
+dataWithAdditionalInformation = (object) array(
+ 'enabled' => true,
+ 'expirationQrCode' => 300,
+ 'bankType' => 'Pagar.me',
+ 'additionalInformation' => array(
+ array(
+ 'name' => 'information name',
+ 'value' => 'information value'
+ )
+ )
+ );
+
+ $this->pixConfigFactory = new PixConfigFactory();
+ }
+
+ public function testCreatePixConfigurationWithAdditionalConfiguration()
+ {
+ $pixConfig = $this->pixConfigFactory
+ ->createFromDbData($this->dataWithAdditionalInformation);
+
+ $this->assertEquals(
+ $this->dataWithAdditionalInformation->additionalInformation,
+ $pixConfig->getAdditionalInformation()
+ );
+
+ $serializedPixConfig = $pixConfig->jsonSerialize();
+
+ $this->assertEquals(
+ (array) $this->dataWithAdditionalInformation->additionalInformation,
+ $serializedPixConfig["additionalInformation"]
+ );
+ }
+
+ public function testCreatePixConfigurationWithoutAdditionalConfiguration()
+ {
+ $dataWithoutAdditionalInformation =
+ clone $this->dataWithAdditionalInformation;
+
+ unset($dataWithoutAdditionalInformation->additionalInformation);
+
+ $pixConfig = $this->pixConfigFactory
+ ->createFromDbData($dataWithoutAdditionalInformation);
+
+ $this->assertEquals(
+ null,
+ $pixConfig->getAdditionalInformation()
+ );
+
+ $serializedPixConfig = $pixConfig->jsonSerialize();
+
+ $this->assertEquals(
+ null,
+ $serializedPixConfig["additionalInformation"]
+ );
+ }
+}
diff --git a/tests/Kernel/ValueObjects/TransactionStatusTest.php b/tests/Kernel/ValueObjects/TransactionStatusTest.php
index f12ac3f..b2e23e9 100644
--- a/tests/Kernel/ValueObjects/TransactionStatusTest.php
+++ b/tests/Kernel/ValueObjects/TransactionStatusTest.php
@@ -9,31 +9,31 @@ class TransactionStatusTest extends TestCase
{
protected $validStatuses = [
'CAPTURED' => [
- 'method' => 'captured',
+ 'method' => 'captured',
'value' => "captured"
],
'PARTIAL_CAPTURE' => [
- 'method' => 'partialCapture',
+ 'method' => 'partialCapture',
'value' => "partial_capture"
],
'AUTHORIZED_PENDING_CAPTURE' => [
- 'method' => 'authorizedPendingCapture',
+ 'method' => 'authorizedPendingCapture',
'value' => 'authorized_pending_capture'
],
'VOIDED' => [
- 'method' => 'voided',
+ 'method' => 'voided',
'value' => 'voided'
],
'REFUNDED' => [
- 'method' => 'refunded',
+ 'method' => 'refunded',
'value' => 'refunded'
],
'PARTIAL_VOID' => [
- 'method' => 'partialVoid',
+ 'method' => 'partialVoid',
'value' => 'partial_void'
],
'WITH_ERROR' => [
- 'method' => 'withError',
+ 'method' => 'withError',
'value' => 'withError'
],
'NOT_AUTHORIZED' => [
@@ -41,19 +41,19 @@ class TransactionStatusTest extends TestCase
'value' => 'notAuthorized'
],
'FAILED' => [
- 'method' => 'failed',
+ 'method' => 'failed',
'value' => 'failed'
- ],
+ ],
'GENERATED' => [
- 'method' => 'generated',
+ 'method' => 'generated',
'value' => 'generated'
],
'UNDERPAID' => [
- 'method' => 'underpaid',
+ 'method' => 'underpaid',
'value' => 'underpaid'
],
'PAID' => [
- 'method' => 'paid',
+ 'method' => 'paid',
'value' => 'paid'
],
'OVERPAID' => [
@@ -75,6 +75,18 @@ class TransactionStatusTest extends TestCase
'EXPIRED' => [
'method' => 'expired',
'value' => 'expired'
+ ],
+ 'PENDING_REVIEW' => [
+ 'method' => 'pendingReview',
+ 'value' => 'pending_review'
+ ],
+ 'ANALYZING' => [
+ 'method' => 'analyzing',
+ 'value' => 'analyzing'
+ ],
+ 'WAITING_CAPTURE' => [
+ 'method' => 'waitingCapture',
+ 'value' => 'waiting_capture'
]
];
diff --git a/tests/Payment/Aggregates/AddressTests.php b/tests/Payment/Aggregates/AddressTests.php
index a07183e..36d0085 100644
--- a/tests/Payment/Aggregates/AddressTests.php
+++ b/tests/Payment/Aggregates/AddressTests.php
@@ -10,16 +10,78 @@ class AddressTests extends TestCase
/**
* @var Address
*/
- private $andress;
+ private $address;
public function setUp()
{
- $this->andress = new Address();
+ $this->address = new Address();
}
- public function testAddressNumberRemoveComma()
+ public function testCityTrim()
{
- $this->andress->setNumber('12,3,4,5,6');
- $this->assertEquals('123456', $this->andress->getNumber());
+ $this->address->setCity(' Florianópolis ');
+ $this->assertEquals('Florianópolis', $this->address->getCity());
+ }
+
+ public function testCityRemoveCharactersAfterMaxLength()
+ {
+ $cityMaxLength = 64;
+ $addressCity = str_repeat('a', $cityMaxLength + 1);
+
+ $this->address->setCity($addressCity);
+
+ $this->assertEquals($cityMaxLength, strlen($this->address->getCity()));
+ }
+
+ public function testNumberRemoveComma()
+ {
+ $this->address->setNumber('12,3,4,5,6');
+ $this->assertEquals('123456', $this->address->getNumber());
+ }
+
+ public function testZipCodeRemoveDash()
+ {
+ $this->address->setZipCode('12345-678');
+ $this->assertEquals('12345678', $this->address->getZipCode());
+ }
+
+ public function testZipCodeTrim()
+ {
+ $this->address->setZipCode(' 12345678 ');
+ $this->assertEquals('12345678', $this->address->getZipCode());
+ }
+
+ public function testZipCodeRemoveCharactersAfterGeneralMaxLength()
+ {
+ $zipCodeGeneralMaxLength = 16;
+ $this->address->setCountry('US');
+ $this->address->setZipCode(
+ str_repeat('1', $zipCodeGeneralMaxLength + 1)
+ );
+ $this->assertEquals(
+ $zipCodeGeneralMaxLength, strlen($this->address->getZipCode())
+ );
+ }
+
+ public function testZipCodeRemoveCharactersAfterBrazilianMaxLength()
+ {
+ $zipCodeBrazilianMaxLength = 8;
+ $this->address->setCountry('BR');
+ $this->address->setZipCode(
+ str_repeat('1', $zipCodeBrazilianMaxLength + 1)
+ );
+ $this->assertEquals(
+ $zipCodeBrazilianMaxLength, strlen($this->address->getZipCode())
+ );
+ }
+
+ public function testZipCodeAddCharactersForBrazilianMinLength()
+ {
+ $zipCodeBrazilianMinLength = 8;
+ $this->address->setCountry('BR');
+ $this->address->setZipCode('1');
+ $this->assertEquals(
+ $zipCodeBrazilianMinLength, strlen($this->address->getZipCode())
+ );
}
}
diff --git a/tests/Payment/CustomerTests.php b/tests/Payment/Aggregates/CustomerTests.php
similarity index 54%
rename from tests/Payment/CustomerTests.php
rename to tests/Payment/Aggregates/CustomerTests.php
index e00d8ee..80c0efb 100644
--- a/tests/Payment/CustomerTests.php
+++ b/tests/Payment/Aggregates/CustomerTests.php
@@ -3,6 +3,7 @@
namespace Pagarme\Core\Test\Payment;
+use Pagarme\Core\Kernel\ValueObjects\AbstractValidString;
use Pagarme\Core\Kernel\ValueObjects\Id\CustomerId;
use Pagarme\Core\Payment\Aggregates\Customer;
use Pagarme\Core\Payment\ValueObjects\CustomerType;
@@ -32,4 +33,26 @@ public function testBuildCustomerObject()
$this->assertEquals(2, $this->customer->getCode());
}
+
+ public function testEmailTrim()
+ {
+ $this->customer->setCode(3);
+ $this->customer->setEmail(' teste@teste.com ');
+ $this->assertEquals('teste@teste.com', $this->customer->getEmail());
+ }
+
+ public function testEmailRemoveCharactersAfterMaxLength()
+ {
+ $emailMaxLength = 64;
+ $newEmailLength = $emailMaxLength + 1;
+ $customerEmail = "teste@gmail.com";
+ $customerEmail = sprintf("%'a${newEmailLength}s", $customerEmail);
+
+ $this->customer->setCode(4);
+ $this->customer->setEmail($customerEmail);
+
+ $this->assertEquals(
+ $emailMaxLength, strlen($this->customer->getEmail())
+ );
+ }
}
diff --git a/tests/Payment/ValueObjects/PhoneTests.php b/tests/Payment/ValueObjects/PhoneTests.php
new file mode 100644
index 0000000..26307a5
--- /dev/null
+++ b/tests/Payment/ValueObjects/PhoneTests.php
@@ -0,0 +1,56 @@
+phone = new Phone('11987654321');
+
+
+ $this->assertEquals('55', $this->phone->getCountryCode());
+ $this->assertEquals('11', $this->phone->getAreaCode());
+ $this->assertEquals('987654321', $this->phone->getNumber());
+ $this->assertEquals('5511987654321', $this->phone->getFullNumber());
+ }
+
+ public function testPhoneOnlyDigits()
+ {
+ $this->phone = new Phone(' Tel. 12 987654333 ');
+
+ $this->assertEquals('5512987654333', $this->phone->getFullNumber());
+ }
+
+ public function testPhoneRemoveCharactersAfterMaxLength()
+ {
+ $phoneMaxLength = 15;
+ $phone = str_repeat('1', $phoneMaxLength + 1);
+
+ $this->phone = new Phone($phone);
+
+ $this->assertEquals(
+ $phoneMaxLength, strlen($this->phone->getFullNumber())
+ );
+ }
+
+ public function testPhoneAddCharactersForMinLength()
+ {
+ $phoneMinLength = 7;
+
+ $this->phone = new Phone('1');
+
+ $this->assertEquals(
+ $phoneMinLength, strlen($this->phone->getFullNumber())
+ );
+ }
+}