1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Buckaroo; |
4
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Title: Buckaroo integration |
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 Integration extends AbstractIntegration { |
18
|
|
|
public function __construct() { |
19
|
|
|
$this->id = 'buckaroo'; |
20
|
|
|
$this->name = 'Buckaroo - HTML'; |
21
|
|
|
$this->url = 'https://plaza.buckaroo.nl/'; |
22
|
|
|
$this->product_url = __( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ); |
23
|
|
|
$this->dashboard_url = 'https://plaza.buckaroo.nl/'; |
24
|
|
|
$this->provider = 'buckaroo'; |
25
|
|
|
$this->supports = array( |
26
|
|
|
'webhook', |
27
|
|
|
'webhook_log', |
28
|
|
|
'webhook_no_config', |
29
|
|
|
); |
30
|
|
|
|
31
|
|
|
$this->set_manual_url( __( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ) ); |
|
|
|
|
32
|
|
|
|
33
|
|
|
// Actions |
34
|
|
|
$function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
35
|
|
|
|
36
|
|
|
if ( ! has_action( 'wp_loaded', $function ) ) { |
37
|
|
|
add_action( 'wp_loaded', $function ); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function get_settings_fields() { |
42
|
|
|
$fields = array(); |
43
|
|
|
|
44
|
|
|
// Website Key. |
45
|
|
|
$fields[] = array( |
46
|
|
|
'section' => 'general', |
47
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
48
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_website_key', |
49
|
|
|
'title' => __( 'Website Key', 'pronamic_ideal' ), |
50
|
|
|
'type' => 'text', |
51
|
|
|
'classes' => array( 'code' ), |
52
|
|
|
'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), |
53
|
|
|
); |
54
|
|
|
|
55
|
|
|
// Secret Key. |
56
|
|
|
$fields[] = array( |
57
|
|
|
'section' => 'general', |
58
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
59
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_secret_key', |
60
|
|
|
'title' => __( 'Secret Key', 'pronamic_ideal' ), |
61
|
|
|
'type' => 'text', |
62
|
|
|
'classes' => array( 'regular-text', 'code' ), |
63
|
|
|
'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboardb on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
// Excluded services. |
67
|
|
|
$fields[] = array( |
68
|
|
|
'section' => 'advanced', |
69
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
70
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_excluded_services', |
71
|
|
|
'title' => __( 'Excluded services', 'pronamic_ideal' ), |
72
|
|
|
'type' => 'text', |
73
|
|
|
'classes' => array( 'regular-text', 'code' ), |
74
|
|
|
'tooltip' => sprintf( |
75
|
|
|
/* translators: %s: <code>brq_exludedservices</code> */ |
76
|
|
|
__( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), |
77
|
|
|
sprintf( '<code>%s</code>', 'brq_exludedservices' ) |
78
|
|
|
), |
79
|
|
|
); |
80
|
|
|
|
81
|
|
|
// Invoice number. |
82
|
|
|
$fields[] = array( |
83
|
|
|
'section' => 'advanced', |
84
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
85
|
|
|
'meta_key' => '_pronamic_gateway_buckaroo_invoice_number', |
86
|
|
|
'title' => __( 'Invoice number', 'pronamic_ideal' ), |
87
|
|
|
'type' => 'text', |
88
|
|
|
'classes' => array( 'regular-text', 'code' ), |
89
|
|
|
'tooltip' => sprintf( |
90
|
|
|
/* translators: %s: <code>brq_invoicenumber</code> */ |
91
|
|
|
__( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), |
92
|
|
|
sprintf( '<code>%s</code>', 'brq_invoicenumber' ) |
93
|
|
|
), |
94
|
|
|
'description' => sprintf( |
95
|
|
|
'%s<br />%s', |
96
|
|
|
/* translators: %s: <code>{order_id}</code> <code>{payment_id}</code> */ |
97
|
|
|
sprintf( __( 'Available tags: %s', 'pronamic_ideal' ), sprintf( '<code>%s</code> <code>%s</code>', '{order_id}', '{payment_id}' ) ), |
98
|
|
|
/* translators: %s: <code>{payment_id}</code> */ |
99
|
|
|
sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), '{payment_id}' ) |
100
|
|
|
), |
101
|
|
|
); |
102
|
|
|
|
103
|
|
|
// Push URL. |
104
|
|
|
$fields[] = array( |
105
|
|
|
'section' => 'feedback', |
106
|
|
|
'title' => __( 'Push URL', 'pronamic_ideal' ), |
107
|
|
|
'type' => 'text', |
108
|
|
|
'classes' => array( 'large-text', 'code' ), |
109
|
|
|
'value' => add_query_arg( 'buckaroo_push', '', home_url( '/' ) ), |
110
|
|
|
'readonly' => true, |
111
|
|
|
'tooltip' => __( 'The Push URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
112
|
|
|
); |
113
|
|
|
|
114
|
|
|
return $fields; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function get_config( $post_id ) { |
118
|
|
|
$config = new Config(); |
119
|
|
|
|
120
|
|
|
$config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); |
121
|
|
|
$config->secret_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ); |
122
|
|
|
$config->excluded_services = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_excluded_services', true ); |
123
|
|
|
$config->invoice_number = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_invoice_number', true ); |
124
|
|
|
$config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
|
|
|
125
|
|
|
|
126
|
|
|
return $config; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Get gateway. |
131
|
|
|
* |
132
|
|
|
* @param int $post_id Post ID. |
133
|
|
|
* @return Gateway |
134
|
|
|
*/ |
135
|
|
|
public function get_gateway( $post_id ) { |
136
|
|
|
return new Gateway( $this->get_config( $post_id ) ); |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.