Test Failed
Push — develop ( 98e16c...e3bb23 )
by Reüel
02:40
created

src/Settings.php (5 issues)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Buckaroo;
4
5
use Pronamic\WordPress\Pay\Core\GatewaySettings;
6
7
/**
8
 * Title: Buckaroo 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.2.1
16
 */
17
class Settings extends GatewaySettings {
18
	/**
19
	 * Settings constructor.
20
	 */
21
	public function __construct() {
22
		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

22
		/** @scrutinizer ignore-call */ 
23
  add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
Loading history...
23
		add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) );
24
	}
25
26
	/**
27
	 * Sections.
28
	 *
29
	 * @param array $sections Sections.
30
	 *
31
	 * @return array
32
	 */
33
	public function sections( array $sections ) {
34
		// Buckaroo.
35
		$sections['buckaroo'] = array(
36
			'title'       => __( 'Buckaroo', '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

36
			'title'       => /** @scrutinizer ignore-call */ __( 'Buckaroo', 'pronamic_ideal' ),
Loading history...
37
			'methods'     => array( 'buckaroo' ),
38
			'description' => sprintf(
39
				/* translators: %s: Buckaroo */
40
				__( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ),
41
				__( 'Buckaroo', 'pronamic_ideal' )
42
			),
43
		);
44
45
		$sections['buckaroo_advanced'] = array(
46
			'title'       => __( 'Advanced', 'pronamic_ideal' ),
47
			'methods'     => array( 'buckaroo' ),
48
			'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ),
49
		);
50
51
		// Transaction feedback.
52
		$sections['buckaroo_feedback'] = array(
53
			'title'       => __( 'Transaction feedback', 'pronamic_ideal' ),
54
			'methods'     => array( 'buckaroo' ),
55
			'description' => __( 'Payment status updates will be processed without any additional configuration. The <em>Push URL</em> is being used to receive the status updates.', 'pronamic_ideal' ),
56
		);
57
58
		return $sections;
59
	}
60
61
	/**
62
	 * Fields.
63
	 *
64
	 * @param array $fields Fields.
65
	 *
66
	 * @return array
67
	 */
68
	public function fields( array $fields ) {
69
		// Website Key.
70
		$fields[] = array(
71
			'filter'   => FILTER_SANITIZE_STRING,
72
			'section'  => 'buckaroo',
73
			'meta_key' => '_pronamic_gateway_buckaroo_website_key',
74
			'title'    => __( 'Website 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

74
			'title'    => /** @scrutinizer ignore-call */ __( 'Website Key', 'pronamic_ideal' ),
Loading history...
75
			'type'     => 'text',
76
			'classes'  => array( 'code' ),
77
			'tooltip'  => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ),
78
		);
79
80
		// Secret Key.
81
		$fields[] = array(
82
			'filter'   => FILTER_SANITIZE_STRING,
83
			'section'  => 'buckaroo',
84
			'meta_key' => '_pronamic_gateway_buckaroo_secret_key',
85
			'title'    => __( 'Secret Key', 'pronamic_ideal' ),
86
			'type'     => 'text',
87
			'classes'  => array( 'regular-text', 'code' ),
88
			'tooltip'  => __( 'Secret key as mentioned in the Buckaroo dashboardb on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ),
89
		);
90
91
		// Transaction feedback.
92
		$fields[] = array(
93
			'section' => 'buckaroo',
94
			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
95
			'type'    => 'description',
96
			'html'    => sprintf(
97
				'<span class="dashicons dashicons-yes"></span> %s',
98
				__( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' )
99
			),
100
		);
101
102
		// Excluded services.
103
		$fields[] = array(
104
			'filter'   => FILTER_SANITIZE_STRING,
105
			'section'  => 'buckaroo_advanced',
106
			'meta_key' => '_pronamic_gateway_buckaroo_excluded_services',
107
			'title'    => __( 'Excluded services', 'pronamic_ideal' ),
108
			'type'     => 'text',
109
			'classes'  => array( 'regular-text', 'code' ),
110
			'tooltip'  => sprintf(
111
				/* translators: %s: <code>brq_exludedservices</code> */
112
				__( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ),
113
				sprintf( '<code>%s</code>', 'brq_exludedservices' )
114
			),
115
		);
116
117
		// Invoice number.
118
		$fields[] = array(
119
			'filter'      => FILTER_SANITIZE_STRING,
120
			'section'     => 'buckaroo_advanced',
121
			'meta_key'    => '_pronamic_gateway_buckaroo_invoice_number',
122
			'title'       => __( 'Invoice number', 'pronamic_ideal' ),
123
			'type'        => 'text',
124
			'classes'     => array( 'regular-text', 'code' ),
125
			'tooltip'     => sprintf(
126
				/* translators: %s: <code>brq_invoicenumber</code> */
127
				__( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ),
128
				sprintf( '<code>%s</code>', 'brq_invoicenumber' )
129
			),
130
			'description' => sprintf(
131
				'%s<br />%s',
132
				/* translators: %s: <code>{order_id}</code> <code>{payment_id}</code> */
133
				sprintf( __( 'Available tags: %s', 'pronamic_ideal' ), sprintf( '<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}' ) ),
134
				/* translators: %s: <code>{payment_id}</code> */
135
				sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), '{payment_id}' )
136
			),
137
		);
138
139
		// Push URL.
140
		$fields[] = array(
141
			'section'  => 'buckaroo_feedback',
142
			'title'    => __( 'Push URL', 'pronamic_ideal' ),
143
			'type'     => 'text',
144
			'classes'  => array( 'large-text', 'code' ),
145
			'value'    => add_query_arg( 'buckaroo_push', '', home_url( '/' ) ),
0 ignored issues
show
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

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

145
			'value'    => add_query_arg( 'buckaroo_push', '', /** @scrutinizer ignore-call */ home_url( '/' ) ),
Loading history...
146
			'readonly' => true,
147
			'tooltip'  => __( 'The Push URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ),
148
		);
149
150
		return $fields;
151
	}
152
}
153