Test Failed
Push — master ( e1fb16...2c0485 )
by Reüel
04:54
created

src/Settings.php (5 issues)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Icepay;
4
5
use Pronamic\WordPress\Pay\Core\GatewaySettings;
6
7
/**
8
 * Title: ICEPAY 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['icepay'] = array(
26
			'title'       => __( 'ICEPAY', '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 */ __( 'ICEPAY', 'pronamic_ideal' ),
Loading history...
27
			'methods'     => array( 'icepay' ),
28
			'description' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ),
29
		);
30
31
		// Advanced
32
		$sections['icepay_advanced'] = array(
33
			'title'       => __( 'Advanced', 'pronamic_ideal' ),
34
			'methods'     => array( 'icepay' ),
35
			'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ),
36
		);
37
38
		// Transaction feedback
39
		$sections['icepay_feedback'] = array(
40
			'title'       => __( 'Transaction feedback', 'pronamic_ideal' ),
41
			'methods'     => array( 'icepay' ),
42
			'description' => __( 'Set the below URLs in the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ),
43
		);
44
45
		return $sections;
46
	}
47
48
	public function fields( array $fields ) {
49
		// Merchant ID
50
		$fields[] = array(
51
			'filter'   => FILTER_SANITIZE_STRING,
52
			'section'  => 'icepay',
53
			'meta_key' => '_pronamic_gateway_icepay_merchant_id',
54
			'title'    => _x( 'Merchant ID', 'icepay', '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

54
			'title'    => /** @scrutinizer ignore-call */ _x( 'Merchant ID', 'icepay', 'pronamic_ideal' ),
Loading history...
55
			'type'     => 'text',
56
			'tooltip'  => __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', '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

56
			'tooltip'  => /** @scrutinizer ignore-call */ __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ),
Loading history...
57
		);
58
59
		// Secret Code
60
		$fields[] = array(
61
			'filter'   => FILTER_SANITIZE_STRING,
62
			'section'  => 'icepay',
63
			'meta_key' => '_pronamic_gateway_icepay_secret_code',
64
			'title'    => _x( 'Secret Code', 'icepay', 'pronamic_ideal' ),
65
			'type'     => 'text',
66
			'classes'  => array( 'regular-text', 'code' ),
67
			'tooltip'  => __( 'Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ),
68
		);
69
70
		// Transaction feedback
71
		$fields[] = array(
72
			'section' => 'icepay',
73
			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
74
			'type'    => 'description',
75
			'html'    => sprintf(
76
				'<span class="dashicons dashicons-warning"></span> %s',
77
				__( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' )
78
			),
79
		);
80
81
		// Purchase ID
82
		$fields[] = array(
83
			'filter'      => array(
84
				'filter' => FILTER_SANITIZE_STRING,
85
				'flags'  => FILTER_FLAG_NO_ENCODE_QUOTES,
86
			),
87
			'section'     => 'icepay_advanced',
88
			'meta_key'    => '_pronamic_gateway_icepay_order_id',
89
			'title'       => __( 'Order ID', 'pronamic_ideal' ),
90
			'type'        => 'text',
91
			'classes'     => array( 'regular-text', 'code' ),
92
			'tooltip'     => sprintf(
93
				/* translators: %s: <code>OrderID</code> */
94
				__( 'The Icepay %s parameter.', 'pronamic_ideal' ),
95
				sprintf( '<code>%s</code>', 'OrderID' )
96
			),
97
			'description' => sprintf(
98
				'%s %s<br />%s',
99
				__( 'Available tags:', 'pronamic_ideal' ),
100
				sprintf(
101
					'<code>%s</code> <code>%s</code>',
102
					'{order_id}',
103
					'{payment_id}'
104
				),
105
				sprintf(
106
					/* translators: %s: <code>{payment_id}</code> */
107
					__( 'Default: <code>%s</code>', 'pronamic_ideal' ),
108
					'{payment_id}'
109
				)
110
			),
111
		);
112
113
		// Thank you page URL
114
		$fields[] = array(
115
			'section'  => 'icepay_feedback',
116
			'title'    => __( 'Thank you page URL', 'pronamic_ideal' ),
117
			'type'     => 'text',
118
			'classes'  => array( 'regular-text', 'code' ),
119
			'value'    => 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

119
			'value'    => /** @scrutinizer ignore-call */ home_url( '/' ),
Loading history...
120
			'readonly' => true,
121
		);
122
123
		// Error page URL
124
		$fields[] = array(
125
			'section'  => 'icepay_feedback',
126
			'title'    => __( 'Error page URL', 'pronamic_ideal' ),
127
			'type'     => 'text',
128
			'classes'  => array( 'regular-text', 'code' ),
129
			'value'    => home_url( '/' ),
130
			'readonly' => true,
131
		);
132
133
		// Postback URL
134
		$fields[] = array(
135
			'section'  => 'icepay_feedback',
136
			'title'    => __( 'Postback URL', 'pronamic_ideal' ),
137
			'type'     => 'text',
138
			'classes'  => array( 'regular-text', 'code' ),
139
			'value'    => home_url( '/' ),
140
			'readonly' => true,
141
		);
142
143
		return $fields;
144
	}
145
}
146