Skip to content

Commit a729198

Browse files
MC-42211: Amount attribute is passed to the Message even Billing Agreements feature is turned on
1 parent de3dec9 commit a729198

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

app/code/Magento/Paypal/Block/PayLater/Banner.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public function getJsLayout()
8282
$componentConfig = $this->jsLayout['components']['payLater']['config'] ?? [];
8383
$defaultConfig = ['sdkUrl' => $this->getPayPalSdkUrl()];
8484
$config = array_replace($defaultConfig, $componentConfig);
85+
$displayAmount = $config['displayAmount'] ?? false;
86+
$config['displayAmount'] = !$displayAmount || $this->payLaterConfig->isPPBillingAgreementEnabled()
87+
? false : true;
8588

8689
//Extend block component attributes with defaults
8790
$componentAttributes = $this->jsLayout['components']['payLater']['config']['attributes'] ?? [];

app/code/Magento/Paypal/Block/PayLater/LayoutProcessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public function process($jsLayout)
7272
]
7373
];
7474
$config = array_replace($defaultConfig, $componentConfig);
75+
$displayAmount = $config['displayAmount'] ?? false;
76+
$config['displayAmount'] = !$displayAmount || $this->payLaterConfig->isPPBillingAgreementEnabled()
77+
? false : true;
7578

7679
$attributes = $this->payLaterConfig->getSectionConfig(
7780
PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT,

app/code/Magento/Paypal/Model/PayLaterConfig.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,14 @@ public function getSectionConfig(string $section, string $key)
134134

135135
return $this->configData[$section][$key];
136136
}
137+
138+
/**
139+
* Check if billing agreement is enabled
140+
*
141+
* @return bool
142+
*/
143+
public function isPPBillingAgreementEnabled(): bool
144+
{
145+
return $this->config->isMethodActive(Config::METHOD_BILLING_AGREEMENT);
146+
}
137147
}

0 commit comments

Comments
 (0)