Skip to content

Commit 40b4d63

Browse files
committed
MAG2-369 - Fixed problems with buttonTextCase param
1 parent b440e90 commit 40b4d63

File tree

3 files changed

+119
-22
lines changed

3 files changed

+119
-22
lines changed

Model/Source/ButtonTextCase.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/**
4+
* PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* PAYONE Magento 2 Connector is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* PHP version 8
18+
*
19+
* @category Payone
20+
* @package Payone_Magento2_Plugin
21+
* @author FATCHIP GmbH <support@fatchip.de>
22+
* @copyright 2003 - 2026 Payone GmbH
23+
* @license <http://www.gnu.org/licenses/> GNU Lesser General Public License
24+
* @link http://www.payone.de
25+
*/
26+
27+
namespace Payone\Core\Model\Source;
28+
29+
use Magento\Framework\Option\ArrayInterface;
30+
31+
/**
32+
* Source class for existing text cases
33+
*/
34+
class ButtonTextCase implements ArrayInterface
35+
{
36+
/**
37+
* Return existing operation modes
38+
*
39+
* @return array
40+
*/
41+
public function toOptionArray()
42+
{
43+
return [
44+
[
45+
'value' => 'capitalize',
46+
'label' => __('Capitalize'),
47+
],
48+
[
49+
'value' => 'uppercase',
50+
'label' => __('Uppercase')
51+
]
52+
];
53+
}
54+
}

etc/adminhtml/system.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,9 @@
325325
<field id="button_style" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
326326
<label>Button style</label>
327327
</field>
328-
<field id="button_text_case" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
328+
<field id="button_text_case" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
329329
<label>Button text case</label>
330+
<source_model>Payone\Core\Model\Source\ButtonTextCase</source_model>
330331
</field>
331332
<field id="button_badge_color" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
332333
<label>Button and badge color</label>

view/frontend/web/js/view/payment/method-renderer/creditcardv2-method.js

Lines changed: 63 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,33 +133,75 @@ define(
133133
getUiConfig: function () {
134134
let uiConfig = {};
135135
if (this.getFrontendConfigParam('uiConfigCustomizationEnabled') === "1") {
136-
uiConfig.formBgColor = this.getFrontendConfigParam('uiConfigFormBgColor');
137-
uiConfig.fieldBgColor = this.getFrontendConfigParam('uiConfigFieldBgColor');
138-
uiConfig.fieldBorder = this.getFrontendConfigParam('uiConfigFieldBorder');
139-
uiConfig.fieldOutline = this.getFrontendConfigParam('uiConfigFieldOutline');
140-
uiConfig.fieldLabelColor = this.getFrontendConfigParam('uiConfigFieldLabelColor');
141-
uiConfig.fieldPlaceholderColor = this.getFrontendConfigParam('uiConfigFieldPlaceholderColor');
142-
uiConfig.fieldTextColor = this.getFrontendConfigParam('uiConfigFieldTextColor');
143-
uiConfig.fieldErrorCodeColor = this.getFrontendConfigParam('uiConfigFieldErrorCodeColor');
136+
if (this.getFrontendConfigParam('uiConfigFormBgColor')) {
137+
uiConfig.formBgColor = this.getFrontendConfigParam('uiConfigFormBgColor');
138+
}
139+
if (this.getFrontendConfigParam('uiConfigFieldBgColor')) {
140+
uiConfig.fieldBgColor = this.getFrontendConfigParam('uiConfigFieldBgColor');
141+
}
142+
if (this.getFrontendConfigParam('uiConfigFieldBorder')) {
143+
uiConfig.fieldBorder = this.getFrontendConfigParam('uiConfigFieldBorder');
144+
}
145+
if (this.getFrontendConfigParam('uiConfigFieldOutline')) {
146+
uiConfig.fieldOutline = this.getFrontendConfigParam('uiConfigFieldOutline');
147+
}
148+
if (this.getFrontendConfigParam('uiConfigFieldLabelColor')) {
149+
uiConfig.fieldLabelColor = this.getFrontendConfigParam('uiConfigFieldLabelColor');
150+
}
151+
if (this.getFrontendConfigParam('uiConfigFieldPlaceholderColor')) {
152+
uiConfig.fieldPlaceholderColor = this.getFrontendConfigParam('uiConfigFieldPlaceholderColor');
153+
}
154+
if (this.getFrontendConfigParam('uiConfigFieldTextColor')) {
155+
uiConfig.fieldTextColor = this.getFrontendConfigParam('uiConfigFieldTextColor');
156+
}
157+
if (this.getFrontendConfigParam('uiConfigFieldErrorCodeColor')) {
158+
uiConfig.fieldErrorCodeColor = this.getFrontendConfigParam('uiConfigFieldErrorCodeColor');
159+
}
144160
}
145161
return uiConfig;
146162
},
147163
getCTPUiConfig: function () {
148164
let uiConfig = {};
149165
if (this.getFrontendConfigParam('uiConfigCustomizationEnabled') === "1") {
150-
uiConfig.buttonStyle = this.getFrontendConfigParam('uiConfigButtonStyle');
151-
uiConfig.buttonTextCase = this.getFrontendConfigParam('uiConfigButtonTextCase');
152-
uiConfig.buttonAndBadgeColor = this.getFrontendConfigParam('uiConfigButtonAndBadgeColor');
153-
uiConfig.buttonFilledHoverColor = this.getFrontendConfigParam('uiConfigButtonFilledHoverColor');
154-
uiConfig.buttonOutlinedHoverColor = this.getFrontendConfigParam('uiConfigButtonOutlinedHoverColor');
155-
uiConfig.buttonDisabledColor = this.getFrontendConfigParam('uiConfigButtonDisabledColor');
156-
uiConfig.cardItemActiveColor = this.getFrontendConfigParam('uiConfigCardItemActiveColor');
157-
uiConfig.buttonAndBadgeTextColor = this.getFrontendConfigParam('uiConfigButtonAndBadgeTextColor');
158-
uiConfig.linkTextColor = this.getFrontendConfigParam('uiConfigLinkTextColor');
159-
uiConfig.accentColor = this.getFrontendConfigParam('uiConfigAccentColor');
160-
uiConfig.fontFamily = this.getFrontendConfigParam('uiConfigFontFamily');
161-
uiConfig.buttonAndInputRadius = this.getFrontendConfigParam('uiConfigButtonAndInputRadius');
162-
uiConfig.cardItemRadius = this.getFrontendConfigParam('uiConfigCardItemRadius');
166+
if (this.getFrontendConfigParam('uiConfigButtonStyle')) {
167+
uiConfig.buttonStyle = this.getFrontendConfigParam('uiConfigButtonStyle');
168+
}
169+
if (this.getFrontendConfigParam('uiConfigButtonTextCase')) {
170+
uiConfig.buttonTextCase = this.getFrontendConfigParam('uiConfigButtonTextCase');
171+
}
172+
if (this.getFrontendConfigParam('uiConfigButtonAndBadgeColor')) {
173+
uiConfig.buttonAndBadgeColor = this.getFrontendConfigParam('uiConfigButtonAndBadgeColor');
174+
}
175+
if (this.getFrontendConfigParam('uiConfigButtonFilledHoverColor')) {
176+
uiConfig.buttonFilledHoverColor = this.getFrontendConfigParam('uiConfigButtonFilledHoverColor');
177+
}
178+
if (this.getFrontendConfigParam('uiConfigButtonOutlinedHoverColor')) {
179+
uiConfig.buttonOutlinedHoverColor = this.getFrontendConfigParam('uiConfigButtonOutlinedHoverColor');
180+
}
181+
if (this.getFrontendConfigParam('uiConfigButtonDisabledColor')) {
182+
uiConfig.buttonDisabledColor = this.getFrontendConfigParam('uiConfigButtonDisabledColor');
183+
}
184+
if (this.getFrontendConfigParam('uiConfigCardItemActiveColor')) {
185+
uiConfig.cardItemActiveColor = this.getFrontendConfigParam('uiConfigCardItemActiveColor');
186+
}
187+
if (this.getFrontendConfigParam('uiConfigButtonAndBadgeTextColor')) {
188+
uiConfig.buttonAndBadgeTextColor = this.getFrontendConfigParam('uiConfigButtonAndBadgeTextColor');
189+
}
190+
if (this.getFrontendConfigParam('uiConfigLinkTextColor')) {
191+
uiConfig.linkTextColor = this.getFrontendConfigParam('uiConfigLinkTextColor');
192+
}
193+
if (this.getFrontendConfigParam('uiConfigAccentColor')) {
194+
uiConfig.accentColor = this.getFrontendConfigParam('uiConfigAccentColor');
195+
}
196+
if (this.getFrontendConfigParam('uiConfigFontFamily')) {
197+
uiConfig.fontFamily = this.getFrontendConfigParam('uiConfigFontFamily');
198+
}
199+
if (this.getFrontendConfigParam('uiConfigButtonAndInputRadius')) {
200+
uiConfig.buttonAndInputRadius = this.getFrontendConfigParam('uiConfigButtonAndInputRadius');
201+
}
202+
if (this.getFrontendConfigParam('uiConfigCardItemRadius')) {
203+
uiConfig.cardItemRadius = this.getFrontendConfigParam('uiConfigCardItemRadius');
204+
}
163205
}
164206
return uiConfig;
165207
},

0 commit comments

Comments
 (0)