1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Buckaroo; |
4
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\AbstractGatewayIntegration; |
|
|
|
|
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Title: Buckaroo integration |
9
|
|
|
* Description: |
10
|
|
|
* Copyright: 2005-2020 Pronamic |
11
|
|
|
* Company: Pronamic |
12
|
|
|
* |
13
|
|
|
* @author Reüel van der Steege |
14
|
|
|
* @version 2.0.4 |
15
|
|
|
* @since 1.0.0 |
16
|
|
|
*/ |
17
|
|
|
class Integration extends AbstractGatewayIntegration { |
18
|
|
|
/** |
19
|
|
|
* Construct Buckaroo integration. |
20
|
|
|
* |
21
|
|
|
* @param array $args Arguments. |
22
|
|
|
*/ |
23
|
|
|
public function __construct( $args = array() ) { |
24
|
|
|
$args = wp_parse_args( |
25
|
|
|
$args, |
26
|
|
|
array( |
27
|
|
|
'id' => 'buckaroo', |
28
|
|
|
'name' => 'Buckaroo - HTML', |
29
|
|
|
'url' => 'https://plaza.buckaroo.nl/', |
30
|
|
|
'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), |
31
|
|
|
'dashboard_url' => 'https://plaza.buckaroo.nl/', |
32
|
|
|
'provider' => 'buckaroo', |
33
|
|
|
'supports' => array( |
34
|
|
|
'webhook', |
35
|
|
|
'webhook_log', |
36
|
|
|
'webhook_no_config', |
37
|
|
|
), |
38
|
|
|
'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), |
39
|
|
|
) |
40
|
|
|
); |
41
|
|
|
|
42
|
|
|
parent::__construct( $args ); |
43
|
|
|
|
44
|
|
|
// Actions |
45
|
|
|
$function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
46
|
|
|
|
47
|
|
|
if ( ! has_action( 'wp_loaded', $function ) ) { |
48
|
|
|
add_action( 'wp_loaded', $function ); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function get_settings_fields() { |
53
|
|
|
$fields = array(); |
54
|
|
|
|
55
|
|
|
// Website Key. |
56
|
|
|
$fields[] = array( |
57
|
|
|
'section' => 'general', |
58
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
59
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_website_key', |
60
|
|
|
'title' => __( 'Website Key', 'pronamic_ideal' ), |
61
|
|
|
'type' => 'text', |
62
|
|
|
'classes' => array( 'code' ), |
63
|
|
|
'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
// Secret Key. |
67
|
|
|
$fields[] = array( |
68
|
|
|
'section' => 'general', |
69
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
70
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_secret_key', |
71
|
|
|
'title' => __( 'Secret Key', 'pronamic_ideal' ), |
72
|
|
|
'type' => 'text', |
73
|
|
|
'classes' => array( 'regular-text', 'code' ), |
74
|
|
|
'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboardb on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
// Excluded services. |
78
|
|
|
$fields[] = array( |
79
|
|
|
'section' => 'advanced', |
80
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
81
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_excluded_services', |
82
|
|
|
'title' => __( 'Excluded services', 'pronamic_ideal' ), |
83
|
|
|
'type' => 'text', |
84
|
|
|
'classes' => array( 'regular-text', 'code' ), |
85
|
|
|
'tooltip' => sprintf( |
86
|
|
|
/* translators: %s: <code>brq_exludedservices</code> */ |
87
|
|
|
__( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), |
88
|
|
|
sprintf( '<code>%s</code>', 'brq_exludedservices' ) |
89
|
|
|
), |
90
|
|
|
); |
91
|
|
|
|
92
|
|
|
// Invoice number. |
93
|
|
|
$fields[] = array( |
94
|
|
|
'section' => 'advanced', |
95
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
96
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_invoice_number', |
97
|
|
|
'title' => __( 'Invoice number', 'pronamic_ideal' ), |
98
|
|
|
'type' => 'text', |
99
|
|
|
'classes' => array( 'regular-text', 'code' ), |
100
|
|
|
'tooltip' => sprintf( |
101
|
|
|
/* translators: %s: <code>brq_invoicenumber</code> */ |
102
|
|
|
__( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), |
103
|
|
|
sprintf( '<code>%s</code>', 'brq_invoicenumber' ) |
104
|
|
|
), |
105
|
|
|
'description' => sprintf( |
106
|
|
|
'%s<br />%s', |
107
|
|
|
/* translators: %s: <code>{order_id}</code> <code>{payment_id}</code> */ |
108
|
|
|
sprintf( __( 'Available tags: %s', 'pronamic_ideal' ), sprintf( '<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}' ) ), |
109
|
|
|
/* translators: %s: <code>{payment_id}</code> */ |
110
|
|
|
sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), '{payment_id}' ) |
111
|
|
|
), |
112
|
|
|
); |
113
|
|
|
|
114
|
|
|
// Push URL. |
115
|
|
|
$fields[] = array( |
116
|
|
|
'section' => 'feedback', |
117
|
|
|
'title' => __( 'Push URL', 'pronamic_ideal' ), |
118
|
|
|
'type' => 'text', |
119
|
|
|
'classes' => array( 'large-text', 'code' ), |
120
|
|
|
'value' => add_query_arg( 'buckaroo_push', '', home_url( '/' ) ), |
121
|
|
|
'readonly' => true, |
122
|
|
|
'tooltip' => __( 'The Push URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
123
|
|
|
); |
124
|
|
|
|
125
|
|
|
return $fields; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function get_config( $post_id ) { |
129
|
|
|
$config = new Config(); |
130
|
|
|
|
131
|
|
|
$config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); |
|
|
|
|
132
|
|
|
$config->secret_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ); |
|
|
|
|
133
|
|
|
$config->excluded_services = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_excluded_services', true ); |
|
|
|
|
134
|
|
|
$config->invoice_number = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_invoice_number', true ); |
|
|
|
|
135
|
|
|
$config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
|
|
|
136
|
|
|
|
137
|
|
|
return $config; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Get gateway. |
142
|
|
|
* |
143
|
|
|
* @param int $post_id Post ID. |
144
|
|
|
* @return Gateway |
145
|
|
|
*/ |
146
|
|
|
public function get_gateway( $post_id ) { |
147
|
|
|
return new Gateway( $this->get_config( $post_id ) ); |
148
|
|
|
} |
149
|
|
|
} |
150
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths