29 private $backendHelper;
34 private $scopeDefiner;
39 private $paymentSectionModifier;
44 private static $paypalConfigCountries = [
65 BackendHelper $backendHelper,
68 $this->scopeDefiner = $scopeDefiner;
69 $this->backendHelper = $backendHelper;
70 $this->paymentSectionModifier = $paymentSectionModifier
82 $countries = self::$paypalConfigCountries;
85 $countries[] =
'payment_other';
103 $isSectionChanged = $pathParts[0] ==
'payment';
105 if ($isSectionChanged) {
106 $requestedCountrySection =
'payment_' . strtolower($this->backendHelper->getConfigurationCountryCode());
108 if (in_array($requestedCountrySection, self::getPaypalConfigCountries())) {
109 $pathParts[0] = $requestedCountrySection;
111 $pathParts[0] =
'payment_other';
115 $result = $proceed($pathParts);
117 if ($isSectionChanged &&
$result) {
119 $this->restructurePayments(
$result);
123 [
'showInDefault' =>
true,
'showInWebsite' =>
true,
'showInStore' =>
true]
125 $this->scopeDefiner->getScope()
141 $sectionData =
$result->getData();
142 $sectionInitialStructure = isset($sectionData[
'children']) ? $sectionData[
'children'] : [];
143 $sectionChangedStructure = $this->paymentSectionModifier->modify($sectionInitialStructure);
144 $sectionData[
'children'] = $sectionChangedStructure;
145 $result->setData($sectionData, $this->scopeDefiner->getScope());
__construct(ScopeDefiner $scopeDefiner, BackendHelper $backendHelper, PaymentSectionModifier $paymentSectionModifier=null)
static getPaypalConfigCountries($addOther=false)
const REQUEST_PARAM_COUNTRY
aroundGetElementByPathParts(Structure $subject, \Closure $proceed, array $pathParts)