|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\EMS\ECommerce; |
|
4
|
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Core\GatewaySettings; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Title: EMS e-Commerce gateway settings |
|
9
|
|
|
* Description: |
|
10
|
|
|
* Copyright: 2005-2019 Pronamic |
|
11
|
|
|
* Company: Pronamic |
|
12
|
|
|
* |
|
13
|
|
|
* @author Reüel van der Steege |
|
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
|
|
|
* Sections. |
|
28
|
|
|
* |
|
29
|
|
|
* @param array $sections Sections. |
|
30
|
|
|
* |
|
31
|
|
|
* @return array |
|
32
|
|
|
*/ |
|
33
|
|
|
public function sections( array $sections ) { |
|
34
|
|
|
// EMS e-Commerce. |
|
35
|
|
|
$sections['ems_ecommerce'] = array( |
|
36
|
|
|
'title' => __( 'EMS e-Commerce', 'pronamic_ideal' ), |
|
|
|
|
|
|
37
|
|
|
'methods' => array( 'ems_ecommerce' ), |
|
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
|
|
|
// Advanced. |
|
42
|
|
|
$sections['ems_ecommerce_advanced'] = array( |
|
43
|
|
|
'title' => __( 'Advanced', 'pronamic_ideal' ), |
|
44
|
|
|
'methods' => array( 'ems_ecommerce' ), |
|
45
|
|
|
'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ), |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
return $sections; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Fields. |
|
53
|
|
|
* |
|
54
|
|
|
* @param array $fields Fields. |
|
55
|
|
|
* |
|
56
|
|
|
* @return array |
|
57
|
|
|
*/ |
|
58
|
|
|
public function fields( array $fields ) { |
|
59
|
|
|
// Storename. |
|
60
|
|
|
$fields[] = array( |
|
61
|
|
|
'filter' => FILTER_UNSAFE_RAW, |
|
62
|
|
|
'section' => 'ems_ecommerce', |
|
63
|
|
|
'meta_key' => '_pronamic_gateway_ems_ecommerce_storename', |
|
64
|
|
|
'title' => _x( 'Storename', 'ems', 'pronamic_ideal' ), |
|
|
|
|
|
|
65
|
|
|
'type' => 'text', |
|
66
|
|
|
'classes' => array( 'code' ), |
|
67
|
|
|
); |
|
68
|
|
|
|
|
69
|
|
|
// Shared secret. |
|
70
|
|
|
$fields[] = array( |
|
71
|
|
|
'filter' => FILTER_UNSAFE_RAW, |
|
72
|
|
|
'section' => 'ems_ecommerce', |
|
73
|
|
|
'meta_key' => '_pronamic_gateway_ems_ecommerce_secret', |
|
74
|
|
|
'title' => _x( 'Shared Secret', 'ems', 'pronamic_ideal' ), |
|
75
|
|
|
'type' => 'text', |
|
76
|
|
|
'classes' => array( 'large-text', 'code' ), |
|
77
|
|
|
); |
|
78
|
|
|
|
|
79
|
|
|
// Transaction feedback. |
|
80
|
|
|
$fields[] = array( |
|
81
|
|
|
'section' => 'ems_ecommerce', |
|
82
|
|
|
'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
|
|
|
|
|
83
|
|
|
'type' => 'description', |
|
84
|
|
|
'html' => sprintf( |
|
85
|
|
|
'<span class="dashicons dashicons-yes"></span> %s', |
|
86
|
|
|
__( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
87
|
|
|
), |
|
88
|
|
|
); |
|
89
|
|
|
|
|
90
|
|
|
// Purchase ID. |
|
91
|
|
|
$fields[] = array( |
|
92
|
|
|
'filter' => array( |
|
93
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
|
94
|
|
|
'flags' => FILTER_FLAG_NO_ENCODE_QUOTES, |
|
95
|
|
|
), |
|
96
|
|
|
'section' => 'ems_ecommerce_advanced', |
|
97
|
|
|
'meta_key' => '_pronamic_gateway_ems_ecommerce_order_id', |
|
98
|
|
|
'title' => __( 'Order ID', 'pronamic_ideal' ), |
|
99
|
|
|
'type' => 'text', |
|
100
|
|
|
'classes' => array( 'regular-text', 'code' ), |
|
101
|
|
|
'tooltip' => sprintf( |
|
102
|
|
|
/* translators: %s: <code>{orderId}</code> */ |
|
103
|
|
|
__( 'The EMS e-Commerce %s parameter.', 'pronamic_ideal' ), |
|
104
|
|
|
sprintf( '<code>%s</code>', 'orderId' ) |
|
105
|
|
|
), |
|
106
|
|
|
'description' => sprintf( |
|
107
|
|
|
'%s %s<br />%s', |
|
108
|
|
|
__( 'Available tags:', 'pronamic_ideal' ), |
|
109
|
|
|
sprintf( |
|
110
|
|
|
'<code>%s</code> <code>%s</code>', |
|
111
|
|
|
'{order_id}', |
|
112
|
|
|
'{payment_id}' |
|
113
|
|
|
), |
|
114
|
|
|
sprintf( |
|
115
|
|
|
/* translators: %s: {order_id} */ |
|
116
|
|
|
__( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
|
117
|
|
|
'{order_id}' |
|
118
|
|
|
) |
|
119
|
|
|
), |
|
120
|
|
|
); |
|
121
|
|
|
|
|
122
|
|
|
return $fields; |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|