Skip to content

Commit

Permalink
Merge pull request #835 from buckaroo-it/BP-2374-advanced-configuration
Browse files Browse the repository at this point in the history
BP-2374 advanced configuration
  • Loading branch information
LucianTuriacArnia authored Oct 25, 2023
2 parents 0f89152 + c4ef2eb commit 23f1fde
Show file tree
Hide file tree
Showing 49 changed files with 1 addition and 752 deletions.
88 changes: 0 additions & 88 deletions Gateway/Validator/AvailableBasedOnIPValidator.php

This file was deleted.

26 changes: 0 additions & 26 deletions Logging/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,6 @@ public function __construct(DebugConfiguration $debugConfiguration)
$this->debugConfiguration = $debugConfiguration;
}

/**
* Mail the debug message to the debug recipients
*
* @return void
*/
public function mailMessage()
{
$debugEmails = $this->debugConfiguration->getDebugEmails();
$message = $this->getMessageAsString();

if (count($debugEmails) <= 0 || !$message) {
return;
}

$headers = 'From: ' . $this->getMailFrom() . "\r\n" .
'Reply-To: ' . $this->getMailFrom() . "\r\n" .
'X-Mailer: PHP/' . phpversion();

foreach ($debugEmails as $mailTo) {
//@codingStandardsIgnoreLine
mail($mailTo, $this->getMailSubject(), $message, $headers);
}

$this->resetMessage();
}

/**
* Reset the message
*
Expand Down
106 changes: 0 additions & 106 deletions Model/Checks/CanUseForIP.php

This file was deleted.

34 changes: 0 additions & 34 deletions Model/ConfigProvider/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class Account extends AbstractConfigProvider
public const XPATH_ACCOUNT_LOG_HANDLER = 'buckaroo_magento2/account/log_handler';
public const XPATH_ACCOUNT_LOG_DBTRACE_DEPTH = 'buckaroo_magento2/account/log_handler_db_depth';
public const XPATH_ACCOUNT_LOG_RETENTION = 'buckaroo_magento2/account/log_retention';
public const XPATH_ACCOUNT_DEBUG_EMAIL = 'buckaroo_magento2/account/debug_email';
public const XPATH_ACCOUNT_LIMIT_BY_IP = 'buckaroo_magento2/account/limit_by_ip';
public const XPATH_ACCOUNT_FEE_PERCENTAGE_MODE = 'buckaroo_magento2/account/fee_percentage_mode';
public const XPATH_ACCOUNT_PAYMENT_FEE_LABEL = 'buckaroo_magento2/account/payment_fee_label';
public const XPATH_ACCOUNT_ORDER_STATUS_NEW = 'buckaroo_magento2/account/order_status_new';
Expand Down Expand Up @@ -113,10 +111,8 @@ public function getConfig($store = null): array
'failure_redirect_to_checkout' => $this->getFailureRedirectToCheckout($store),
'cancel_on_failed' => $this->getCancelOnFailed($store),
'debug_types' => $this->getLogLevel($store),
'debug_email' => $this->getDebugEmail($store),
'log_handler' => $this->getLogHandler($store),
'log_retention' => $this->getLogRetention($store),
'limit_by_ip' => $this->getLimitByIp($store),
'fee_percentage_mode' => $this->getFeePercentageMode($store),
'payment_fee_label' => $this->getPaymentFeeLabel($store),
'order_status_new' => $this->getOrderStatusNew($store),
Expand Down Expand Up @@ -494,36 +490,6 @@ public function getLogRetention($store = null)
);
}

/**
* Get comma-separated emails where debug information will be sent
*
* @param null|int|string $store
* @return mixed
*/
public function getDebugEmail($store = null)
{
return $this->scopeConfig->getValue(
self::XPATH_ACCOUNT_DEBUG_EMAIL,
ScopeInterface::SCOPE_STORE,
$store
);
}

/**
* Display only for selected IPs
*
* @param null|int|string $store
* @return mixed
*/
public function getLimitByIp($store = null)
{
return $this->scopeConfig->getValue(
self::XPATH_ACCOUNT_LIMIT_BY_IP,
ScopeInterface::SCOPE_STORE,
$store
);
}

/**
* Get Fee percentage mode (Subtotal/Subtotal incl. tax)
*
Expand Down
19 changes: 0 additions & 19 deletions Model/ConfigProvider/DebugConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,6 @@ public function getLogLevel()
return (string)$this->accountConfig->getLogLevel();
}

/**
* Get array of emails where debug information will be sent
*
* @return array
*/
public function getDebugEmails(): array
{
$debugEmails = $this->accountConfig->getDebugEmail();
if (!is_scalar($debugEmails)) {
return [];
}

$debugEmails = explode(',', preg_replace('/\s+/', '', (string)$debugEmails));

return array_filter($debugEmails, function ($debugEmail) {
return filter_var($debugEmail, FILTER_VALIDATE_EMAIL);
});
}

/**
* Is Logger active
*
Expand Down
12 changes: 0 additions & 12 deletions Model/ConfigProvider/Method/AbstractConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ abstract class AbstractConfigProvider extends BaseAbstractConfigProvider impleme
public const XPATH_ACTIVE_STATUS = 'active_status';
public const XPATH_ORDER_STATUS_SUCCESS = 'order_status_success';
public const XPATH_ORDER_STATUS_FAILED = 'order_status_failed';
public const XPATH_LIMIT_BY_IP = 'limit_by_ip';

public const XPATH_ALLOWED_CURRENCIES = 'allowed_currencies';
public const XPATH_ALLOW_SPECIFIC = 'allowspecific';
Expand Down Expand Up @@ -456,17 +455,6 @@ public function getOrderStatusFailed($store = null)
return $this->getMethodConfigValue(static::XPATH_ORDER_STATUS_FAILED, $store);
}

/**
* Get Limit By IP
*
* @param null|int|string $store
* @return mixed|null
*/
public function getLimitByIp($store = null)
{
return $this->getMethodConfigValue(static::XPATH_LIMIT_BY_IP, $store);
}

/**
* Get subtext
*
Expand Down
Loading

0 comments on commit 23f1fde

Please sign in to comment.