Test Failed
Push — develop ( 038caf...6d438f )
by Reüel
03:03
created

Settings::sections()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa;
4
5
use Pronamic\WordPress\Pay\Core\GatewaySettings;
6
7
/**
8
 * Title: iDEAL gateway settings
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.0
15
 * @since   1.0.0
16
 */
17
class Settings extends GatewaySettings {
18
	public function __construct() {
19
		add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
0 ignored issues
show
Bug introduced by
The function add_filter was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
		/** @scrutinizer ignore-call */ 
20
  add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
Loading history...
20
		add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) );
21
	}
22
23
	public function sections( array $sections ) {
24
		// iDEAL
25
		$sections['omnikassa'] = array(
26
			'title'   => __( 'OmniKassa', 'pronamic_ideal' ),
0 ignored issues
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
			'title'   => /** @scrutinizer ignore-call */ __( 'OmniKassa', 'pronamic_ideal' ),
Loading history...
27
			'methods' => array( 'omnikassa' ),
28
		);
29
30
		// Advanced
31
		$sections['omnikassa_advanced'] = array(
32
			'title'   => __( 'Advanced', 'pronamic_ideal' ),
33
			'methods' => array( 'omnikassa' ),
34
		);
35
36
		return $sections;
37
	}
38
39
	public function fields( array $fields ) {
40
		// Merchant ID
41
		$fields[] = array(
42
			'filter'   => FILTER_SANITIZE_STRING,
43
			'section'  => 'omnikassa',
44
			'meta_key' => '_pronamic_gateway_omnikassa_merchant_id',
45
			'title'    => __( 'Merchant ID', 'pronamic_ideal' ),
0 ignored issues
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
			'title'    => /** @scrutinizer ignore-call */ __( 'Merchant ID', 'pronamic_ideal' ),
Loading history...
46
			'type'     => 'text',
47
			'classes'  => array( 'code' ),
48
		);
49
50
		// Secret Key
51
		$fields[] = array(
52
			'filter'   => FILTER_SANITIZE_STRING,
53
			'section'  => 'omnikassa',
54
			'meta_key' => '_pronamic_gateway_omnikassa_secret_key',
55
			'title'    => __( 'Secret Key', 'pronamic_ideal' ),
56
			'type'     => 'text',
57
			'classes'  => array( 'large-text', 'code' ),
58
		);
59
60
		// Key Version
61
		$fields[] = array(
62
			'filter'      => FILTER_SANITIZE_STRING,
63
			'section'     => 'omnikassa',
64
			'meta_key'    => '_pronamic_gateway_omnikassa_key_version',
65
			'title'       => __( 'Key Version', 'pronamic_ideal' ),
66
			'type'        => 'text',
67
			'classes'     => array( 'code' ),
68
			'size'        => 5,
69
			'description' => sprintf( __( 'You can find the key version in the <a href="%s" target="_blank">OmniKassa Download Dashboard</a>.', 'pronamic_ideal' ), 'https://download.omnikassa.rabobank.nl/' ),
70
		);
71
72
		// Transaction feedback
73
		$fields[] = array(
74
			'section' => 'omnikassa',
75
			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
76
			'type'    => 'description',
77
			'html'    => sprintf(
78
				'<span class="dashicons dashicons-yes"></span> %s',
79
				__( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' )
80
			),
81
		);
82
83
		// Purchase ID
84
		$fields[] = array(
85
			'filter'      => FILTER_SANITIZE_STRING,
86
			'section'     => 'omnikassa_advanced',
87
			'meta_key'    => '_pronamic_gateway_omnikassa_order_id',
88
			'title'       => __( 'Order ID', 'pronamic_ideal' ),
89
			'type'        => 'text',
90
			'classes'     => array( 'regular-text', 'code' ),
91
			'tooltip'     => sprintf(
92
				__( 'The OmniKassa %s parameter.', 'pronamic_ideal' ),
93
				sprintf( '<code>%s</code>', 'orderId' )
94
			),
95
			'description' => sprintf(
96
				'%s %s<br />%s',
97
				__( 'Available tags:', 'pronamic_ideal' ),
98
				sprintf(
99
					'<code>%s</code> <code>%s</code>',
100
					'{order_id}',
101
					'{payment_id}'
102
				),
103
				sprintf(
104
					__( 'Default: <code>%s</code>', 'pronamic_ideal' ),
105
					'{payment_id}'
106
				)
107
			),
108
		);
109
110
		return $fields;
111
	}
112
}
113