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( $args = array() ) { |
|
19 | 1 | $args = wp_parse_args( |
|
20 | 1 | $args, |
|
21 | 1 | array( |
|
22 | 1 | 'id' => 'icepay-ideal', |
|
23 | 1 | 'name' => 'ICEPAY', |
|
24 | 1 | 'url' => 'https://icepay.com/', |
|
25 | 'product_url' => __( 'https://icepay.com/nl/en/pricing-and-accounts/', 'pronamic_ideal' ), |
||
26 | 'manual_url' => __( 'https://www.pronamic.eu/support/how-to-connect-icepay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), |
||
27 | 1 | 'dashboard_url' => 'https://portal.icepay.com/', |
|
28 | 'provider' => 'icepay', |
||
29 | 1 | ) |
|
30 | 1 | ); |
|
31 | |||
32 | 1 | $this->id = $args['id']; |
|
33 | $this->name = $args['name']; |
||
34 | 1 | $this->url = $args['url']; |
|
35 | 1 | $this->product_url = $args['product_url']; |
|
36 | $this->dashboard_url = $args['dashboard_url']; |
||
37 | $this->provider = $args['provider']; |
||
38 | $this->supports = array( |
||
39 | 'webhook', |
||
40 | 'webhook_log', |
||
41 | ); |
||
42 | |||
43 | $this->set_manual_url( $args['manual_url'] ); |
||
0 ignored issues
–
show
|
|||
44 | |||
45 | // Actions |
||
46 | $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
||
47 | |||
48 | if ( ! has_action( 'wp_loaded', $function ) ) { |
||
49 | add_action( 'wp_loaded', $function ); |
||
50 | } |
||
51 | } |
||
52 | |||
53 | public function get_settings_fields() { |
||
54 | $fields = array(); |
||
55 | |||
56 | // Merchant ID |
||
57 | $fields[] = array( |
||
58 | 'section' => 'general', |
||
59 | 'filter' => FILTER_SANITIZE_STRING, |
||
60 | 'meta_key' => '_pronamic_gateway_icepay_merchant_id', |
||
61 | 'title' => _x( 'Merchant ID', 'icepay', 'pronamic_ideal' ), |
||
62 | 'type' => 'text', |
||
63 | 'tooltip' => __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
||
64 | ); |
||
65 | |||
66 | // Secret Code |
||
67 | $fields[] = array( |
||
68 | 'section' => 'general', |
||
69 | 'filter' => FILTER_SANITIZE_STRING, |
||
70 | 'meta_key' => '_pronamic_gateway_icepay_secret_code', |
||
71 | 'title' => _x( 'Secret Code', 'icepay', 'pronamic_ideal' ), |
||
72 | 'type' => 'text', |
||
73 | 'classes' => array( 'regular-text', 'code' ), |
||
74 | 'tooltip' => __( 'Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
||
75 | ); |
||
76 | |||
77 | // Purchase ID |
||
78 | $fields[] = array( |
||
79 | 'section' => 'advanced', |
||
80 | 'filter' => array( |
||
81 | 'filter' => FILTER_SANITIZE_STRING, |
||
82 | 'flags' => FILTER_FLAG_NO_ENCODE_QUOTES, |
||
83 | ), |
||
84 | 'meta_key' => '_pronamic_gateway_icepay_order_id', |
||
85 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
86 | 'type' => 'text', |
||
87 | 'classes' => array( 'regular-text', 'code' ), |
||
88 | 'tooltip' => sprintf( |
||
89 | /* translators: %s: <code>OrderID</code> */ |
||
90 | __( 'The Icepay %s parameter.', 'pronamic_ideal' ), |
||
91 | sprintf( '<code>%s</code>', 'OrderID' ) |
||
92 | ), |
||
93 | 'description' => sprintf( |
||
94 | '%s %s<br />%s', |
||
95 | __( 'Available tags:', 'pronamic_ideal' ), |
||
96 | sprintf( |
||
97 | '<code>%s</code> <code>%s</code>', |
||
98 | '{order_id}', |
||
99 | '{payment_id}' |
||
100 | ), |
||
101 | sprintf( |
||
102 | /* translators: %s: <code>{payment_id}</code> */ |
||
103 | __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
||
104 | '{payment_id}' |
||
105 | ) |
||
106 | ), |
||
107 | ); |
||
108 | |||
109 | // Thank you page URL |
||
110 | $fields[] = array( |
||
111 | 'section' => 'feedback', |
||
112 | 'title' => __( 'Thank you page URL', 'pronamic_ideal' ), |
||
113 | 'type' => 'text', |
||
114 | 'classes' => array( 'regular-text', 'code' ), |
||
115 | 'value' => home_url( '/' ), |
||
116 | 'readonly' => true, |
||
117 | ); |
||
118 | |||
119 | // Error page URL |
||
120 | $fields[] = array( |
||
121 | 'section' => 'feedback', |
||
122 | 'title' => __( 'Error page URL', 'pronamic_ideal' ), |
||
123 | 'type' => 'text', |
||
124 | 'classes' => array( 'regular-text', 'code' ), |
||
125 | 'value' => home_url( '/' ), |
||
126 | 'readonly' => true, |
||
127 | ); |
||
128 | |||
129 | // Postback URL |
||
130 | $fields[] = array( |
||
131 | 'section' => 'feedback', |
||
132 | 'title' => __( 'Postback URL', 'pronamic_ideal' ), |
||
133 | 'type' => 'text', |
||
134 | 'classes' => array( 'regular-text', 'code' ), |
||
135 | 'value' => home_url( '/' ), |
||
136 | 'readonly' => true, |
||
137 | ); |
||
138 | |||
139 | return $fields; |
||
140 | } |
||
141 | |||
142 | public function get_config( $post_id ) { |
||
143 | $config = new Config(); |
||
144 | |||
145 | $config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_icepay_merchant_id', true ); |
||
146 | $config->secret_code = get_post_meta( $post_id, '_pronamic_gateway_icepay_secret_code', true ); |
||
147 | $config->order_id = get_post_meta( $post_id, '_pronamic_gateway_icepay_order_id', true ); |
||
148 | |||
149 | return $config; |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Get gateway. |
||
154 | * |
||
155 | * @param int $post_id Post ID. |
||
156 | * @return Gateway |
||
157 | */ |
||
158 | public function get_gateway( $post_id ) { |
||
159 | return new Gateway( $this->get_config( $post_id ) ); |
||
160 | } |
||
161 | } |
||
162 |
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.