diff --git a/.env.sample b/.env.sample index d619edf..8ee3800 100644 --- a/.env.sample +++ b/.env.sample @@ -4,4 +4,5 @@ PUBLIC_KEY= PUBLIC_KEY_3DS= NOTIFICATION_URL= APPLICATION_ID= -PRODUCT_ID= \ No newline at end of file +PRODUCT_ID= +URIS_SCOPE= \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 006d4cb..5d110e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## V3.0.0 +### Added +- Add new parameter `uris_scope` on SDK instantiation to allow use of beta scopes on APIs calls + ## V2.13.0 ### Added - Add new method to get onboarding data for the new credential autofill flow diff --git a/README.md b/README.md index d5b18d2..fa26aaf 100644 --- a/README.md +++ b/README.md @@ -24,17 +24,19 @@ Para incluir a biblioteca em seu projeto, basta fazer o seguinte: getPaymentInstance(); @@ -57,7 +59,7 @@ Para incluir a biblioteca em seu projeto, basta fazer o seguinte: getPaymentInstance(); @@ -70,7 +72,7 @@ Para incluir a biblioteca em seu projeto, basta fazer o seguinte: getPreferenceInstance(); @@ -104,7 +106,7 @@ O parâmetro para consulta deve seguir o modelo abaixo: getNotificationInstance(); @@ -118,7 +120,7 @@ O parâmetro para consulta deve seguir o modelo abaixo: getDatadogEventInstance(); @@ -145,7 +147,7 @@ O parâmetro para consulta deve seguir o modelo abaixo: getRegisterErrorLogInstance(); @@ -175,7 +177,7 @@ O parâmetro para consulta deve seguir o modelo abaixo: getPaymentMethodsInstance(); @@ -191,7 +193,7 @@ Exemplo de requisição agrupando os meios de pagamento pelo campo id: getPaymentMethodsInstance(); @@ -213,7 +215,7 @@ Exemplo de requisição agrupando os meios de pagamento pelo campo id: echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $merchantOrder = $sdk->getMerchantOrderInstance(); @@ -236,7 +238,7 @@ Exemplo de requisição agrupando os meios de pagamento pelo campo id: echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $createSellerFunnelBase = $sdk->getCreateSellerFunnelBaseInstance(); @@ -268,7 +270,7 @@ Exemplo de requisição agrupando os meios de pagamento pelo campo id: echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $updateSellerFunnelBase = $sdk->getUpdateSellerFunnelBaseInstance(); @@ -293,7 +295,7 @@ Exemplo de requisição agrupando os meios de pagamento pelo campo id: getExchangeInstance(); @@ -309,7 +311,8 @@ Exemplo de requisição agrupando os meios de pagamento pelo campo id: 'platformId', 'productId', 'integratorId', - 'publicKey' + 'publicKey', + 'urisScope' ); $onboarding = $sdk->getOnboardingInstance(); diff --git a/composer.json b/composer.json index 83a40c8..2c39cc6 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mp-plugins/php-sdk", "description": "Mercado Pago Plugins PHP-SDK", - "version": "2.13.0", + "version": "3.0.0", "type": "library", "scripts": { "lint": "./vendor/bin/phpcs -q --report=checkstyle --standard=PSR2 src", diff --git a/composer.lock b/composer.lock index 970f2af..7638c58 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7983dbecb4e95646f39a1ebab0933773", + "content-hash": "d67ccbac4962263252a4b86a9fe7578e", "packages": [], "packages-dev": [ { @@ -1818,13 +1818,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7", "ext-json": "*" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/examples/Exchange.php b/examples/Exchange.php index de8b06a..8f8dac7 100644 --- a/examples/Exchange.php +++ b/examples/Exchange.php @@ -11,7 +11,7 @@ function debug($value) echo ""; } - $sdk = new Sdk('accessToken', 'platformId', 'productId', 'integratorId', 'publicKey'); + $sdk = new Sdk('accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope'); $exchange = $sdk->getExchangeInstance(); diff --git a/examples/Multipayment.php b/examples/Multipayment.php index 5388a8c..4373c05 100644 --- a/examples/Multipayment.php +++ b/examples/Multipayment.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); //Payment with two Cards $multipayment = $sdk->getMultipaymentInstance(); diff --git a/examples/createSellerFunnelBase.php b/examples/createSellerFunnelBase.php index 8ab7daf..e0665b1 100644 --- a/examples/createSellerFunnelBase.php +++ b/examples/createSellerFunnelBase.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $createSellerFunnelBase = $sdk->getCreateSellerFunnelBaseInstance(); diff --git a/examples/datadog_event.php b/examples/datadog_event.php index 34ba6cf..4721c8c 100644 --- a/examples/datadog_event.php +++ b/examples/datadog_event.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $datadogEvent = $sdk->getDatadogEventInstance(); diff --git a/examples/getOnboardingData.php b/examples/getOnboardingData.php index f7878ab..0b9714e 100644 --- a/examples/getOnboardingData.php +++ b/examples/getOnboardingData.php @@ -15,7 +15,8 @@ function debug($value){ 'platformId', 'productId', 'integratorId', - 'publicKey' + 'publicKey', + 'urisScope' ); $onboarding = $sdk->getOnboardingInstance(); diff --git a/examples/groupedPaymentMethods.php b/examples/groupedPaymentMethods.php index 676f9ee..4c9df35 100644 --- a/examples/groupedPaymentMethods.php +++ b/examples/groupedPaymentMethods.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $paymentMethods = $sdk->getPaymentMethodsInstance(); diff --git a/examples/merchantOrder.php b/examples/merchantOrder.php index 0dd8393..0997af7 100644 --- a/examples/merchantOrder.php +++ b/examples/merchantOrder.php @@ -9,7 +9,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $merchantOrder = $sdk->getMerchantOrderInstance(); diff --git a/examples/monitoring_register_log.php b/examples/monitoring_register_log.php index 9903455..15e825d 100644 --- a/examples/monitoring_register_log.php +++ b/examples/monitoring_register_log.php @@ -11,7 +11,7 @@ function debug($value) echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $registerErrorLog = $sdk->getRegisterErrorLogInstance(); diff --git a/examples/notification.php b/examples/notification.php index caffd29..b6a963d 100644 --- a/examples/notification.php +++ b/examples/notification.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $notification = $sdk->getNotificationInstance(); diff --git a/examples/payment.php b/examples/payment.php index ba927a3..f8b5ee1 100644 --- a/examples/payment.php +++ b/examples/payment.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $payment = $sdk->getPaymentInstance(); diff --git a/examples/paymentMethods.php b/examples/paymentMethods.php index 61197d6..bbe824b 100644 --- a/examples/paymentMethods.php +++ b/examples/paymentMethods.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $paymentMethods = $sdk->getPaymentMethodsInstance(); diff --git a/examples/payment_3ds.php b/examples/payment_3ds.php index 6ea6110..cf1e569 100644 --- a/examples/payment_3ds.php +++ b/examples/payment_3ds.php @@ -11,7 +11,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $payment = $sdk->getPaymentInstance(); diff --git a/examples/preference.php b/examples/preference.php index ad715b2..88bbf5c 100644 --- a/examples/preference.php +++ b/examples/preference.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $preference = $sdk->getPreferenceInstance(); diff --git a/examples/updateSellerFunnelBase.php b/examples/updateSellerFunnelBase.php index 2d6f834..892d247 100644 --- a/examples/updateSellerFunnelBase.php +++ b/examples/updateSellerFunnelBase.php @@ -10,7 +10,7 @@ function debug($value){ echo ""; } - $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey' ); + $sdk = new Sdk( 'accessToken', 'platformId', 'productId', 'integratorId', 'publicKey', 'urisScope' ); $updateSellerFunnelBase = $sdk->getUpdateSellerFunnelBaseInstance(); diff --git a/src/Common/Config.php b/src/Common/Config.php index 6d62ca8..10c654b 100644 --- a/src/Common/Config.php +++ b/src/Common/Config.php @@ -29,11 +29,16 @@ class Config */ private $integrator_id; - /** + /** * @var string */ private $public_key; + /** + * @var string + */ + private $uris_scope; + /** * Config constructor. * @@ -42,19 +47,22 @@ class Config * @param string|null $product_id * @param string|null $integrator_id * @param string|null $public_key + * @param string|null $uris_scope */ public function __construct( string $access_token = null, string $platform_id = null, string $product_id = null, string $integrator_id = null, - string $public_key = null + string $public_key = null, + string $uris_scope = null ) { $this->access_token = $access_token; $this->platform_id = $platform_id; $this->product_id = $product_id; $this->integrator_id = $integrator_id; $this->public_key = $public_key; + $this->uris_scope = $uris_scope; } /** diff --git a/src/Common/Manager.php b/src/Common/Manager.php index 05c63f6..f9db132 100644 --- a/src/Common/Manager.php +++ b/src/Common/Manager.php @@ -67,7 +67,8 @@ public function execute(AbstractEntity $entity, string $uri, string $method = 'g public function getEntityUri(AbstractEntity $entity, string $method, array $params = [], array $queryStrings = []) { if (method_exists($entity, 'getUris')) { - $uri = $entity->getUris()[$method]; + $uris_scope = $this->config->__get('uris_scope'); + $uri = $entity->getUris($uris_scope)[$method]; $matches = []; preg_match_all('/\\:\\w+/', $uri, $matches); diff --git a/src/Entity/Exchange/Exchange.php b/src/Entity/Exchange/Exchange.php index d44189c..c0a8e7f 100644 --- a/src/Entity/Exchange/Exchange.php +++ b/src/Entity/Exchange/Exchange.php @@ -78,10 +78,12 @@ public function getHeaders(): array * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'prod'; + return array( - 'get' => '/ppcore/prod/payment-methods/v1/exchange', + 'get' => '/ppcore/' . $scope_ppcore . '/payment-methods/v1/exchange', ); } diff --git a/src/Entity/Identification/CreateSellerFunnelBase.php b/src/Entity/Identification/CreateSellerFunnelBase.php index bfd6665..8d8c148 100644 --- a/src/Entity/Identification/CreateSellerFunnelBase.php +++ b/src/Entity/Identification/CreateSellerFunnelBase.php @@ -58,10 +58,12 @@ public function __construct($manager) * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'v1'; + return array( - 'post' => '/v1/eplatforms/core/identification/seller-configuration/start-integration', + 'post' => '/' . $scope_ppcore . '/eplatforms/core/identification/seller-configuration/start-integration', ); } diff --git a/src/Entity/Identification/UpdateSellerFunnelBase.php b/src/Entity/Identification/UpdateSellerFunnelBase.php index 3bac5cf..7b5db7a 100644 --- a/src/Entity/Identification/UpdateSellerFunnelBase.php +++ b/src/Entity/Identification/UpdateSellerFunnelBase.php @@ -110,10 +110,12 @@ public function getHeaders(): array * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'v1'; + return array( - 'put' => '/v1/eplatforms/core/identification/seller-configuration/update-integration', + 'put' => '/' . $scope_ppcore . '/eplatforms/core/identification/seller-configuration/update-integration', ); } diff --git a/src/Entity/MerchantOrder/MerchantOrder.php b/src/Entity/MerchantOrder/MerchantOrder.php index 4ff299e..b6967d5 100644 --- a/src/Entity/MerchantOrder/MerchantOrder.php +++ b/src/Entity/MerchantOrder/MerchantOrder.php @@ -214,7 +214,7 @@ public function setExcludedProperties() * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { return array( 'get' => '/merchant_orders/:id' diff --git a/src/Entity/Monitoring/DatadogEvent.php b/src/Entity/Monitoring/DatadogEvent.php index e860706..86a6cf6 100644 --- a/src/Entity/Monitoring/DatadogEvent.php +++ b/src/Entity/Monitoring/DatadogEvent.php @@ -72,10 +72,12 @@ public function setExcludedProperties() * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'prod'; + return array( - 'post' => '/ppcore/prod/monitor/v1/event/datadog/:team/:event_type', + 'post' => '/ppcore/' . $scope_ppcore . '/monitor/v1/event/datadog/:team/:event_type', ); } diff --git a/src/Entity/Monitoring/RegisterErrorLog.php b/src/Entity/Monitoring/RegisterErrorLog.php index 4ce0675..3e29f4c 100644 --- a/src/Entity/Monitoring/RegisterErrorLog.php +++ b/src/Entity/Monitoring/RegisterErrorLog.php @@ -123,10 +123,12 @@ public function getHeaders(): array * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'prod'; + return array( - 'post' => '/ppcore/prod/monitor/v1/event/error', + 'post' => '/ppcore/' . $scope_ppcore . '/monitor/v1/event/error', ); } diff --git a/src/Entity/Notification/Notification.php b/src/Entity/Notification/Notification.php index 585d6ef..14671fb 100644 --- a/src/Entity/Notification/Notification.php +++ b/src/Entity/Notification/Notification.php @@ -169,10 +169,12 @@ public function setExcludedProperties() * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'v1'; + return array( - 'get' => '/v1/asgard/notification/:id', + 'get' => '/' . $scope_ppcore . '/asgard/notification/:id', ); } diff --git a/src/Entity/Onboarding/Application.php b/src/Entity/Onboarding/Application.php index ba17b84..34e2eb9 100644 --- a/src/Entity/Onboarding/Application.php +++ b/src/Entity/Onboarding/Application.php @@ -83,7 +83,7 @@ public function __construct($manager) * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { return array( 'get' => '/applications/:application_id', diff --git a/src/Entity/Onboarding/Onboarding.php b/src/Entity/Onboarding/Onboarding.php index 7809625..6c1b60a 100644 --- a/src/Entity/Onboarding/Onboarding.php +++ b/src/Entity/Onboarding/Onboarding.php @@ -41,7 +41,7 @@ public function __construct($manager) * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { return array(); } diff --git a/src/Entity/Onboarding/User.php b/src/Entity/Onboarding/User.php index d30b8b6..8d64a8b 100644 --- a/src/Entity/Onboarding/User.php +++ b/src/Entity/Onboarding/User.php @@ -65,7 +65,7 @@ public function __construct($manager) * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { return array( 'get' => '/users/me', diff --git a/src/Entity/Payment/Payment.php b/src/Entity/Payment/Payment.php index e613e45..d6dd40f 100644 --- a/src/Entity/Payment/Payment.php +++ b/src/Entity/Payment/Payment.php @@ -307,10 +307,12 @@ public function setCustomHeaders(array $customHeader = []) * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'v1'; + return array( - 'post' => '/v1/asgard/payments', + 'post' => '/' . $scope_ppcore . '/asgard/payments', 'get' => '/v1/payments/:id' ); } diff --git a/src/Entity/Payment/PaymentV2.php b/src/Entity/Payment/PaymentV2.php index 38fe412..559af0e 100644 --- a/src/Entity/Payment/PaymentV2.php +++ b/src/Entity/Payment/PaymentV2.php @@ -9,10 +9,12 @@ class PaymentV2 extends Payment * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? '/beta' : ''; + return array( - 'post' => '/v2/asgard/payments', + 'post' => $scope_ppcore . '/v2/asgard/payments', 'get' => '/v1/payments/:id' ); } diff --git a/src/Entity/Payment/PaymentV21.php b/src/Entity/Payment/PaymentV21.php index ff79dae..1bf0463 100644 --- a/src/Entity/Payment/PaymentV21.php +++ b/src/Entity/Payment/PaymentV21.php @@ -9,10 +9,12 @@ class PaymentV21 extends Payment * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'prod'; + return array( - 'post' => '/ppcore/prod/transaction/v21/payments', + 'post' => '/ppcore/' . $scope_ppcore . '/transaction/v21/payments', 'get' => '/v1/payments/:id' ); } diff --git a/src/Entity/PaymentMethods/PaymentMethods.php b/src/Entity/PaymentMethods/PaymentMethods.php index 50d4b94..245eff7 100644 --- a/src/Entity/PaymentMethods/PaymentMethods.php +++ b/src/Entity/PaymentMethods/PaymentMethods.php @@ -93,10 +93,12 @@ public function setCustomHeaders(array $customHeader = []) * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'prod'; + return array( - 'get' => '/ppcore/prod/payment-methods/v1/payment-methods', + 'get' => '/ppcore/' . $scope_ppcore . '/payment-methods/v1/payment-methods', ); } diff --git a/src/Entity/Preference/Preference.php b/src/Entity/Preference/Preference.php index 55a346a..83d3046 100644 --- a/src/Entity/Preference/Preference.php +++ b/src/Entity/Preference/Preference.php @@ -184,10 +184,12 @@ public function setExcludedProperties() * * @return array */ - public function getUris(): array + public function getUris(string $uris_scope = null): array { + $scope_ppcore = $uris_scope === 'beta' ? 'beta' : 'v1'; + return array( - 'post' => '/v1/asgard/preferences', + 'post' => '/' . $scope_ppcore . '/asgard/preferences', 'get' => '/checkout/preferences/:id' ); } diff --git a/src/Interfaces/RequesterEntityInterface.php b/src/Interfaces/RequesterEntityInterface.php index 3704e65..614d6e2 100644 --- a/src/Interfaces/RequesterEntityInterface.php +++ b/src/Interfaces/RequesterEntityInterface.php @@ -16,7 +16,7 @@ public function getHeaders(): array; * * @return array */ - public function getUris(): array; + public function getUris(string $uris_scope = null): array; /** * Read method (GET). diff --git a/src/Sdk.php b/src/Sdk.php index 7b7569b..9ad773c 100644 --- a/src/Sdk.php +++ b/src/Sdk.php @@ -50,13 +50,15 @@ class Sdk * @param String $product_id * @param String $integrator_id * @param String $public_key + * @param String $uris_scope */ public function __construct( string $access_token = null, string $platform_id = null, string $product_id = null, string $integrator_id = null, - string $public_key = null + string $public_key = null, + string $uris_scope = null ) { $this->requester = new CurlRequester(); $this->config = new Config(); @@ -65,7 +67,8 @@ public function __construct( 'platform_id' => $platform_id, 'product_id' => $product_id, 'integrator_id' => $integrator_id, - 'public_key' => $public_key + 'public_key' => $public_key, + 'uris_scope' => $uris_scope ]; foreach ($parameters as $key => $value) { diff --git a/tests/integration/DatadogEventTest.php b/tests/integration/DatadogEventTest.php index c52dd31..0154815 100644 --- a/tests/integration/DatadogEventTest.php +++ b/tests/integration/DatadogEventTest.php @@ -13,12 +13,14 @@ private function loadDatadogEvent() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $datadogEvent = $sdk->getDatadogEventInstance(); diff --git a/tests/integration/ExchangeTest.php b/tests/integration/ExchangeTest.php index 44d6beb..a8e9329 100644 --- a/tests/integration/ExchangeTest.php +++ b/tests/integration/ExchangeTest.php @@ -12,12 +12,14 @@ private function loadSdk() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); return $sdk; diff --git a/tests/integration/MerchantOrderTest.php b/tests/integration/MerchantOrderTest.php index 031f425..22551e9 100644 --- a/tests/integration/MerchantOrderTest.php +++ b/tests/integration/MerchantOrderTest.php @@ -13,12 +13,14 @@ private function loadSdk() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); return $sdk; diff --git a/tests/integration/MultipaymentTest.php b/tests/integration/MultipaymentTest.php index 46b3634..6660f62 100644 --- a/tests/integration/MultipaymentTest.php +++ b/tests/integration/MultipaymentTest.php @@ -13,12 +13,14 @@ private function loadMultipaymentV1() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $notificationUrl = $envVars['NOTIFICATION_URL'] ?? null; @@ -39,12 +41,14 @@ private function loadMultipaymentV2() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $notificationUrl = $envVars['NOTIFICATION_URL'] ?? null; @@ -65,12 +69,14 @@ private function loadMultipaymentV21() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $notificationUrl = $envVars['NOTIFICATION_URL'] ?? null; diff --git a/tests/integration/NotificationTest.php b/tests/integration/NotificationTest.php index 2651867..737df95 100644 --- a/tests/integration/NotificationTest.php +++ b/tests/integration/NotificationTest.php @@ -14,12 +14,14 @@ private function loadSdk() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); return $sdk; diff --git a/tests/integration/OnboardingTest.php b/tests/integration/OnboardingTest.php index 5932324..c326ef9 100644 --- a/tests/integration/OnboardingTest.php +++ b/tests/integration/OnboardingTest.php @@ -13,12 +13,14 @@ private function loadOnboardingInstance() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); return $sdk->getOnboardingInstance(); diff --git a/tests/integration/PaymentMethodsTest.php b/tests/integration/PaymentMethodsTest.php index e82d74a..2251976 100644 --- a/tests/integration/PaymentMethodsTest.php +++ b/tests/integration/PaymentMethodsTest.php @@ -13,12 +13,14 @@ private function loadSdk() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); return $sdk; diff --git a/tests/integration/PaymentTest.php b/tests/integration/PaymentTest.php index 9ca1976..93d9bb0 100644 --- a/tests/integration/PaymentTest.php +++ b/tests/integration/PaymentTest.php @@ -13,12 +13,14 @@ private function loadPaymentSdk() { $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $notificationUrl = $envVars['NOTIFICATION_URL'] ?? null; $payment = $sdk->getPaymentInstance(); @@ -31,12 +33,14 @@ private function loadPaymentSdkV21() { $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $notificationUrl = $envVars['NOTIFICATION_URL'] ?? null; $payment = $sdk->getPaymentV21Instance(); @@ -108,12 +112,14 @@ private function loadPayment3DS() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN_3DS'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', $envVars['PRODUCT_ID'], '', - $publicKey + $publicKey, + $urisScope ); $notificationUrl = $envVars['NOTIFICATION_URL'] ?? null; $payment = $sdk->getPaymentInstance(); diff --git a/tests/integration/PreferenceTest.php b/tests/integration/PreferenceTest.php index 55e223b..57eba02 100644 --- a/tests/integration/PreferenceTest.php +++ b/tests/integration/PreferenceTest.php @@ -13,12 +13,14 @@ private function loadPreferenceSdk() { $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); return $sdk->getPreferenceInstance(); } diff --git a/tests/integration/RegisterErrorLog.php b/tests/integration/RegisterErrorLog.php index 9804eff..956a144 100644 --- a/tests/integration/RegisterErrorLog.php +++ b/tests/integration/RegisterErrorLog.php @@ -13,12 +13,14 @@ private function loadRegisterErrorLog() $envVars = $configKeys->loadConfigs(); $accessToken = $envVars['ACCESS_TOKEN'] ?? null; $publicKey = $envVars['PUBLIC_KEY'] ?? null; + $urisScope = $envVars['URIS_SCOPE'] ?? null; $sdk = new Sdk( $accessToken, 'ppcoreinternal', 'ppcoreinternal', '', - $publicKey + $publicKey, + $urisScope ); $registerErrorLog = $sdk->getRegisterErrorLogInstance(); diff --git a/tests/unit/Entity/Exchange/ExchangeTest.php b/tests/unit/Entity/Exchange/ExchangeTest.php index 430dbb1..1774fad 100644 --- a/tests/unit/Entity/Exchange/ExchangeTest.php +++ b/tests/unit/Entity/Exchange/ExchangeTest.php @@ -59,9 +59,20 @@ function testGetHeadersSuccess() function testGetUriSuccess() { - $actual = $this->exchange->getUris(); + $uris_scope = null; + $actual = $this->exchange->getUris($uris_scope); $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/prod/payment-methods/v1/exchange', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->exchange->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/beta/payment-methods/v1/exchange', $actual); } function testGetExchangeSuccess() diff --git a/tests/unit/Entity/Identification/CreateSellerFunnelBaseTest.php b/tests/unit/Entity/Identification/CreateSellerFunnelBaseTest.php index c2e4318..cc36c33 100644 --- a/tests/unit/Entity/Identification/CreateSellerFunnelBaseTest.php +++ b/tests/unit/Entity/Identification/CreateSellerFunnelBaseTest.php @@ -69,6 +69,16 @@ function testGetUriSuccess() $actual = $this->createSellerFunnelBase->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/v1/eplatforms/core/identification/seller-configuration/start-integration', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->createSellerFunnelBase->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/beta/eplatforms/core/identification/seller-configuration/start-integration', $actual); } function testSaveSuccess() diff --git a/tests/unit/Entity/Identification/UpdateSellerFunnelBaseTest.php b/tests/unit/Entity/Identification/UpdateSellerFunnelBaseTest.php index 92b8cee..bc8c786 100644 --- a/tests/unit/Entity/Identification/UpdateSellerFunnelBaseTest.php +++ b/tests/unit/Entity/Identification/UpdateSellerFunnelBaseTest.php @@ -69,6 +69,16 @@ function testGetUriSuccess() $actual = $this->updateSellerFunnelBase->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/v1/eplatforms/core/identification/seller-configuration/update-integration', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->updateSellerFunnelBase->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/beta/eplatforms/core/identification/seller-configuration/update-integration', $actual); } function testSaveSuccess() diff --git a/tests/unit/Entity/MerchantOrder/MerchantOrderTest.php b/tests/unit/Entity/MerchantOrder/MerchantOrderTest.php index 58e61a7..dc71ecf 100644 --- a/tests/unit/Entity/MerchantOrder/MerchantOrderTest.php +++ b/tests/unit/Entity/MerchantOrder/MerchantOrderTest.php @@ -71,6 +71,7 @@ function testGetUriSuccess() $actual = $this->merchantOrder->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/merchant_orders/:id', $actual); } function testGetMerchantOrdersSuccess() diff --git a/tests/unit/Entity/Monitoring/DatadogEventTest.php b/tests/unit/Entity/Monitoring/DatadogEventTest.php index 2be4555..00abe80 100644 --- a/tests/unit/Entity/Monitoring/DatadogEventTest.php +++ b/tests/unit/Entity/Monitoring/DatadogEventTest.php @@ -90,6 +90,16 @@ function testGetUriSuccess() $actual = $this->datadogEvent->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/prod/monitor/v1/event/datadog/:team/:event_type', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->datadogEvent->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/beta/monitor/v1/event/datadog/:team/:event_type', $actual); } function testRegisterSuccess() diff --git a/tests/unit/Entity/Monitoring/RegisterErrorLogTest.php b/tests/unit/Entity/Monitoring/RegisterErrorLogTest.php index 8e635d8..bb615a9 100644 --- a/tests/unit/Entity/Monitoring/RegisterErrorLogTest.php +++ b/tests/unit/Entity/Monitoring/RegisterErrorLogTest.php @@ -78,6 +78,16 @@ function testGetUriSuccess() $actual = $this->registerErrorLog->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/prod/monitor/v1/event/error', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->registerErrorLog->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/beta/monitor/v1/event/error', $actual); } function testSaveSuccess() diff --git a/tests/unit/Entity/Notification/NotificationTest.php b/tests/unit/Entity/Notification/NotificationTest.php index d871fb1..a61daeb 100644 --- a/tests/unit/Entity/Notification/NotificationTest.php +++ b/tests/unit/Entity/Notification/NotificationTest.php @@ -95,6 +95,16 @@ function testGetUriSuccess() $actual = $this->notification->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/v1/asgard/notification/:id', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->notification->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/beta/asgard/notification/:id', $actual); } function testReadSuccess() diff --git a/tests/unit/Entity/Payment/PaymentTest.php b/tests/unit/Entity/Payment/PaymentTest.php index 2769670..37df86c 100644 --- a/tests/unit/Entity/Payment/PaymentTest.php +++ b/tests/unit/Entity/Payment/PaymentTest.php @@ -139,6 +139,16 @@ function testGetUriSuccess() $actual = $this->payment->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/v1/asgard/payments', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->payment->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/beta/asgard/payments', $actual); } function testReadSuccess() diff --git a/tests/unit/Entity/PaymentMethods/PaymentMethodsTest.php b/tests/unit/Entity/PaymentMethods/PaymentMethodsTest.php index e9805c2..23c1d28 100644 --- a/tests/unit/Entity/PaymentMethods/PaymentMethodsTest.php +++ b/tests/unit/Entity/PaymentMethods/PaymentMethodsTest.php @@ -91,6 +91,16 @@ function testGetUriSuccess() $actual = $this->paymentMethods->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/prod/payment-methods/v1/payment-methods', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->paymentMethods->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/ppcore/beta/payment-methods/v1/payment-methods', $actual); } function testGetPaymentMethodsSuccess() diff --git a/tests/unit/Entity/Preference/PreferenceTest.php b/tests/unit/Entity/Preference/PreferenceTest.php index 2ceced0..72467f2 100644 --- a/tests/unit/Entity/Preference/PreferenceTest.php +++ b/tests/unit/Entity/Preference/PreferenceTest.php @@ -152,6 +152,16 @@ function testGetUriSuccess() $actual = $this->preference->getUris(); $this->assertTrue(is_array($actual)); + $this->assertContains('/v1/asgard/preferences', $actual); + } + + function testGetUriBetaSuccess() + { + $uris_scope = 'beta'; + $actual = $this->preference->getUris($uris_scope); + + $this->assertTrue(is_array($actual)); + $this->assertContains('/beta/asgard/preferences', $actual); } function testSaveSuccess() diff --git a/tests/unit/SdkTest.php b/tests/unit/SdkTest.php index c27a67f..75d9d6f 100644 --- a/tests/unit/SdkTest.php +++ b/tests/unit/SdkTest.php @@ -63,7 +63,7 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); - $this->sdk = new Sdk('access_token', 'platform_id', 'product_id', 'integrator_id', 'publicKey'); + $this->sdk = new Sdk('access_token', 'platform_id', 'product_id', 'integrator_id', 'publicKey', 'urisScope'); } function testGetPreferenceSuccess()