|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Mollie; |
|
4
|
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Core\GatewaySettings; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Title: Mollie gateway settings |
|
9
|
|
|
* Description: |
|
10
|
|
|
* Copyright: Copyright (c) 2005 - 2018 |
|
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
|
|
|
/** |
|
19
|
|
|
* Settings constructor. |
|
20
|
|
|
*/ |
|
21
|
|
|
public function __construct() { |
|
22
|
|
|
add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
|
|
|
|
|
23
|
|
|
add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Settings sections. |
|
28
|
|
|
* |
|
29
|
|
|
* @param array $sections Sections. |
|
30
|
|
|
* |
|
31
|
|
|
* @return array |
|
32
|
|
|
*/ |
|
33
|
|
|
public function sections( array $sections ) { |
|
34
|
|
|
// General. |
|
35
|
|
|
$sections['mollie'] = array( |
|
36
|
|
|
'title' => __( 'Mollie', 'pronamic_ideal' ), |
|
|
|
|
|
|
37
|
|
|
'methods' => array( 'mollie' ), |
|
38
|
|
|
'description' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ), |
|
39
|
|
|
); |
|
40
|
|
|
|
|
41
|
|
|
// Transaction feedback. |
|
42
|
|
|
$sections['mollie_feedback'] = array( |
|
43
|
|
|
'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
44
|
|
|
'methods' => array( 'mollie' ), |
|
45
|
|
|
'description' => __( 'Payment status updates will be processed without any additional configuration. The <em>Webhook URL</em> is being used to receive the status updates.', 'pronamic_ideal' ), |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
return $sections; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Settings fields. |
|
53
|
|
|
* |
|
54
|
|
|
* @param array $fields Fields. |
|
55
|
|
|
* |
|
56
|
|
|
* @return array |
|
57
|
|
|
*/ |
|
58
|
|
|
public function fields( array $fields ) { |
|
59
|
|
|
// API Key. |
|
60
|
|
|
$fields[] = array( |
|
61
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
|
62
|
|
|
'section' => 'mollie', |
|
63
|
|
|
'meta_key' => '_pronamic_gateway_mollie_api_key', |
|
64
|
|
|
'title' => _x( 'API Key', 'mollie', 'pronamic_ideal' ), |
|
|
|
|
|
|
65
|
|
|
'type' => 'text', |
|
66
|
|
|
'classes' => array( 'regular-text', 'code' ), |
|
67
|
|
|
'methods' => array( 'mollie' ), |
|
68
|
|
|
'tooltip' => __( 'API key as mentioned in the payment provider dashboard', 'pronamic_ideal' ), |
|
|
|
|
|
|
69
|
|
|
); |
|
70
|
|
|
|
|
71
|
|
|
// Transaction feedback. |
|
72
|
|
|
$fields[] = array( |
|
73
|
|
|
'section' => 'mollie', |
|
74
|
|
|
'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
75
|
|
|
'type' => 'description', |
|
76
|
|
|
'html' => sprintf( |
|
77
|
|
|
'<span class="dashicons dashicons-yes"></span> %s', |
|
78
|
|
|
__( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
79
|
|
|
), |
|
80
|
|
|
); |
|
81
|
|
|
|
|
82
|
|
|
// Webhook. |
|
83
|
|
|
$fields[] = array( |
|
84
|
|
|
'section' => 'mollie_feedback', |
|
85
|
|
|
'title' => __( 'Webhook URL', 'pronamic_ideal' ), |
|
86
|
|
|
'type' => 'text', |
|
87
|
|
|
'classes' => array( 'large-text', 'code' ), |
|
88
|
|
|
'value' => add_query_arg( 'mollie_webhook', '', home_url( '/' ) ), |
|
|
|
|
|
|
89
|
|
|
'readonly' => true, |
|
90
|
|
|
'methods' => array( 'mollie' ), |
|
91
|
|
|
'tooltip' => __( 'The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
|
92
|
|
|
); |
|
93
|
|
|
|
|
94
|
|
|
return $fields; |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|