1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\IDealBasic; |
4
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Gateways\IDeal\AbstractIntegration; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Title: Integration |
9
|
|
|
* Description: |
10
|
|
|
* Copyright: 2005-2019 Pronamic |
11
|
|
|
* Company: Pronamic |
12
|
|
|
* |
13
|
|
|
* @author Remco Tolsma |
14
|
|
|
* @version 2.0.0 |
15
|
|
|
* @since 1.0.0 |
16
|
|
|
*/ |
17
|
|
|
class Integration extends AbstractIntegration { |
18
|
|
|
/** |
19
|
|
|
* Construct and initialize integration. |
20
|
|
|
*/ |
21
|
|
|
public function __construct( $args = array() ) { |
22
|
|
|
$args = wp_parse_args( $args, array( |
23
|
|
|
'id' => 'ideal-basic', |
24
|
|
|
'name' => 'iDEAL Basic', |
25
|
|
|
'url' => __( 'https://www.ideal.nl/en/', 'pronamic_ideal' ), |
26
|
|
|
'product_url' => __( 'https://www.ideal.nl/en/', 'pronamic_ideal' ), |
27
|
|
|
'dashboard_url' => null, |
28
|
|
|
'provider' => null, |
29
|
|
|
) ); |
30
|
|
|
|
31
|
|
|
$this->id = $args['id']; |
32
|
|
|
$this->name = $args['name']; |
33
|
|
|
$this->url = $args['url']; |
34
|
|
|
$this->product_url = $args['product_url']; |
35
|
|
|
$this->dashboard_url = $args['dashboard_url']; |
36
|
|
|
$this->provider = $args['provider']; |
37
|
|
|
|
38
|
|
|
$this->supports = array( |
|
|
|
|
39
|
|
|
'webhook', |
40
|
|
|
); |
41
|
|
|
|
42
|
|
|
// Actions. |
43
|
|
|
$function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
44
|
|
|
|
45
|
|
|
if ( ! has_action( 'wp_loaded', $function ) ) { |
46
|
|
|
add_action( 'wp_loaded', $function ); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function get_settings_fields() { |
51
|
|
|
$fields = parent::get_settings_fields(); |
|
|
|
|
52
|
|
|
|
53
|
|
|
// Hash Key |
54
|
|
|
$fields[] = array( |
55
|
|
|
'section' => 'general', |
56
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
57
|
|
|
'meta_key' => '_pronamic_gateway_ideal_hash_key', |
58
|
|
|
'title' => __( 'Hash Key', 'pronamic_ideal' ), |
59
|
|
|
'type' => 'text', |
60
|
|
|
'classes' => array( 'regular-text', 'code' ), |
61
|
|
|
'tooltip' => __( 'Hash key (also known as: key or secret key) as mentioned in the payment provider dashboard.', 'pronamic_ideal' ), |
62
|
|
|
'methods' => array( 'ideal-basic' ), |
63
|
|
|
); |
64
|
|
|
|
65
|
|
|
// XML Notification URL. |
66
|
|
|
$fields[] = array( |
67
|
|
|
'section' => 'feedback', |
68
|
|
|
'title' => __( 'XML Notification URL', 'pronamic_ideal' ), |
69
|
|
|
'type' => 'text', |
70
|
|
|
'classes' => array( 'regular-text', 'code' ), |
71
|
|
|
'value' => add_query_arg( |
72
|
|
|
array( |
73
|
|
|
'gateway' => 'IDealBasic', |
74
|
|
|
'xml_notification' => 'true', |
75
|
|
|
), |
76
|
|
|
site_url( '/' ) |
77
|
|
|
), |
78
|
|
|
'methods' => array( 'ideal-basic' ), |
79
|
|
|
'readonly' => true, |
80
|
|
|
'size' => 200, |
81
|
|
|
'tooltip' => __( 'Copy the XML notification URL to the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
82
|
|
|
); |
83
|
|
|
|
84
|
|
|
// Return fields. |
85
|
|
|
return $fields; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function get_config( $post_id ) { |
89
|
|
|
$mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
|
|
|
90
|
|
|
|
91
|
|
|
$config = new Config(); |
92
|
|
|
|
93
|
|
|
$config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true ); |
94
|
|
|
$config->sub_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_sub_id', true ); |
95
|
|
|
$config->hash_key = get_post_meta( $post_id, '_pronamic_gateway_ideal_hash_key', true ); |
96
|
|
|
$config->purchase_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_purchase_id', true ); |
97
|
|
|
|
98
|
|
|
return $config; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|