1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Icepay; |
4
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Title: ICEPAY 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
|
1 |
|
public function __construct() { |
19
|
1 |
|
$this->id = 'icepay-ideal'; |
20
|
1 |
|
$this->name = 'ICEPAY'; |
21
|
1 |
|
$this->url = 'https://icepay.com/'; |
22
|
1 |
|
$this->product_url = __( 'https://icepay.com/nl/en/pricing-and-accounts/', 'pronamic_ideal' ); |
23
|
1 |
|
$this->dashboard_url = 'https://portal.icepay.com/'; |
24
|
1 |
|
$this->provider = 'icepay'; |
25
|
|
|
|
26
|
|
|
// Actions |
27
|
1 |
|
$function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
28
|
|
|
|
29
|
1 |
|
if ( ! has_action( 'wp_loaded', $function ) ) { |
30
|
1 |
|
add_action( 'wp_loaded', $function ); |
31
|
|
|
} |
32
|
1 |
|
} |
33
|
|
|
|
34
|
1 |
|
public function get_config_factory_class() { |
35
|
1 |
|
return __NAMESPACE__ . '\ConfigFactory'; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function get_settings_fields() { |
39
|
|
|
$fields = array(); |
40
|
|
|
|
41
|
|
|
// Merchant ID |
42
|
|
|
$fields[] = array( |
43
|
|
|
'section' => 'general', |
44
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
45
|
|
|
'meta_key' => '_pronamic_gateway_icepay_merchant_id', |
46
|
|
|
'title' => _x( 'Merchant ID', 'icepay', 'pronamic_ideal' ), |
47
|
|
|
'type' => 'text', |
48
|
|
|
'tooltip' => __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
49
|
|
|
); |
50
|
|
|
|
51
|
|
|
// Secret Code |
52
|
|
|
$fields[] = array( |
53
|
|
|
'section' => 'general', |
54
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
55
|
|
|
'meta_key' => '_pronamic_gateway_icepay_secret_code', |
56
|
|
|
'title' => _x( 'Secret Code', 'icepay', 'pronamic_ideal' ), |
57
|
|
|
'type' => 'text', |
58
|
|
|
'classes' => array( 'regular-text', 'code' ), |
59
|
|
|
'tooltip' => __( 'Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
60
|
|
|
); |
61
|
|
|
|
62
|
|
|
// Purchase ID |
63
|
|
|
$fields[] = array( |
64
|
|
|
'section' => 'advanced', |
65
|
|
|
'filter' => array( |
66
|
|
|
'filter' => FILTER_SANITIZE_STRING, |
67
|
|
|
'flags' => FILTER_FLAG_NO_ENCODE_QUOTES, |
68
|
|
|
), |
69
|
|
|
'meta_key' => '_pronamic_gateway_icepay_order_id', |
70
|
|
|
'title' => __( 'Order ID', 'pronamic_ideal' ), |
71
|
|
|
'type' => 'text', |
72
|
|
|
'classes' => array( 'regular-text', 'code' ), |
73
|
|
|
'tooltip' => sprintf( |
74
|
|
|
/* translators: %s: <code>OrderID</code> */ |
75
|
|
|
__( 'The Icepay %s parameter.', 'pronamic_ideal' ), |
76
|
|
|
sprintf( '<code>%s</code>', 'OrderID' ) |
77
|
|
|
), |
78
|
|
|
'description' => sprintf( |
79
|
|
|
'%s %s<br />%s', |
80
|
|
|
__( 'Available tags:', 'pronamic_ideal' ), |
81
|
|
|
sprintf( |
82
|
|
|
'<code>%s</code> <code>%s</code>', |
83
|
|
|
'{order_id}', |
84
|
|
|
'{payment_id}' |
85
|
|
|
), |
86
|
|
|
sprintf( |
87
|
|
|
/* translators: %s: <code>{payment_id}</code> */ |
88
|
|
|
__( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
89
|
|
|
'{payment_id}' |
90
|
|
|
) |
91
|
|
|
), |
92
|
|
|
); |
93
|
|
|
|
94
|
|
|
// Thank you page URL |
95
|
|
|
$fields[] = array( |
96
|
|
|
'section' => 'feedback', |
97
|
|
|
'title' => __( 'Thank you page URL', 'pronamic_ideal' ), |
98
|
|
|
'type' => 'text', |
99
|
|
|
'classes' => array( 'regular-text', 'code' ), |
100
|
|
|
'value' => home_url( '/' ), |
101
|
|
|
'readonly' => true, |
102
|
|
|
); |
103
|
|
|
|
104
|
|
|
// Error page URL |
105
|
|
|
$fields[] = array( |
106
|
|
|
'section' => 'feedback', |
107
|
|
|
'title' => __( 'Error page URL', 'pronamic_ideal' ), |
108
|
|
|
'type' => 'text', |
109
|
|
|
'classes' => array( 'regular-text', 'code' ), |
110
|
|
|
'value' => home_url( '/' ), |
111
|
|
|
'readonly' => true, |
112
|
|
|
); |
113
|
|
|
|
114
|
|
|
// Postback URL |
115
|
|
|
$fields[] = array( |
116
|
|
|
'section' => 'feedback', |
117
|
|
|
'title' => __( 'Postback URL', 'pronamic_ideal' ), |
118
|
|
|
'type' => 'text', |
119
|
|
|
'classes' => array( 'regular-text', 'code' ), |
120
|
|
|
'value' => home_url( '/' ), |
121
|
|
|
'readonly' => true, |
122
|
|
|
); |
123
|
|
|
|
124
|
|
|
// Webhook status. |
125
|
|
|
$fields[] = array( |
126
|
|
|
'section' => 'feedback', |
127
|
|
|
'methods' => array( 'icepay' ), |
128
|
|
|
'title' => __( 'Status', 'pronamic_ideal' ), |
129
|
|
|
'type' => 'description', |
130
|
|
|
'callback' => array( $this, 'feedback_status' ), |
131
|
|
|
); |
132
|
|
|
|
133
|
|
|
return $fields; |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
|