diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c534d4..94730e37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,20 @@ - Global Payments logo + Global Payments logo # Changelog ## Latest version +#### Enhancements: +- Add RequestLogger to GP-ECOM +- Fix message_extension issue for 3DS2 on GP-ECOM +- Update logo image on Readme and Changelog files +- Add depositDate and depositReference mappings for settlement disputes report on GP-API +- Change property name from "storage_model" to "storage_mode" on GP-API + +## v2.3.3 (05/27/2021) + #### Enhancements: - enhance GP-ECOM error handling diff --git a/README.md b/README.md index be5bcb69..7e4f9cf9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ - Global Payments logo + Global Payments logo # Global Payments & Heartland PHP SDK diff --git a/src/Entities/GpApi/DTO/PaymentMethod.php b/src/Entities/GpApi/DTO/PaymentMethod.php index 8a4b95cf..502f650d 100644 --- a/src/Entities/GpApi/DTO/PaymentMethod.php +++ b/src/Entities/GpApi/DTO/PaymentMethod.php @@ -12,7 +12,7 @@ class PaymentMethod public $authentication; public $encryption; public $name; - public $storage_model; + public $storage_mode; /** @var Card $card */ public $card; diff --git a/src/Entities/GpApi/GpApiAuthorizationRequestBuilder.php b/src/Entities/GpApi/GpApiAuthorizationRequestBuilder.php index 213f32df..aba5bafe 100644 --- a/src/Entities/GpApi/GpApiAuthorizationRequestBuilder.php +++ b/src/Entities/GpApi/GpApiAuthorizationRequestBuilder.php @@ -200,7 +200,7 @@ private function createPaymentMethodParam($builder) if (is_null($paymentMethod->id)) { $paymentMethod->card = CardUtils::generateCard($builder); } - $paymentMethod->storage_model = $builder->requestMultiUseToken == true ? 'ON_SUCCESS' : null; + $paymentMethod->storage_mode = $builder->requestMultiUseToken == true ? 'ON_SUCCESS' : null; return $paymentMethod; } diff --git a/src/Entities/MessageExtension.php b/src/Entities/MessageExtension.php new file mode 100644 index 00000000..aed32fe4 --- /dev/null +++ b/src/Entities/MessageExtension.php @@ -0,0 +1,26 @@ +cavv = $this->mergeValue($this->cavv, $secureEcom->cavv); $this->challengeMandated = $this->mergeValue($this->challengeMandated, $secureEcom->challengeMandated); $this->challengeValue = $this->mergeValue($this->challengeValue, $secureEcom->challengeValue); - $this->criticalityIndicator = $this->mergeValue($this->criticalityIndicator, $secureEcom->criticalityIndicator); + $this->messageExtension = $this->mergeValue($this->messageExtension, $secureEcom->messageExtension); $this->currency = $this->mergeValue($this->currency, $secureEcom->currency); $this->decoupledResponseIndicator = $this->mergeValue($this->decoupledResponseIndicator, $secureEcom->decoupledResponseIndicator); $this->directoryServerTransactionId = $this->mergeValue($this->directoryServerTransactionId, $secureEcom->directoryServerTransactionId); @@ -402,9 +387,6 @@ public function merge(ThreeDSecure $secureEcom) $this->enrolled = $this->mergeValue($this->enrolled, $secureEcom->enrolled); $this->issuerAcsUrl = $this->mergeValue($this->issuerAcsUrl, $secureEcom->issuerAcsUrl); $this->messageCategory = $this->mergeValue($this->messageCategory, $secureEcom->messageCategory); - $this->messageExtensionData = $this->mergeValue($this->messageExtensionData, $secureEcom->messageExtensionData); - $this->messageExtensionId = $this->mergeValue($this->messageExtensionId, $secureEcom->messageExtensionId); - $this->messageExtensionName = $this->mergeValue($this->messageExtensionName, $secureEcom->messageExtensionName); $this->messageVersion = $this->mergeValue($this->messageVersion, $secureEcom->messageVersion); $this->orderId = $this->mergeValue($this->orderId, $secureEcom->orderId); $this->payerAuthenticationRequest = $this->mergeValue($this->payerAuthenticationRequest, $secureEcom->payerAuthenticationRequest); diff --git a/src/Gateways/Gateway.php b/src/Gateways/Gateway.php index 8937aceb..6d414094 100644 --- a/src/Gateways/Gateway.php +++ b/src/Gateways/Gateway.php @@ -94,7 +94,7 @@ protected function sendRequest( } if (isset($this->requestLogger)) { - $this->requestLogger->requestSent($verb, $endpoint, $headers, $queryStringParams, $data); + $this->requestLogger->requestSent($verb, $this->serviceUrl . $endpoint . $queryString, $headers, null, $data); } curl_setopt($request, CURLOPT_CONNECTTIMEOUT, $this->timeout); diff --git a/src/Gateways/Gp3DSProvider.php b/src/Gateways/Gp3DSProvider.php index c49093f8..4e2422cf 100644 --- a/src/Gateways/Gp3DSProvider.php +++ b/src/Gateways/Gp3DSProvider.php @@ -5,6 +5,7 @@ use GlobalPayments\Api\Builders\Secure3dBuilder; use GlobalPayments\Api\Entities\Enums\ExemptionReason; use GlobalPayments\Api\Entities\Enums\ExemptStatus; +use GlobalPayments\Api\Entities\MessageExtension; use GlobalPayments\Api\Entities\ThreeDSecure; use GlobalPayments\Api\Entities\Transaction; use GlobalPayments\Api\Entities\Enums\Secure3dVersion; @@ -12,8 +13,6 @@ use GlobalPayments\Api\Entities\Exceptions\ApiException; use GlobalPayments\Api\Entities\Exceptions\GatewayException; use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod; -use GlobalPayments\Api\PaymentMethods\Interfaces\ISecure3d; use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod; use GlobalPayments\Api\Utils\GenerationUtils; @@ -409,15 +408,17 @@ private function mapResponse($rawResponse) // message_extension if (array_key_exists('message_extension', $doc)) { - $secureEcom->criticalityIndicator = - isset($doc['message_extension']['criticality_indicator']) ? - $doc['message_extension']['criticality_indicator'] : null; - $secureEcom->messageExtensionData = isset($doc['message_extension']['data']) ? - $doc['message_extension']['data'] : null; - $secureEcom->messageExtensionId = - isset($doc['message_extension']['id']) ? $doc['message_extension']['id'] : null; - $secureEcom->messageExtensionName = - isset($doc['message_extension']['name']) ? $doc['message_extension']['name'] : null; + foreach ($doc['message_extension'] as $messageExtension) { + $msgItem = new MessageExtension(); + $msgItem->criticalityIndicator = + isset($messageExtension['criticality_indicator']) ? + $messageExtension['criticality_indicator'] : null; + $msgItem->messageExtensionData = isset($messageExtension['data']) ? + json_encode($messageExtension['data']) : null; + $msgItem->messageExtensionId = isset($messageExtension['id']) ? $messageExtension['id'] : null; + $msgItem->messageExtensionName = isset($messageExtension['name']) ? $messageExtension['name'] : null; + $secureEcom->messageExtension[] = $msgItem; + } } // versions diff --git a/src/Mapping/GpApiMapping.php b/src/Mapping/GpApiMapping.php index dd3c8b1d..5e37775b 100644 --- a/src/Mapping/GpApiMapping.php +++ b/src/Mapping/GpApiMapping.php @@ -299,6 +299,8 @@ public static function mapDisputeSummary($response) $summary->lastAdjustmentAmount = StringUtils::toAmount($response->last_adjustment_amount); $summary->lastAdjustmentCurrency = $response->last_adjustment_currency; $summary->lastAdjustmentFunding = $response->last_adjustment_funding; + $summary->depositDate = !empty($response->deposit_time_created) ? $response->deposit_time_created : null; + $summary->depositReference = !empty($response->deposit_id) ? $response->deposit_id : null; return $summary; } diff --git a/src/ServiceConfigs/Gateways/GpEcomConfig.php b/src/ServiceConfigs/Gateways/GpEcomConfig.php index c3df22d5..a58781e5 100644 --- a/src/ServiceConfigs/Gateways/GpEcomConfig.php +++ b/src/ServiceConfigs/Gateways/GpEcomConfig.php @@ -53,6 +53,7 @@ public function configureContainer(ConfiguredServices $services) $gateway->serviceUrl = $this->serviceUrl; $gateway->refundPassword = $this->refundPassword; $gateway->hostedPaymentConfig = $this->hostedPaymentConfig; + $gateway->requestLogger = $this->requestLogger; $gateway->webProxy = $this->webProxy; $services->gatewayConnector = $gateway; @@ -76,6 +77,8 @@ public function configureContainer(ConfiguredServices $services) $secure3d2->setMethodNotificationUrl($this->methodNotificationUrl); $secure3d2->setChallengeNotificationUrl($this->challengeNotificationUrl); $secure3d2->timeout = $gateway->timeout; + $secure3d2->requestLogger = $this->requestLogger; + $secure3d2->webProxy = $this->webProxy; $services->setSecure3dProvider(Secure3dVersion::TWO, $secure3d2); } diff --git a/src/Utils/Logging/SampleRequestLogger.php b/src/Utils/Logging/SampleRequestLogger.php index 84f04ffd..c0b65f78 100644 --- a/src/Utils/Logging/SampleRequestLogger.php +++ b/src/Utils/Logging/SampleRequestLogger.php @@ -19,26 +19,28 @@ public function __construct(LoggerInterface $logger) public function requestSent($verb, $endpoint, $headers, $queryStringParams, $data) { - // TODO: Implement requestSent() method. $this->logger->info("Request/Response START"); $this->logger->info("Request START"); $this->logger->info("Request verb: " . $verb); $this->logger->info("Request endpoint: " . $endpoint); $this->logger->info("Request headers: ", $headers); - $this->logger->info("Request query string: ", !empty($queryStringParams) ? $queryStringParams : array()); - $this->logger->info("Request body: ", !empty($data) ? json_decode($data, true) : array()); + $this->logger->info("Request body: " . $data); $this->logger->info("REQUEST END"); } public function responseReceived(GatewayResponse $response) { - // TODO: Implement responseReceived() method. $this->logger->info("Response START"); $this->logger->info("Status code: " . $response->statusCode); - $this->logger->info("Response body: ", json_decode(gzdecode($response->rawResponse), true)); + $rs = clone $response; + if (strpos($rs->header, ': gzip') !== false) { + $rs->rawResponse = gzdecode($rs->rawResponse); + } + $this->logger->info("Response body: " . $rs->rawResponse); $this->logger->info("Response END"); $this->logger->info("Request/Response END"); + $this->logger->info("============================================="); } public function responseError(\Exception $e) @@ -48,6 +50,7 @@ public function responseError(\Exception $e) $this->logger->info("Exception type: " . get_class($e)); $this->logger->info("Exception message: " . $e->getMessage()); $this->logger->info("Exception END"); + $this->logger->info("============================================="); } diff --git a/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.php b/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.php index 920a0742..b55aa528 100644 --- a/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.php +++ b/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.php @@ -22,6 +22,8 @@ use GlobalPayments\Api\ServiceConfigs\Gateways\GpApiConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Utils\GenerationUtils; +use GlobalPayments\Api\Utils\Logging\Logger; +use GlobalPayments\Api\Utils\Logging\SampleRequestLogger; use PHPUnit\Framework\TestCase; class CreditCardNotPresentTest extends TestCase @@ -1033,7 +1035,8 @@ public function setUpConfig() $config->channel = Channels::CardNotPresent; $config->country = 'GB'; // $config->permissions = ['TRN_POST_Authorize']; -// $config->webProxy = new CustomWebProxy('127.0.0.1:8866'); +// $config->webProxy = new CustomWebProxy('127.0.0.1:8866'); +// $config->requestLogger = new SampleRequestLogger(new Logger("logs")); return $config; } diff --git a/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php b/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php index 50865f7d..1d2c93f2 100644 --- a/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php +++ b/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php @@ -2,6 +2,7 @@ namespace GlobalPayments\Api\Tests\Integration\Gateways\RealexConnector; +use GlobalPayments\Api\Entities\CustomWebProxy; use GlobalPayments\Api\Entities\Enums\DecoupledFlowRequest; use GlobalPayments\Api\Entities\Enums\MerchantInitiatedRequestType; use GlobalPayments\Api\Entities\Enums\WhiteListStatus; @@ -13,6 +14,8 @@ use GlobalPayments\Api\Services\Secure3dService; use GlobalPayments\Api\Tests\Data\TestCards; use GlobalPayments\Api\Tests\Integration\Gateways\ThreeDSecureAcsClient; +use GlobalPayments\Api\Utils\Logging\Logger; +use GlobalPayments\Api\Utils\Logging\SampleRequestLogger; use PHPUnit\Framework\TestCase; use GlobalPayments\Api\Entities\Address; use GlobalPayments\Api\Entities\BrowserData; @@ -105,6 +108,8 @@ protected function getConfig() $config->challengeNotificationUrl = 'https://www.example.com/challengeNotificationUrl'; $config->secure3dVersion = Secure3dVersion::ANY; $config->merchantContactUrl = 'https://www.example.com'; +// $config->requestLogger = new SampleRequestLogger(new Logger("logs")); +// $config->webProxy = new CustomWebProxy('127.0.0.1:8866'); return $config; }