-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from logeecom-dev/main
Introduce the changes needed for E2E testing
- Loading branch information
Showing
5 changed files
with
614 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: CI Pipeline | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
run_unit_tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php_version: ['7.2','7.4'] | ||
|
||
name: Run Unit Tests for ${{ matrix.php_version }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php_version }} | ||
- name: Install Composer Dependencies | ||
run: composer install | ||
- name: Execute Unit Tests | ||
run: php vendor/bin/phpunit --configuration=phpunit.xml | ||
|
138 changes: 138 additions & 0 deletions
138
src/BusinessLogic/E2ETest/Data/integration_config_test_data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"authorizationData": { | ||
"storeId": 1, | ||
"mode": "test", | ||
"testAPiKey": "{test_api_key}", | ||
"testMerchantId": "LogeecomECOM", | ||
"liveAPiKey": "", | ||
"liveMerchantId": "" | ||
}, | ||
"creditCard": { | ||
"methodId": "PM3224P22322225FNZ7B8G5D2", | ||
"code": "scheme", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/card.svg", | ||
"name": "Credit Card", | ||
"description": "Adyen Credit Card", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": { | ||
"showLogos": true, | ||
"singleClickPayment": true, | ||
"sendBasket": true, | ||
"installments": false | ||
} | ||
}, | ||
"ideal": { | ||
"methodId": "PM32265223222D5HQM75V6FFG", | ||
"code": "ideal", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/ideal.svg", | ||
"name": "iDEAL", | ||
"description": "Adyen iDEAL", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": { | ||
"showLogos": true, | ||
"bankIssuer": "" | ||
} | ||
}, | ||
"klarnaPayNow": { | ||
"methodId": "PM3224P22322225FNZ7B8G4LV", | ||
"code": "klarna_paynow", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/klarna_paynow.svg", | ||
"name": "Pay now with Klarna.", | ||
"description": "Adyen Pay now with Klarna.", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": {} | ||
}, | ||
"klarnaPayLater": { | ||
"methodId": "PM3224P22322225FNZ7B8G5B4", | ||
"code": "klarna", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/klarna.svg", | ||
"name": "Pay later with Klarna.", | ||
"description": "Adyen Pay later with Klarna.", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": {} | ||
}, | ||
"klarnaPayOverTime": { | ||
"methodId": "PM3224P22322225FNZ7B8G586", | ||
"code": "klarna_account", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/klarna_account.svg", | ||
"name": "Pay over time with Klarna.", | ||
"description": "Adyen Pay over time with Klarna.", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": {} | ||
}, | ||
"twint": { | ||
"methodId": "PM322PW223224L5GMTCKMGGBJ", | ||
"code": "twint", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/twint.svg", | ||
"name": "TWINT", | ||
"description": "Adyen TWINT", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": {} | ||
}, | ||
"bancontact": { | ||
"methodId": "PM3224Q22322235HPDL5J4S88", | ||
"code": "bcmc_mobile", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/bcmc_mobile.svg", | ||
"name": "Payconiq by Bancontact", | ||
"description": "Adyen Payconiq by Bancontact", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": {} | ||
}, | ||
"payPal": { | ||
"methodId": "PM3224R223224K5G2Z8W5GKH2", | ||
"code": "paypal", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/paypal.svg", | ||
"name": "PayPal", | ||
"description": "Adyen PayPal", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": { | ||
"displayButtonOn": true | ||
} | ||
}, | ||
"applePay": { | ||
"methodId": "PM322PW223224W5HW558VGL7C", | ||
"code": "applepay", | ||
"logo": "https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/applepay.svg", | ||
"name": "Apple Pay", | ||
"description": "Adyen Apple Pay", | ||
"surchargeType": "none", | ||
"percentSurcharge": "", | ||
"fixedSurcharge": "", | ||
"surchargeLimit": "", | ||
"additionalData": { | ||
"merchantId": "000000000203160", | ||
"merchantName": "LogeecomECOM", | ||
"displayButtonOn": true | ||
} | ||
}, | ||
"generalSettings": { | ||
"basketItemSync": false, | ||
"capture": "manual", | ||
"captureDelay": 1, | ||
"retentionPeriod": "60" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
namespace Adyen\Core\BusinessLogic\E2ETest\Services; | ||
|
||
use Adyen\Core\BusinessLogic\AdyenAPI\Management\Connection\Http\Proxy; | ||
use Adyen\Core\Infrastructure\Http\Exceptions\HttpRequestException; | ||
use Adyen\Core\Infrastructure\Http\HttpClient; | ||
use Adyen\Core\Infrastructure\ServiceRegister; | ||
|
||
/** | ||
* Class AdyenAPIService | ||
* | ||
* @package Adyen\Core\BusinessLogic\E2ETest\Services | ||
*/ | ||
class AdyenAPIService | ||
{ | ||
public const MANAGEMENT_API_TEST_URL = 'management-test.adyen.com'; | ||
public const MANAGEMENT_API_LIVE_URL = 'management-live.adyen.com'; | ||
public const API_VERSION = 'v1'; | ||
|
||
/** | ||
* Verifies if Adyen Management API is stable | ||
* | ||
* @param string $testApiKey | ||
* @param string $liveApiKey | ||
* @return void | ||
* @throws HttpRequestException | ||
*/ | ||
public function verifyManagementAPI(string $testApiKey, string $liveApiKey): void | ||
{ | ||
$this->verifyTestManagementAPI($testApiKey); | ||
$this->verifyLiveManagementAPI($liveApiKey); | ||
} | ||
|
||
/** | ||
* Verifies if Adyen test Management API is stable | ||
* | ||
* @param string $apiKey | ||
* @return void | ||
* @throws HttpRequestException | ||
*/ | ||
private function verifyTestManagementAPI(string $apiKey): void | ||
{ | ||
$proxy = new Proxy( | ||
static::getHttpClient(), | ||
self::MANAGEMENT_API_TEST_URL, | ||
self::API_VERSION, | ||
$apiKey | ||
); | ||
if (!$proxy->getApiCredentialDetails()) { | ||
throw new HttpRequestException('Test Management API is not stable'); | ||
} | ||
} | ||
|
||
/** | ||
* Verifies if Adyen live Management API is stable | ||
* | ||
* @param string $apiKey | ||
* @return void | ||
* @throws HttpRequestException | ||
*/ | ||
private function verifyLiveManagementAPI(string $apiKey): void | ||
{ | ||
$proxy = new Proxy( | ||
static::getHttpClient(), | ||
self::MANAGEMENT_API_LIVE_URL, | ||
self::API_VERSION, | ||
$apiKey | ||
); | ||
if (!$proxy->getApiCredentialDetails()) { | ||
throw new HttpRequestException('Live Management API is not stable'); | ||
} | ||
} | ||
|
||
/** | ||
* Returns HttpClient instance | ||
* | ||
* @return HttpClient | ||
*/ | ||
protected static function getHttpClient(): HttpClient | ||
{ | ||
return ServiceRegister::getService(HttpClient::class); | ||
} | ||
} |
Oops, something went wrong.