Test Failed
Push — develop ( 19382a...671140 )
by Reüel
02:30
created

src/Settings.php (6 issues)

1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet;
4
5
use Pronamic\WordPress\Pay\Core\GatewaySettings;
6
7
/**
8
 * Title: ING Kassa Compleet 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
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['ing_kassa_compleet'] = array(
26
			'title'       => __( 'ING Kassa Compleet', 'pronamic_ideal' ),
0 ignored issues
show
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 */ __( 'ING Kassa Compleet', 'pronamic_ideal' ),
Loading history...
27
			'methods'     => array( 'ing_kassa_compleet' ),
28
			'description' => sprintf(
29
				/* translators: 1: ING */
30
				__( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ),
31
				__( 'ING', 'pronamic_ideal' )
32
			),
33
		);
34
35
		// Transaction feedback
36
		$sections['ing_kassa_compleet_feedback'] = array(
37
			'title'       => __( 'Transaction feedback', 'pronamic_ideal' ),
38
			'methods'     => array( 'ing_kassa_compleet' ),
39
			'description' => sprintf(
40
				/* translators: %s: ING Kassa Compleet */
41
				__( 'Set the Webhook URL in the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ),
42
				__( 'ING Kassa Compleet', 'pronamic_ideal' )
43
			),
44
		);
45
46
		// Return sections
47
		return $sections;
48
	}
49
50
	public function fields( array $fields ) {
51
		// API Key
52
		$fields[] = array(
53
			'filter'   => FILTER_SANITIZE_STRING,
54
			'section'  => 'ing_kassa_compleet',
55
			'meta_key' => '_pronamic_gateway_ing_kassa_compleet_api_key',
56
			'title'    => _x( 'API Key', 'ing_kassa_compleet', 'pronamic_ideal' ),
0 ignored issues
show
The function _x 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

56
			'title'    => /** @scrutinizer ignore-call */ _x( 'API Key', 'ing_kassa_compleet', 'pronamic_ideal' ),
Loading history...
57
			'type'     => 'text',
58
			'classes'  => array( 'regular-text', 'code' ),
59
			'methods'  => array( 'ing_kassa_compleet' ),
60
			'tooltip'  => sprintf(
61
				'%s %s.',
62
				__( 'API key', 'pronamic_ideal' ),
0 ignored issues
show
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

62
				/** @scrutinizer ignore-call */ 
63
    __( 'API key', 'pronamic_ideal' ),
Loading history...
63
				sprintf(
64
					/* translators: %s: ING Kassa Compleet */
65
					__( 'as mentioned in the %s dashboard', 'pronamic_ideal' ),
66
					__( 'ING Kassa Compleet', 'pronamic_ideal' )
67
				)
68
			),
69
		);
70
71
		// Transaction feedback
72
		$fields[] = array(
73
			'section' => 'ing_kassa_compleet',
74
			'methods' => array( 'ing_kassa_compleet' ),
75
			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
76
			'type'    => 'description',
77
			'html'    => sprintf(
78
				'<span class="dashicons dashicons-warning"></span> %s',
79
				__( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' )
80
			),
81
		);
82
83
		// Webhook URL
84
		$fields[] = array(
85
			'section'  => 'ing_kassa_compleet_feedback',
86
			'title'    => __( 'Webhook URL', 'pronamic_ideal' ),
87
			'type'     => 'text',
88
			'classes'  => array( 'large-text', 'code' ),
89
			'value'    => add_query_arg( 'ing_kassa_compleet_webhook', '', home_url( '/' ) ),
0 ignored issues
show
The function home_url 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

89
			'value'    => add_query_arg( 'ing_kassa_compleet_webhook', '', /** @scrutinizer ignore-call */ home_url( '/' ) ),
Loading history...
The function add_query_arg 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

89
			'value'    => /** @scrutinizer ignore-call */ add_query_arg( 'ing_kassa_compleet_webhook', '', home_url( '/' ) ),
Loading history...
90
			'readonly' => true,
91
			'tooltip'  => sprintf(
92
				/* translators: %s: ING Kassa Compleet */
93
				__( 'Copy the Webhook URL to the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ),
94
				__( 'ING Kassa Compleet', 'pronamic_ideal' )
95
			),
96
		);
97
98
		// Return fields
99
		return $fields;
100
	}
101
}
102