Skip to content

Commit

Permalink
remove payment fee label and make title by default "Payment Fee"
Browse files Browse the repository at this point in the history
  • Loading branch information
vegimcarkaxhija committed Jan 30, 2025
1 parent 10cef65 commit 09d92e3
Show file tree
Hide file tree
Showing 125 changed files with 1,048 additions and 1,903 deletions.
16 changes: 1 addition & 15 deletions Block/Cart/CartTotalsProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,24 @@

class CartTotalsProcessor extends AbstractTotalsProcessor implements LayoutProcessorInterface
{
/**
* @param \Buckaroo\Magento2\Model\ConfigProvider\Factory
*/
protected $configProviderFactory;

/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Buckaroo\Magento2\Model\ConfigProvider\Factory $configProviderFactory
*
* @codeCoverageIgnore
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Buckaroo\Magento2\Model\ConfigProvider\Factory $configProviderFactory
) {
parent::__construct($scopeConfig);
$this->configProviderFactory = $configProviderFactory;
}

/**
* {@inheritdoc}
*/
public function process($jsLayout)
{
/**
* @var \Buckaroo\Magento2\Model\ConfigProvider\Account $configProvider
*/
$configProvider = $this->configProviderFactory->get('account');
$paymentFeeLabel = $configProvider->getPaymentFeeLabel();

$jsLayout['components']['block-totals']['children']['before_grandtotal']['children']['buckaroo-fee-order-level']
['config']['title'] = $paymentFeeLabel;
['config']['title'] = "Payment Fee";
return $jsLayout;
}
}
16 changes: 1 addition & 15 deletions Block/Checkout/TotalsProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,24 @@

class TotalsProcessor extends AbstractTotalsProcessor implements LayoutProcessorInterface
{
/**
* @param \Buckaroo\Magento2\Model\ConfigProvider\Factory
*/
protected $configProviderFactory;

/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Buckaroo\Magento2\Model\ConfigProvider\Factory $configProviderFactory
*
* @codeCoverageIgnore
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Buckaroo\Magento2\Model\ConfigProvider\Factory $configProviderFactory
) {
parent::__construct($scopeConfig);
$this->configProviderFactory = $configProviderFactory;
}

/**
* {@inheritdoc}
*/
public function process($jsLayout)
{
/**
* @var \Buckaroo\Magento2\Model\ConfigProvider\Account $configProvider
*/
$configProvider = $this->configProviderFactory->get('account');
$paymentFeeLabel = $configProvider->getPaymentFeeLabel();

$jsLayout['components']['checkout']['children']['sidebar']['children']['summary']['children']['totals']
['children']['before_grandtotal']['children']['buckaroo_fee']['config']['title'] = $paymentFeeLabel;
['children']['before_grandtotal']['children']['buckaroo_fee']['config']['title'] = 'Payment Fee';
return $jsLayout;
}
}
22 changes: 3 additions & 19 deletions Helper/PaymentFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getTotals($dataObject)
$taxClassId = $this->configProviderBuckarooFee->getBuckarooFeeTaxClass($store);
$isIncludingTax = $this->isFeeDisplayTypeIncludingTax($taxClassId);

$label = $this->getBuckarooPaymentFeeLabel($dataObject);
$label = $this->getBuckarooPaymentFeeLabel();
$fee = $dataObject->getBuckarooFee();
$feeTaxAmount = $dataObject->getBuckarooFeeTaxAmount();
$baseFee = $dataObject->getBaseBuckarooFee();
Expand Down Expand Up @@ -293,27 +293,11 @@ public function getBuckarooFeeTax()
/**
* Retrieve the correct label for the Buckaroo payment fee.
*
* @param mixed $dataObject
* @return string
*/
public function getBuckarooPaymentFeeLabel($dataObject)
public function getBuckarooPaymentFeeLabel()
{
$method = $this->extractPaymentMethodFromDataObject($dataObject);
$label = false;

if ($method && $this->configProviderMethodFactory->has($method)) {
$label = $this->configProviderMethodFactory->get($method)->getPaymentFeeLabel();
}

if (!$label) {
$label = $this->configProviderAccount->getPaymentFeeLabel();
}

if (!$label) {
$label = __('Buckaroo Fee');
}

return $label;
return __('Payment Fee');
}

/**
Expand Down
5 changes: 1 addition & 4 deletions Model/ConfigProvider/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
* @method mixed getLimitByIp()
* @method mixed getOrderStatusPending()
* @method mixed getOrderStatusNew()
* @method mixed getPaymentFeeLabel()
* @method mixed getCreateOrderBeforeTransaction()
* @method mixed getCustomerAdditionalInfo()
* @method mixed getBuckarooFeeTaxClass()
Expand Down Expand Up @@ -73,7 +72,6 @@ class Account extends AbstractConfigProvider
const XPATH_ACCOUNT_DEBUG_TYPES = 'buckaroo_magento2/account/debug_types';
const XPATH_ACCOUNT_DEBUG_EMAIL = 'buckaroo_magento2/account/debug_email';
const XPATH_ACCOUNT_LIMIT_BY_IP = 'buckaroo_magento2/account/limit_by_ip';
const XPATH_ACCOUNT_PAYMENT_FEE_LABEL = 'buckaroo_magento2/account/payment_fee_label';
const XPATH_ACCOUNT_ORDER_STATUS_NEW = 'buckaroo_magento2/account/order_status_new';
const XPATH_ACCOUNT_ORDER_STATUS_PENDING = 'buckaroo_magento2/account/order_status_pending';
const XPATH_ACCOUNT_ORDER_STATUS_SUCCESS = 'buckaroo_magento2/account/order_status_success';
Expand Down Expand Up @@ -135,7 +133,6 @@ public function getConfig($store = null)
'debug_types' => $this->getDebugTypes($store),
'debug_email' => $this->getDebugEmail($store),
'limit_by_ip' => $this->getLimitByIp($store),
'payment_fee_label' => $this->getPaymentFeeLabel($store),
'order_status_new' => $this->getOrderStatusNew($store),
'order_status_pending' => $this->getOrderStatusPending($store),
'order_status_success' => $this->getOrderStatusSuccess($store),
Expand Down Expand Up @@ -252,7 +249,7 @@ public function getParsedLabel(Store $store, OrderInterface $order)
if ($label === null) {
return $store->getName();
}

$label = preg_replace('/\{order_number\}/', $order->getIncrementId(), $label);
$label = preg_replace('/\{shop_name\}/', $store->getName(), $label);

Expand Down
8 changes: 3 additions & 5 deletions Model/ConfigProvider/Method/AbstractConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function getCreditcardLogo(string $code): string
if($code === 'cartebleuevisa') {
$code = 'cartebleue';
}

return $this->getImageUrl("creditcards/{$code}", "svg");
}

Expand Down Expand Up @@ -340,13 +340,11 @@ public function getSpecificCustomerGroupB2B($store = null)
}

/**
* @param string|bool $method
*
* @return string
*/
public function getBuckarooPaymentFeeLabel($method = false)
public function getBuckarooPaymentFeeLabel()
{
return $this->paymentFeeHelper->getBuckarooPaymentFeeLabel($method);
return $this->paymentFeeHelper->getBuckarooPaymentFeeLabel();
}

/**
Expand Down
10 changes: 4 additions & 6 deletions Model/ConfigProvider/Method/Afterpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Afterpay extends AbstractConfigProvider
const XPATH_AFTERPAY_SUBTEXT_STYLE = 'payment/buckaroo_magento2_afterpay/subtext_style';
const XPATH_AFTERPAY_SUBTEXT_COLOR = 'payment/buckaroo_magento2_afterpay/subtext_color';
const XPATH_AFTERPAY_PAYMENT_FEE = 'payment/buckaroo_magento2_afterpay/payment_fee';
const XPATH_AFTERPAY_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_afterpay/payment_fee_label';
const XPATH_AFTERPAY_SEND_EMAIL = 'payment/buckaroo_magento2_afterpay/send_email';
const XPATH_AFTERPAY_ACTIVE_STATUS = 'payment/buckaroo_magento2_afterpay/active_status';
const XPATH_AFTERPAY_ORDER_STATUS_SUCCESS = 'payment/buckaroo_magento2_afterpay/order_status_success';
Expand Down Expand Up @@ -70,9 +69,7 @@ public function getConfig()
return [];
}

$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Afterpay::PAYMENT_METHOD_CODE
);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down Expand Up @@ -124,11 +121,12 @@ public function getBusiness()
*
* @return bool|int
*/
public function getPaymentMethod()
public function getPaymentMethod($storeId = null)
{
$paymentMethod = (int) $this->scopeConfig->getValue(
self::XPATH_AFTERPAY_PAYMENT_METHODS,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);

return $paymentMethod ? $paymentMethod : false;
Expand Down
5 changes: 1 addition & 4 deletions Model/ConfigProvider/Method/Afterpay2.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Afterpay2 extends AbstractConfigProvider
const XPATH_AFTERPAY2_SUBTEXT_STYLE = 'payment/buckaroo_magento2_afterpay2/subtext_style';
const XPATH_AFTERPAY2_SUBTEXT_COLOR = 'payment/buckaroo_magento2_afterpay2/subtext_color';
const XPATH_AFTERPAY2_PAYMENT_FEE = 'payment/buckaroo_magento2_afterpay2/payment_fee';
const XPATH_AFTERPAY2_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_afterpay2/payment_fee_label';
const XPATH_AFTERPAY2_SEND_EMAIL = 'payment/buckaroo_magento2_afterpay2/send_email';
const XPATH_AFTERPAY2_ACTIVE_STATUS = 'payment/buckaroo_magento2_afterpay2/active_status';
const XPATH_AFTERPAY2_ORDER_STATUS_SUCCESS = 'payment/buckaroo_magento2_afterpay2/order_status_success';
Expand Down Expand Up @@ -70,9 +69,7 @@ public function getConfig()
return [];
}

$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Afterpay2::PAYMENT_METHOD_CODE
);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
3 changes: 1 addition & 2 deletions Model/ConfigProvider/Method/Afterpay20.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Afterpay20 extends AbstractConfigProvider
const XPATH_AFTERPAY20_SUBTEXT_STYLE = 'payment/buckaroo_magento2_afterpay20/subtext_style';
const XPATH_AFTERPAY20_SUBTEXT_COLOR = 'payment/buckaroo_magento2_afterpay20/subtext_color';
const XPATH_AFTERPAY20_PAYMENT_FEE = 'payment/buckaroo_magento2_afterpay20/payment_fee';
const XPATH_AFTERPAY20_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_afterpay20/payment_fee_label';
const XPATH_AFTERPAY20_SEND_EMAIL = 'payment/buckaroo_magento2_afterpay20/send_email';
const XPATH_AFTERPAY20_ACTIVE_STATUS = 'payment/buckaroo_magento2_afterpay20/active_status';
const XPATH_AFTERPAY20_ORDER_STATUS_SUCCESS = 'payment/buckaroo_magento2_afterpay20/order_status_success';
Expand Down Expand Up @@ -69,7 +68,7 @@ public function getConfig()
return [];
}

$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(Afterpay20Method::PAYMENT_METHOD_CODE);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
5 changes: 1 addition & 4 deletions Model/ConfigProvider/Method/Alipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
class Alipay extends AbstractConfigProvider
{
const XPATH_ALIPAY_PAYMENT_FEE = 'payment/buckaroo_magento2_alipay/payment_fee';
const XPATH_ALIPAY_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_alipay/payment_fee_label';
const XPATH_ALIPAY_ACTIVE = 'payment/buckaroo_magento2_alipay/active';
const XPATH_ALIPAY_SUBTEXT = 'payment/buckaroo_magento2_alipay/subtext';
const XPATH_ALIPAY_SUBTEXT_STYLE = 'payment/buckaroo_magento2_alipay/subtext_style';
Expand All @@ -44,9 +43,7 @@ class Alipay extends AbstractConfigProvider
*/
public function getConfig()
{
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Alipay::PAYMENT_METHOD_CODE
);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
5 changes: 1 addition & 4 deletions Model/ConfigProvider/Method/Belfius.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
class Belfius extends AbstractConfigProvider
{
const XPATH_BELFIUS_PAYMENT_FEE = 'payment/buckaroo_magento2_belfius/payment_fee';
const XPATH_BELFIUS_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_belfius/payment_fee_label';
const XPATH_BELFIUS_ACTIVE = 'payment/buckaroo_magento2_belfius/active';
const XPATH_BELFIUS_SUBTEXT = 'payment/buckaroo_magento2_belfius/subtext';
const XPATH_BELFIUS_SUBTEXT_STYLE = 'payment/buckaroo_magento2_belfius/subtext_style';
Expand All @@ -44,9 +43,7 @@ class Belfius extends AbstractConfigProvider
*/
public function getConfig()
{
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Belfius::PAYMENT_METHOD_CODE
);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
3 changes: 1 addition & 2 deletions Model/ConfigProvider/Method/Billink.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class Billink extends AbstractConfigProvider
const XPATH_BILLINK_SUBTEXT_STYLE = 'payment/buckaroo_magento2_billink/subtext_style';
const XPATH_BILLINK_SUBTEXT_COLOR = 'payment/buckaroo_magento2_billink/subtext_color';
const XPATH_BILLINK_PAYMENT_FEE = 'payment/buckaroo_magento2_billink/payment_fee';
const XPATH_BILLINK_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_billink/payment_fee_label';
const XPATH_BILLINK_SEND_EMAIL = 'payment/buckaroo_magento2_billink/send_email';
const XPATH_BILLINK_ACTIVE_STATUS = 'payment/buckaroo_magento2_billink/active_status';
const XPATH_BILLINK_ORDER_STATUS_SUCCESS = 'payment/buckaroo_magento2_billink/order_status_success';
Expand Down Expand Up @@ -90,7 +89,7 @@ public function getConfig()
return [];
}

$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(BillinkMethod::PAYMENT_METHOD_CODE);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
5 changes: 1 addition & 4 deletions Model/ConfigProvider/Method/Blik.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
class Blik extends AbstractConfigProvider
{
const XPATH_BLIK_PAYMENT_FEE = 'payment/buckaroo_magento2_blik/payment_fee';
const XPATH_BLIK_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_blik/payment_fee_label';
const XPATH_BLIK_ACTIVE = 'payment/buckaroo_magento2_blik/active';
const XPATH_BLIK_SUBTEXT = 'payment/buckaroo_magento2_blik/subtext';
const XPATH_BLIK_SUBTEXT_STYLE = 'payment/buckaroo_magento2_blik/subtext_style';
Expand All @@ -50,9 +49,7 @@ class Blik extends AbstractConfigProvider
*/
public function getConfig()
{
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Blik::PAYMENT_METHOD_CODE
);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
6 changes: 1 addition & 5 deletions Model/ConfigProvider/Method/CapayableIn3.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@
use Magento\Store\Model\ScopeInterface;
use Buckaroo\Magento2\Model\Method\Capayable\Installments as CapayableIn3Method;

/**
* @method getPaymentFeeLabel()
*/
class CapayableIn3 extends AbstractConfigProvider
{
const XPATH_CAPAYABLEIN3_PAYMENT_FEE = 'payment/buckaroo_magento2_capayablein3/payment_fee';
const XPATH_CAPAYABLEIN3_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_capayablein3/payment_fee_label';
const XPATH_CAPAYABLEIN3_ACTIVE = 'payment/buckaroo_magento2_capayablein3/active';
const XPATH_CAPAYABLEIN3_SUBTEXT = 'payment/buckaroo_magento2_capayablein3/subtext';
const XPATH_CAPAYABLEIN3_SUBTEXT_STYLE = 'payment/buckaroo_magento2_capayablein3/subtext_style';
Expand Down Expand Up @@ -70,7 +66,7 @@ public function getConfig()
return [];
}

$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(CapayableIn3Method::PAYMENT_METHOD_CODE);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
6 changes: 1 addition & 5 deletions Model/ConfigProvider/Method/CapayablePostpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@
use Magento\Store\Model\ScopeInterface;
use Buckaroo\Magento2\Model\Method\Capayable\Postpay as CapayablePostpayMethod;

/**
* @method getPaymentFeeLabel()
*/
class CapayablePostpay extends AbstractConfigProvider
{
const XPATH_CAPAYABLEPOSTPAY_PAYMENT_FEE = 'payment/buckaroo_magento2_capayablepostpay/payment_fee';
const XPATH_CAPAYABLEPOSTPAY_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_capayablepostpay/payment_fee_label';
const XPATH_CAPAYABLEPOSTPAY_ACTIVE = 'payment/buckaroo_magento2_capayablepostpay/active';
const XPATH_CAPAYABLEPOSTPAY_SUBTEXT = 'payment/buckaroo_magento2_capayablepostpay/subtext';
const XPATH_CAPAYABLEPOSTPAY_SUBTEXT_STYLE = 'payment/buckaroo_magento2_capayablepostpay/subtext_style';
Expand Down Expand Up @@ -68,7 +64,7 @@ public function getConfig()
return [];
}

$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(CapayablePostpayMethod::PAYMENT_METHOD_CODE);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

return [
'payment' => [
Expand Down
6 changes: 1 addition & 5 deletions Model/ConfigProvider/Method/Creditcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace Buckaroo\Magento2\Model\ConfigProvider\Method;

/**
* @method getPaymentFeeLabel();
* @method getMaestroUnsecureHold()
* @method getMastercardUnsecureHold()
* @method getVisaUnsecureHold()
Expand All @@ -46,7 +45,6 @@ class Creditcard extends AbstractConfigProvider
/**#@-*/

const XPATH_CREDITCARD_PAYMENT_FEE = 'payment/buckaroo_magento2_creditcard/payment_fee';
const XPATH_CREDITCARD_PAYMENT_FEE_LABEL = 'payment/buckaroo_magento2_creditcard/payment_fee_label';
const XPATH_CREDITCARD_ACTIVE = 'payment/buckaroo_magento2_creditcard/active';
const XPATH_CREDITCARD_SUBTEXT = 'payment/buckaroo_magento2_creditcard/subtext';
const XPATH_CREDITCARD_SUBTEXT_STYLE = 'payment/buckaroo_magento2_creditcard/subtext_style';
Expand Down Expand Up @@ -179,9 +177,7 @@ public function formatIssuers()
public function getConfig()
{
$issuers = $this->formatIssuers();
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel(
\Buckaroo\Magento2\Model\Method\Creditcard::PAYMENT_METHOD_CODE
);
$paymentFeeLabel = $this->getBuckarooPaymentFeeLabel();

$selectionType = $this->scopeConfig->getValue(
self::XPATH_SELECTION_TYPE,
Expand Down
Loading

0 comments on commit 09d92e3

Please sign in to comment.