-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathConfigReader.php
More file actions
74 lines (58 loc) · 3.42 KB
/
ConfigReader.php
File metadata and controls
74 lines (58 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
declare(strict_types=1);
namespace UnzerPayment6\Components\ConfigReader;
use Shopware\Core\System\SystemConfig\SystemConfigService;
use UnzerPayment6\Components\Struct\Configuration;
class ConfigReader implements ConfigReaderInterface
{
/** @var string */
public const SYSTEM_CONFIG_DOMAIN = 'UnzerPayment6.settings.';
public const CONFIG_KEY_PUBLIC_KEY = 'publicKey';
public const CONFIG_KEY_PRIVATE_KEY = 'privateKey';
public const CONFIG_KEY_TEST_DATA = 'testData';
public const CONFIG_KEY_EXTENDED_LOGGING = 'extendedLogging';
public const CONFIG_KEY_BOOKING_MODE_CARD = 'bookingModeCreditCard';
public const CONFIG_KEY_BOOKING_MODE_PAYPAL = 'bookingModePayPal';
public const CONFIG_KEY_BOOKING_MODE_APPLE_PAY = 'bookingModeApplePay';
public const CONFIG_KEY_APPLE_PAY_PAYMENT_PROCESSING_CERTIFICATE_ID = 'applePayPaymentProcessingCertificateId';
public const CONFIG_KEY_APPLE_PAY_MERCHANT_IDENTIFICATION_CERTIFICATE_ID = 'applePayMerchantIdentificationCertificateId';
public const CONFIG_KEY_APPLE_PAY_MERCHANT_IDENTIFIER = 'applePayMerchantIdentifier';
public const CONFIG_KEY_PAYLATER_INSTALLMENT = 'paylaterInstallment';
public const CONFIG_KEY_PAYLATER_INVOICE = 'paylaterInvoice';
public const CONFIG_KEY_PAYLATER_DIRECT_DEBIT_SECURED = 'paylaterDirectDebitSecured';
public const CONFIG_KEY_SHIPPING_STATUS = 'statusForAutomaticShippingNotification';
public const CONFIG_KEY_GOOGLE_PAY_BOOKING_MODE = 'googlePayBookingMode';
public const CONFIG_KEY_GOOGLE_PAY_MERCHANT_ID = 'googlePayMerchantId';
public const CONFIG_KEY_GOOGLE_PAY_MERCHANT_NAME = 'googlePayMerchantName';
public const CONFIG_KEY_GOOGLE_PAY_CHANNEL_ID = 'googlePayChannelId';
public const CONFIG_KEY_GOOGLE_PAY_COUNTRY_CODE = 'googlePayCountryCode';
public const CONFIG_KEY_GOOGLE_PAY_CREDIT_CARDS_ALLOWED = 'googlePayCreditCardsAllowed';
public const CONFIG_KEY_GOOGLE_PAY_PREPAID_CARDS_ALLOWED = 'googlePayPrepaidCardsAllowed';
public const CONFIG_KEY_GOOGLE_PAY_CARD_NETWORKS = 'googlePayCardNetworks';
public const CONFIG_KEY_GOOGLE_PAY_BUTTON_COLOR = 'googlePayButtonColor';
public const CONFIG_KEY_GOOGLE_PAY_BUTTON_SIZE_MODE = 'googlePayButtonSizeMode';
public const CONFIG_KEY_PAYPAL_SHOW_SAVE_ACCOUNT = 'paypalShowSaveAccount';
public const CONFIG_KEY_DELIVERY_STATUS_FOR_CAPTURE = 'deliveryStatusForAutomaticCapture';
public const CONFIG_KEY_DELIVERY_STATUS_FOR_REFUND = 'deliveryStatusForAutomaticRefund';
private SystemConfigService $systemConfigService;
public function __construct(SystemConfigService $systemConfigService)
{
$this->systemConfigService = $systemConfigService;
}
public function read(string $salesChannelId = '', bool $fallback = true): Configuration
{
$values = $this->systemConfigService->getDomain(
self::SYSTEM_CONFIG_DOMAIN,
$salesChannelId,
$fallback
);
$config = [];
foreach ($values as $key => $value) {
$property = substr($key, strlen(self::SYSTEM_CONFIG_DOMAIN));
if (!empty($property)) {
$config[$property] = $value;
}
}
return new Configuration($config);
}
}