Passed
Push — develop ( 511324...a79f51 )
by Remco
02:29
created

Settings::fields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 26
c 0
b 0
f 0
rs 9.6333
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Settings
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2018 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Adyen
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
12
13
use Pronamic\WordPress\Pay\Core\GatewaySettings;
14
15
/**
16
 * Settings
17
 *
18
 * @author  Remco Tolsma
19
 * @version 2.0.0
20
 * @since   2.0.0
21
 */
22
class Settings extends GatewaySettings {
23
	/**
24
	 * Constructs and initialize settings.
25
	 */
26
	public function __construct() {
27
		add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
28
		add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) );
29
	}
30
31
	/**
32
	 * Sections.
33
	 *
34
	 * @param array $sections Sections.
35
	 * @return array
36
	 */
37
	public function sections( array $sections ) {
38
		$sections['adyen'] = array(
39
			'title'   => __( 'Adyen', 'pronamic_ideal' ),
40
			'methods' => array( 'adyen' ),
41
		);
42
43
		return $sections;
44
	}
45
46
	/**
47
	 * Fields.
48
	 *
49
	 * @param array $fields Fields.
50
	 * @return array
51
	 */
52
	public function fields( array $fields ) {
53
		// API Key.
54
		$fields[] = array(
55
			'filter'   => FILTER_SANITIZE_STRING,
56
			'section'  => 'adyen',
57
			'meta_key' => '_pronamic_gateway_adyen_api_key',
58
			'title'    => _x( 'API Key', 'adyen', 'pronamic_ideal' ),
59
			'type'     => 'text',
60
			'classes'  => array( 'regular-text', 'code' ),
61
			'methods'  => array( 'adyen' ),
62
			'tooltip'  => __( 'API key as mentioned in the payment provider dashboard', 'pronamic_ideal' ),
63
		);
64
65
		// Merchant Account.
66
		$fields[] = array(
67
			'filter'   => FILTER_SANITIZE_STRING,
68
			'section'  => 'adyen',
69
			'meta_key' => '_pronamic_gateway_adyen_merchant_account',
70
			'title'    => _x( 'Merchant Account', 'adyen', 'pronamic_ideal' ),
71
			'type'     => 'text',
72
			'classes'  => array( 'regular-text', 'code' ),
73
			'methods'  => array( 'adyen' ),
74
			'tooltip'  => __( 'The merchant account identifier, with which you want to process the transaction', 'pronamic_ideal' ),
75
		);
76
77
		return $fields;
78
	}
79
}
80