1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Integration. |
4
|
|
|
* |
5
|
|
|
* @author Pronamic <[email protected]> |
6
|
|
|
* @copyright 2005-2019 Pronamic |
7
|
|
|
* @license GPL-3.0-or-later |
8
|
|
|
* @package Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet; |
12
|
|
|
|
13
|
|
|
use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Title: ING Kassa Compleet integration |
17
|
|
|
* Description: |
18
|
|
|
* Copyright: 2005-2019 Pronamic |
19
|
|
|
* Company: Pronamic |
20
|
|
|
* |
21
|
|
|
* @author Reüel van der Steege |
22
|
|
|
* @version 2.0.0 |
23
|
|
|
* @since 1.0.0 |
24
|
|
|
*/ |
25
|
|
|
class Integration extends AbstractIntegration { |
26
|
|
|
/** |
27
|
|
|
* Integration constructor. |
28
|
|
|
*/ |
29
|
|
|
public function __construct() { |
30
|
|
|
$this->id = 'ing-kassa-compleet'; |
31
|
|
|
$this->name = 'ING - Kassa Compleet'; |
32
|
|
|
$this->provider = 'ing'; |
33
|
|
|
$this->product_url = 'https://www.ing.nl/zakelijk/betalen/geld-ontvangen/kassa-compleet/'; |
34
|
|
|
$this->dashboard_url = 'https://portal.kassacompleet.nl/'; |
35
|
|
|
$this->supports = array( |
|
|
|
|
36
|
|
|
'payment_status_request', |
37
|
|
|
'webhook', |
38
|
|
|
); |
39
|
|
|
|
40
|
|
|
// Actions. |
41
|
|
|
$function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
42
|
|
|
|
43
|
|
|
if ( ! has_action( 'wp_loaded', $function ) ) { |
44
|
|
|
add_action( 'wp_loaded', $function ); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Get settings fields. |
50
|
|
|
* |
51
|
|
|
* @return array |
52
|
|
|
*/ |
53
|
|
|
public function get_settings_fields() { |
54
|
|
|
$fields = array(); |
55
|
|
|
|
56
|
|
|
// API Key. |
57
|
|
|
$fields[] = array( |
58
|
|
|
'section' => 'general', |
59
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
60
|
|
|
'meta_key' => '_pronamic_gateway_ing_kassa_compleet_api_key', |
61
|
|
|
'title' => _x( 'API Key', 'ing_kassa_compleet', 'pronamic_ideal' ), |
62
|
|
|
'type' => 'text', |
63
|
|
|
'classes' => array( 'regular-text', 'code' ), |
64
|
|
|
'tooltip' => sprintf( |
65
|
|
|
'%s %s.', |
66
|
|
|
__( 'API key', 'pronamic_ideal' ), |
67
|
|
|
sprintf( |
68
|
|
|
/* translators: %s: ING Kassa Compleet */ |
69
|
|
|
__( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), |
70
|
|
|
__( 'ING Kassa Compleet', 'pronamic_ideal' ) |
71
|
|
|
) |
72
|
|
|
), |
73
|
|
|
); |
74
|
|
|
|
75
|
|
|
// Webhook URL. |
76
|
|
|
$fields[] = array( |
77
|
|
|
'section' => 'feedback', |
78
|
|
|
'title' => __( 'Webhook URL', 'pronamic_ideal' ), |
79
|
|
|
'type' => 'text', |
80
|
|
|
'classes' => array( 'large-text', 'code' ), |
81
|
|
|
'value' => add_query_arg( 'ing_kassa_compleet_webhook', '', home_url( '/' ) ), |
82
|
|
|
'readonly' => true, |
83
|
|
|
'tooltip' => sprintf( |
84
|
|
|
/* translators: %s: ING Kassa Compleet */ |
85
|
|
|
__( 'Copy the Webhook URL to the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
86
|
|
|
__( 'ING Kassa Compleet', 'pronamic_ideal' ) |
87
|
|
|
), |
88
|
|
|
); |
89
|
|
|
|
90
|
|
|
return $fields; |
91
|
|
|
} |
92
|
|
|
/** |
93
|
|
|
* Get config with specified post ID. |
94
|
|
|
* |
95
|
|
|
* @param int $post_id Post ID. |
96
|
|
|
* |
97
|
|
|
* @return Config|null |
98
|
|
|
*/ |
99
|
|
|
public function get_config( $post_id ) { |
100
|
|
|
$config = new Config(); |
101
|
|
|
|
102
|
|
|
$config->api_key = $this->get_meta( $post_id, 'ing_kassa_compleet_api_key' ); |
|
|
|
|
103
|
|
|
$config->mode = $this->get_meta( $post_id, 'mode' ); |
104
|
|
|
|
105
|
|
|
return $config; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|