Test Failed
Push — develop ( 3c540f...9e64da )
by Remco
06:16 queued 01:50
created

views/page-payment.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Page payment.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2020 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Mollie
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Mollie;
12
13
use Pronamic\WordPress\Pay\Admin\AdminPaymentPostType;
14
15
$mollie_payment_id = \filter_input( INPUT_GET, 'id', FILTER_SANITIZE_STRING );
16
17
$payment = \get_pronamic_payment_by_transaction_id( $mollie_payment_id );
18
19
$api_key = \get_post_meta( $payment->config_id, '_pronamic_gateway_mollie_api_key', true );
20
21
$client = new Client( $api_key );
0 ignored issues
show
It seems like $api_key can also be of type false; however, parameter $api_key of Pronamic\WordPress\Pay\G...e\Client::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

21
$client = new Client( /** @scrutinizer ignore-type */ $api_key );
Loading history...
22
23
/**
24
 * Customer.
25
 *
26
 * @link https://docs.mollie.com/reference/v2/payments-api/get-payment
27
 */
28
$mollie_payment = $client->get_payment(
29
	$mollie_payment_id,
30
	array(
31
		'embed' => 'chargebacks,refunds',
32
	)
33
);
34
35
?>
36
<div class="wrap">
37
	<h1><?php echo \esc_html( \get_admin_page_title() ); ?></h1>
38
39
	<h2>
40
	<?php
41
42
	echo \wp_kses(
43
		\sprintf(
44
			/* translators: %s: payment number */
45
			\__( 'Payment %s', 'pronamic_ideal' ),
46
			\sprintf(
47
				'<code>%s</code>',
48
				$mollie_payment_id
49
			)
50
		),
51
		array(
52
			'code' => array(),
53
		)
54
	);
55
56
	?>
57
	</h2>
58
59
	<table class="form-table">
60
		<tbody>
61
			<tr>
62
				<th scope="row"><?php \esc_html_e( 'ID', 'pronamic_ideal' ); ?></th>
63
				<td>
64
					<code><?php echo \esc_html( $mollie_payment_id ); ?></code>
65
				</td>
66
			</tr>
67
			<tr>
68
				<th scope="row"><?php \esc_html_e( 'Link', 'pronamic_ideal' ); ?></th>
69
				<td>
70
					<?php
71
72
					$mollie_link = \sprintf(
73
						'https://www.mollie.com/dashboard/payments/%s',
74
						$mollie_payment_id
75
					);
76
77
					\printf(
78
						'<a href="%s">%s</a>',
79
						\esc_url( $mollie_link ),
80
						\esc_html( $mollie_link )
81
					);
82
83
					?>
84
				</td>
85
			</tr>
86
87
			<?php if ( null !== $payment ) : ?>
88
89
				<?php
90
91
				$url = $payment->get_meta( 'mollie_change_payment_state_url' );
92
93
				if ( ! empty( $url ) ) :
94
95
					?>
96
97
					<tr>
98
						<th scope="row"><?php \esc_html_e( 'Change Payment State', 'pronamic_ideal' ); ?></th>
99
						<td>
100
							<?php
101
102
							\printf(
103
								'<a href="%1$s" title="%2$s">%3$s</a>',
104
								\esc_url( $url ),
105
								\esc_attr( \__( 'Change Payment State', 'pronamic_ideal' ) ),
106
								\esc_html( $url )
107
							);
108
109
							?>
110
						</td>
111
					</tr>
112
113
				<?php endif; ?>
114
115
				<tr>
116
					<th scope="row"><?php \esc_html_e( 'Pronamic Pay Payment', 'pronamic_ideal' ); ?></th>
117
					<td>
118
						<?php
119
120
						\do_action(
121
							'manage_' . AdminPaymentPostType::POST_TYPE . '_posts_custom_column',
122
							'pronamic_payment_title',
123
							$payment->get_id()
124
						);
125
126
						?>
127
					</td>
128
				</tr>
129
130
			<?php endif; ?>
131
		</tbody>
132
	</table>
133
</div>
134