Failed Conditions
Push — develop ( a3bd71...4b51d2 )
by Remco
03:45
created

Integration::get_settings_class()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Integration.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet;
12
13
use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration;
14
15
/**
16
 * Title: ING Kassa Compleet integration
17
 * Description:
18
 * Copyright: 2005-2019 Pronamic
19
 * Company: Pronamic
20
 *
21
 * @author  Reüel van der Steege
22
 * @version 2.0.0
23
 * @since   1.0.0
24
 */
25
class Integration extends AbstractIntegration {
26
	/**
27
	 * Integration constructor.
28
	 */
29
	public function __construct() {
30
		$this->id            = 'ing-kassa-compleet';
31
		$this->name          = 'ING - Kassa Compleet';
32
		$this->provider      = 'ing';
33
		$this->product_url   = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/kassa-compleet/';
34
		$this->dashboard_url = 'https://portal.kassacompleet.nl/';
35
36
		// Actions.
37
		$function = array( __NAMESPACE__ . '\Listener', 'listen' );
38
39
		if ( ! has_action( 'wp_loaded', $function ) ) {
40
			add_action( 'wp_loaded', $function );
41
		}
42
	}
43
44
	/**
45
	 * Get config factory class.
46
	 *
47
	 * @return string
48
	 */
49
	public function get_config_factory_class() {
50
		return __NAMESPACE__ . '\ConfigFactory';
51
	}
52
53
	/**
54
	 * Get settings fields.
55
	 *
56
	 * @return array
57
	 */
58
	public function get_settings_fields() {
59
		$fields = array();
60
61
		// API Key.
62
		$fields[] = array(
63
			'section'  => 'general',
64
			'filter'   => FILTER_SANITIZE_STRING,
65
			'meta_key' => '_pronamic_gateway_ing_kassa_compleet_api_key',
66
			'title'    => _x( 'API Key', 'ing_kassa_compleet', 'pronamic_ideal' ),
67
			'type'     => 'text',
68
			'classes'  => array( 'regular-text', 'code' ),
69
			'methods'  => array( 'ing_kassa_compleet' ),
70
			'tooltip'  => sprintf(
71
				'%s %s.',
72
				__( 'API key', 'pronamic_ideal' ),
73
				sprintf(
74
					/* translators: %s: ING Kassa Compleet */
75
					__( 'as mentioned in the %s dashboard', 'pronamic_ideal' ),
76
					__( 'ING Kassa Compleet', 'pronamic_ideal' )
77
				)
78
			),
79
		);
80
81
		// Webhook URL.
82
		$fields[] = array(
83
			'section'  => 'feedback',
84
			'title'    => __( 'Webhook URL', 'pronamic_ideal' ),
85
			'type'     => 'text',
86
			'classes'  => array( 'large-text', 'code' ),
87
			'value'    => add_query_arg( 'ing_kassa_compleet_webhook', '', home_url( '/' ) ),
88
			'readonly' => true,
89
			'tooltip'  => sprintf(
90
				/* translators: %s: ING Kassa Compleet */
91
				__( 'Copy the Webhook URL to the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ),
92
				__( 'ING Kassa Compleet', 'pronamic_ideal' )
93
			),
94
		);
95
96
		return $fields;
97
	}
98
}
99