From 456db2f0d782d5deac1cb744c219d16887f0525c Mon Sep 17 00:00:00 2001 From: securesubmit-buildmaster Date: Thu, 2 Nov 2023 08:04:34 -0400 Subject: [PATCH] OctopusDeploy release: 11.0.2 --- CHANGELOG.md | 156 +++++++++--------- metadata.xml | 2 +- src/Entities/Enums/Region.php | 2 + src/Entities/Enums/ServiceEndpoints.php | 3 +- src/Terminals/ConnectionConfig.php | 10 +- src/Terminals/Diamond/DiamondController.php | 10 +- src/Terminals/DiamondCloudConfig.php | 23 ++- src/Terminals/Enums/ConnectionModes.php | 1 - .../PAX/Responses/PaxBaseResponse.php | 2 +- src/Terminals/UPA/UpaController.php | 7 +- .../Terminals/PAX/PaxExceptionTests.php | 64 +++++++ .../Gateways/Terminals/UPA/UpaMicTests.php | 11 +- 12 files changed, 194 insertions(+), 97 deletions(-) create mode 100644 test/Integration/Gateways/Terminals/PAX/PaxExceptionTests.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8628128b..d3f5d5f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,48 +4,54 @@ # Changelog -## Latest Version - v11.0.1 (10/24/2023) +## Latest Version - v11.0.2 (11/01/23) +### Enhancements: +- [PAX Devices] Improvements to decline-response handling +- [DiamondCloud] Add production endpoints +- [MEET-IN-THE-CLOUD][UPA] Remove duplicate ConnectionMode const "MIC" + +## v11.0.1 (10/24/23) ### Enhancements: - [GP-API] Add stored credentials to verify request - [GP-API & GP-ECOM] Enhancements on unit tests -- [MEET-IN-THE-CLOUD][GP-API] Remove QA endpoint +- [MEET-IN-THE-CLOUD][UPA] Remove QA endpoint #### Bug Fixes: -[GP-API]: Fix 3DS example -## v11.0.0 (10/19/2023) +## v11.0.0 (10/19/23) ### Enhancements: - [DiamondCloud] Add support for Diamond Cloud provider payment terminals. - [Breaking] Terminals: Architecture update -## v10.1.2 (10/17/2023) +## v10.1.2 (10/17/23) ### Enhancements: - [Portico] Added cardholder email support. -## v10.1.1 (10/10/2023) +## v10.1.1 (10/10/23) #### Enhancements: - [GP-API] Add a new alternative payment method, ALIPAY - [GP-ECOM] Limit what card types to accept for payment or storage (HPP & API) * https://developer.globalpay.com/hpp/card-blocking * https://developer.globalpay.com/api/card-blocking -## v10.1.0 (09/21/2023) +## v10.1.0 (09/21/23) #### Enhancements: - [Verifone] P400: added initial Meet-In-The-Cloud connectivity support for this device - [GP-API]: Upload Merchant Documentation - https://developer.globalpay.com/api/merchants - [GP-API]: Credit Or Debit a Funds Management Account (FMA) - https://developer.globalpay.com/api/funds -## v10.0.3 (09/13/2023) +## v10.0.3 (09/13/23) #### Enhancements: - [GP-API]: Update onboarding merchant requests - Security vulnerabilities fixes -## v10.0.2 (09/07/2023) +## v10.0.2 (09/07/23) #### Enhancements: - [GP-ECOM] Support parseResponse for status_url on HostedService (HPP APMs) - [GP-ECOM] Added "custnum" from Customer on "payer_new" request -## v10.0.1 (08/29/2023) +## v10.0.1 (08/29/23) #### Enhancements: - Enhance logs based on environment (GP-API & GP-ECOM) - Security vulnerabilities fixes @@ -53,22 +59,22 @@ ds_trans_reference,value) - Unit test updates -## v10.0.0 (08/22/2023) +## v10.0.0 (08/22/23) #### Enhancements: - [GP-API] Rename PayLink to PayByLink -## v9.0.2 (08/10/2023) +## v9.0.2 (08/10/23) #### Enhancements: - [GP-API] Improve Open Banking and 3DS tests #### Bug Fixes: -[PAX Devices]: Fix PAX controller -## v9.0.1 (07/11/2023) +## v9.0.1 (07/11/23) #### Enhancements: - Add appsec.properties for Macroscope -## v9.0.0 (07/06/2023) +## v9.0.0 (07/06/23) #### Enhancements: - Add support for PHP8.2 - Drop support for PHP lower than 8.0 @@ -78,7 +84,7 @@ ds_trans_reference,value) #### Bug Fixes: - [GP-ECOM]: Send the correct "message_version" in the initiate step on 3DS2 -## v8.0.2 (06/27/2023) +## v8.0.2 (06/27/23) #### Enhancements: - [Profac]: Additional transaction support added | Account Management | Spilt Fund | Network Transaction - [PAX Devices]: Improved some tests @@ -86,17 +92,17 @@ ds_trans_reference,value) #### Bug Fixes: - [GP-ECOM]: Fix type confusion vulnerability on sha1hash for hppResponse -## v8.0.1 (05/30/2023) +## v8.0.1 (05/30/23) #### Bug Fixes: - Portico/Heartland: fix 'AllowDup' flag not included with some CreditReturn transactions -## v8.0.0 (05/23/2023) +## v8.0.0 (05/23/23) #### Enhancements: - Propay: Change file encoding for: AccountPermissions, BeneficialOwnerData, BusinessData, OwnersData, SignificantOwnerData, UploadDocumentData - [Breaking] Terminals (HPA, PAX, UPA): Architecture update - GP-API: Unit tests updates on: GpApiMerchantAccountsTest, GpApiDigitalWalletTest, GpApiMerchantsOnboardTest -## v7.0.3 (05/09/2023) +## v7.0.3 (05/09/23) #### Enhancements: - GP-API: Manage fund transfers, splits and reverse splits in your partner network. - https://developer.globalpay.com/api/transfers @@ -106,31 +112,31 @@ ds_trans_reference,value) #### Bug Fixes: - Portico/Heartland: fix to allow CreditAuth transaction type with wallet data -## v7.0.2 (05/02/2023) +## v7.0.2 (05/02/23) #### Enhancements: - GP-API: Manage merchant accounts for partner solution - https://developer.globalpay.com/api/accounts - GP-ECOM: Add to the mapping response fields: acs_reference_number & acs_signed_content for the authentication source MOBILE_SDK -## v7.0.1 (04/04/2023) +## v7.0.1 (04/04/23) #### Enhancements: - Portico/Heartland: improvements to transaction request building logic - GP-API: Unit tests update on fraud management and APMs - GP-ECOM: Unit test update on 3DS -## v7.0.0 (03/21/2023) +## v7.0.0 (03/21/23) #### Enhancements: - Add payer information on Transaction object - GP-API: Update request for boarding merchants - GP-ECOM: Change recurring entity return type -## v6.1.7 (03/09/2023) +## v6.1.7 (03/09/23) #### Bug Fixes: - GP-API: fix issue on PHP8.1 with strtoupper and str_pad - GP-API: fix unit tests on PHP8.1 -## v6.1.6 (03/07/2023) +## v6.1.6 (03/07/23) #### Bug Fixes: - Portico/Heartland: fix 'withStartDate()' reporting method @@ -138,43 +144,43 @@ ds_trans_reference,value) - Portico/Heartland: improvements to GooglePay and ApplePay token handling - Portico/Heartland: simple GooglePay example added -## v6.1.5 (02/28/2023) +## v6.1.5 (02/28/23) #### Bug Fixes: - TSYS/Merchantware: correction to service endpoints -## v6.1.4 (02/21/2023) +## v6.1.4 (02/21/23) #### Enhancements: - GP-API: Add account_id on all requests #### Bug Fixes: - PAX A35: Fixed device-response handling -## v6.1.3 (02/16/2023) +## v6.1.3 (02/16/23) #### Enhancements: - GP-API: Create open banking transactions - GPI Transactions: Reporting tests refactor -## v6.1.2 (02/13/2023) +## v6.1.2 (02/13/23) #### Enhancements: - GP-API: BNPL unit tests update -## v6.1.1 (02/09/2023) +## v6.1.1 (02/09/23) #### Bug Fixes: - Portico Gateway: fix DigitalPaymentToken handling -## v6.1.0 (02/02/2023) +## v6.1.0 (02/02/23) #### Enhancements: - GP-API: add risk assessment feature - Refacto the Secure3DBuilder - GP-API: update CTP transaction request -## v6.0.6 (01/26/2023) +## v6.0.6 (01/26/23) #### Enhancements: - GPI Transactions : added support for credit, ach & reporting transactions - GP-API: add to generateXGPSignature to GenerationUtils - Portico Gateway: Fix incorrect date handling in schedule response -## v6.0.5 (01/12/2023) +## v6.0.5 (01/12/23) #### Enhancements: - GP-API: add exemption status on "/transaction" endpoint - Add enum classes: HostedPaymentMethods, IntervalToExpire @@ -183,17 +189,17 @@ ds_trans_reference,value) #### Bug Fixes: - GP-API: Fix issue on mapping o transaction report -## v6.0.4 (12/13/2022) +## v6.0.4 (12/13/22) #### Enhancements: - GP-API: Add BNPL feature - GP-API: Click-to-Pay -## v6.0.3 (12/06/2022) +## v6.0.3 (12/06/22) #### Enhancements: - PAX: Adding tip after the Sale - Portico: APPLE PAY / GOOGLE PAY fix for token format -## v6.0.2 (11/17/2022) +## v6.0.2 (11/17/22) #### Enhancements: - GP-API: Onboard merchants feature - GP-API: Decoupled Authentication @@ -203,66 +209,66 @@ ds_trans_reference,value) - GP-API/GP-ECOM: Fix end-to-end examples - Portico: APPLE PAY / GOOGLE PAY fix -## v6.0.1 (11/03/2022) +## v6.0.1 (11/03/22) #### Enhancements: - Security vulnerabilities fixes -## v6.0.0 (10/20/2022) +## v6.0.0 (10/20/22) #### Enhancements: - GP-API/GP-ECOM: Sunset 3DS1 - Add method on CountryUtil to extract phone country code based on ISO-2/ISO-3/the name of the country - GP-API Update unit tests with new set of credentials for GP-API - Genius - Fix Configuration for service URL -## v5.0.3 (10/04/2022) +## v5.0.3 (10/04/22) #### Enhancements: - GP-API: PayLink enhancements -## v5.0.2 (09/29/2022) +## v5.0.2 (09/29/22) #### Enhancements: - GP-API: Add fraud management feature - GP-ECOM: Billing/Shipping country value should be ISO2 country code - GP-API: Add missing request properties for /transactions and /initiate endpoints -## v5.0.1 (09/08/2022) +## v5.0.1 (09/08/22) #### Enhancements: - GP-API: Add new mapping for card issuer avs/cvv result - GP-ECOM: Add srd tag to card storage request -## v5.0.0 (08/23/2022) +## v5.0.0 (08/23/22) #### Enhancements: - Support PHP v. >= 8.0 - GP_API: Update PayLink unit tests -## v4.0.5 (07/28/2022) +## v4.0.5 (07/28/22) #### Enhancements: - GP-API: Add PayLink service #### Bug Fixes: - GP-API: Fix mapping issue on APMs -## v4.0.4 (07/14/2022) +## v4.0.4 (07/14/22) #### Enhancements: - GP-API: Add mapping for some missing fields on response 3DS2 initiate step - GP-ECOM: Add missing optional fields HPP_CUSTOMER_PHONENUMBER_HOME and HPP_CUSTOMER_PHONENUMBER_WORK - Update Open Banking endpoints -## v4.0.3 (06/28/2022) +## v4.0.3 (06/28/22) #### Enhancements: - Add autoloader standalone - Add end-to-end example for GP-API with HF and 3DS2 - Refacto on the folder structure in examples -## v4.0.2 (06/14/2022) +## v4.0.2 (06/14/22) #### Bug Fixes: - Fix issue with recurring payment schedule edits (Portico) -## v4.0.1 (06/09/2022) +## v4.0.1 (06/09/22) #### Enhancements: - HPP Exemption Optimization Service - Update timestamp on the Logger -## v4.0.0 (06/07/2022) +## v4.0.0 (06/07/22) #### Enhancements: - GP-ECOM: Add payment scheduler - GP-ECOM/GP-API: Structure refacto @@ -270,32 +276,32 @@ ds_trans_reference,value) - GP-API: Add example with Google Pay - GP-API: Add Dynamic Descriptor for authorize and charge -## v3.1.1 (05/17/2022) +## v3.1.1 (05/17/22) #### Enhancements: - GP-ECOM: Add HPP capture billing/shipping address - Add intl and mbstring extensions on composer - GP-API: Refacto reporting for disputes / search stored payment methods / LodgingData -## v3.1.0 (05/05/2022) +## v3.1.0 (05/05/22) #### Enhancements: - GP-ECOM: Add bank payment (open banking) service - GP-API: Update usage mode, cardholder name and card number on a stored payment method - Portico: Updated code for Secure3D and WalletData Element -## v3.0.4 (04/21/2022) +## v3.0.5 (04/21/22) #### Enhancements: - GP-API: Increment an Auth: increment the amount for an existing transaction. - GP-API: Map multiCapture on the transaction response - GP-API: Update unit tests - Deprecate verifyEnrolled and verifySignature from CreditCardData -## v3.0.4 (04/12/2022) +## v3.0.4 (04/12/22) #### Enhancements: - UPA devices: add support for batch summary report, batch detail report, and open tab details report - UPA devices: various modifications to account for latest UPA version's changes -## v3.0.3 (03/21/2022) +## v3.0.3 (03/21/22) #### Enhancements: - add "MOBILE_SDK" source in the 3DS2 flow initiate step (GP-API) - Adjust a CP Sale (GP-API) @@ -304,13 +310,13 @@ ds_trans_reference,value) - Get a Document associated with a Dispute (GP-API) -## v3.0.2 (02/17/2022) +## v3.0.2 (02/17/22) #### Enhancements: - use "IN_APP" entry_mode when creating a transaction with digital wallets (GP-API) - add new unit tests for dcc and others -## v3.0.1 (01/27/2022) +## v3.0.1 (01/27/22) #### Enhancements: - Add fingerprint feature (GP-API) - Add Payment Link Id in the request for authorize (GP-API) @@ -320,14 +326,14 @@ ds_trans_reference,value) - Fix issue for Fleet cards (GP-ECOM) - Fix issue for Diners card type (GP-ECOM) -## v3.0.0 (12/16/2021) +## v3.0.0 (12/16/21) - Add Dynamic Currency Conversion feature for GP-API - Show exceptions on updateTokenExpiry() & deleteToken() - DOMDocument data encoded before serialization - CardUtils MC regex updated -## v2.4.4 (12/07/2021) +## v2.4.4 (12/07/21) #### Enhancements: - Added avs/cvv mapping and support for findTransaction method @@ -335,32 +341,32 @@ ds_trans_reference,value) - Added support for split tender GiftCardSale transactions - Fix some GP-API unit tests -## v2.4.3 (11/17/2021) +## v2.4.3 (11/17/21) #### Enhancements: - Add Unified Payments Application support -## v2.4.2 (11/16/2021) +## v2.4.2 (11/16/21) #### Enhancements: - Add LPMs HPP on GP-ECOM - Add PAYPAL on GP-ECOM -## v2.4.1 (11/12/2021) +## v2.4.1 (11/12/21) #### Enhancements: - Add reporting service to get transaction by id on GP-ECOM - Add HPP_POST_DIMENSIONS and HPP_POST_RESPONSE to serialize on GP-ECOM -## v2.4.0 (11/04/2021) +## v2.4.0 (11/04/21) - Add PAYPAL alternative payment method on GP-API -## v2.3.15 (10/21/2021) +## v2.3.15 (10/21/21) - Added ach-transaction details test block for Portico -## v2.3.14 (09/30/2021) +## v2.3.14 (09/30/21) - Add "paybybankapp" APM (GP-ECOM) - Add AVS missing mapping to response when creating a transaction (GP-API) @@ -368,17 +374,17 @@ ds_trans_reference,value) - Update "entry_mode" functionality and add manual entry methods: MOTO, PHONE, MAIL (GP-API) - Add merchantId on GpApiConfig for partnership active -## v2.3.13 (09/23/2021) +## v2.3.13 (09/23/21) #### Bug Fixes: - Removed unwanted artefacts files -## v2.3.12 (09/09/2021) +## v2.3.12 (09/09/21) - Add sanitize data -## v2.3.11 (08/26/2021) +## v2.3.11 (08/26/21) - Add the amount and currency to hash generation (GP-ECOM) - Digital wallets unencrypted and encrypted for GP-API with Google Pay and Apple Pay: @@ -398,12 +404,12 @@ ds_trans_reference,value) - Add optional parameters to tokenize() method - Add amount and currency to hash generation for Apple PAY (GP-ECOM) -## v2.3.10 (08/19/2021) +## v2.3.10 (08/19/21) - Set Fraud Management Rules for GP-ECOM - Portico tokenization example update -## v2.3.9 (08/03/2021) +## v2.3.9 (08/03/21) - Send "x-gp-sdk" in the header with the SDK programming language and release version used - Send headers to GP-API that are dynamically set through configuration, like: @@ -412,32 +418,32 @@ ds_trans_reference,value) - Fix some GP-ECOM unit tests for APM, certifications and add Secure3dServiceTest to realex test suite - Add support for Propay timezone and device details -## v2.3.8 (07/27/2021) +## v2.3.8 (07/27/21) #### Enhancements: - Add new HPP example for GP-ECOM - Add file medatada.xml -## v2.3.7 (07/20/2021) +## v2.3.7 (07/20/21) #### Enhancements: - Replace in create transaction request authentication.three_ds with authentication.id) - Add liability shift checks in the 3DS GP-API flow / update unit tests - add new mappings on 3DS GP-API: authenticationSource, authenticationType, acsInfoIndicator, whitelistStatus, messageExtension -## v2.3.6 (07/13/2021) +## v2.3.6 (07/13/21) #### Enhancements: - Send the numeric version in the three_ds.message_version in the create transaction request - Map the ACS challenge redirect URL only if the status is "CHALLENGE_REQUIRED" -## v2.3.5 (07/08/2021) +## v2.3.5 (07/08/21) #### Enhancements: - Add "Netherlands Antilles" to our mapping for country codes - Strip all non-numeric characters for phone number and phone country code on 3DS2 flow GP-ECOM -## v2.3.4 (06/15/2021) +## v2.3.4 (06/15/21) #### Enhancements: @@ -448,7 +454,7 @@ ds_trans_reference,value) - Change property name from "storage_model" to "storage_mode" on GP-API -## v2.3.3 (05/27/2021) +## v2.3.3 (05/27/21) #### Enhancements: @@ -456,20 +462,20 @@ ds_trans_reference,value) - update GP-ECOM unit test for APPLE PAY and GOOGLE PAY -## v2.2.16 (05/20/2021) +## v2.2.16 (05/20/21) #### Enhancements: Add GP-ECOM dynamic descriptor functionality -## v2.2.15 (05/18/2021) +## v2.2.15 (05/18/21) #### Bug Fixes: - GP-ECOM fix 3DS recurring data fields: recurring expiry date format and max_number_of_instalments -## v2.2.14 (05/11/2021) +## v2.2.14 (05/11/21) #### Enhancements: @@ -481,7 +487,7 @@ Add GP-ECOM dynamic descriptor functionality - Remove "/detokenize" endpoint from GP-API - Update GP-API production endpoint -## v2.2.13 (04/29/2021) +## v2.2.13 (04/29/21) #### Enhancements: diff --git a/metadata.xml b/metadata.xml index 271badfb..c56495aa 100644 --- a/metadata.xml +++ b/metadata.xml @@ -1,3 +1,3 @@ - 11.0.1 + 11.0.2 \ No newline at end of file diff --git a/src/Entities/Enums/Region.php b/src/Entities/Enums/Region.php index 52cb4f41..f128519c 100644 --- a/src/Entities/Enums/Region.php +++ b/src/Entities/Enums/Region.php @@ -15,4 +15,6 @@ class Region extends Enum const NZ = 'NZ'; const UK = 'UK'; const EU = 'EU'; + const MX = 'MX'; + const CL = 'CL'; } diff --git a/src/Entities/Enums/ServiceEndpoints.php b/src/Entities/Enums/ServiceEndpoints.php index 51d1c8a2..d51acf7a 100644 --- a/src/Entities/Enums/ServiceEndpoints.php +++ b/src/Entities/Enums/ServiceEndpoints.php @@ -31,7 +31,8 @@ class ServiceEndpoints extends Enum const TRANSACTION_API_TEST = "https://api.pit.paygateway.com/transactions/"; const TRANSACTION_API_PROD = "https://api.paygateway.com/transactions"; const DIAMOND_CLOUD_TEST = "https://qr-cert.simpletabcloud.com/tomcat/command"; - const DIAMOND_CLOUD_PROD = ""; + const DIAMOND_CLOUD_PROD = "https://qr.simpletabcloud.com/tomcat/command"; + const DIAMOND_CLOUD_PROD_EU = "https://qreu.simpletabcloud.com/tomcat/command"; const MEET_IN_THE_CLOUD_PROD = "https://api.paygateway.com"; const MEET_IN_THE_CLOUD_TEST = "https://api.pit.paygateway.com"; } diff --git a/src/Terminals/ConnectionConfig.php b/src/Terminals/ConnectionConfig.php index 0242017a..fa433211 100644 --- a/src/Terminals/ConnectionConfig.php +++ b/src/Terminals/ConnectionConfig.php @@ -120,9 +120,9 @@ public function configureContainer(ConfiguredServices $services) public function validate() { if ($this->connectionMode === ConnectionModes::MEET_IN_THE_CLOUD) { - if (empty($this->meetInTheCloudConfig)) { + if (empty($this->meetInTheCloudConfig) && empty($this->gatewayConfig)) { throw new ConfigurationException( - "meetInTheCloudConfig object is required for this connection method" + "meetInTheCloudConfig or gatewayConfig object is required for this connection method" ); } @@ -152,12 +152,6 @@ public function validate() ); } - if ($this->connectionMode == ConnectionModes::MIC) { - if (empty($this->gatewayConfig)) { - throw new ConfigurationException('Gateway config is required for the Meet In the Cloud Service'); - } - } - if ($this->connectionMode == ConnectionModes::DIAMOND_CLOUD) { if (empty($this->isvID) || empty($this->secretKey)) { throw new ConfigurationException('ISV ID and secretKey is required for ' . ConnectionModes::DIAMOND_CLOUD); diff --git a/src/Terminals/Diamond/DiamondController.php b/src/Terminals/Diamond/DiamondController.php index 30a630c7..3a3bab03 100644 --- a/src/Terminals/Diamond/DiamondController.php +++ b/src/Terminals/Diamond/DiamondController.php @@ -102,13 +102,11 @@ public function configureInterface() : IDeviceInterface public function configureConnector(): IDeviceCommInterface { - switch ($this->settings->getConnectionMode()) - { - case ConnectionModes::DIAMOND_CLOUD: - return new DiamondHttpInterface($this->settings); - default: - throw new NotImplementedException(); + if ($this->settings->getConnectionMode() !== ConnectionModes::DIAMOND_CLOUD) { + throw new NotImplementedException(); } + + return new DiamondHttpInterface($this->settings); } private function doTransaction(IDeviceMessage $request) diff --git a/src/Terminals/DiamondCloudConfig.php b/src/Terminals/DiamondCloudConfig.php index 91208394..e2ab5c4a 100644 --- a/src/Terminals/DiamondCloudConfig.php +++ b/src/Terminals/DiamondCloudConfig.php @@ -6,6 +6,8 @@ use GlobalPayments\Api\Entities\Enums\Environment; use GlobalPayments\Api\Entities\Enums\Region; use GlobalPayments\Api\Entities\Enums\ServiceEndpoints; +use GlobalPayments\Api\Entities\Exceptions\ConfigurationException; +use GlobalPayments\Api\Terminals\Enums\ConnectionModes; class DiamondCloudConfig extends ConnectionConfig { @@ -15,13 +17,32 @@ class DiamondCloudConfig extends ConnectionConfig /** @var Region $country */ public string $region = Region::US; public string $posID; + private array $supportedRegions = [ + Region::EU, + Region::US, + Region::MX, + Region::CL + ]; public function configureContainer(ConfiguredServices $services) { if (empty($this->serviceUrl)) { $this->serviceUrl = (($this->environment === Environment::PRODUCTION) ? - ServiceEndpoints::DIAMOND_CLOUD_PROD : ServiceEndpoints::DIAMOND_CLOUD_TEST); + ($this->region == Region::EU ? + ServiceEndpoints::DIAMOND_CLOUD_PROD_EU : ServiceEndpoints::DIAMOND_CLOUD_PROD + ) : ServiceEndpoints::DIAMOND_CLOUD_TEST); } parent::configureContainer($services); } + + public function validate() + { + parent::validate(); + if (empty($this->isvID) || empty($this->secretKey)) { + throw new ConfigurationException('ISV ID and secretKey is required for ' . ConnectionModes::DIAMOND_CLOUD); + } + if (!in_array($this->region, $this->supportedRegions)) { + throw new ConfigurationException(sprintf('Region %s is not supported!'), $this->region); + } + } } \ No newline at end of file diff --git a/src/Terminals/Enums/ConnectionModes.php b/src/Terminals/Enums/ConnectionModes.php index 10020924..ecec6bfc 100644 --- a/src/Terminals/Enums/ConnectionModes.php +++ b/src/Terminals/Enums/ConnectionModes.php @@ -12,6 +12,5 @@ class ConnectionModes extends Enum const HTTP = 'HTTP'; const HTTPS = 'HTTPS'; const MEET_IN_THE_CLOUD = 'MEET_IN_THE_CLOUD'; - const MIC = 'MIC'; const DIAMOND_CLOUD = 'DIAMOND_CLOUD'; } diff --git a/src/Terminals/PAX/Responses/PaxBaseResponse.php b/src/Terminals/PAX/Responses/PaxBaseResponse.php index 893ec8d1..53792e48 100644 --- a/src/Terminals/PAX/Responses/PaxBaseResponse.php +++ b/src/Terminals/PAX/Responses/PaxBaseResponse.php @@ -39,7 +39,7 @@ public function parseResponse($messageReader) public function checkResponse($acceptedCodes = null) { if ($acceptedCodes === null) { - $acceptedCodes = ["000000"]; + $acceptedCodes = ["000000", "000100"]; } if (!empty($this->deviceResponseText)) { diff --git a/src/Terminals/UPA/UpaController.php b/src/Terminals/UPA/UpaController.php index 32d07c78..b762057c 100644 --- a/src/Terminals/UPA/UpaController.php +++ b/src/Terminals/UPA/UpaController.php @@ -5,6 +5,7 @@ use GlobalPayments\Api\Entities\Exceptions\ConfigurationException; use GlobalPayments\Api\Entities\Exceptions\GatewayException; use GlobalPayments\Api\Entities\Exceptions\NotImplementedException; +use GlobalPayments\Api\ServiceConfigs\Gateways\GpApiConfig; use GlobalPayments\Api\Terminals\Abstractions\IDeviceCommInterface; use GlobalPayments\Api\Terminals\Abstractions\IDeviceMessage; use GlobalPayments\Api\Terminals\Abstractions\ITerminalReport; @@ -190,8 +191,10 @@ public function configureConnector(): IDeviceCommInterface case ConnectionModes::HTTP: case ConnectionModes::SERIAL: case ConnectionModes::SSL_TCP: - case ConnectionModes::MIC: - return new UpaMicInterface($this->settings); + case ConnectionModes::MEET_IN_THE_CLOUD: + if ($this->settings->getGatewayConfig() instanceof GpApiConfig) { + return new UpaMicInterface($this->settings); + } default: throw new NotImplementedException(); } diff --git a/test/Integration/Gateways/Terminals/PAX/PaxExceptionTests.php b/test/Integration/Gateways/Terminals/PAX/PaxExceptionTests.php new file mode 100644 index 00000000..e2899952 --- /dev/null +++ b/test/Integration/Gateways/Terminals/PAX/PaxExceptionTests.php @@ -0,0 +1,64 @@ +device = DeviceService::create($this->getConfig()); + } + + public function tearDown(): void + { + sleep(3); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '192.168.1.10'; + $config->port = '10009'; + $config->deviceType = DeviceType::PAX_S300; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 10; + $config->requestIdProvider = new RequestIdProvider(); + $config->logManagementProvider = new LogManagement(); + + return $config; + } + + public function testCreditSaleExpiredCard() + { + $response = $this->device->sale(10.32) + ->withAllowDuplicates(1) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('54', $response->responseCode); + } + + public function testDebitSaleExpiredCard() + { + $response = $this->device->sale(10.32) + ->withPaymentMethodType(PaymentMethodType::DEBIT) + ->withAllowDuplicates(1) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('54', $response->responseCode); + } + +} \ No newline at end of file diff --git a/test/Integration/Gateways/Terminals/UPA/UpaMicTests.php b/test/Integration/Gateways/Terminals/UPA/UpaMicTests.php index ea652e66..22d53b16 100644 --- a/test/Integration/Gateways/Terminals/UPA/UpaMicTests.php +++ b/test/Integration/Gateways/Terminals/UPA/UpaMicTests.php @@ -39,7 +39,7 @@ public function getConfig(): ConnectionConfig { $config = new ConnectionConfig(); $config->deviceType = DeviceType::UPA_DEVICE; - $config->connectionMode = ConnectionModes::MIC; + $config->connectionMode = ConnectionModes::MEET_IN_THE_CLOUD; BaseGpApiTestConfig::$appId = BaseGpApiTestConfig::APP_ID; #gitleaks:allow BaseGpApiTestConfig::$appKey = BaseGpApiTestConfig::APP_KEY; #gitleaks:allow $gpApiConfig = BaseGpApiTestConfig::gpApiSetupConfig(Channel::CardPresent); @@ -149,7 +149,16 @@ public function testCreditVerify() public function testCreditVoid() { + $response = $this->device->sale(10) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->deviceResponseCode); + $this->assertEquals('INITIATED', $response->deviceResponseText); + $this->assertNotNull($response->transactionId); + $response = $this->device->void() + ->withTransactionId($response->transactionId) ->execute(); $this->assertNotNull($response);