Skip to content

Commit cd942c8

Browse files
PSPAYPAL-541 Refactored config keys to use the osc prefix; gave up hungarian notation; refactored the settings arrays for a clearer appearance
1 parent dec66f7 commit cd942c8

16 files changed

+338
-226
lines changed

.env.dist

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ acdcCreditCardExpirationDate=generate-me
99
acdcCreditCardCVV=generate-me
1010
sSellerLogin=Paypal-Seller-Login
1111
sSellerPassword=Paypal-Seller-Password
12-
sPayPalSandboxClientId=Paypal-Sandbox-ClientId
13-
blPayPalSandboxMode=Paypal-Sandbox-Mode
14-
sPayPalSandboxClientSecret=Paypal-Sandbox-ClientSecret
15-
sPayPalSandboxWebhookId=Paypal-Sandbox-ClientSecret
12+
oscPayPalSandboxClientId=Paypal-Sandbox-ClientId
13+
oscPayPalSandboxMode=Paypal-Sandbox-Mode
14+
oscPayPalSandboxClientSecret=Paypal-Sandbox-ClientSecret
15+
oscPayPalSandboxWebhookId=Paypal-Sandbox-ClientSecret

Tests/Codeception/Acceptance/AdminOnboardingCest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function _before(AcceptanceTester $I): void
3434
{
3535
parent::_before($I);
3636

37-
$I->updateModuleConfiguration('sPayPalSandboxClientId', '');
38-
$I->updateModuleConfiguration('blPayPalSandboxMode', false);
39-
$I->updateModuleConfiguration('sPayPalSandboxClientSecret', '');
37+
$I->updateModuleConfiguration('oscPayPalSandboxClientId', '');
38+
$I->updateModuleConfiguration('oscPayPalSandboxMode', false);
39+
$I->updateModuleConfiguration('oscPayPalSandboxClientSecret', '');
4040

4141
$I->clearShopCache();
4242
}
@@ -95,4 +95,4 @@ public function testOnboardingSandboxMode(AcceptanceTester $I): void
9595
$I->see(substr(Translator::translate('OSC_PAYPAL_CONF_VALID'), 0, 20));
9696
$I->dontSee(substr(Translator::translate('OSC_PAYPAL_ERR_CONF_INVALID'), 0, 65));
9797
}
98-
}
98+
}

Tests/Codeception/Acceptance/BaseCest.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public function _before(AcceptanceTester $I): void
3232
$I->updateConfigInDatabase('blUseStock', false, 'bool');
3333
$I->updateConfigInDatabase('bl_perfLoadPrice', true, 'bool');
3434
$I->updateConfigInDatabase('iNewBasketItemMessage', false, 'bool');
35-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', false);
35+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', false);
3636

37-
$I->updateModuleConfiguration('sPayPalSandboxClientId', $_ENV['sPayPalSandboxClientId']);
38-
$I->updateModuleConfiguration('blPayPalSandboxMode', true);
39-
$I->updateModuleConfiguration('sPayPalSandboxClientSecret', $_ENV['sPayPalSandboxClientSecret']);
37+
$I->updateModuleConfiguration('oscPayPalSandboxClientId', $_ENV['oscPayPalSandboxClientId']);
38+
$I->updateModuleConfiguration('oscPayPalSandboxMode', true);
39+
$I->updateModuleConfiguration('oscPayPalSandboxClientSecret', $_ENV['oscPayPalSandboxClientSecret']);
4040

4141
$this->ensureShopUserData($I);
4242
$this->enableExpressButtons($I);
@@ -47,7 +47,7 @@ public function _after(AcceptanceTester $I): void
4747
$this->ensureShopUserData($I);
4848
$this->enableExpressButtons($I);
4949
$I->updateConfigInDatabase('blShowNetPrice', false, 'bool');
50-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', false);
50+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', false);
5151

5252
$I->deleteFromDatabase('oxorder', ['OXORDERNR >=' => '2']);
5353
$I->deleteFromDatabase('oxuserbaskets', ['OXTITLE >=' => 'savedbasket']);
@@ -178,7 +178,7 @@ protected function setUserNameSameAsPayPal(AcceptanceTester $I): void
178178
protected function proceedToPaymentStep(AcceptanceTester $I, string $userName = null, bool $ensureCheckoutButton = true): void
179179
{
180180
if ($ensureCheckoutButton) {
181-
$I->updateModuleConfiguration('blPayPalShowCheckoutButton', true);
181+
$I->updateModuleConfiguration('oscPayPalShowCheckoutButton', true);
182182
}
183183

184184
$userName = $userName ?: Fixtures::get('userName');
@@ -208,7 +208,7 @@ protected function fromBasketToPayment(AcceptanceTester $I): void
208208

209209
protected function proceedToBasketStep(AcceptanceTester $I, string $userName = null, bool $logMeIn = true): void
210210
{
211-
$I->updateModuleConfiguration('blPayPalShowCheckoutButton', true);
211+
$I->updateModuleConfiguration('oscPayPalShowCheckoutButton', true);
212212

213213
$userName = $userName ?: Fixtures::get('userName');
214214

@@ -289,9 +289,9 @@ protected function openOrderPayPal(AcceptanceTester $I, string $orderNumber): vo
289289

290290
protected function enableExpressButtons(AcceptanceTester $I, bool $flag = true): void
291291
{
292-
$I->updateModuleConfiguration('blPayPalShowProductDetailsButton', $flag);
293-
$I->updateModuleConfiguration('blPayPalShowBasketButton', $flag);
294-
$I->updateModuleConfiguration('blPayPalShowCheckoutButton', $flag);
292+
$I->updateModuleConfiguration('oscPayPalShowProductDetailsButton', $flag);
293+
$I->updateModuleConfiguration('oscPayPalShowBasketButton', $flag);
294+
$I->updateModuleConfiguration('oscPayPalShowCheckoutButton', $flag);
295295
}
296296

297297
protected function checkWeAreStillInAdminPanel(AcceptanceTester $I): void

Tests/Codeception/Acceptance/ButtonPlacementCest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testDetailsButtonPlacement(AcceptanceTester $I): void
3939
$I->dontSeeElement("#PayPalButtonProductMain");
4040

4141
//switch it on
42-
$I->updateModuleConfiguration('blPayPalShowProductDetailsButton', true);
42+
$I->updateModuleConfiguration('oscPayPalShowProductDetailsButton', true);
4343

4444
$I->openShop();
4545
$I->waitForText(Translator::translate('HOME'));
@@ -60,7 +60,7 @@ public function testBasketButtonPlacement(AcceptanceTester $I): void
6060
$I->dontSeeElement("#PayPalPayButtonNextCart2");
6161

6262
//switch it on
63-
$I->updateModuleConfiguration('blPayPalShowBasketButton', true);
63+
$I->updateModuleConfiguration('oscPayPalShowBasketButton', true);
6464
$I->openShop();
6565
$I->waitForText(Translator::translate('HOME'));
6666
$this->fillBasket($I);
@@ -77,7 +77,7 @@ public function testCheckoutButtonPlacement(AcceptanceTester $I): void
7777
$I->dontSeeElement("#PayPalButtonPaymentPage");
7878

7979
//switch it on
80-
$I->updateModuleConfiguration('blPayPalShowCheckoutButton', true);
80+
$I->updateModuleConfiguration('oscPayPalShowCheckoutButton', true);
8181
$I->clearShopCache();
8282
$this->proceedToPaymentStep($I, Fixtures::get('userName'), false);
8383
$I->seeElement("#PayPalButtonPaymentPage");

Tests/Codeception/Acceptance/ExpressCheckoutFromDetailsCest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testExpressCheckoutFromDetailsButton(AcceptanceTester $I): void
3232
$I->wantToTest('checkout from details page with empty cart. Customer is logged in.');
3333

3434
$this->enableExpressButtons($I, false);
35-
$I->updateModuleConfiguration('blPayPalShowProductDetailsButton', true);
35+
$I->updateModuleConfiguration('oscPayPalShowProductDetailsButton', true);
3636

3737
$I->openShop()
3838
->loginUser(Fixtures::get('userName'), Fixtures::get('userPassword'));
@@ -81,7 +81,7 @@ public function testDetailsButtonPlacementWithPrefilledCart(AcceptanceTester $I)
8181
$I->wantToTest('checkout from details page from clean session and filled cart. Customer is guest buyer without shop account.');
8282

8383
$this->enableExpressButtons($I);
84-
$I->updateModuleConfiguration('blPayPalShowProductDetailsButton', true);
84+
$I->updateModuleConfiguration('oscPayPalShowProductDetailsButton', true);
8585

8686
$this->proceedToBasketStep($I, $_ENV['sBuyerLogin'], false);
8787

@@ -125,7 +125,7 @@ public function testExpressCheckouFromDetailsAutomaticLogin(AcceptanceTester $I)
125125

126126
$this->enableExpressButtons($I);
127127
$this->setUserNameSameAsPayPal($I);
128-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', true);
128+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', true);
129129

130130
$productNavigation = new ProductNavigation($I);
131131
$productNavigation->openProductDetailsPage(Fixtures::get('product')['oxid']);

Tests/Codeception/Acceptance/InstallmentBannersCest.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function shopStartPageShowsBanner(AcceptanceTester $I): void
4646
{
4747
$I->wantToTest('shop start page with installment banner');
4848

49-
$I->updateModuleConfiguration('oePayPalBannersShowAll', true);
50-
$I->updateModuleConfiguration('oePayPalBannersStartPage', true);
49+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', true);
50+
$I->updateModuleConfiguration('oscPayPalBannersStartPage', true);
5151

5252
$I->openShop();
5353
$I->waitForText(Translator::translate('HOME'));
@@ -59,8 +59,8 @@ public function categoryPageShowsBanner(AcceptanceTester $I): void
5959
{
6060
$I->wantToTest('category page with installment banner');
6161

62-
$I->updateModuleConfiguration('oePayPalBannersShowAll', true);
63-
$I->updateModuleConfiguration('oePayPalBannersCategoryPage', true);
62+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', true);
63+
$I->updateModuleConfiguration('oscPayPalBannersCategoryPage', true);
6464

6565
$home = $I->openShop();
6666
$I->waitForText(Translator::translate('HOME'));
@@ -74,8 +74,8 @@ public function searchResultsPageShowsBanner(AcceptanceTester $I): void
7474
{
7575
$I->wantToTest('search resuotes page with installment banner');
7676

77-
$I->updateModuleConfiguration('oePayPalBannersShowAll', true);
78-
$I->updateModuleConfiguration('oePayPalBannersSearchResultsPage', true);
77+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', true);
78+
$I->updateModuleConfiguration('oscPayPalBannersSearchResultsPage', true);
7979

8080
$home = $I->openShop();
8181
$I->waitForText(Translator::translate('HOME'));
@@ -92,8 +92,8 @@ public function detailPageShowsBanner(AcceptanceTester $I): void
9292
{
9393
$I->wantToTest('product details page with installment banner');
9494

95-
$I->updateModuleConfiguration('oePayPalBannersShowAll', true);
96-
$I->updateModuleConfiguration('oePayPalBannersProductDetailsPage', true);
95+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', true);
96+
$I->updateModuleConfiguration('oscPayPalBannersProductDetailsPage', true);
9797

9898
$home = $I->openShop();
9999
$I->waitForText(Translator::translate('HOME'));
@@ -117,8 +117,8 @@ public function checkoutPageShowsBanner(AcceptanceTester $I): void
117117
{
118118
$I->wantToTest('checkout page with installment banner and logged in user');
119119

120-
$I->updateModuleConfiguration('oePayPalBannersShowAll', true);
121-
$I->updateModuleConfiguration('oePayPalBannersCheckoutPage', true);
120+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', true);
121+
$I->updateModuleConfiguration('oscPayPalBannersCheckoutPage', true);
122122

123123
$home = $I->openShop()
124124
->loginUser(Fixtures::get('userName'), Fixtures::get('userPassword'));
@@ -155,11 +155,11 @@ public function disableAllBannersFlag(AcceptanceTester $I): void
155155
$this->checkBannersOnAllPages($I, true);
156156

157157
//disable main flag
158-
$I->updateModuleConfiguration('oePayPalBannersShowAll', false);
158+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', false);
159159
$this->checkBannersOnAllPages($I, false);
160160

161161
//reenable main flag but change performance shop config flag
162-
$I->updateModuleConfiguration('oePayPalBannersShowAll', true);
162+
$I->updateModuleConfiguration('oscPayPalBannersShowAll', true);
163163
$I->updateConfigInDatabase('bl_perfLoadPrice', false, 'bool');
164164
$this->checkBannersOnAllPages($I, false);
165165

@@ -316,4 +316,4 @@ private function checkBannersOnAllPages($I, bool $visible = true)
316316

317317
$home->logoutUser();
318318
}
319-
}
319+
}

Tests/Codeception/Acceptance/PayPalCheckoutLoginCest.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function checkoutWithPaypalFromBasketStepAutomaticLogin(AcceptanceTester
2828
{
2929
$I->wantToTest('automatic login as existing but not logged in shop user. Shop login and PayPal login mail are the same.');
3030

31-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', true);
31+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', true);
3232

3333
$this->setUserDataSameAsPayPal($I);
3434
$this->proceedToBasketStep($I, $_ENV['sBuyerLogin'], false);
@@ -66,7 +66,7 @@ public function checkoutWithPaypalFromBasketStepNoAutomaticLoginFinalizeAsSameUs
6666
{
6767
$I->wantToTest('no automatic login as existing but not logged in shop user. Shop login and PayPal login mail are the same.');
6868

69-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', false);
69+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', false);
7070

7171
$token = $this->startExpressCheckoutAsNotLoggedInExistingUser($I);
7272

@@ -102,7 +102,7 @@ public function checkoutWithPaypalFromBasketStepNoAutomaticLoginFinalizeAsDiffer
102102
{
103103
$I->wantToTest('no automatic login as existing but not logged in shop user. Log into shop with different account.');
104104

105-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', false);
105+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', false);
106106

107107
$token = $this->startExpressCheckoutAsNotLoggedInExistingUser($I);
108108

@@ -139,10 +139,10 @@ public function checkoutWithPaypalFromBasketStepNoAutomaticLoginFinalizeAsDiffer
139139
*/
140140
public function checkoutWithPaypalExpressNewCustomer(AcceptanceTester $I, Example $example): void
141141
{
142-
$I->wantToTest('checking out with PayPal payment as not existing shop user will end me up with passwordless shop login, PPlogin is ' . (int) $example['blPayPalLoginWithPayPalEMail']);
142+
$I->wantToTest('checking out with PayPal payment as not existing shop user will end me up with passwordless shop login, PPlogin is ' . (int) $example['oscPayPalLoginWithPayPalEMail']);
143143

144144
//login flag does not make a difference in this case
145-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', $example['blPayPalLoginWithPayPalEMail']);
145+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', $example['oscPayPalLoginWithPayPalEMail']);
146146

147147
//user does not exist in database
148148
$I->seeInDatabase('oxuser', ['oxusername' => Fixtures::get('userName')]);
@@ -191,10 +191,10 @@ public function checkoutWithPaypalExpressNewCustomer(AcceptanceTester $I, Exampl
191191
*/
192192
public function checkoutWithPaypalExpressRepeatGuestBuySameAddress(AcceptanceTester $I, Example $example): void
193193
{
194-
$I->wantToTest('returning passwordless shop login customer, PPlogin is ' . (int) $example['blPayPalLoginWithPayPalEMail']);
194+
$I->wantToTest('returning passwordless shop login customer, PPlogin is ' . (int) $example['oscPayPalLoginWithPayPalEMail']);
195195

196196
//login flag should not make a difference in this case as we only have a guest account anyway
197-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', $example['blPayPalLoginWithPayPalEMail']);
197+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', $example['oscPayPalLoginWithPayPalEMail']);
198198

199199
//paypal user does with same name and invoice exist in database but has no password
200200
$this->setUserDataSameAsPayPal($I, true);
@@ -239,10 +239,10 @@ public function checkoutWithPaypalExpressRepeatGuestBuySameAddress(AcceptanceTes
239239
*/
240240
public function checkoutWithPaypalExpressRepeatGuestBuyDifferentAddress(AcceptanceTester $I, Example $example): void
241241
{
242-
$I->wantToTest('passwordless guest user, shop and PayPal email are same, invoice and names different, PPlogin is ' . (int) $example['blPayPalLoginWithPayPalEMail']);
242+
$I->wantToTest('passwordless guest user, shop and PayPal email are same, invoice and names different, PPlogin is ' . (int) $example['oscPayPalLoginWithPayPalEMail']);
243243

244244
//login flag should not make a difference in this case as we only have a guest account anyway
245-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', $example['blPayPalLoginWithPayPalEMail']);
245+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', $example['oscPayPalLoginWithPayPalEMail']);
246246

247247
//paypal user does exist in database but has no password.
248248
//Shop name and invoice address is different from paypal, only email is the same
@@ -291,10 +291,10 @@ public function checkoutWithPaypalExpressRepeatGuestBuyDifferentAddress(Acceptan
291291
*/
292292
public function checkoutWithPaypalFromBasketAlreadyLoggedIn(AcceptanceTester $I, Example $example): void
293293
{
294-
$I->wantToTest('Logged in shop user, shop and PayPal email and address are different, PPlogin is ' . (int) $example['blPayPalLoginWithPayPalEMail']);
294+
$I->wantToTest('Logged in shop user, shop and PayPal email and address are different, PPlogin is ' . (int) $example['oscPayPalLoginWithPayPalEMail']);
295295

296296
//setting should not make a difference, user is already logged in
297-
$I->updateModuleConfiguration('blPayPalLoginWithPayPalEMail', $example['blPayPalLoginWithPayPalEMail']);
297+
$I->updateModuleConfiguration('oscPayPalLoginWithPayPalEMail', $example['oscPayPalLoginWithPayPalEMail']);
298298

299299
$this->proceedToBasketStep($I);
300300

@@ -343,8 +343,8 @@ public function checkoutWithPaypalFromBasketAlreadyLoggedIn(AcceptanceTester $I,
343343
protected function providerLogInWithPayPal(): array
344344
{
345345
return [
346-
['blPayPalLoginWithPayPalEMail' => false],
347-
['blPayPalLoginWithPayPalEMail' => true]
346+
['oscPayPalLoginWithPayPalEMail' => false],
347+
['oscPayPalLoginWithPayPalEMail' => true]
348348
];
349349
}
350350

0 commit comments

Comments
 (0)