Skip to content

Commit

Permalink
GopayConfig: introduce constants for test/prod gopay endpoints, chang…
Browse files Browse the repository at this point in the history
…e test url

* Update GopayConfig.php

Gopay changed test url
from `https://testgw.gopay.cz/` to `https://gw.sandbox.gopay.com/`

* Update GopayConfig.phpt

Gopay changed test url
from `https://testgw.gopay.cz/` to `https://gw.sandbox.gopay.com/`

* Update GopayConfig.phpt

* Update GopayConfig.php

* Update GopayConfig.php

* Update GopayConfig.php

* Update GopayConfig.php

# Conflicts:
#	src/GopayConfig.php
  • Loading branch information
wamesro authored and f3l1x committed May 3, 2017
1 parent 083c587 commit 2d5f238
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
31 changes: 20 additions & 11 deletions src/GopayConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ class GopayConfig
const TEST = "TEST";
const PROD = "PROD";

/**
* Testovaci a produkcni URL
*/
const TEST_URL = 'https://gw.sandbox.gopay.com/';
const PROD_URL = 'https://gate.gopay.cz/';

/**
* Parametr specifikujici, pracuje-li se na testovacim ci provoznim prostredi
*/
Expand All @@ -27,6 +33,9 @@ class GopayConfig
* @param $new_version
* TEST - Testovaci prostredi
* PROD - Provozni prostredi
*
* @param string $new_version typ verze
* @return void
*/
public static function init($new_version)
{
Expand All @@ -42,10 +51,10 @@ public static function init($new_version)
public static function fullIntegrationURL()
{
if (self::$version == self::PROD) {
return "https://gate.gopay.cz/gw/pay-full-v2";
return self::PROD_URL . 'gw/pay-full-v2';

} else {
return "https://testgw.gopay.cz/gw/pay-full-v2";
return self::TEST_URL . 'gw/pay-full-v2';

}
}
Expand All @@ -59,10 +68,10 @@ public static function fullIntegrationURL()
public static function ws()
{
if (self::$version == self::PROD) {
return "https://gate.gopay.cz/axis/EPaymentServiceV2?wsdl";
return self::PROD_URL . 'axis/EPaymentServiceV2?wsdl';

} else {
return "https://testgw.gopay.cz/axis/EPaymentServiceV2?wsdl";
return self::TEST_URL . 'axis/EPaymentServiceV2?wsdl';

}
}
Expand All @@ -75,10 +84,10 @@ public static function ws()
public static function fullNewIntegrationURL()
{
if (self::$version == self::PROD) {
return "https://gate.gopay.cz/gw/v3";
return self::PROD_URL . 'gw/v3';

} else {
return "https://testgw.gopay.cz/gw/v3";
return self::TEST_URL . 'gw/v3';

}
}
Expand All @@ -92,10 +101,10 @@ public static function fullNewIntegrationURL()
public static function baseIntegrationURL()
{
if (self::$version == self::PROD) {
return "https://gate.gopay.cz/gw/pay-base-v2";
return self::PROD_URL . 'gw/pay-base-v2';

} else {
return "https://testgw.gopay.cz/gw/pay-base-v2";
return self::TEST_URL . 'gw/pay-base-v2';

}
}
Expand All @@ -108,11 +117,11 @@ public static function baseIntegrationURL()
*/
public static function getAccountStatementURL()
{
if (self::$version == GopayConfig::PROD) {
return "https://gate.gopay.cz/gw/services/get-account-statement";
if (self::$version == self::PROD) {
return self::PROD_URL . 'gw/services/get-account-statement';

} else {
return "https://testgw.gopay.cz/gw/services/get-account-statement";
return self::TEST_URL . 'gw/services/get-account-statement';

}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/GopayApi/GopayConfig.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ require __DIR__ . '/../bootstrap.php';
test(function () {
GopayConfig::init(GopayConfig::PROD);
Assert::equal(GopayConfig::PROD, GopayConfig::$version);
Assert::equal('https://gate.gopay.cz/gw/v3', GopayConfig::fullNewIntegrationURL());
Assert::equal(GopayConfig::PROD_URL . 'gw/v3', GopayConfig::fullNewIntegrationURL());

GopayConfig::init(GopayConfig::TEST);
Assert::equal(GopayConfig::TEST, GopayConfig::$version);
Assert::equal('https://testgw.gopay.cz/gw/v3', GopayConfig::fullNewIntegrationURL());
Assert::equal(GopayConfig::TEST_URL . 'gw/v3', GopayConfig::fullNewIntegrationURL());
});

test(function () {
Expand Down

0 comments on commit 2d5f238

Please sign in to comment.