2020-04-02 08:38:00 +03:00
|
|
|
<?php
|
2020-04-28 12:31:12 +03:00
|
|
|
|
2020-04-02 08:38:00 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Inpsyde\PayPalCommerce\WcGateway;
|
|
|
|
|
2020-07-10 15:45:49 +03:00
|
|
|
use Inpsyde\Woocommerce\Logging\Logger\NullLogger;
|
|
|
|
use Inpsyde\Woocommerce\Logging\Logger\WooCommerceLogger;
|
2020-07-02 12:48:40 +03:00
|
|
|
use Psr\Container\ContainerInterface;
|
2020-07-10 15:45:49 +03:00
|
|
|
use Psr\Log\LoggerInterface;
|
2020-07-02 12:48:40 +03:00
|
|
|
|
2020-04-02 08:38:00 +03:00
|
|
|
return [
|
2020-06-30 11:03:57 +03:00
|
|
|
|
2020-07-02 12:48:40 +03:00
|
|
|
'api.merchant_email' => static function (ContainerInterface $container): string {
|
2020-06-30 11:03:57 +03:00
|
|
|
$settings = $container->get('wcgateway.settings');
|
|
|
|
return $settings->has('merchant_email') ? (string) $settings->get('merchant_email') : '';
|
|
|
|
},
|
2020-07-02 12:48:40 +03:00
|
|
|
'api.merchant_id' => static function (ContainerInterface $container): string {
|
2020-06-30 11:03:57 +03:00
|
|
|
$settings = $container->get('wcgateway.settings');
|
|
|
|
return $settings->has('merchant_id') ? (string) $settings->get('merchant_id') : '';
|
|
|
|
},
|
2020-07-02 12:48:40 +03:00
|
|
|
'api.partner_merchant_id' => static function (): string {
|
2020-06-30 11:03:57 +03:00
|
|
|
// ToDo: Replace with the real merchant id of platform
|
|
|
|
return 'KQ8FCM66JFGDL';
|
|
|
|
},
|
2020-07-02 12:48:40 +03:00
|
|
|
'api.key' => static function (ContainerInterface $container): string {
|
2020-06-30 11:03:57 +03:00
|
|
|
$settings = $container->get('wcgateway.settings');
|
|
|
|
$key = $settings->has('client_id') ? (string) $settings->get('client_id') : '';
|
|
|
|
return $key;
|
|
|
|
},
|
2020-07-02 12:48:40 +03:00
|
|
|
'api.secret' => static function (ContainerInterface $container): string {
|
2020-06-30 11:03:57 +03:00
|
|
|
$settings = $container->get('wcgateway.settings');
|
|
|
|
return $settings->has('client_secret') ? (string) $settings->get('client_secret') : '';
|
|
|
|
},
|
2020-07-10 15:45:49 +03:00
|
|
|
'woocommerce.logger.woocommerce' => function (ContainerInterface $container): LoggerInterface {
|
|
|
|
$settings = $container->get('wcgateway.settings');
|
|
|
|
if (! $settings->has('logging_enabled') || ! $settings->get('logging_enabled')) {
|
|
|
|
return new NullLogger();
|
|
|
|
}
|
|
|
|
|
|
|
|
$source = $container->get('woocommerce.logger.source');
|
|
|
|
return new WooCommerceLogger(
|
|
|
|
wc_get_logger(),
|
|
|
|
$source
|
|
|
|
);
|
|
|
|
},
|
2020-04-02 08:38:00 +03:00
|
|
|
];
|