@@ -7,66 +7,65 @@ |
||
7 | 7 | * @package Event Espresso |
8 | 8 | * @subpackage /shortcodes/ |
9 | 9 | * @author Brent Christensen |
10 | - |
|
11 | 10 | * ------------------------------------------------------------------------ |
12 | 11 | */ |
13 | 12 | class EES_Espresso_Checkout extends EES_Shortcode |
14 | 13 | { |
15 | 14 | |
16 | - /** |
|
17 | - * set_hooks - for hooking into EE Core, modules, etc |
|
18 | - * |
|
19 | - * @access public |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public static function set_hooks() |
|
23 | - { |
|
24 | - } |
|
15 | + /** |
|
16 | + * set_hooks - for hooking into EE Core, modules, etc |
|
17 | + * |
|
18 | + * @access public |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public static function set_hooks() |
|
22 | + { |
|
23 | + } |
|
25 | 24 | |
26 | - /** |
|
27 | - * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
28 | - * |
|
29 | - * @access public |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public static function set_hooks_admin() |
|
33 | - { |
|
34 | - } |
|
25 | + /** |
|
26 | + * set_hooks_admin - for hooking into EE Admin Core, modules, etc |
|
27 | + * |
|
28 | + * @access public |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public static function set_hooks_admin() |
|
32 | + { |
|
33 | + } |
|
35 | 34 | |
36 | 35 | |
37 | 36 | |
38 | - /** |
|
39 | - * run - initial shortcode module setup called during "wp_loaded" hook |
|
40 | - * this method is primarily used for loading resources that will be required by the shortcode when it is actually processed |
|
41 | - * |
|
42 | - * @access public |
|
43 | - * @param WP $WP |
|
44 | - * @return void |
|
45 | - * @throws \EE_Error |
|
46 | - */ |
|
47 | - public function run(WP $WP) |
|
48 | - { |
|
49 | - } |
|
37 | + /** |
|
38 | + * run - initial shortcode module setup called during "wp_loaded" hook |
|
39 | + * this method is primarily used for loading resources that will be required by the shortcode when it is actually processed |
|
40 | + * |
|
41 | + * @access public |
|
42 | + * @param WP $WP |
|
43 | + * @return void |
|
44 | + * @throws \EE_Error |
|
45 | + */ |
|
46 | + public function run(WP $WP) |
|
47 | + { |
|
48 | + } |
|
50 | 49 | |
51 | 50 | |
52 | 51 | |
53 | - /** |
|
54 | - * process_shortcode - ESPRESSO_CHECKOUT |
|
55 | - * |
|
56 | - * @access public |
|
57 | - * @param array $attributes |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function process_shortcode($attributes = array()) |
|
61 | - { |
|
62 | - \EE_Error::doing_it_wrong( |
|
63 | - __METHOD__, |
|
64 | - esc_html__( |
|
65 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCheckout::processShortcode() instead.', |
|
66 | - 'event_espresso' |
|
67 | - ), |
|
68 | - '4.9.27' |
|
69 | - ); |
|
70 | - return ''; |
|
71 | - } |
|
52 | + /** |
|
53 | + * process_shortcode - ESPRESSO_CHECKOUT |
|
54 | + * |
|
55 | + * @access public |
|
56 | + * @param array $attributes |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function process_shortcode($attributes = array()) |
|
60 | + { |
|
61 | + \EE_Error::doing_it_wrong( |
|
62 | + __METHOD__, |
|
63 | + esc_html__( |
|
64 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCheckout::processShortcode() instead.', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + '4.9.27' |
|
68 | + ); |
|
69 | + return ''; |
|
70 | + } |
|
72 | 71 | } |
@@ -11,50 +11,50 @@ |
||
11 | 11 | class EES_Espresso_Events extends EES_Shortcode |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @deprecated 4.9.27 |
|
16 | - * @return void |
|
17 | - */ |
|
18 | - public static function set_hooks() |
|
19 | - { |
|
20 | - } |
|
21 | - |
|
22 | - /** |
|
23 | - * @deprecated 4.9.27 |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public static function set_hooks_admin() |
|
27 | - { |
|
28 | - } |
|
29 | - |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * @deprecated 4.9.27 |
|
34 | - * @param WP $WP |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function run(WP $WP) |
|
38 | - { |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @deprecated 4.9.27 |
|
45 | - * @param array $attributes |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function process_shortcode($attributes = array()) |
|
49 | - { |
|
50 | - \EE_Error::doing_it_wrong( |
|
51 | - __METHOD__, |
|
52 | - esc_html__( |
|
53 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEvents instead.', |
|
54 | - 'event_espresso' |
|
55 | - ), |
|
56 | - '4.9.27' |
|
57 | - ); |
|
58 | - return ''; |
|
59 | - } |
|
14 | + /** |
|
15 | + * @deprecated 4.9.27 |
|
16 | + * @return void |
|
17 | + */ |
|
18 | + public static function set_hooks() |
|
19 | + { |
|
20 | + } |
|
21 | + |
|
22 | + /** |
|
23 | + * @deprecated 4.9.27 |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public static function set_hooks_admin() |
|
27 | + { |
|
28 | + } |
|
29 | + |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * @deprecated 4.9.27 |
|
34 | + * @param WP $WP |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function run(WP $WP) |
|
38 | + { |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @deprecated 4.9.27 |
|
45 | + * @param array $attributes |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function process_shortcode($attributes = array()) |
|
49 | + { |
|
50 | + \EE_Error::doing_it_wrong( |
|
51 | + __METHOD__, |
|
52 | + esc_html__( |
|
53 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEvents instead.', |
|
54 | + 'event_espresso' |
|
55 | + ), |
|
56 | + '4.9.27' |
|
57 | + ); |
|
58 | + return ''; |
|
59 | + } |
|
60 | 60 | } |
@@ -11,55 +11,55 @@ |
||
11 | 11 | class EES_Espresso_Cancelled extends EES_Shortcode |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @deprecated 4.9.27 |
|
16 | - * @return void |
|
17 | - */ |
|
18 | - public static function set_hooks() |
|
19 | - { |
|
20 | - } |
|
14 | + /** |
|
15 | + * @deprecated 4.9.27 |
|
16 | + * @return void |
|
17 | + */ |
|
18 | + public static function set_hooks() |
|
19 | + { |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @deprecated 4.9.27 |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public static function set_hooks_admin() |
|
29 | - { |
|
30 | - } |
|
24 | + /** |
|
25 | + * @deprecated 4.9.27 |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public static function set_hooks_admin() |
|
29 | + { |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @deprecated 4.9.27 |
|
36 | - * @param WP $WP |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function run(WP $WP) |
|
40 | - { |
|
41 | - } |
|
34 | + /** |
|
35 | + * @deprecated 4.9.27 |
|
36 | + * @param WP $WP |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function run(WP $WP) |
|
40 | + { |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * process_shortcode - ESPRESSO_CANCELLED |
|
47 | - * |
|
48 | - * @deprecated 4.9.27 |
|
49 | - * @param array $attributes |
|
50 | - * @return string |
|
51 | - * @throws \EE_Error |
|
52 | - */ |
|
53 | - public function process_shortcode($attributes = array()) |
|
54 | - { |
|
55 | - \EE_Error::doing_it_wrong( |
|
56 | - __METHOD__, |
|
57 | - esc_html__( |
|
58 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCancelled instead.', |
|
59 | - 'event_espresso' |
|
60 | - ), |
|
61 | - '4.9.27' |
|
62 | - ); |
|
63 | - return ''; |
|
64 | - } |
|
45 | + /** |
|
46 | + * process_shortcode - ESPRESSO_CANCELLED |
|
47 | + * |
|
48 | + * @deprecated 4.9.27 |
|
49 | + * @param array $attributes |
|
50 | + * @return string |
|
51 | + * @throws \EE_Error |
|
52 | + */ |
|
53 | + public function process_shortcode($attributes = array()) |
|
54 | + { |
|
55 | + \EE_Error::doing_it_wrong( |
|
56 | + __METHOD__, |
|
57 | + esc_html__( |
|
58 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCancelled instead.', |
|
59 | + 'event_espresso' |
|
60 | + ), |
|
61 | + '4.9.27' |
|
62 | + ); |
|
63 | + return ''; |
|
64 | + } |
|
65 | 65 | } |
@@ -12,399 +12,399 @@ |
||
12 | 12 | class EES_Espresso_Thank_You extends EES_Shortcode |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
17 | - */ |
|
18 | - const IPN_wait_time = 1200; |
|
19 | - |
|
20 | - |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * @deprecated 4.9.27 |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public static function set_hooks() |
|
28 | - { |
|
29 | - } |
|
30 | - |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @deprecated 4.9.27 |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public static function set_hooks_admin() |
|
38 | - { |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @deprecated 4.9.27 |
|
45 | - * @return void |
|
46 | - */ |
|
47 | - public static function set_definitions() |
|
48 | - { |
|
49 | - \EE_Error::doing_it_wrong( |
|
50 | - __METHOD__, |
|
51 | - esc_html__( |
|
52 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
53 | - 'event_espresso' |
|
54 | - ), |
|
55 | - '4.9.27' |
|
56 | - ); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * @deprecated 4.9.27 |
|
63 | - * @return EE_Transaction |
|
64 | - */ |
|
65 | - public function get_txn() |
|
66 | - { |
|
67 | - \EE_Error::doing_it_wrong( |
|
68 | - __METHOD__, |
|
69 | - esc_html__( |
|
70 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
71 | - 'event_espresso' |
|
72 | - ), |
|
73 | - '4.9.27' |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @deprecated 4.9.27 |
|
81 | - * @param int $since |
|
82 | - * @return mixed array of EE_Payment || FALSE |
|
83 | - */ |
|
84 | - public function get_txn_payments($since = 0) |
|
85 | - { |
|
86 | - \EE_Error::doing_it_wrong( |
|
87 | - __METHOD__, |
|
88 | - esc_html__( |
|
89 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
90 | - 'event_espresso' |
|
91 | - ), |
|
92 | - '4.9.27' |
|
93 | - ); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @deprecated 4.9.27 |
|
100 | - * @param string $reg_url_link |
|
101 | - * @return void |
|
102 | - */ |
|
103 | - public function set_reg_url_link($reg_url_link = null) |
|
104 | - { |
|
105 | - \EE_Error::doing_it_wrong( |
|
106 | - __METHOD__, |
|
107 | - esc_html__( |
|
108 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
109 | - 'event_espresso' |
|
110 | - ), |
|
111 | - '4.9.27' |
|
112 | - ); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @deprecated 4.9.27 |
|
119 | - * @param WP $WP |
|
120 | - * @return void |
|
121 | - */ |
|
122 | - public function run(WP $WP) |
|
123 | - { |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * @deprecated 4.9.27 |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - protected function _translate_strings() |
|
133 | - { |
|
134 | - \EE_Error::doing_it_wrong( |
|
135 | - __METHOD__, |
|
136 | - esc_html__( |
|
137 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
138 | - 'event_espresso' |
|
139 | - ), |
|
140 | - '4.9.27' |
|
141 | - ); |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - |
|
146 | - /** |
|
147 | - * @deprecated 4.9.27 |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - public function load_js() |
|
151 | - { |
|
152 | - \EE_Error::doing_it_wrong( |
|
153 | - __METHOD__, |
|
154 | - esc_html__( |
|
155 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
156 | - 'event_espresso' |
|
157 | - ), |
|
158 | - '4.9.27' |
|
159 | - ); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * @deprecated 4.9.27 |
|
166 | - * @return void |
|
167 | - * @throws \EE_Error |
|
168 | - */ |
|
169 | - public function init() |
|
170 | - { |
|
171 | - \EE_Error::doing_it_wrong( |
|
172 | - __METHOD__, |
|
173 | - esc_html__( |
|
174 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
175 | - 'event_espresso' |
|
176 | - ), |
|
177 | - '4.9.27' |
|
178 | - ); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * @deprecated 4.9.27 |
|
185 | - * @param array $attributes |
|
186 | - * @return string |
|
187 | - * @throws \EE_Error |
|
188 | - */ |
|
189 | - public function process_shortcode($attributes = array()) |
|
190 | - { |
|
191 | - \EE_Error::doing_it_wrong( |
|
192 | - __METHOD__, |
|
193 | - esc_html__( |
|
194 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
195 | - 'event_espresso' |
|
196 | - ), |
|
197 | - '4.9.27' |
|
198 | - ); |
|
199 | - return ''; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * @deprecated 4.9.27 |
|
206 | - * @param array $response |
|
207 | - * @param array $data |
|
208 | - * @return array |
|
209 | - * @throws \EE_Error |
|
210 | - */ |
|
211 | - public static function thank_you_page_IPN_monitor($response = array(), $data = array()) |
|
212 | - { |
|
213 | - \EE_Error::doing_it_wrong( |
|
214 | - __METHOD__, |
|
215 | - esc_html__( |
|
216 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
217 | - 'event_espresso' |
|
218 | - ), |
|
219 | - '4.9.27' |
|
220 | - ); |
|
221 | - } |
|
222 | - |
|
223 | - |
|
224 | - |
|
225 | - |
|
226 | - /** |
|
227 | - * @deprecated 4.9.27 |
|
228 | - * @return string |
|
229 | - * @throws \EE_Error |
|
230 | - */ |
|
231 | - public function get_registration_details() |
|
232 | - { |
|
233 | - \EE_Error::doing_it_wrong( |
|
234 | - __METHOD__, |
|
235 | - esc_html__( |
|
236 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
237 | - 'event_espresso' |
|
238 | - ), |
|
239 | - '4.9.27' |
|
240 | - ); |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - |
|
245 | - /** |
|
246 | - * resend_reg_confirmation_email |
|
247 | - * |
|
248 | - * @deprecated 4.9.27 |
|
249 | - */ |
|
250 | - public static function resend_reg_confirmation_email() |
|
251 | - { |
|
252 | - \EE_Error::doing_it_wrong( |
|
253 | - __METHOD__, |
|
254 | - esc_html__( |
|
255 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
256 | - 'event_espresso' |
|
257 | - ), |
|
258 | - '4.9.27' |
|
259 | - ); |
|
260 | - } |
|
261 | - |
|
262 | - |
|
263 | - |
|
264 | - /** |
|
265 | - * get_ajax_content |
|
266 | - * |
|
267 | - * @deprecated 4.9.27 |
|
268 | - * @return void |
|
269 | - */ |
|
270 | - public function get_ajax_content() |
|
271 | - { |
|
272 | - \EE_Error::doing_it_wrong( |
|
273 | - __METHOD__, |
|
274 | - esc_html__( |
|
275 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
276 | - 'event_espresso' |
|
277 | - ), |
|
278 | - '4.9.27' |
|
279 | - ); |
|
280 | - } |
|
281 | - |
|
282 | - |
|
283 | - |
|
284 | - /** |
|
285 | - * display_details_for_events |
|
286 | - * |
|
287 | - * @deprecated 4.9.27 |
|
288 | - * @param EE_Event[] $events |
|
289 | - * @return void |
|
290 | - */ |
|
291 | - public function display_details_for_events($events = array()) |
|
292 | - { |
|
293 | - \EE_Error::doing_it_wrong( |
|
294 | - __METHOD__, |
|
295 | - esc_html__( |
|
296 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
297 | - 'event_espresso' |
|
298 | - ), |
|
299 | - '4.9.27' |
|
300 | - ); |
|
301 | - } |
|
302 | - |
|
303 | - |
|
304 | - |
|
305 | - /** |
|
306 | - * display_details_for_events_requiring_pre_approval |
|
307 | - * |
|
308 | - * @deprecated 4.9.27 |
|
309 | - * @param EE_Event[] $events |
|
310 | - * @return void |
|
311 | - */ |
|
312 | - public function display_details_for_events_requiring_pre_approval($events = array()) |
|
313 | - { |
|
314 | - \EE_Error::doing_it_wrong( |
|
315 | - __METHOD__, |
|
316 | - esc_html__( |
|
317 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
318 | - 'event_espresso' |
|
319 | - ), |
|
320 | - '4.9.27' |
|
321 | - ); |
|
322 | - } |
|
323 | - |
|
324 | - |
|
325 | - |
|
326 | - /** |
|
327 | - * get_transaction_details |
|
328 | - * |
|
329 | - * @deprecated 4.9.27 |
|
330 | - * @return string |
|
331 | - * @throws \EE_Error |
|
332 | - */ |
|
333 | - public function get_transaction_details() |
|
334 | - { |
|
335 | - \EE_Error::doing_it_wrong( |
|
336 | - __METHOD__, |
|
337 | - esc_html__( |
|
338 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
339 | - 'event_espresso' |
|
340 | - ), |
|
341 | - '4.9.27' |
|
342 | - ); |
|
343 | - } |
|
344 | - |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * get_payment_row_html |
|
349 | - * |
|
350 | - * @deprecated 4.9.27 |
|
351 | - * @param EE_Payment $payment |
|
352 | - * @return string |
|
353 | - * @throws \EE_Error |
|
354 | - */ |
|
355 | - public function get_payment_row_html($payment = null) |
|
356 | - { |
|
357 | - \EE_Error::doing_it_wrong( |
|
358 | - __METHOD__, |
|
359 | - esc_html__( |
|
360 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
361 | - 'event_espresso' |
|
362 | - ), |
|
363 | - '4.9.27' |
|
364 | - ); |
|
365 | - } |
|
366 | - |
|
367 | - |
|
368 | - |
|
369 | - /** |
|
370 | - * get_payment_details |
|
371 | - * |
|
372 | - * @deprecated 4.9.27 |
|
373 | - * @param array $payments |
|
374 | - * @return string |
|
375 | - * @throws \EE_Error |
|
376 | - */ |
|
377 | - public function get_payment_details($payments = array()) |
|
378 | - { |
|
379 | - \EE_Error::doing_it_wrong( |
|
380 | - __METHOD__, |
|
381 | - esc_html__( |
|
382 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
383 | - 'event_espresso' |
|
384 | - ), |
|
385 | - '4.9.27' |
|
386 | - ); |
|
387 | - } |
|
388 | - |
|
389 | - |
|
390 | - |
|
391 | - /** |
|
392 | - * get_payment_details |
|
393 | - * |
|
394 | - * @deprecated 4.9.27 |
|
395 | - * @param array $payments |
|
396 | - * @return string |
|
397 | - * @throws \EE_Error |
|
398 | - */ |
|
399 | - public function get_new_payments($payments = array()) |
|
400 | - { |
|
401 | - \EE_Error::doing_it_wrong( |
|
402 | - __METHOD__, |
|
403 | - esc_html__( |
|
404 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
405 | - 'event_espresso' |
|
406 | - ), |
|
407 | - '4.9.27' |
|
408 | - ); |
|
409 | - } |
|
15 | + /** |
|
16 | + * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes ) |
|
17 | + */ |
|
18 | + const IPN_wait_time = 1200; |
|
19 | + |
|
20 | + |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * @deprecated 4.9.27 |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public static function set_hooks() |
|
28 | + { |
|
29 | + } |
|
30 | + |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @deprecated 4.9.27 |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public static function set_hooks_admin() |
|
38 | + { |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @deprecated 4.9.27 |
|
45 | + * @return void |
|
46 | + */ |
|
47 | + public static function set_definitions() |
|
48 | + { |
|
49 | + \EE_Error::doing_it_wrong( |
|
50 | + __METHOD__, |
|
51 | + esc_html__( |
|
52 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
53 | + 'event_espresso' |
|
54 | + ), |
|
55 | + '4.9.27' |
|
56 | + ); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * @deprecated 4.9.27 |
|
63 | + * @return EE_Transaction |
|
64 | + */ |
|
65 | + public function get_txn() |
|
66 | + { |
|
67 | + \EE_Error::doing_it_wrong( |
|
68 | + __METHOD__, |
|
69 | + esc_html__( |
|
70 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
71 | + 'event_espresso' |
|
72 | + ), |
|
73 | + '4.9.27' |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @deprecated 4.9.27 |
|
81 | + * @param int $since |
|
82 | + * @return mixed array of EE_Payment || FALSE |
|
83 | + */ |
|
84 | + public function get_txn_payments($since = 0) |
|
85 | + { |
|
86 | + \EE_Error::doing_it_wrong( |
|
87 | + __METHOD__, |
|
88 | + esc_html__( |
|
89 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
90 | + 'event_espresso' |
|
91 | + ), |
|
92 | + '4.9.27' |
|
93 | + ); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @deprecated 4.9.27 |
|
100 | + * @param string $reg_url_link |
|
101 | + * @return void |
|
102 | + */ |
|
103 | + public function set_reg_url_link($reg_url_link = null) |
|
104 | + { |
|
105 | + \EE_Error::doing_it_wrong( |
|
106 | + __METHOD__, |
|
107 | + esc_html__( |
|
108 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
109 | + 'event_espresso' |
|
110 | + ), |
|
111 | + '4.9.27' |
|
112 | + ); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @deprecated 4.9.27 |
|
119 | + * @param WP $WP |
|
120 | + * @return void |
|
121 | + */ |
|
122 | + public function run(WP $WP) |
|
123 | + { |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * @deprecated 4.9.27 |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + protected function _translate_strings() |
|
133 | + { |
|
134 | + \EE_Error::doing_it_wrong( |
|
135 | + __METHOD__, |
|
136 | + esc_html__( |
|
137 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
138 | + 'event_espresso' |
|
139 | + ), |
|
140 | + '4.9.27' |
|
141 | + ); |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + |
|
146 | + /** |
|
147 | + * @deprecated 4.9.27 |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + public function load_js() |
|
151 | + { |
|
152 | + \EE_Error::doing_it_wrong( |
|
153 | + __METHOD__, |
|
154 | + esc_html__( |
|
155 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
156 | + 'event_espresso' |
|
157 | + ), |
|
158 | + '4.9.27' |
|
159 | + ); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * @deprecated 4.9.27 |
|
166 | + * @return void |
|
167 | + * @throws \EE_Error |
|
168 | + */ |
|
169 | + public function init() |
|
170 | + { |
|
171 | + \EE_Error::doing_it_wrong( |
|
172 | + __METHOD__, |
|
173 | + esc_html__( |
|
174 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
175 | + 'event_espresso' |
|
176 | + ), |
|
177 | + '4.9.27' |
|
178 | + ); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * @deprecated 4.9.27 |
|
185 | + * @param array $attributes |
|
186 | + * @return string |
|
187 | + * @throws \EE_Error |
|
188 | + */ |
|
189 | + public function process_shortcode($attributes = array()) |
|
190 | + { |
|
191 | + \EE_Error::doing_it_wrong( |
|
192 | + __METHOD__, |
|
193 | + esc_html__( |
|
194 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
195 | + 'event_espresso' |
|
196 | + ), |
|
197 | + '4.9.27' |
|
198 | + ); |
|
199 | + return ''; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * @deprecated 4.9.27 |
|
206 | + * @param array $response |
|
207 | + * @param array $data |
|
208 | + * @return array |
|
209 | + * @throws \EE_Error |
|
210 | + */ |
|
211 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) |
|
212 | + { |
|
213 | + \EE_Error::doing_it_wrong( |
|
214 | + __METHOD__, |
|
215 | + esc_html__( |
|
216 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
217 | + 'event_espresso' |
|
218 | + ), |
|
219 | + '4.9.27' |
|
220 | + ); |
|
221 | + } |
|
222 | + |
|
223 | + |
|
224 | + |
|
225 | + |
|
226 | + /** |
|
227 | + * @deprecated 4.9.27 |
|
228 | + * @return string |
|
229 | + * @throws \EE_Error |
|
230 | + */ |
|
231 | + public function get_registration_details() |
|
232 | + { |
|
233 | + \EE_Error::doing_it_wrong( |
|
234 | + __METHOD__, |
|
235 | + esc_html__( |
|
236 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
237 | + 'event_espresso' |
|
238 | + ), |
|
239 | + '4.9.27' |
|
240 | + ); |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + |
|
245 | + /** |
|
246 | + * resend_reg_confirmation_email |
|
247 | + * |
|
248 | + * @deprecated 4.9.27 |
|
249 | + */ |
|
250 | + public static function resend_reg_confirmation_email() |
|
251 | + { |
|
252 | + \EE_Error::doing_it_wrong( |
|
253 | + __METHOD__, |
|
254 | + esc_html__( |
|
255 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
256 | + 'event_espresso' |
|
257 | + ), |
|
258 | + '4.9.27' |
|
259 | + ); |
|
260 | + } |
|
261 | + |
|
262 | + |
|
263 | + |
|
264 | + /** |
|
265 | + * get_ajax_content |
|
266 | + * |
|
267 | + * @deprecated 4.9.27 |
|
268 | + * @return void |
|
269 | + */ |
|
270 | + public function get_ajax_content() |
|
271 | + { |
|
272 | + \EE_Error::doing_it_wrong( |
|
273 | + __METHOD__, |
|
274 | + esc_html__( |
|
275 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
276 | + 'event_espresso' |
|
277 | + ), |
|
278 | + '4.9.27' |
|
279 | + ); |
|
280 | + } |
|
281 | + |
|
282 | + |
|
283 | + |
|
284 | + /** |
|
285 | + * display_details_for_events |
|
286 | + * |
|
287 | + * @deprecated 4.9.27 |
|
288 | + * @param EE_Event[] $events |
|
289 | + * @return void |
|
290 | + */ |
|
291 | + public function display_details_for_events($events = array()) |
|
292 | + { |
|
293 | + \EE_Error::doing_it_wrong( |
|
294 | + __METHOD__, |
|
295 | + esc_html__( |
|
296 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
297 | + 'event_espresso' |
|
298 | + ), |
|
299 | + '4.9.27' |
|
300 | + ); |
|
301 | + } |
|
302 | + |
|
303 | + |
|
304 | + |
|
305 | + /** |
|
306 | + * display_details_for_events_requiring_pre_approval |
|
307 | + * |
|
308 | + * @deprecated 4.9.27 |
|
309 | + * @param EE_Event[] $events |
|
310 | + * @return void |
|
311 | + */ |
|
312 | + public function display_details_for_events_requiring_pre_approval($events = array()) |
|
313 | + { |
|
314 | + \EE_Error::doing_it_wrong( |
|
315 | + __METHOD__, |
|
316 | + esc_html__( |
|
317 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
318 | + 'event_espresso' |
|
319 | + ), |
|
320 | + '4.9.27' |
|
321 | + ); |
|
322 | + } |
|
323 | + |
|
324 | + |
|
325 | + |
|
326 | + /** |
|
327 | + * get_transaction_details |
|
328 | + * |
|
329 | + * @deprecated 4.9.27 |
|
330 | + * @return string |
|
331 | + * @throws \EE_Error |
|
332 | + */ |
|
333 | + public function get_transaction_details() |
|
334 | + { |
|
335 | + \EE_Error::doing_it_wrong( |
|
336 | + __METHOD__, |
|
337 | + esc_html__( |
|
338 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
339 | + 'event_espresso' |
|
340 | + ), |
|
341 | + '4.9.27' |
|
342 | + ); |
|
343 | + } |
|
344 | + |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * get_payment_row_html |
|
349 | + * |
|
350 | + * @deprecated 4.9.27 |
|
351 | + * @param EE_Payment $payment |
|
352 | + * @return string |
|
353 | + * @throws \EE_Error |
|
354 | + */ |
|
355 | + public function get_payment_row_html($payment = null) |
|
356 | + { |
|
357 | + \EE_Error::doing_it_wrong( |
|
358 | + __METHOD__, |
|
359 | + esc_html__( |
|
360 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
361 | + 'event_espresso' |
|
362 | + ), |
|
363 | + '4.9.27' |
|
364 | + ); |
|
365 | + } |
|
366 | + |
|
367 | + |
|
368 | + |
|
369 | + /** |
|
370 | + * get_payment_details |
|
371 | + * |
|
372 | + * @deprecated 4.9.27 |
|
373 | + * @param array $payments |
|
374 | + * @return string |
|
375 | + * @throws \EE_Error |
|
376 | + */ |
|
377 | + public function get_payment_details($payments = array()) |
|
378 | + { |
|
379 | + \EE_Error::doing_it_wrong( |
|
380 | + __METHOD__, |
|
381 | + esc_html__( |
|
382 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
383 | + 'event_espresso' |
|
384 | + ), |
|
385 | + '4.9.27' |
|
386 | + ); |
|
387 | + } |
|
388 | + |
|
389 | + |
|
390 | + |
|
391 | + /** |
|
392 | + * get_payment_details |
|
393 | + * |
|
394 | + * @deprecated 4.9.27 |
|
395 | + * @param array $payments |
|
396 | + * @return string |
|
397 | + * @throws \EE_Error |
|
398 | + */ |
|
399 | + public function get_new_payments($payments = array()) |
|
400 | + { |
|
401 | + \EE_Error::doing_it_wrong( |
|
402 | + __METHOD__, |
|
403 | + esc_html__( |
|
404 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoThankYou instead.', |
|
405 | + 'event_espresso' |
|
406 | + ), |
|
407 | + '4.9.27' |
|
408 | + ); |
|
409 | + } |
|
410 | 410 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | printf( |
4 | - esc_html__( |
|
5 | - 'PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
6 | - 'event_espresso' |
|
7 | - ), |
|
8 | - '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">', |
|
9 | - '</a>' |
|
4 | + esc_html__( |
|
5 | + 'PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
6 | + 'event_espresso' |
|
7 | + ), |
|
8 | + '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">', |
|
9 | + '</a>' |
|
10 | 10 | ); |
@@ -19,608 +19,608 @@ |
||
19 | 19 | class EEG_Paypal_Standard extends EE_Offsite_Gateway |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * Name for the wp option used to save the itemized payment |
|
24 | - */ |
|
25 | - const itemized_payment_option_name = '_itemized_payment'; |
|
26 | - |
|
27 | - protected $_paypal_id; |
|
28 | - |
|
29 | - protected $_image_url; |
|
30 | - |
|
31 | - protected $_shipping_details; |
|
32 | - |
|
33 | - protected $_paypal_shipping; |
|
34 | - |
|
35 | - protected $_paypal_taxes; |
|
36 | - |
|
37 | - protected $_gateway_url; |
|
38 | - |
|
39 | - protected $_currencies_supported = array( |
|
40 | - 'USD', |
|
41 | - 'GBP', |
|
42 | - 'CAD', |
|
43 | - 'AUD', |
|
44 | - 'BRL', |
|
45 | - 'CHF', |
|
46 | - 'CZK', |
|
47 | - 'DKK', |
|
48 | - 'EUR', |
|
49 | - 'HKD', |
|
50 | - 'HUF', |
|
51 | - 'ILS', |
|
52 | - 'JPY', |
|
53 | - 'MXN', |
|
54 | - 'MYR', |
|
55 | - 'NOK', |
|
56 | - 'NZD', |
|
57 | - 'PHP', |
|
58 | - 'PLN', |
|
59 | - 'SEK', |
|
60 | - 'SGD', |
|
61 | - 'THB', |
|
62 | - 'TRY', |
|
63 | - 'TWD', |
|
64 | - 'RUB' |
|
65 | - ); |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * EEG_Paypal_Standard constructor. |
|
70 | - * |
|
71 | - * @return EEG_Paypal_Standard |
|
72 | - */ |
|
73 | - public function __construct() |
|
74 | - { |
|
75 | - $this->set_uses_separate_IPN_request(true); |
|
76 | - parent::__construct(); |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * Also sets the gateway url class variable based on whether debug mode is enabled or not. |
|
82 | - * |
|
83 | - * @param array $settings_array |
|
84 | - */ |
|
85 | - public function set_settings($settings_array) |
|
86 | - { |
|
87 | - parent::set_settings($settings_array); |
|
88 | - $this->_gateway_url = $this->_debug_mode |
|
89 | - ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' |
|
90 | - : 'https://www.paypal.com/cgi-bin/webscr'; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @param EEI_Payment $payment the payment to process |
|
96 | - * @param array $billing_info but should be empty for this gateway |
|
97 | - * @param string $return_url URL to send the user to after payment on the payment provider's website |
|
98 | - * @param string $notify_url URL to send the instant payment notification |
|
99 | - * @param string $cancel_url URL to send the user to after a cancelled payment attempt |
|
100 | - * on the payment provider's website |
|
101 | - * @return EEI_Payment |
|
102 | - * @throws \EE_Error |
|
103 | - */ |
|
104 | - public function set_redirection_info( |
|
105 | - $payment, |
|
106 | - $billing_info = array(), |
|
107 | - $return_url = null, |
|
108 | - $notify_url = null, |
|
109 | - $cancel_url = null |
|
110 | - ) { |
|
111 | - $redirect_args = array(); |
|
112 | - $transaction = $payment->transaction(); |
|
113 | - $gateway_formatter = $this->_get_gateway_formatter(); |
|
114 | - $item_num = 1; |
|
115 | - /** @type EE_Line_Item $total_line_item */ |
|
116 | - $total_line_item = $transaction->total_line_item(); |
|
117 | - |
|
118 | - $total_discounts_to_cart_total = $transaction->paid(); |
|
119 | - // only itemize the order if we're paying for the rest of the order's amount |
|
120 | - if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
121 | - $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true); |
|
122 | - // this payment is for the remaining transaction amount, |
|
123 | - // keep track of exactly how much the itemized order amount equals |
|
124 | - $itemized_sum = 0; |
|
125 | - $shipping_previously_added = 0; |
|
126 | - // so let's show all the line items |
|
127 | - foreach ($total_line_item->get_items() as $line_item) { |
|
128 | - if ($line_item instanceof EE_Line_Item) { |
|
129 | - // it's some kind of discount |
|
130 | - if ($line_item->total() < 0) { |
|
131 | - $total_discounts_to_cart_total += abs($line_item->total()); |
|
132 | - $itemized_sum += $line_item->total(); |
|
133 | - continue; |
|
134 | - } |
|
135 | - // dont include shipping again. |
|
136 | - if (strpos($line_item->code(), 'paypal_shipping_') === 0) { |
|
137 | - $shipping_previously_added = $line_item->total(); |
|
138 | - continue; |
|
139 | - } |
|
140 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
141 | - $gateway_formatter->formatLineItemName($line_item, $payment), |
|
142 | - 0, |
|
143 | - 127 |
|
144 | - ); |
|
145 | - $redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price(); |
|
146 | - $redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity(); |
|
147 | - // if we're not letting PayPal calculate shipping, tell them its 0 |
|
148 | - if (! $this->_paypal_shipping) { |
|
149 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
150 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
151 | - } |
|
152 | - $item_num++; |
|
153 | - $itemized_sum += $line_item->total(); |
|
154 | - } |
|
155 | - } |
|
156 | - $taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item); |
|
157 | - // ideally itemized sum equals the transaction total. but if not (which is weird) |
|
158 | - // and the itemized sum is LESS than the transaction total |
|
159 | - // add another line item |
|
160 | - // if the itemized sum is MORE than the transaction total, |
|
161 | - // add the difference it to the discounts |
|
162 | - $itemized_sum_diff_from_txn_total = round( |
|
163 | - $transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added, |
|
164 | - 2 |
|
165 | - ); |
|
166 | - if ($itemized_sum_diff_from_txn_total < 0) { |
|
167 | - // itemized sum is too big |
|
168 | - $total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total); |
|
169 | - } elseif ($itemized_sum_diff_from_txn_total > 0) { |
|
170 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
171 | - esc_html__('Other charges', 'event_espresso'), |
|
172 | - 0, |
|
173 | - 127 |
|
174 | - ); |
|
175 | - $redirect_args[ 'amount_' . $item_num ] = $gateway_formatter->formatCurrency( |
|
176 | - $itemized_sum_diff_from_txn_total |
|
177 | - ); |
|
178 | - $redirect_args[ 'quantity_' . $item_num ] = 1; |
|
179 | - $item_num++; |
|
180 | - } |
|
181 | - if ($total_discounts_to_cart_total > 0) { |
|
182 | - $redirect_args['discount_amount_cart'] = $gateway_formatter->formatCurrency( |
|
183 | - $total_discounts_to_cart_total |
|
184 | - ); |
|
185 | - } |
|
186 | - // add our taxes to the order if we're NOT using PayPal's |
|
187 | - if (! $this->_paypal_taxes) { |
|
188 | - $redirect_args['tax_cart'] = $total_line_item->get_total_tax(); |
|
189 | - } |
|
190 | - } else { |
|
191 | - $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false); |
|
192 | - // partial payment that's not for the remaining amount, so we can't send an itemized list |
|
193 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
194 | - $gateway_formatter->formatPartialPaymentLineItemName($payment), |
|
195 | - 0, |
|
196 | - 127 |
|
197 | - ); |
|
198 | - $redirect_args[ 'amount_' . $item_num ] = $payment->amount(); |
|
199 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
200 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
201 | - $redirect_args['tax_cart'] = '0'; |
|
202 | - $item_num++; |
|
203 | - } |
|
204 | - |
|
205 | - if ($this->_debug_mode) { |
|
206 | - $redirect_args[ 'item_name_' . $item_num ] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
207 | - $redirect_args[ 'amount_' . $item_num ] = 0; |
|
208 | - $redirect_args[ 'on0_' . $item_num ] = 'NOTIFY URL'; |
|
209 | - $redirect_args[ 'os0_' . $item_num ] = $notify_url; |
|
210 | - $redirect_args[ 'on1_' . $item_num ] = 'RETURN URL'; |
|
211 | - $redirect_args[ 'os1_' . $item_num ] = $return_url; |
|
22 | + /** |
|
23 | + * Name for the wp option used to save the itemized payment |
|
24 | + */ |
|
25 | + const itemized_payment_option_name = '_itemized_payment'; |
|
26 | + |
|
27 | + protected $_paypal_id; |
|
28 | + |
|
29 | + protected $_image_url; |
|
30 | + |
|
31 | + protected $_shipping_details; |
|
32 | + |
|
33 | + protected $_paypal_shipping; |
|
34 | + |
|
35 | + protected $_paypal_taxes; |
|
36 | + |
|
37 | + protected $_gateway_url; |
|
38 | + |
|
39 | + protected $_currencies_supported = array( |
|
40 | + 'USD', |
|
41 | + 'GBP', |
|
42 | + 'CAD', |
|
43 | + 'AUD', |
|
44 | + 'BRL', |
|
45 | + 'CHF', |
|
46 | + 'CZK', |
|
47 | + 'DKK', |
|
48 | + 'EUR', |
|
49 | + 'HKD', |
|
50 | + 'HUF', |
|
51 | + 'ILS', |
|
52 | + 'JPY', |
|
53 | + 'MXN', |
|
54 | + 'MYR', |
|
55 | + 'NOK', |
|
56 | + 'NZD', |
|
57 | + 'PHP', |
|
58 | + 'PLN', |
|
59 | + 'SEK', |
|
60 | + 'SGD', |
|
61 | + 'THB', |
|
62 | + 'TRY', |
|
63 | + 'TWD', |
|
64 | + 'RUB' |
|
65 | + ); |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * EEG_Paypal_Standard constructor. |
|
70 | + * |
|
71 | + * @return EEG_Paypal_Standard |
|
72 | + */ |
|
73 | + public function __construct() |
|
74 | + { |
|
75 | + $this->set_uses_separate_IPN_request(true); |
|
76 | + parent::__construct(); |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * Also sets the gateway url class variable based on whether debug mode is enabled or not. |
|
82 | + * |
|
83 | + * @param array $settings_array |
|
84 | + */ |
|
85 | + public function set_settings($settings_array) |
|
86 | + { |
|
87 | + parent::set_settings($settings_array); |
|
88 | + $this->_gateway_url = $this->_debug_mode |
|
89 | + ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' |
|
90 | + : 'https://www.paypal.com/cgi-bin/webscr'; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @param EEI_Payment $payment the payment to process |
|
96 | + * @param array $billing_info but should be empty for this gateway |
|
97 | + * @param string $return_url URL to send the user to after payment on the payment provider's website |
|
98 | + * @param string $notify_url URL to send the instant payment notification |
|
99 | + * @param string $cancel_url URL to send the user to after a cancelled payment attempt |
|
100 | + * on the payment provider's website |
|
101 | + * @return EEI_Payment |
|
102 | + * @throws \EE_Error |
|
103 | + */ |
|
104 | + public function set_redirection_info( |
|
105 | + $payment, |
|
106 | + $billing_info = array(), |
|
107 | + $return_url = null, |
|
108 | + $notify_url = null, |
|
109 | + $cancel_url = null |
|
110 | + ) { |
|
111 | + $redirect_args = array(); |
|
112 | + $transaction = $payment->transaction(); |
|
113 | + $gateway_formatter = $this->_get_gateway_formatter(); |
|
114 | + $item_num = 1; |
|
115 | + /** @type EE_Line_Item $total_line_item */ |
|
116 | + $total_line_item = $transaction->total_line_item(); |
|
117 | + |
|
118 | + $total_discounts_to_cart_total = $transaction->paid(); |
|
119 | + // only itemize the order if we're paying for the rest of the order's amount |
|
120 | + if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
121 | + $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true); |
|
122 | + // this payment is for the remaining transaction amount, |
|
123 | + // keep track of exactly how much the itemized order amount equals |
|
124 | + $itemized_sum = 0; |
|
125 | + $shipping_previously_added = 0; |
|
126 | + // so let's show all the line items |
|
127 | + foreach ($total_line_item->get_items() as $line_item) { |
|
128 | + if ($line_item instanceof EE_Line_Item) { |
|
129 | + // it's some kind of discount |
|
130 | + if ($line_item->total() < 0) { |
|
131 | + $total_discounts_to_cart_total += abs($line_item->total()); |
|
132 | + $itemized_sum += $line_item->total(); |
|
133 | + continue; |
|
134 | + } |
|
135 | + // dont include shipping again. |
|
136 | + if (strpos($line_item->code(), 'paypal_shipping_') === 0) { |
|
137 | + $shipping_previously_added = $line_item->total(); |
|
138 | + continue; |
|
139 | + } |
|
140 | + $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
141 | + $gateway_formatter->formatLineItemName($line_item, $payment), |
|
142 | + 0, |
|
143 | + 127 |
|
144 | + ); |
|
145 | + $redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price(); |
|
146 | + $redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity(); |
|
147 | + // if we're not letting PayPal calculate shipping, tell them its 0 |
|
148 | + if (! $this->_paypal_shipping) { |
|
149 | + $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
150 | + $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
151 | + } |
|
152 | + $item_num++; |
|
153 | + $itemized_sum += $line_item->total(); |
|
154 | + } |
|
155 | + } |
|
156 | + $taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item); |
|
157 | + // ideally itemized sum equals the transaction total. but if not (which is weird) |
|
158 | + // and the itemized sum is LESS than the transaction total |
|
159 | + // add another line item |
|
160 | + // if the itemized sum is MORE than the transaction total, |
|
161 | + // add the difference it to the discounts |
|
162 | + $itemized_sum_diff_from_txn_total = round( |
|
163 | + $transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added, |
|
164 | + 2 |
|
165 | + ); |
|
166 | + if ($itemized_sum_diff_from_txn_total < 0) { |
|
167 | + // itemized sum is too big |
|
168 | + $total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total); |
|
169 | + } elseif ($itemized_sum_diff_from_txn_total > 0) { |
|
170 | + $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
171 | + esc_html__('Other charges', 'event_espresso'), |
|
172 | + 0, |
|
173 | + 127 |
|
174 | + ); |
|
175 | + $redirect_args[ 'amount_' . $item_num ] = $gateway_formatter->formatCurrency( |
|
176 | + $itemized_sum_diff_from_txn_total |
|
177 | + ); |
|
178 | + $redirect_args[ 'quantity_' . $item_num ] = 1; |
|
179 | + $item_num++; |
|
180 | + } |
|
181 | + if ($total_discounts_to_cart_total > 0) { |
|
182 | + $redirect_args['discount_amount_cart'] = $gateway_formatter->formatCurrency( |
|
183 | + $total_discounts_to_cart_total |
|
184 | + ); |
|
185 | + } |
|
186 | + // add our taxes to the order if we're NOT using PayPal's |
|
187 | + if (! $this->_paypal_taxes) { |
|
188 | + $redirect_args['tax_cart'] = $total_line_item->get_total_tax(); |
|
189 | + } |
|
190 | + } else { |
|
191 | + $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false); |
|
192 | + // partial payment that's not for the remaining amount, so we can't send an itemized list |
|
193 | + $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
194 | + $gateway_formatter->formatPartialPaymentLineItemName($payment), |
|
195 | + 0, |
|
196 | + 127 |
|
197 | + ); |
|
198 | + $redirect_args[ 'amount_' . $item_num ] = $payment->amount(); |
|
199 | + $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
200 | + $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
201 | + $redirect_args['tax_cart'] = '0'; |
|
202 | + $item_num++; |
|
203 | + } |
|
204 | + |
|
205 | + if ($this->_debug_mode) { |
|
206 | + $redirect_args[ 'item_name_' . $item_num ] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
207 | + $redirect_args[ 'amount_' . $item_num ] = 0; |
|
208 | + $redirect_args[ 'on0_' . $item_num ] = 'NOTIFY URL'; |
|
209 | + $redirect_args[ 'os0_' . $item_num ] = $notify_url; |
|
210 | + $redirect_args[ 'on1_' . $item_num ] = 'RETURN URL'; |
|
211 | + $redirect_args[ 'os1_' . $item_num ] = $return_url; |
|
212 | 212 | // $redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ? |
213 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
214 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
215 | - } |
|
216 | - |
|
217 | - $redirect_args['business'] = $this->_paypal_id; |
|
218 | - $redirect_args['return'] = $return_url; |
|
219 | - $redirect_args['cancel_return'] = $cancel_url; |
|
220 | - $redirect_args['notify_url'] = $notify_url; |
|
221 | - $redirect_args['cmd'] = '_cart'; |
|
222 | - $redirect_args['upload'] = 1; |
|
223 | - $redirect_args['currency_code'] = $payment->currency_code(); |
|
224 | - $redirect_args['rm'] = 2;// makes the user return with method=POST |
|
225 | - if ($this->_image_url) { |
|
226 | - $redirect_args['image_url'] = $this->_image_url; |
|
227 | - } |
|
228 | - $redirect_args['no_shipping'] = $this->_shipping_details; |
|
229 | - $redirect_args['bn'] = 'EventEspresso_SP';// EE will blow up if you change this |
|
230 | - |
|
231 | - $redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this); |
|
232 | - |
|
233 | - $payment->set_redirect_url($this->_gateway_url); |
|
234 | - $payment->set_redirect_args($redirect_args); |
|
235 | - // log the results |
|
236 | - $this->log( |
|
237 | - array( |
|
238 | - 'message' => sprintf( |
|
239 | - esc_html__('PayPal payment request initiated.', 'event_espresso') |
|
240 | - ), |
|
241 | - 'transaction' => $transaction->model_field_array(), |
|
242 | - ), |
|
243 | - $payment |
|
244 | - ); |
|
245 | - return $payment; |
|
246 | - } |
|
247 | - |
|
248 | - |
|
249 | - /** |
|
250 | - * Often used for IPNs. But applies the info in $update_info to the payment. |
|
251 | - * What is $update_info? Often the contents of $_REQUEST, but not necessarily. Whatever |
|
252 | - * the payment method passes in. |
|
253 | - * |
|
254 | - * @param array $update_info like $_POST |
|
255 | - * @param EEI_Transaction $transaction |
|
256 | - * @return \EEI_Payment updated |
|
257 | - * @throws \EE_Error, IpnException |
|
258 | - */ |
|
259 | - public function handle_payment_update($update_info, $transaction) |
|
260 | - { |
|
261 | - // verify there's payment data that's been sent |
|
262 | - if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) { |
|
263 | - // log the results |
|
264 | - $this->log( |
|
265 | - array( |
|
266 | - 'message' => sprintf( |
|
267 | - // @codingStandardsIgnoreStart |
|
268 | - esc_html__('PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso') |
|
269 | - // @codingStandardsIgnoreEnd |
|
270 | - ), |
|
271 | - 'update_info' => $update_info, |
|
272 | - ), |
|
273 | - $transaction |
|
274 | - ); |
|
275 | - // waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/) |
|
276 | - // indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes |
|
277 | - if (isset($update_info['tx'])) { |
|
278 | - return $transaction->last_payment(); |
|
279 | - } else { |
|
280 | - return null; |
|
281 | - } |
|
282 | - } |
|
283 | - $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']); |
|
284 | - if (! $payment instanceof EEI_Payment) { |
|
285 | - $payment = $transaction->last_payment(); |
|
286 | - } |
|
287 | - // ok, then validate the IPN. Even if we've already processed this payment, |
|
288 | - // let PayPal know we don't want to hear from them anymore! |
|
289 | - if (! $this->validate_ipn($update_info, $payment)) { |
|
290 | - return $payment; |
|
291 | - } |
|
292 | - // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction, |
|
293 | - // registrations, ticket counts, etc) |
|
294 | - if ( |
|
295 | - ( |
|
296 | - $update_info['payment_status'] === 'Refunded' |
|
297 | - || $update_info['payment_status'] === 'Partially_Refunded' |
|
298 | - ) |
|
299 | - && apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true) |
|
300 | - ) { |
|
301 | - throw new EventEspresso\core\exceptions\IpnException( |
|
302 | - sprintf( |
|
303 | - esc_html__('Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'), |
|
304 | - $update_info['payment_status'] |
|
305 | - ), |
|
306 | - EventEspresso\core\exceptions\IpnException::UNSUPPORTED, |
|
307 | - null, |
|
308 | - $payment, |
|
309 | - $update_info |
|
310 | - ); |
|
311 | - } |
|
312 | - // ok, well let's process this payment then! |
|
313 | - switch ($update_info['payment_status']) { |
|
314 | - case 'Completed': |
|
315 | - $status = $this->_pay_model->approved_status(); |
|
316 | - $gateway_response = esc_html__('The payment is approved.', 'event_espresso'); |
|
317 | - break; |
|
318 | - |
|
319 | - case 'Pending': |
|
320 | - $status = $this->_pay_model->pending_status(); |
|
321 | - $gateway_response = esc_html__( |
|
322 | - 'The payment is in progress. Another message will be sent when payment is approved.', |
|
323 | - 'event_espresso' |
|
324 | - ); |
|
325 | - break; |
|
326 | - |
|
327 | - case 'Denied': |
|
328 | - $status = $this->_pay_model->declined_status(); |
|
329 | - $gateway_response = esc_html__('The payment has been declined.', 'event_espresso'); |
|
330 | - break; |
|
331 | - |
|
332 | - case 'Expired': |
|
333 | - case 'Failed': |
|
334 | - $status = $this->_pay_model->failed_status(); |
|
335 | - $gateway_response = esc_html__('The payment failed for technical reasons or expired.', 'event_espresso'); |
|
336 | - break; |
|
337 | - |
|
338 | - case 'Refunded': |
|
339 | - case 'Partially_Refunded': |
|
340 | - // even though it's a refund, we consider the payment as approved, it just has a negative value |
|
341 | - $status = $this->_pay_model->approved_status(); |
|
342 | - $gateway_response = esc_html__( |
|
343 | - 'The payment has been refunded. Please update registrations accordingly.', |
|
344 | - 'event_espresso' |
|
345 | - ); |
|
346 | - break; |
|
347 | - |
|
348 | - case 'Voided': |
|
349 | - case 'Reversed': |
|
350 | - case 'Canceled_Reversal': |
|
351 | - default: |
|
352 | - $status = $this->_pay_model->cancelled_status(); |
|
353 | - $gateway_response = esc_html__( |
|
354 | - 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', |
|
355 | - 'event_espresso' |
|
356 | - ); |
|
357 | - break; |
|
358 | - } |
|
359 | - |
|
360 | - // check if we've already processed this payment |
|
361 | - if ($payment instanceof EEI_Payment) { |
|
362 | - // payment exists. if this has the exact same status and amount, don't bother updating. just return |
|
363 | - if ($payment->status() === $status && (float) $payment->amount() === (float) $update_info['mc_gross']) { |
|
364 | - // DUPLICATED IPN! don't bother updating transaction |
|
365 | - throw new IpnException( |
|
366 | - sprintf( |
|
367 | - esc_html__( |
|
368 | - 'It appears we have received a duplicate IPN from PayPal for payment %d', |
|
369 | - 'event_espresso' |
|
370 | - ), |
|
371 | - $payment->ID() |
|
372 | - ), |
|
373 | - IpnException::DUPLICATE, |
|
374 | - null, |
|
375 | - $payment, |
|
376 | - $update_info |
|
377 | - ); |
|
378 | - } else { |
|
379 | - // new payment yippee !!! |
|
380 | - $payment->set_status($status); |
|
381 | - $payment->set_amount((float) $update_info['mc_gross']); |
|
382 | - $payment->set_gateway_response($gateway_response); |
|
383 | - $payment->set_details($update_info); |
|
384 | - $payment->set_txn_id_chq_nmbr($update_info['txn_id']); |
|
385 | - $this->log( |
|
386 | - array( |
|
387 | - 'message' => esc_html__( |
|
388 | - 'Updated payment either from IPN or as part of POST from PayPal', |
|
389 | - 'event_espresso' |
|
390 | - ), |
|
391 | - 'url' => $this->_process_response_url(), |
|
392 | - 'payment' => $payment->model_field_array(), |
|
393 | - 'IPN_data' => $update_info |
|
394 | - ), |
|
395 | - $payment |
|
396 | - ); |
|
397 | - } |
|
398 | - } |
|
399 | - do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this); |
|
400 | - return $payment; |
|
401 | - } |
|
402 | - |
|
403 | - |
|
404 | - /** |
|
405 | - * Validate the IPN notification. |
|
406 | - * |
|
407 | - * @param array $update_info like $_REQUEST |
|
408 | - * @param EE_Payment|EEI_Payment $payment |
|
409 | - * @return boolean |
|
410 | - * @throws \EE_Error |
|
411 | - */ |
|
412 | - public function validate_ipn($update_info, $payment) |
|
413 | - { |
|
414 | - // allow us to skip validating IPNs with PayPal (useful for testing) |
|
415 | - if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) { |
|
416 | - return true; |
|
417 | - } |
|
418 | - // ...otherwise, we actually don't care what the $update_info is, we need to look |
|
419 | - // at the request directly because we can't use $update_info because it has issues with quotes |
|
420 | - // Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. |
|
421 | - // Instead, read raw POST data from the input stream. |
|
422 | - // @see https://gist.github.com/xcommerce-gists/3440401 |
|
423 | - $raw_post_data = file_get_contents('php://input'); |
|
424 | - $raw_post_array = explode('&', $raw_post_data); |
|
425 | - $update_info = array(); |
|
426 | - foreach ($raw_post_array as $keyval) { |
|
427 | - $keyval = explode('=', $keyval); |
|
428 | - if (count($keyval) === 2) { |
|
429 | - $update_info[ $keyval[0] ] = urldecode($keyval[1]); |
|
430 | - } |
|
431 | - } |
|
432 | - // read the IPN message sent from PayPal and prepend 'cmd=_notify-validate' |
|
433 | - $req = 'cmd=_notify-validate'; |
|
434 | - $uses_get_magic_quotes = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() === 1 |
|
435 | - ? true |
|
436 | - : false; |
|
437 | - foreach ($update_info as $key => $value) { |
|
438 | - $value = $uses_get_magic_quotes ? urlencode(stripslashes($value)) : urlencode($value); |
|
439 | - $req .= "&$key=$value"; |
|
440 | - } |
|
441 | - // HTTP POST the complete, unaltered IPN back to PayPal |
|
442 | - $response = wp_remote_post( |
|
443 | - $this->_gateway_url, |
|
444 | - array( |
|
445 | - 'body' => $req, |
|
446 | - 'sslverify' => false, |
|
447 | - 'timeout' => 60, |
|
448 | - // make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal |
|
449 | - // plz see: https://github.com/websharks/s2member/issues/610 |
|
450 | - 'user-agent' => 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(), |
|
451 | - 'httpversion' => '1.1' |
|
452 | - ) |
|
453 | - ); |
|
454 | - // then check the response |
|
455 | - if ( |
|
456 | - array_key_exists('body', $response) |
|
457 | - && ! is_wp_error($response) |
|
458 | - && strcmp($response['body'], "VERIFIED") === 0 |
|
459 | - ) { |
|
460 | - return true; |
|
461 | - } |
|
462 | - // huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly, |
|
463 | - // or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html |
|
464 | - if ($response instanceof WP_Error) { |
|
465 | - $error_msg = sprintf( |
|
466 | - esc_html__('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'), |
|
467 | - $response->get_error_code(), |
|
468 | - $response->get_error_message(), |
|
469 | - print_r($response->get_error_data(), true) |
|
470 | - ); |
|
471 | - } elseif (is_array($response) && isset($response['body'])) { |
|
472 | - $error_msg = $response['body']; |
|
473 | - } else { |
|
474 | - $error_msg = print_r($response, true); |
|
475 | - } |
|
476 | - $payment->set_gateway_response( |
|
477 | - sprintf( |
|
478 | - esc_html__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), |
|
479 | - $error_msg |
|
480 | - ) |
|
481 | - ); |
|
482 | - $payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response)); |
|
483 | - $payment->set_status(EEM_Payment::status_id_failed); |
|
484 | - // log the results |
|
485 | - $this->log( |
|
486 | - array( |
|
487 | - 'url' => $this->_process_response_url(), |
|
488 | - 'message' => $payment->gateway_response(), |
|
489 | - 'details' => $payment->details(), |
|
490 | - ), |
|
491 | - $payment |
|
492 | - ); |
|
493 | - return false; |
|
494 | - } |
|
495 | - |
|
496 | - |
|
497 | - /** |
|
498 | - * _process_response_url |
|
499 | - * @return string |
|
500 | - */ |
|
501 | - protected function _process_response_url() |
|
502 | - { |
|
503 | - if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) { |
|
504 | - $url = is_ssl() ? 'https://' : 'http://'; |
|
505 | - $url .= EEH_URL::filter_input_server_url('HTTP_HOST'); |
|
506 | - $url .= EEH_URL::filter_input_server_url(); |
|
507 | - } else { |
|
508 | - $url = 'unknown'; |
|
509 | - } |
|
510 | - return $url; |
|
511 | - } |
|
512 | - |
|
513 | - |
|
514 | - /** |
|
515 | - * Updates the transaction and line items based on the payment IPN data from PayPal, |
|
516 | - * like the taxes or shipping |
|
517 | - * |
|
518 | - * @param EEI_Payment $payment |
|
519 | - * @throws \EE_Error |
|
520 | - */ |
|
521 | - public function update_txn_based_on_payment($payment) |
|
522 | - { |
|
523 | - $update_info = $payment->details(); |
|
524 | - /** @var EE_Transaction $transaction */ |
|
525 | - $transaction = $payment->transaction(); |
|
526 | - $payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false); |
|
527 | - if (! $transaction) { |
|
528 | - $this->log( |
|
529 | - esc_html__( |
|
530 | - // @codingStandardsIgnoreStart |
|
531 | - 'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', |
|
532 | - // @codingStandardsIgnoreEnd |
|
533 | - 'event_espresso' |
|
534 | - ), |
|
535 | - $payment |
|
536 | - ); |
|
537 | - return; |
|
538 | - } |
|
539 | - if ( |
|
540 | - ! is_array($update_info) |
|
541 | - || ! isset($update_info['mc_shipping']) |
|
542 | - || ! isset($update_info['tax']) |
|
543 | - ) { |
|
544 | - $this->log( |
|
545 | - array( |
|
546 | - 'message' => esc_html__( |
|
547 | - // @codingStandardsIgnoreStart |
|
548 | - 'Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', |
|
549 | - // @codingStandardsIgnoreEnd |
|
550 | - 'event_espresso' |
|
551 | - ), |
|
552 | - 'url' => $this->_process_response_url(), |
|
553 | - 'payment' => $payment->model_field_array() |
|
554 | - ), |
|
555 | - $payment |
|
556 | - ); |
|
557 | - return; |
|
558 | - } |
|
559 | - if ($payment->status() !== $this->_pay_model->approved_status()) { |
|
560 | - $this->log( |
|
561 | - array( |
|
562 | - 'message' => esc_html__( |
|
563 | - 'We shouldn\'t update transactions taxes or shipping data from non-approved payments', |
|
564 | - 'event_espresso' |
|
565 | - ), |
|
566 | - 'url' => $this->_process_response_url(), |
|
567 | - 'payment' => $payment->model_field_array() |
|
568 | - ), |
|
569 | - $payment |
|
570 | - ); |
|
571 | - return; |
|
572 | - } |
|
573 | - $grand_total_needs_resaving = false; |
|
574 | - /** @var EE_Line_Item $transaction_total_line_item */ |
|
575 | - $transaction_total_line_item = $transaction->total_line_item(); |
|
576 | - |
|
577 | - // might paypal have changed the taxes? |
|
578 | - if ($this->_paypal_taxes && $payment_was_itemized) { |
|
579 | - // note that we're doing this BEFORE adding shipping; |
|
580 | - // we actually want PayPal's shipping to remain non-taxable |
|
581 | - $this->_line_item->set_line_items_taxable($transaction_total_line_item, true, 'paypal_shipping'); |
|
582 | - $this->_line_item->set_total_tax_to( |
|
583 | - $transaction_total_line_item, |
|
584 | - (float) $update_info['tax'], |
|
585 | - esc_html__('Taxes', 'event_espresso'), |
|
586 | - esc_html__('Calculated by Paypal', 'event_espresso'), |
|
587 | - 'paypal_tax' |
|
588 | - ); |
|
589 | - $grand_total_needs_resaving = true; |
|
590 | - } |
|
591 | - |
|
592 | - $shipping_amount = (float) $update_info['mc_shipping']; |
|
593 | - // might paypal have added shipping? |
|
594 | - if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) { |
|
595 | - $this->_line_item->add_unrelated_item( |
|
596 | - $transaction_total_line_item, |
|
597 | - sprintf(esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()), |
|
598 | - $shipping_amount, |
|
599 | - esc_html__('Shipping charges calculated by Paypal', 'event_espresso'), |
|
600 | - 1, |
|
601 | - false, |
|
602 | - 'paypal_shipping_' . $transaction->ID() |
|
603 | - ); |
|
604 | - $grand_total_needs_resaving = true; |
|
605 | - } |
|
606 | - |
|
607 | - if ($grand_total_needs_resaving) { |
|
608 | - $transaction_total_line_item->save_this_and_descendants_to_txn($transaction->ID()); |
|
609 | - /** @var EE_Registration_Processor $registration_processor */ |
|
610 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
611 | - $registration_processor->update_registration_final_prices($transaction); |
|
612 | - } |
|
613 | - $this->log( |
|
614 | - array( |
|
615 | - 'message' => esc_html__('Updated transaction related to payment', 'event_espresso'), |
|
616 | - 'url' => $this->_process_response_url(), |
|
617 | - 'transaction (updated)' => $transaction->model_field_array(), |
|
618 | - 'payment (updated)' => $payment->model_field_array(), |
|
619 | - 'use_paypal_shipping' => $this->_paypal_shipping, |
|
620 | - 'use_paypal_tax' => $this->_paypal_taxes, |
|
621 | - 'grand_total_needed_resaving' => $grand_total_needs_resaving, |
|
622 | - ), |
|
623 | - $payment |
|
624 | - ); |
|
625 | - } |
|
213 | + $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
214 | + $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
215 | + } |
|
216 | + |
|
217 | + $redirect_args['business'] = $this->_paypal_id; |
|
218 | + $redirect_args['return'] = $return_url; |
|
219 | + $redirect_args['cancel_return'] = $cancel_url; |
|
220 | + $redirect_args['notify_url'] = $notify_url; |
|
221 | + $redirect_args['cmd'] = '_cart'; |
|
222 | + $redirect_args['upload'] = 1; |
|
223 | + $redirect_args['currency_code'] = $payment->currency_code(); |
|
224 | + $redirect_args['rm'] = 2;// makes the user return with method=POST |
|
225 | + if ($this->_image_url) { |
|
226 | + $redirect_args['image_url'] = $this->_image_url; |
|
227 | + } |
|
228 | + $redirect_args['no_shipping'] = $this->_shipping_details; |
|
229 | + $redirect_args['bn'] = 'EventEspresso_SP';// EE will blow up if you change this |
|
230 | + |
|
231 | + $redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this); |
|
232 | + |
|
233 | + $payment->set_redirect_url($this->_gateway_url); |
|
234 | + $payment->set_redirect_args($redirect_args); |
|
235 | + // log the results |
|
236 | + $this->log( |
|
237 | + array( |
|
238 | + 'message' => sprintf( |
|
239 | + esc_html__('PayPal payment request initiated.', 'event_espresso') |
|
240 | + ), |
|
241 | + 'transaction' => $transaction->model_field_array(), |
|
242 | + ), |
|
243 | + $payment |
|
244 | + ); |
|
245 | + return $payment; |
|
246 | + } |
|
247 | + |
|
248 | + |
|
249 | + /** |
|
250 | + * Often used for IPNs. But applies the info in $update_info to the payment. |
|
251 | + * What is $update_info? Often the contents of $_REQUEST, but not necessarily. Whatever |
|
252 | + * the payment method passes in. |
|
253 | + * |
|
254 | + * @param array $update_info like $_POST |
|
255 | + * @param EEI_Transaction $transaction |
|
256 | + * @return \EEI_Payment updated |
|
257 | + * @throws \EE_Error, IpnException |
|
258 | + */ |
|
259 | + public function handle_payment_update($update_info, $transaction) |
|
260 | + { |
|
261 | + // verify there's payment data that's been sent |
|
262 | + if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) { |
|
263 | + // log the results |
|
264 | + $this->log( |
|
265 | + array( |
|
266 | + 'message' => sprintf( |
|
267 | + // @codingStandardsIgnoreStart |
|
268 | + esc_html__('PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso') |
|
269 | + // @codingStandardsIgnoreEnd |
|
270 | + ), |
|
271 | + 'update_info' => $update_info, |
|
272 | + ), |
|
273 | + $transaction |
|
274 | + ); |
|
275 | + // waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/) |
|
276 | + // indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes |
|
277 | + if (isset($update_info['tx'])) { |
|
278 | + return $transaction->last_payment(); |
|
279 | + } else { |
|
280 | + return null; |
|
281 | + } |
|
282 | + } |
|
283 | + $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']); |
|
284 | + if (! $payment instanceof EEI_Payment) { |
|
285 | + $payment = $transaction->last_payment(); |
|
286 | + } |
|
287 | + // ok, then validate the IPN. Even if we've already processed this payment, |
|
288 | + // let PayPal know we don't want to hear from them anymore! |
|
289 | + if (! $this->validate_ipn($update_info, $payment)) { |
|
290 | + return $payment; |
|
291 | + } |
|
292 | + // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction, |
|
293 | + // registrations, ticket counts, etc) |
|
294 | + if ( |
|
295 | + ( |
|
296 | + $update_info['payment_status'] === 'Refunded' |
|
297 | + || $update_info['payment_status'] === 'Partially_Refunded' |
|
298 | + ) |
|
299 | + && apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true) |
|
300 | + ) { |
|
301 | + throw new EventEspresso\core\exceptions\IpnException( |
|
302 | + sprintf( |
|
303 | + esc_html__('Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'), |
|
304 | + $update_info['payment_status'] |
|
305 | + ), |
|
306 | + EventEspresso\core\exceptions\IpnException::UNSUPPORTED, |
|
307 | + null, |
|
308 | + $payment, |
|
309 | + $update_info |
|
310 | + ); |
|
311 | + } |
|
312 | + // ok, well let's process this payment then! |
|
313 | + switch ($update_info['payment_status']) { |
|
314 | + case 'Completed': |
|
315 | + $status = $this->_pay_model->approved_status(); |
|
316 | + $gateway_response = esc_html__('The payment is approved.', 'event_espresso'); |
|
317 | + break; |
|
318 | + |
|
319 | + case 'Pending': |
|
320 | + $status = $this->_pay_model->pending_status(); |
|
321 | + $gateway_response = esc_html__( |
|
322 | + 'The payment is in progress. Another message will be sent when payment is approved.', |
|
323 | + 'event_espresso' |
|
324 | + ); |
|
325 | + break; |
|
326 | + |
|
327 | + case 'Denied': |
|
328 | + $status = $this->_pay_model->declined_status(); |
|
329 | + $gateway_response = esc_html__('The payment has been declined.', 'event_espresso'); |
|
330 | + break; |
|
331 | + |
|
332 | + case 'Expired': |
|
333 | + case 'Failed': |
|
334 | + $status = $this->_pay_model->failed_status(); |
|
335 | + $gateway_response = esc_html__('The payment failed for technical reasons or expired.', 'event_espresso'); |
|
336 | + break; |
|
337 | + |
|
338 | + case 'Refunded': |
|
339 | + case 'Partially_Refunded': |
|
340 | + // even though it's a refund, we consider the payment as approved, it just has a negative value |
|
341 | + $status = $this->_pay_model->approved_status(); |
|
342 | + $gateway_response = esc_html__( |
|
343 | + 'The payment has been refunded. Please update registrations accordingly.', |
|
344 | + 'event_espresso' |
|
345 | + ); |
|
346 | + break; |
|
347 | + |
|
348 | + case 'Voided': |
|
349 | + case 'Reversed': |
|
350 | + case 'Canceled_Reversal': |
|
351 | + default: |
|
352 | + $status = $this->_pay_model->cancelled_status(); |
|
353 | + $gateway_response = esc_html__( |
|
354 | + 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', |
|
355 | + 'event_espresso' |
|
356 | + ); |
|
357 | + break; |
|
358 | + } |
|
359 | + |
|
360 | + // check if we've already processed this payment |
|
361 | + if ($payment instanceof EEI_Payment) { |
|
362 | + // payment exists. if this has the exact same status and amount, don't bother updating. just return |
|
363 | + if ($payment->status() === $status && (float) $payment->amount() === (float) $update_info['mc_gross']) { |
|
364 | + // DUPLICATED IPN! don't bother updating transaction |
|
365 | + throw new IpnException( |
|
366 | + sprintf( |
|
367 | + esc_html__( |
|
368 | + 'It appears we have received a duplicate IPN from PayPal for payment %d', |
|
369 | + 'event_espresso' |
|
370 | + ), |
|
371 | + $payment->ID() |
|
372 | + ), |
|
373 | + IpnException::DUPLICATE, |
|
374 | + null, |
|
375 | + $payment, |
|
376 | + $update_info |
|
377 | + ); |
|
378 | + } else { |
|
379 | + // new payment yippee !!! |
|
380 | + $payment->set_status($status); |
|
381 | + $payment->set_amount((float) $update_info['mc_gross']); |
|
382 | + $payment->set_gateway_response($gateway_response); |
|
383 | + $payment->set_details($update_info); |
|
384 | + $payment->set_txn_id_chq_nmbr($update_info['txn_id']); |
|
385 | + $this->log( |
|
386 | + array( |
|
387 | + 'message' => esc_html__( |
|
388 | + 'Updated payment either from IPN or as part of POST from PayPal', |
|
389 | + 'event_espresso' |
|
390 | + ), |
|
391 | + 'url' => $this->_process_response_url(), |
|
392 | + 'payment' => $payment->model_field_array(), |
|
393 | + 'IPN_data' => $update_info |
|
394 | + ), |
|
395 | + $payment |
|
396 | + ); |
|
397 | + } |
|
398 | + } |
|
399 | + do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this); |
|
400 | + return $payment; |
|
401 | + } |
|
402 | + |
|
403 | + |
|
404 | + /** |
|
405 | + * Validate the IPN notification. |
|
406 | + * |
|
407 | + * @param array $update_info like $_REQUEST |
|
408 | + * @param EE_Payment|EEI_Payment $payment |
|
409 | + * @return boolean |
|
410 | + * @throws \EE_Error |
|
411 | + */ |
|
412 | + public function validate_ipn($update_info, $payment) |
|
413 | + { |
|
414 | + // allow us to skip validating IPNs with PayPal (useful for testing) |
|
415 | + if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) { |
|
416 | + return true; |
|
417 | + } |
|
418 | + // ...otherwise, we actually don't care what the $update_info is, we need to look |
|
419 | + // at the request directly because we can't use $update_info because it has issues with quotes |
|
420 | + // Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. |
|
421 | + // Instead, read raw POST data from the input stream. |
|
422 | + // @see https://gist.github.com/xcommerce-gists/3440401 |
|
423 | + $raw_post_data = file_get_contents('php://input'); |
|
424 | + $raw_post_array = explode('&', $raw_post_data); |
|
425 | + $update_info = array(); |
|
426 | + foreach ($raw_post_array as $keyval) { |
|
427 | + $keyval = explode('=', $keyval); |
|
428 | + if (count($keyval) === 2) { |
|
429 | + $update_info[ $keyval[0] ] = urldecode($keyval[1]); |
|
430 | + } |
|
431 | + } |
|
432 | + // read the IPN message sent from PayPal and prepend 'cmd=_notify-validate' |
|
433 | + $req = 'cmd=_notify-validate'; |
|
434 | + $uses_get_magic_quotes = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() === 1 |
|
435 | + ? true |
|
436 | + : false; |
|
437 | + foreach ($update_info as $key => $value) { |
|
438 | + $value = $uses_get_magic_quotes ? urlencode(stripslashes($value)) : urlencode($value); |
|
439 | + $req .= "&$key=$value"; |
|
440 | + } |
|
441 | + // HTTP POST the complete, unaltered IPN back to PayPal |
|
442 | + $response = wp_remote_post( |
|
443 | + $this->_gateway_url, |
|
444 | + array( |
|
445 | + 'body' => $req, |
|
446 | + 'sslverify' => false, |
|
447 | + 'timeout' => 60, |
|
448 | + // make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal |
|
449 | + // plz see: https://github.com/websharks/s2member/issues/610 |
|
450 | + 'user-agent' => 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(), |
|
451 | + 'httpversion' => '1.1' |
|
452 | + ) |
|
453 | + ); |
|
454 | + // then check the response |
|
455 | + if ( |
|
456 | + array_key_exists('body', $response) |
|
457 | + && ! is_wp_error($response) |
|
458 | + && strcmp($response['body'], "VERIFIED") === 0 |
|
459 | + ) { |
|
460 | + return true; |
|
461 | + } |
|
462 | + // huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly, |
|
463 | + // or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html |
|
464 | + if ($response instanceof WP_Error) { |
|
465 | + $error_msg = sprintf( |
|
466 | + esc_html__('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'), |
|
467 | + $response->get_error_code(), |
|
468 | + $response->get_error_message(), |
|
469 | + print_r($response->get_error_data(), true) |
|
470 | + ); |
|
471 | + } elseif (is_array($response) && isset($response['body'])) { |
|
472 | + $error_msg = $response['body']; |
|
473 | + } else { |
|
474 | + $error_msg = print_r($response, true); |
|
475 | + } |
|
476 | + $payment->set_gateway_response( |
|
477 | + sprintf( |
|
478 | + esc_html__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), |
|
479 | + $error_msg |
|
480 | + ) |
|
481 | + ); |
|
482 | + $payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response)); |
|
483 | + $payment->set_status(EEM_Payment::status_id_failed); |
|
484 | + // log the results |
|
485 | + $this->log( |
|
486 | + array( |
|
487 | + 'url' => $this->_process_response_url(), |
|
488 | + 'message' => $payment->gateway_response(), |
|
489 | + 'details' => $payment->details(), |
|
490 | + ), |
|
491 | + $payment |
|
492 | + ); |
|
493 | + return false; |
|
494 | + } |
|
495 | + |
|
496 | + |
|
497 | + /** |
|
498 | + * _process_response_url |
|
499 | + * @return string |
|
500 | + */ |
|
501 | + protected function _process_response_url() |
|
502 | + { |
|
503 | + if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) { |
|
504 | + $url = is_ssl() ? 'https://' : 'http://'; |
|
505 | + $url .= EEH_URL::filter_input_server_url('HTTP_HOST'); |
|
506 | + $url .= EEH_URL::filter_input_server_url(); |
|
507 | + } else { |
|
508 | + $url = 'unknown'; |
|
509 | + } |
|
510 | + return $url; |
|
511 | + } |
|
512 | + |
|
513 | + |
|
514 | + /** |
|
515 | + * Updates the transaction and line items based on the payment IPN data from PayPal, |
|
516 | + * like the taxes or shipping |
|
517 | + * |
|
518 | + * @param EEI_Payment $payment |
|
519 | + * @throws \EE_Error |
|
520 | + */ |
|
521 | + public function update_txn_based_on_payment($payment) |
|
522 | + { |
|
523 | + $update_info = $payment->details(); |
|
524 | + /** @var EE_Transaction $transaction */ |
|
525 | + $transaction = $payment->transaction(); |
|
526 | + $payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false); |
|
527 | + if (! $transaction) { |
|
528 | + $this->log( |
|
529 | + esc_html__( |
|
530 | + // @codingStandardsIgnoreStart |
|
531 | + 'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', |
|
532 | + // @codingStandardsIgnoreEnd |
|
533 | + 'event_espresso' |
|
534 | + ), |
|
535 | + $payment |
|
536 | + ); |
|
537 | + return; |
|
538 | + } |
|
539 | + if ( |
|
540 | + ! is_array($update_info) |
|
541 | + || ! isset($update_info['mc_shipping']) |
|
542 | + || ! isset($update_info['tax']) |
|
543 | + ) { |
|
544 | + $this->log( |
|
545 | + array( |
|
546 | + 'message' => esc_html__( |
|
547 | + // @codingStandardsIgnoreStart |
|
548 | + 'Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', |
|
549 | + // @codingStandardsIgnoreEnd |
|
550 | + 'event_espresso' |
|
551 | + ), |
|
552 | + 'url' => $this->_process_response_url(), |
|
553 | + 'payment' => $payment->model_field_array() |
|
554 | + ), |
|
555 | + $payment |
|
556 | + ); |
|
557 | + return; |
|
558 | + } |
|
559 | + if ($payment->status() !== $this->_pay_model->approved_status()) { |
|
560 | + $this->log( |
|
561 | + array( |
|
562 | + 'message' => esc_html__( |
|
563 | + 'We shouldn\'t update transactions taxes or shipping data from non-approved payments', |
|
564 | + 'event_espresso' |
|
565 | + ), |
|
566 | + 'url' => $this->_process_response_url(), |
|
567 | + 'payment' => $payment->model_field_array() |
|
568 | + ), |
|
569 | + $payment |
|
570 | + ); |
|
571 | + return; |
|
572 | + } |
|
573 | + $grand_total_needs_resaving = false; |
|
574 | + /** @var EE_Line_Item $transaction_total_line_item */ |
|
575 | + $transaction_total_line_item = $transaction->total_line_item(); |
|
576 | + |
|
577 | + // might paypal have changed the taxes? |
|
578 | + if ($this->_paypal_taxes && $payment_was_itemized) { |
|
579 | + // note that we're doing this BEFORE adding shipping; |
|
580 | + // we actually want PayPal's shipping to remain non-taxable |
|
581 | + $this->_line_item->set_line_items_taxable($transaction_total_line_item, true, 'paypal_shipping'); |
|
582 | + $this->_line_item->set_total_tax_to( |
|
583 | + $transaction_total_line_item, |
|
584 | + (float) $update_info['tax'], |
|
585 | + esc_html__('Taxes', 'event_espresso'), |
|
586 | + esc_html__('Calculated by Paypal', 'event_espresso'), |
|
587 | + 'paypal_tax' |
|
588 | + ); |
|
589 | + $grand_total_needs_resaving = true; |
|
590 | + } |
|
591 | + |
|
592 | + $shipping_amount = (float) $update_info['mc_shipping']; |
|
593 | + // might paypal have added shipping? |
|
594 | + if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) { |
|
595 | + $this->_line_item->add_unrelated_item( |
|
596 | + $transaction_total_line_item, |
|
597 | + sprintf(esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()), |
|
598 | + $shipping_amount, |
|
599 | + esc_html__('Shipping charges calculated by Paypal', 'event_espresso'), |
|
600 | + 1, |
|
601 | + false, |
|
602 | + 'paypal_shipping_' . $transaction->ID() |
|
603 | + ); |
|
604 | + $grand_total_needs_resaving = true; |
|
605 | + } |
|
606 | + |
|
607 | + if ($grand_total_needs_resaving) { |
|
608 | + $transaction_total_line_item->save_this_and_descendants_to_txn($transaction->ID()); |
|
609 | + /** @var EE_Registration_Processor $registration_processor */ |
|
610 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
611 | + $registration_processor->update_registration_final_prices($transaction); |
|
612 | + } |
|
613 | + $this->log( |
|
614 | + array( |
|
615 | + 'message' => esc_html__('Updated transaction related to payment', 'event_espresso'), |
|
616 | + 'url' => $this->_process_response_url(), |
|
617 | + 'transaction (updated)' => $transaction->model_field_array(), |
|
618 | + 'payment (updated)' => $payment->model_field_array(), |
|
619 | + 'use_paypal_shipping' => $this->_paypal_shipping, |
|
620 | + 'use_paypal_tax' => $this->_paypal_taxes, |
|
621 | + 'grand_total_needed_resaving' => $grand_total_needs_resaving, |
|
622 | + ), |
|
623 | + $payment |
|
624 | + ); |
|
625 | + } |
|
626 | 626 | } |
@@ -137,17 +137,17 @@ discard block |
||
137 | 137 | $shipping_previously_added = $line_item->total(); |
138 | 138 | continue; |
139 | 139 | } |
140 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
140 | + $redirect_args['item_name_'.$item_num] = substr( |
|
141 | 141 | $gateway_formatter->formatLineItemName($line_item, $payment), |
142 | 142 | 0, |
143 | 143 | 127 |
144 | 144 | ); |
145 | - $redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price(); |
|
146 | - $redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity(); |
|
145 | + $redirect_args['amount_'.$item_num] = $line_item->unit_price(); |
|
146 | + $redirect_args['quantity_'.$item_num] = $line_item->quantity(); |
|
147 | 147 | // if we're not letting PayPal calculate shipping, tell them its 0 |
148 | - if (! $this->_paypal_shipping) { |
|
149 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
150 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
148 | + if ( ! $this->_paypal_shipping) { |
|
149 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
150 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
151 | 151 | } |
152 | 152 | $item_num++; |
153 | 153 | $itemized_sum += $line_item->total(); |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | // itemized sum is too big |
168 | 168 | $total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total); |
169 | 169 | } elseif ($itemized_sum_diff_from_txn_total > 0) { |
170 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
170 | + $redirect_args['item_name_'.$item_num] = substr( |
|
171 | 171 | esc_html__('Other charges', 'event_espresso'), |
172 | 172 | 0, |
173 | 173 | 127 |
174 | 174 | ); |
175 | - $redirect_args[ 'amount_' . $item_num ] = $gateway_formatter->formatCurrency( |
|
175 | + $redirect_args['amount_'.$item_num] = $gateway_formatter->formatCurrency( |
|
176 | 176 | $itemized_sum_diff_from_txn_total |
177 | 177 | ); |
178 | - $redirect_args[ 'quantity_' . $item_num ] = 1; |
|
178 | + $redirect_args['quantity_'.$item_num] = 1; |
|
179 | 179 | $item_num++; |
180 | 180 | } |
181 | 181 | if ($total_discounts_to_cart_total > 0) { |
@@ -184,34 +184,34 @@ discard block |
||
184 | 184 | ); |
185 | 185 | } |
186 | 186 | // add our taxes to the order if we're NOT using PayPal's |
187 | - if (! $this->_paypal_taxes) { |
|
187 | + if ( ! $this->_paypal_taxes) { |
|
188 | 188 | $redirect_args['tax_cart'] = $total_line_item->get_total_tax(); |
189 | 189 | } |
190 | 190 | } else { |
191 | 191 | $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false); |
192 | 192 | // partial payment that's not for the remaining amount, so we can't send an itemized list |
193 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
193 | + $redirect_args['item_name_'.$item_num] = substr( |
|
194 | 194 | $gateway_formatter->formatPartialPaymentLineItemName($payment), |
195 | 195 | 0, |
196 | 196 | 127 |
197 | 197 | ); |
198 | - $redirect_args[ 'amount_' . $item_num ] = $payment->amount(); |
|
199 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
200 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
198 | + $redirect_args['amount_'.$item_num] = $payment->amount(); |
|
199 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
200 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
201 | 201 | $redirect_args['tax_cart'] = '0'; |
202 | 202 | $item_num++; |
203 | 203 | } |
204 | 204 | |
205 | 205 | if ($this->_debug_mode) { |
206 | - $redirect_args[ 'item_name_' . $item_num ] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
207 | - $redirect_args[ 'amount_' . $item_num ] = 0; |
|
208 | - $redirect_args[ 'on0_' . $item_num ] = 'NOTIFY URL'; |
|
209 | - $redirect_args[ 'os0_' . $item_num ] = $notify_url; |
|
210 | - $redirect_args[ 'on1_' . $item_num ] = 'RETURN URL'; |
|
211 | - $redirect_args[ 'os1_' . $item_num ] = $return_url; |
|
206 | + $redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
207 | + $redirect_args['amount_'.$item_num] = 0; |
|
208 | + $redirect_args['on0_'.$item_num] = 'NOTIFY URL'; |
|
209 | + $redirect_args['os0_'.$item_num] = $notify_url; |
|
210 | + $redirect_args['on1_'.$item_num] = 'RETURN URL'; |
|
211 | + $redirect_args['os1_'.$item_num] = $return_url; |
|
212 | 212 | // $redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ? |
213 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
214 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
213 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
214 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $redirect_args['business'] = $this->_paypal_id; |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | $redirect_args['cmd'] = '_cart'; |
222 | 222 | $redirect_args['upload'] = 1; |
223 | 223 | $redirect_args['currency_code'] = $payment->currency_code(); |
224 | - $redirect_args['rm'] = 2;// makes the user return with method=POST |
|
224 | + $redirect_args['rm'] = 2; // makes the user return with method=POST |
|
225 | 225 | if ($this->_image_url) { |
226 | 226 | $redirect_args['image_url'] = $this->_image_url; |
227 | 227 | } |
228 | 228 | $redirect_args['no_shipping'] = $this->_shipping_details; |
229 | - $redirect_args['bn'] = 'EventEspresso_SP';// EE will blow up if you change this |
|
229 | + $redirect_args['bn'] = 'EventEspresso_SP'; // EE will blow up if you change this |
|
230 | 230 | |
231 | 231 | $redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this); |
232 | 232 | |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | } |
282 | 282 | } |
283 | 283 | $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']); |
284 | - if (! $payment instanceof EEI_Payment) { |
|
284 | + if ( ! $payment instanceof EEI_Payment) { |
|
285 | 285 | $payment = $transaction->last_payment(); |
286 | 286 | } |
287 | 287 | // ok, then validate the IPN. Even if we've already processed this payment, |
288 | 288 | // let PayPal know we don't want to hear from them anymore! |
289 | - if (! $this->validate_ipn($update_info, $payment)) { |
|
289 | + if ( ! $this->validate_ipn($update_info, $payment)) { |
|
290 | 290 | return $payment; |
291 | 291 | } |
292 | 292 | // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction, |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | foreach ($raw_post_array as $keyval) { |
427 | 427 | $keyval = explode('=', $keyval); |
428 | 428 | if (count($keyval) === 2) { |
429 | - $update_info[ $keyval[0] ] = urldecode($keyval[1]); |
|
429 | + $update_info[$keyval[0]] = urldecode($keyval[1]); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | // read the IPN message sent from PayPal and prepend 'cmd=_notify-validate' |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | 'timeout' => 60, |
448 | 448 | // make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal |
449 | 449 | // plz see: https://github.com/websharks/s2member/issues/610 |
450 | - 'user-agent' => 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(), |
|
450 | + 'user-agent' => 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(), |
|
451 | 451 | 'httpversion' => '1.1' |
452 | 452 | ) |
453 | 453 | ); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | /** @var EE_Transaction $transaction */ |
525 | 525 | $transaction = $payment->transaction(); |
526 | 526 | $payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false); |
527 | - if (! $transaction) { |
|
527 | + if ( ! $transaction) { |
|
528 | 528 | $this->log( |
529 | 529 | esc_html__( |
530 | 530 | // @codingStandardsIgnoreStart |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | esc_html__('Shipping charges calculated by Paypal', 'event_espresso'), |
600 | 600 | 1, |
601 | 601 | false, |
602 | - 'paypal_shipping_' . $transaction->ID() |
|
602 | + 'paypal_shipping_'.$transaction->ID() |
|
603 | 603 | ); |
604 | 604 | $grand_total_needs_resaving = true; |
605 | 605 | } |
@@ -16,78 +16,78 @@ |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @param EE_PMT_Paypal_Standard $payment_method_type |
|
21 | - */ |
|
22 | - public function __construct($payment_method_type) |
|
23 | - { |
|
24 | - parent::__construct( |
|
25 | - array( |
|
26 | - 'payment_method_type' => $payment_method_type, |
|
27 | - 'extra_meta_inputs' => array( |
|
28 | - 'paypal_id' => new EE_Text_Input(array( |
|
29 | - 'html_label_text' => sprintf(esc_html__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
30 | - 'html_help_text' => esc_html__("Typically [email protected]", 'event_espresso'), |
|
31 | - 'required' => true |
|
32 | - )), |
|
33 | - 'image_url' => new EE_Admin_File_Uploader_Input(array( |
|
34 | - 'html_help_text' => esc_html__("Used for your business/personal logo on the PayPal page", 'event_espresso'), |
|
35 | - 'html_label_text' => esc_html__('Image URL', 'event_espresso') |
|
36 | - )), |
|
37 | - 'paypal_taxes' => new EE_Yes_No_Input(array( |
|
38 | - 'html_label_text' => sprintf(esc_html__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
39 | - 'html_help_text' => esc_html__('Whether Paypal should add taxes to the order', 'event_espresso'), |
|
40 | - 'default' => false |
|
41 | - )), |
|
42 | - 'paypal_shipping' => new EE_Yes_No_Input(array( |
|
43 | - 'html_label_text' => sprintf(esc_html__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
44 | - 'html_help_text' => esc_html__('Whether Paypal should add shipping surcharges', 'event_espresso'), |
|
45 | - 'default' => false |
|
46 | - )), |
|
47 | - 'shipping_details' => new EE_Select_Input(array( |
|
48 | - EE_PMT_Paypal_Standard::shipping_info_none => esc_html__("Do not prompt for an address", 'event_espresso'), |
|
49 | - EE_PMT_Paypal_Standard::shipping_info_optional => esc_html__("Prompt for an address, but do not require it", 'event_espresso'), |
|
50 | - EE_PMT_Paypal_Standard::shipping_info_required => esc_html__("Prompt for an address, and require it", 'event_espresso') |
|
51 | - )) |
|
52 | - ) |
|
53 | - ) |
|
54 | - ); |
|
55 | - } |
|
19 | + /** |
|
20 | + * @param EE_PMT_Paypal_Standard $payment_method_type |
|
21 | + */ |
|
22 | + public function __construct($payment_method_type) |
|
23 | + { |
|
24 | + parent::__construct( |
|
25 | + array( |
|
26 | + 'payment_method_type' => $payment_method_type, |
|
27 | + 'extra_meta_inputs' => array( |
|
28 | + 'paypal_id' => new EE_Text_Input(array( |
|
29 | + 'html_label_text' => sprintf(esc_html__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
30 | + 'html_help_text' => esc_html__("Typically [email protected]", 'event_espresso'), |
|
31 | + 'required' => true |
|
32 | + )), |
|
33 | + 'image_url' => new EE_Admin_File_Uploader_Input(array( |
|
34 | + 'html_help_text' => esc_html__("Used for your business/personal logo on the PayPal page", 'event_espresso'), |
|
35 | + 'html_label_text' => esc_html__('Image URL', 'event_espresso') |
|
36 | + )), |
|
37 | + 'paypal_taxes' => new EE_Yes_No_Input(array( |
|
38 | + 'html_label_text' => sprintf(esc_html__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
39 | + 'html_help_text' => esc_html__('Whether Paypal should add taxes to the order', 'event_espresso'), |
|
40 | + 'default' => false |
|
41 | + )), |
|
42 | + 'paypal_shipping' => new EE_Yes_No_Input(array( |
|
43 | + 'html_label_text' => sprintf(esc_html__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
44 | + 'html_help_text' => esc_html__('Whether Paypal should add shipping surcharges', 'event_espresso'), |
|
45 | + 'default' => false |
|
46 | + )), |
|
47 | + 'shipping_details' => new EE_Select_Input(array( |
|
48 | + EE_PMT_Paypal_Standard::shipping_info_none => esc_html__("Do not prompt for an address", 'event_espresso'), |
|
49 | + EE_PMT_Paypal_Standard::shipping_info_optional => esc_html__("Prompt for an address, but do not require it", 'event_espresso'), |
|
50 | + EE_PMT_Paypal_Standard::shipping_info_required => esc_html__("Prompt for an address, and require it", 'event_espresso') |
|
51 | + )) |
|
52 | + ) |
|
53 | + ) |
|
54 | + ); |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @param array $req_data |
|
61 | - * @throws EE_Error |
|
62 | - */ |
|
63 | - public function _normalize($req_data) |
|
64 | - { |
|
65 | - parent::_normalize($req_data); |
|
66 | - $paypal_calculates_shipping = $this->get_input_value('paypal_shipping'); |
|
67 | - $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
|
68 | - $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
|
69 | - if ( |
|
70 | - ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
71 | - $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
|
72 | - ) { |
|
73 | - // they want paypal to calculate taxes or shipping. They need to ask for |
|
74 | - // address info, otherwise paypal can't calculate taxes or shipping |
|
75 | - /** @type EE_Select_Input $shipping_details_input */ |
|
76 | - $shipping_details_input = $this->get_input('shipping_details'); |
|
77 | - $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional); |
|
78 | - $shipping_details_input_options = $shipping_details_input->options(); |
|
79 | - EE_Error::add_attention( |
|
80 | - sprintf( |
|
81 | - esc_html__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
|
82 | - strip_tags($shipping_details_input->html_label_text()), |
|
83 | - isset($shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]) |
|
84 | - ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
85 | - : esc_html__('Unknown', 'event_espresso') |
|
86 | - ), |
|
87 | - __FILE__, |
|
88 | - __FUNCTION__, |
|
89 | - __LINE__ |
|
90 | - ); |
|
91 | - } |
|
92 | - } |
|
59 | + /** |
|
60 | + * @param array $req_data |
|
61 | + * @throws EE_Error |
|
62 | + */ |
|
63 | + public function _normalize($req_data) |
|
64 | + { |
|
65 | + parent::_normalize($req_data); |
|
66 | + $paypal_calculates_shipping = $this->get_input_value('paypal_shipping'); |
|
67 | + $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
|
68 | + $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
|
69 | + if ( |
|
70 | + ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
71 | + $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
|
72 | + ) { |
|
73 | + // they want paypal to calculate taxes or shipping. They need to ask for |
|
74 | + // address info, otherwise paypal can't calculate taxes or shipping |
|
75 | + /** @type EE_Select_Input $shipping_details_input */ |
|
76 | + $shipping_details_input = $this->get_input('shipping_details'); |
|
77 | + $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional); |
|
78 | + $shipping_details_input_options = $shipping_details_input->options(); |
|
79 | + EE_Error::add_attention( |
|
80 | + sprintf( |
|
81 | + esc_html__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
|
82 | + strip_tags($shipping_details_input->html_label_text()), |
|
83 | + isset($shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]) |
|
84 | + ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
85 | + : esc_html__('Unknown', 'event_espresso') |
|
86 | + ), |
|
87 | + __FILE__, |
|
88 | + __FUNCTION__, |
|
89 | + __LINE__ |
|
90 | + ); |
|
91 | + } |
|
92 | + } |
|
93 | 93 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
68 | 68 | $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
69 | 69 | if ( |
70 | - ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
70 | + ($paypal_calculates_shipping || $paypal_calculates_taxes) && |
|
71 | 71 | $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
72 | 72 | ) { |
73 | 73 | // they want paypal to calculate taxes or shipping. They need to ask for |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | sprintf( |
81 | 81 | esc_html__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
82 | 82 | strip_tags($shipping_details_input->html_label_text()), |
83 | - isset($shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]) |
|
84 | - ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
83 | + isset($shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional]) |
|
84 | + ? $shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional] |
|
85 | 85 | : esc_html__('Unknown', 'event_espresso') |
86 | 86 | ), |
87 | 87 | __FILE__, |
@@ -16,38 +16,38 @@ |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * |
|
21 | - * @param EE_Payment_Method $pm_instance |
|
22 | - * @return EE_PMT_Admin_Only |
|
23 | - */ |
|
24 | - public function __construct($pm_instance = null) |
|
25 | - { |
|
26 | - $this->_pretty_name = esc_html__("Admin Only", 'event_espresso'); |
|
27 | - $this->_default_button_url = ''; |
|
28 | - parent::__construct($pm_instance); |
|
29 | - } |
|
30 | - |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Creates the billing form for this payment method type |
|
35 | - * @param \EE_Transaction $transaction |
|
36 | - * @return NULL |
|
37 | - */ |
|
38 | - public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
39 | - { |
|
40 | - return null; |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * Gets the form for all the settings related to this payment method type |
|
47 | - * @return EE_Payment_Method_Form |
|
48 | - */ |
|
49 | - public function generate_new_settings_form() |
|
50 | - { |
|
51 | - return new EE_Payment_Method_Form(); |
|
52 | - } |
|
19 | + /** |
|
20 | + * |
|
21 | + * @param EE_Payment_Method $pm_instance |
|
22 | + * @return EE_PMT_Admin_Only |
|
23 | + */ |
|
24 | + public function __construct($pm_instance = null) |
|
25 | + { |
|
26 | + $this->_pretty_name = esc_html__("Admin Only", 'event_espresso'); |
|
27 | + $this->_default_button_url = ''; |
|
28 | + parent::__construct($pm_instance); |
|
29 | + } |
|
30 | + |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Creates the billing form for this payment method type |
|
35 | + * @param \EE_Transaction $transaction |
|
36 | + * @return NULL |
|
37 | + */ |
|
38 | + public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
39 | + { |
|
40 | + return null; |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * Gets the form for all the settings related to this payment method type |
|
47 | + * @return EE_Payment_Method_Form |
|
48 | + */ |
|
49 | + public function generate_new_settings_form() |
|
50 | + { |
|
51 | + return new EE_Payment_Method_Form(); |
|
52 | + } |
|
53 | 53 | } |
@@ -13,121 +13,121 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * @param null $pm_instance |
|
18 | - * @return EE_PMT_Check |
|
19 | - */ |
|
20 | - public function __construct($pm_instance = null) |
|
21 | - { |
|
22 | - $this->_pretty_name = esc_html__("Check", 'event_espresso'); |
|
23 | - $this->_default_description = esc_html__('After clicking "Finalize Registration", you will be given instructions on how to complete your payment.', 'event_espresso'); |
|
24 | - parent::__construct($pm_instance); |
|
25 | - $this->_default_button_url = $this->file_url() . 'lib/check-logo.png'; |
|
26 | - } |
|
16 | + /** |
|
17 | + * @param null $pm_instance |
|
18 | + * @return EE_PMT_Check |
|
19 | + */ |
|
20 | + public function __construct($pm_instance = null) |
|
21 | + { |
|
22 | + $this->_pretty_name = esc_html__("Check", 'event_espresso'); |
|
23 | + $this->_default_description = esc_html__('After clicking "Finalize Registration", you will be given instructions on how to complete your payment.', 'event_espresso'); |
|
24 | + parent::__construct($pm_instance); |
|
25 | + $this->_default_button_url = $this->file_url() . 'lib/check-logo.png'; |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * Creates the billing form for this payment method type |
|
32 | - * @param \EE_Transaction $transaction |
|
33 | - * @return NULL |
|
34 | - */ |
|
35 | - public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
36 | - { |
|
37 | - return null; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Creates the billing form for this payment method type |
|
32 | + * @param \EE_Transaction $transaction |
|
33 | + * @return NULL |
|
34 | + */ |
|
35 | + public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
36 | + { |
|
37 | + return null; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * Overrides parent to dynamically set some defaults, but only when the form is requested |
|
44 | - * @return EE_Form_Section_Proper |
|
45 | - */ |
|
46 | - public function generate_new_settings_form() |
|
47 | - { |
|
48 | - if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
49 | - $organization = EE_Registry::instance()->CFG->organization; |
|
50 | - $organization_name = $organization->get_pretty('name'); |
|
51 | - $default_address = $organization->address_1 != '' ? $organization->get_pretty('address_1') . '<br />' : ''; |
|
52 | - $default_address .= $organization->address_2 != '' ? $organization->get_pretty('address_2') . '<br />' : ''; |
|
53 | - $default_address .= $organization->city != '' ? $organization->get_pretty('city') : ''; |
|
54 | - $default_address .= ( $organization->city != '' && $organization->STA_ID != '') ? ', ' : '<br />'; |
|
55 | - $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
|
56 | - $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($organization->CNT_ISO) ; |
|
57 | - $default_address .= $state ? $state->name() . '<br />' : ''; |
|
58 | - $default_address .= $country ? $country->name() . '<br />' : ''; |
|
59 | - $default_address .= $organization->zip != '' ? $organization->get_pretty('zip') : ''; |
|
60 | - } else { |
|
61 | - $default_address = 'unknown'; |
|
62 | - $organization_name = 'unknown'; |
|
63 | - } |
|
64 | - return new EE_Payment_Method_Form(array( |
|
65 | - 'extra_meta_inputs' => array( |
|
66 | - 'check_title' => new EE_Text_Input(array( |
|
67 | - 'html_label_text' => sprintf(esc_html__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
68 | - 'default' => esc_html__("Check/Money Order Payments", 'event_espresso'), |
|
69 | - )), |
|
70 | - 'payment_instructions' => new EE_Text_Area_Input(array( |
|
71 | - 'html_label_text' => sprintf(esc_html__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
72 | - 'default' => esc_html__("Please send Check/Money Order to the address below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
|
73 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
74 | - )), |
|
75 | - 'payable_to' => new EE_Text_Input(array( |
|
76 | - 'html_label_text' => sprintf(esc_html__("Payable To %s", "event_espresso"), $this->get_help_tab_link()), |
|
77 | - 'default' => $organization_name |
|
78 | - )), |
|
79 | - 'address_to_send_payment' => new EE_Text_Area_Input(array( |
|
80 | - 'html_label_text' => sprintf(esc_html__("Address Payable %s", "event_espresso"), $this->get_help_tab_link()), |
|
81 | - 'default' => $default_address, |
|
82 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
83 | - )), |
|
84 | - ), |
|
85 | - 'exclude' => array('PMD_debug_mode') |
|
86 | - )); |
|
87 | - } |
|
42 | + /** |
|
43 | + * Overrides parent to dynamically set some defaults, but only when the form is requested |
|
44 | + * @return EE_Form_Section_Proper |
|
45 | + */ |
|
46 | + public function generate_new_settings_form() |
|
47 | + { |
|
48 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
49 | + $organization = EE_Registry::instance()->CFG->organization; |
|
50 | + $organization_name = $organization->get_pretty('name'); |
|
51 | + $default_address = $organization->address_1 != '' ? $organization->get_pretty('address_1') . '<br />' : ''; |
|
52 | + $default_address .= $organization->address_2 != '' ? $organization->get_pretty('address_2') . '<br />' : ''; |
|
53 | + $default_address .= $organization->city != '' ? $organization->get_pretty('city') : ''; |
|
54 | + $default_address .= ( $organization->city != '' && $organization->STA_ID != '') ? ', ' : '<br />'; |
|
55 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
|
56 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($organization->CNT_ISO) ; |
|
57 | + $default_address .= $state ? $state->name() . '<br />' : ''; |
|
58 | + $default_address .= $country ? $country->name() . '<br />' : ''; |
|
59 | + $default_address .= $organization->zip != '' ? $organization->get_pretty('zip') : ''; |
|
60 | + } else { |
|
61 | + $default_address = 'unknown'; |
|
62 | + $organization_name = 'unknown'; |
|
63 | + } |
|
64 | + return new EE_Payment_Method_Form(array( |
|
65 | + 'extra_meta_inputs' => array( |
|
66 | + 'check_title' => new EE_Text_Input(array( |
|
67 | + 'html_label_text' => sprintf(esc_html__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
68 | + 'default' => esc_html__("Check/Money Order Payments", 'event_espresso'), |
|
69 | + )), |
|
70 | + 'payment_instructions' => new EE_Text_Area_Input(array( |
|
71 | + 'html_label_text' => sprintf(esc_html__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
72 | + 'default' => esc_html__("Please send Check/Money Order to the address below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
|
73 | + 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
74 | + )), |
|
75 | + 'payable_to' => new EE_Text_Input(array( |
|
76 | + 'html_label_text' => sprintf(esc_html__("Payable To %s", "event_espresso"), $this->get_help_tab_link()), |
|
77 | + 'default' => $organization_name |
|
78 | + )), |
|
79 | + 'address_to_send_payment' => new EE_Text_Area_Input(array( |
|
80 | + 'html_label_text' => sprintf(esc_html__("Address Payable %s", "event_espresso"), $this->get_help_tab_link()), |
|
81 | + 'default' => $default_address, |
|
82 | + 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
83 | + )), |
|
84 | + ), |
|
85 | + 'exclude' => array('PMD_debug_mode') |
|
86 | + )); |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * Adds the help tab |
|
93 | - * @see EE_PMT_Base::help_tabs_config() |
|
94 | - * @return array |
|
95 | - */ |
|
96 | - public function help_tabs_config() |
|
97 | - { |
|
98 | - return array( |
|
99 | - $this->get_help_tab_name() => array( |
|
100 | - 'title' => esc_html__('Check Settings', 'event_espresso'), |
|
101 | - 'filename' => 'payment_methods_overview_check' |
|
102 | - ), |
|
103 | - ); |
|
104 | - } |
|
91 | + /** |
|
92 | + * Adds the help tab |
|
93 | + * @see EE_PMT_Base::help_tabs_config() |
|
94 | + * @return array |
|
95 | + */ |
|
96 | + public function help_tabs_config() |
|
97 | + { |
|
98 | + return array( |
|
99 | + $this->get_help_tab_name() => array( |
|
100 | + 'title' => esc_html__('Check Settings', 'event_espresso'), |
|
101 | + 'filename' => 'payment_methods_overview_check' |
|
102 | + ), |
|
103 | + ); |
|
104 | + } |
|
105 | 105 | |
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * For adding any html output ab ove the payment overview. |
|
110 | - * Many gateways won't want ot display anything, so this function just returns an empty string. |
|
111 | - * Other gateways may want to override this, such as offline gateways. |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function payment_overview_content(EE_Payment $payment) |
|
115 | - { |
|
116 | - $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array(); |
|
117 | - $template_vars = array_merge( |
|
118 | - array( |
|
119 | - 'payment_method' => $this->_pm_instance, |
|
120 | - 'payment' => $payment, |
|
121 | - 'check_title' => '', |
|
122 | - 'payment_instructions' => '', |
|
123 | - 'payable_to' => '', |
|
124 | - 'address_to_send_payment' => '', |
|
125 | - ), |
|
126 | - $extra_meta_for_payment_method |
|
127 | - ); |
|
128 | - return EEH_Template::locate_template( |
|
129 | - 'payment_methods/Check/templates/check_payment_details_content.template.php', |
|
130 | - $template_vars |
|
131 | - ); |
|
132 | - } |
|
108 | + /** |
|
109 | + * For adding any html output ab ove the payment overview. |
|
110 | + * Many gateways won't want ot display anything, so this function just returns an empty string. |
|
111 | + * Other gateways may want to override this, such as offline gateways. |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function payment_overview_content(EE_Payment $payment) |
|
115 | + { |
|
116 | + $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array(); |
|
117 | + $template_vars = array_merge( |
|
118 | + array( |
|
119 | + 'payment_method' => $this->_pm_instance, |
|
120 | + 'payment' => $payment, |
|
121 | + 'check_title' => '', |
|
122 | + 'payment_instructions' => '', |
|
123 | + 'payable_to' => '', |
|
124 | + 'address_to_send_payment' => '', |
|
125 | + ), |
|
126 | + $extra_meta_for_payment_method |
|
127 | + ); |
|
128 | + return EEH_Template::locate_template( |
|
129 | + 'payment_methods/Check/templates/check_payment_details_content.template.php', |
|
130 | + $template_vars |
|
131 | + ); |
|
132 | + } |
|
133 | 133 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->_pretty_name = esc_html__("Check", 'event_espresso'); |
23 | 23 | $this->_default_description = esc_html__('After clicking "Finalize Registration", you will be given instructions on how to complete your payment.', 'event_espresso'); |
24 | 24 | parent::__construct($pm_instance); |
25 | - $this->_default_button_url = $this->file_url() . 'lib/check-logo.png'; |
|
25 | + $this->_default_button_url = $this->file_url().'lib/check-logo.png'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
49 | 49 | $organization = EE_Registry::instance()->CFG->organization; |
50 | 50 | $organization_name = $organization->get_pretty('name'); |
51 | - $default_address = $organization->address_1 != '' ? $organization->get_pretty('address_1') . '<br />' : ''; |
|
52 | - $default_address .= $organization->address_2 != '' ? $organization->get_pretty('address_2') . '<br />' : ''; |
|
51 | + $default_address = $organization->address_1 != '' ? $organization->get_pretty('address_1').'<br />' : ''; |
|
52 | + $default_address .= $organization->address_2 != '' ? $organization->get_pretty('address_2').'<br />' : ''; |
|
53 | 53 | $default_address .= $organization->city != '' ? $organization->get_pretty('city') : ''; |
54 | - $default_address .= ( $organization->city != '' && $organization->STA_ID != '') ? ', ' : '<br />'; |
|
54 | + $default_address .= ($organization->city != '' && $organization->STA_ID != '') ? ', ' : '<br />'; |
|
55 | 55 | $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
56 | - $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($organization->CNT_ISO) ; |
|
57 | - $default_address .= $state ? $state->name() . '<br />' : ''; |
|
58 | - $default_address .= $country ? $country->name() . '<br />' : ''; |
|
56 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($organization->CNT_ISO); |
|
57 | + $default_address .= $state ? $state->name().'<br />' : ''; |
|
58 | + $default_address .= $country ? $country->name().'<br />' : ''; |
|
59 | 59 | $default_address .= $organization->zip != '' ? $organization->get_pretty('zip') : ''; |
60 | 60 | } else { |
61 | 61 | $default_address = 'unknown'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'payment_instructions' => new EE_Text_Area_Input(array( |
71 | 71 | 'html_label_text' => sprintf(esc_html__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
72 | 72 | 'default' => esc_html__("Please send Check/Money Order to the address below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
73 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
73 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
74 | 74 | )), |
75 | 75 | 'payable_to' => new EE_Text_Input(array( |
76 | 76 | 'html_label_text' => sprintf(esc_html__("Payable To %s", "event_espresso"), $this->get_help_tab_link()), |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'address_to_send_payment' => new EE_Text_Area_Input(array( |
80 | 80 | 'html_label_text' => sprintf(esc_html__("Address Payable %s", "event_espresso"), $this->get_help_tab_link()), |
81 | 81 | 'default' => $default_address, |
82 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
82 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
83 | 83 | )), |
84 | 84 | ), |
85 | 85 | 'exclude' => array('PMD_debug_mode') |