PluginProbe
MONEI Payments for WooCommerce / 7.1.3
MONEI Payments for WooCommerce v7.1.3
7.3.3 7.3.2 7.3.1 7.3.0 7.2.4 7.2.3 7.2.2 7.2.0 7.2.1 7.1.3 2.1.0 3.0.0 3.1.0 3.1.1 4.0.0 4.1.0 4.1.1 4.2.0 4.2.1 5.0 5.1.0 5.1.1 5.1.2 5.2.2 5.2.3 All 87 releases
monei / src / Services / sdk / MoneiSdkClientFactory.php

MoneiSdkClientFactory.php in MONEI Payments for WooCommerce 7.1.3, at src/Services/sdk/MoneiSdkClientFactory.php

35 lines 901 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Monei\Services\sdk;
4
5 use Monei\Configuration;
6 use Monei\MoneiClient;
7 use Monei\Services\ApiKeyService;
8
9 class MoneiSdkClientFactory {
10 private ApiKeyService $apiKeyService;
11 private $client;
12
13 public function __construct( ApiKeyService $apiKeyService ) {
14 $this->apiKeyService = $apiKeyService;
15 $this->client = null;
16 }
17
18 /**
19 * @return MoneiClient
20 */
21 public function get_client() {
22 if ( $this->client === null ) {
23 include_once WC_Monei()->plugin_path() . '/vendor/autoload.php';
24 $config = Configuration::getDefaultConfiguration();
25 $this->client = new MoneiClient( $this->apiKeyService->get_api_key(), $config );
26 $this->client->setUserAgent(
27 'MONEI/WooCommerce/' . WC_Monei()->version .
28 ' (WordPress v' . get_bloginfo( 'version' ) .
29 '; Woo v' . WC()->version .
30 '; PHP v' . phpversion() . ')'
31 ); }
32 return $this->client;
33 }
34 }
35