@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | protected function _parser($shortcode) |
50 | 50 | { |
51 | 51 | |
52 | - if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
52 | + if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
53 | 53 | return ''; |
54 | 54 | } |
55 | 55 | |
56 | 56 | switch ($shortcode) { |
57 | 57 | case '[QUESTION]': |
58 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
59 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
60 | - if (! $question instanceof EE_Question) { |
|
58 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) |
|
59 | + ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
60 | + if ( ! $question instanceof EE_Question) { |
|
61 | 61 | return ''; // get out because we can't figure out what the question is. |
62 | 62 | } |
63 | 63 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | case '[ANSWER]': |
68 | 68 | // need to get the question to determine the type of question (some questions require translation of the answer). |
69 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
70 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
71 | - if (! $question instanceof EE_Question) { |
|
69 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) |
|
70 | + ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
71 | + if ( ! $question instanceof EE_Question) { |
|
72 | 72 | return ''; // get out cause we can't figure out what the question type is! |
73 | 73 | } |
74 | 74 |
@@ -17,85 +17,85 @@ |
||
17 | 17 | */ |
18 | 18 | class EE_Question_Shortcodes extends EE_Shortcodes |
19 | 19 | { |
20 | - /** |
|
21 | - * _init_props |
|
22 | - * |
|
23 | - * @access protected |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - protected function _init_props() |
|
27 | - { |
|
28 | - $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
29 | - $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
30 | - $this->_shortcodes = array( |
|
31 | - '[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'), |
|
32 | - '[ANSWER]' => esc_html__('Will parse to the answer for a question', 'event_espresso'), |
|
33 | - ); |
|
34 | - } |
|
20 | + /** |
|
21 | + * _init_props |
|
22 | + * |
|
23 | + * @access protected |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + protected function _init_props() |
|
27 | + { |
|
28 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
29 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
30 | + $this->_shortcodes = array( |
|
31 | + '[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'), |
|
32 | + '[ANSWER]' => esc_html__('Will parse to the answer for a question', 'event_espresso'), |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
39 | - * will have to take care of handling. |
|
40 | - * |
|
41 | - * @access protected |
|
42 | - * |
|
43 | - * @param string $shortcode the shortcode to be parsed. |
|
44 | - * |
|
45 | - * @return string parsed shortcode |
|
46 | - */ |
|
47 | - protected function _parser($shortcode) |
|
48 | - { |
|
37 | + /** |
|
38 | + * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
39 | + * will have to take care of handling. |
|
40 | + * |
|
41 | + * @access protected |
|
42 | + * |
|
43 | + * @param string $shortcode the shortcode to be parsed. |
|
44 | + * |
|
45 | + * @return string parsed shortcode |
|
46 | + */ |
|
47 | + protected function _parser($shortcode) |
|
48 | + { |
|
49 | 49 | |
50 | - if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
51 | - return ''; |
|
52 | - } |
|
50 | + if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
51 | + return ''; |
|
52 | + } |
|
53 | 53 | |
54 | - switch ($shortcode) { |
|
55 | - case '[QUESTION]': |
|
56 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
57 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
58 | - if (! $question instanceof EE_Question) { |
|
59 | - return ''; // get out because we can't figure out what the question is. |
|
60 | - } |
|
54 | + switch ($shortcode) { |
|
55 | + case '[QUESTION]': |
|
56 | + $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
57 | + ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
58 | + if (! $question instanceof EE_Question) { |
|
59 | + return ''; // get out because we can't figure out what the question is. |
|
60 | + } |
|
61 | 61 | |
62 | - return $question->get('QST_display_text'); |
|
63 | - break; |
|
62 | + return $question->get('QST_display_text'); |
|
63 | + break; |
|
64 | 64 | |
65 | - case '[ANSWER]': |
|
66 | - // need to get the question to determine the type of question (some questions require translation of the answer). |
|
67 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
68 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
69 | - if (! $question instanceof EE_Question) { |
|
70 | - return ''; // get out cause we can't figure out what the question type is! |
|
71 | - } |
|
65 | + case '[ANSWER]': |
|
66 | + // need to get the question to determine the type of question (some questions require translation of the answer). |
|
67 | + $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
68 | + ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
69 | + if (! $question instanceof EE_Question) { |
|
70 | + return ''; // get out cause we can't figure out what the question type is! |
|
71 | + } |
|
72 | 72 | |
73 | - // what we show for the answer depends on the question type! |
|
74 | - switch ($question->get('QST_type')) { |
|
75 | - case 'STATE': |
|
76 | - $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
77 | - $answer = $state instanceof EE_State ? $state->name() : ''; |
|
78 | - break; |
|
73 | + // what we show for the answer depends on the question type! |
|
74 | + switch ($question->get('QST_type')) { |
|
75 | + case 'STATE': |
|
76 | + $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
77 | + $answer = $state instanceof EE_State ? $state->name() : ''; |
|
78 | + break; |
|
79 | 79 | |
80 | - case 'COUNTRY': |
|
81 | - $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
82 | - $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
83 | - break; |
|
80 | + case 'COUNTRY': |
|
81 | + $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
82 | + $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
83 | + break; |
|
84 | 84 | |
85 | - default: |
|
86 | - $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
87 | - break; |
|
88 | - } |
|
85 | + default: |
|
86 | + $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
87 | + break; |
|
88 | + } |
|
89 | 89 | |
90 | - return apply_filters( |
|
91 | - 'FHEE__EE_Question_Shortcodes___parser__answer', |
|
92 | - $answer, |
|
93 | - $question, |
|
94 | - $this->_data |
|
95 | - ); |
|
96 | - break; |
|
97 | - } |
|
90 | + return apply_filters( |
|
91 | + 'FHEE__EE_Question_Shortcodes___parser__answer', |
|
92 | + $answer, |
|
93 | + $question, |
|
94 | + $this->_data |
|
95 | + ); |
|
96 | + break; |
|
97 | + } |
|
98 | 98 | |
99 | - return ''; |
|
100 | - } |
|
99 | + return ''; |
|
100 | + } |
|
101 | 101 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | </label> |
51 | 51 | </th> |
52 | 52 | <td> |
53 | - <p><?php echo site_url() . '/ ' |
|
53 | + <p><?php echo site_url().'/ ' |
|
54 | 54 | . EEH_Form_Fields::text( |
55 | 55 | 'not_used', |
56 | 56 | EE_Registry::instance()->CFG->core->event_cpt_slug, |
@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
6 | 6 | |
7 | 7 | $values = EEH_Form_Fields::prep_answer_options( |
8 | - array( |
|
9 | - array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')), |
|
10 | - array('id' => 0, 'text' => esc_html__('No', 'event_espresso')), |
|
11 | - ) |
|
8 | + array( |
|
9 | + array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')), |
|
10 | + array('id' => 0, 'text' => esc_html__('No', 'event_espresso')), |
|
11 | + ) |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | $description = EEH_Form_Fields::prep_answer_options( |
15 | - array( |
|
16 | - array('id' => 0, 'text' => esc_html__('none', 'event_espresso')), |
|
17 | - array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')), |
|
18 | - array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')), |
|
19 | - ) |
|
15 | + array( |
|
16 | + array('id' => 0, 'text' => esc_html__('none', 'event_espresso')), |
|
17 | + array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')), |
|
18 | + array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')), |
|
19 | + ) |
|
20 | 20 | ); |
21 | 21 | |
22 | 22 | ?> |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | <th> |
36 | 36 | <label for="event_listings_url"> |
37 | 37 | <?php esc_html_e('Event Listings URL', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
38 | - 'event_listings_url_info' |
|
39 | - ); ?> |
|
38 | + 'event_listings_url_info' |
|
39 | + ); ?> |
|
40 | 40 | </label> |
41 | 41 | </th> |
42 | 42 | <td> |
43 | 43 | <a id="event_listings_url" class="ee-admin-settings-hdr-lnk small-text" |
44 | 44 | href="<?php echo EEH_Event_View::event_archive_url(); ?>"><?php |
45 | - echo EEH_Event_View::event_archive_url(); ?></a> |
|
45 | + echo EEH_Event_View::event_archive_url(); ?></a> |
|
46 | 46 | </td> |
47 | 47 | </tr> |
48 | 48 | |
@@ -54,30 +54,30 @@ discard block |
||
54 | 54 | </th> |
55 | 55 | <td> |
56 | 56 | <p><?php echo site_url() . '/ ' |
57 | - . EEH_Form_Fields::text( |
|
58 | - 'not_used', |
|
59 | - EE_Registry::instance()->CFG->core->event_cpt_slug, |
|
60 | - 'event_cpt_slug', |
|
61 | - 'event_cpt_slug', |
|
62 | - 'regular' |
|
63 | - ); ?></p> |
|
57 | + . EEH_Form_Fields::text( |
|
58 | + 'not_used', |
|
59 | + EE_Registry::instance()->CFG->core->event_cpt_slug, |
|
60 | + 'event_cpt_slug', |
|
61 | + 'event_cpt_slug', |
|
62 | + 'regular' |
|
63 | + ); ?></p> |
|
64 | 64 | <p class="description"><?php |
65 | - esc_html_e( |
|
66 | - 'This allows you to configure what slug is used for the url of all event pages.', |
|
67 | - 'event_espresso' |
|
68 | - ); ?></p> |
|
65 | + esc_html_e( |
|
66 | + 'This allows you to configure what slug is used for the url of all event pages.', |
|
67 | + 'event_espresso' |
|
68 | + ); ?></p> |
|
69 | 69 | <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?> |
70 | 70 | <p class="important-notice"> |
71 | 71 | <?php |
72 | - sprintf( |
|
73 | - esc_html__( |
|
74 | - 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', |
|
75 | - 'event_espresso' |
|
76 | - ), |
|
77 | - '<code>', |
|
78 | - '</code>' |
|
79 | - ); |
|
80 | - ?> |
|
72 | + sprintf( |
|
73 | + esc_html__( |
|
74 | + 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', |
|
75 | + 'event_espresso' |
|
76 | + ), |
|
77 | + '<code>', |
|
78 | + '</code>' |
|
79 | + ); |
|
80 | + ?> |
|
81 | 81 | </p> |
82 | 82 | <?php endif; ?> |
83 | 83 | </td> |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | </th> |
92 | 92 | <td> |
93 | 93 | <?php echo EEH_Form_Fields::select( |
94 | - 'display_status_banner', |
|
95 | - $display_status_banner, |
|
96 | - $values, |
|
97 | - 'EED_Events_Archive_display_status_banner', |
|
98 | - 'EED_Events_Archive_display_status_banner' |
|
99 | - ); ?> |
|
94 | + 'display_status_banner', |
|
95 | + $display_status_banner, |
|
96 | + $values, |
|
97 | + 'EED_Events_Archive_display_status_banner', |
|
98 | + 'EED_Events_Archive_display_status_banner' |
|
99 | + ); ?> |
|
100 | 100 | <p class="description"><?php |
101 | - esc_html_e( |
|
102 | - 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', |
|
103 | - 'event_espresso' |
|
104 | - ); ?></p> |
|
101 | + esc_html_e( |
|
102 | + 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', |
|
103 | + 'event_espresso' |
|
104 | + ); ?></p> |
|
105 | 105 | </td> |
106 | 106 | </tr> |
107 | 107 | |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | <th> |
110 | 110 | <label for="EED_Events_Archive_display_description"> |
111 | 111 | <?php esc_html_e('Display Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
112 | - 'display_description_info' |
|
113 | - ); ?> |
|
112 | + 'display_description_info' |
|
113 | + ); ?> |
|
114 | 114 | </label> |
115 | 115 | </th> |
116 | 116 | <td> |
117 | 117 | <?php echo EEH_Form_Fields::select( |
118 | - 'description', |
|
119 | - $display_description, |
|
120 | - $description, |
|
121 | - 'EED_Events_Archive_display_description', |
|
122 | - 'EED_Events_Archive_display_description' |
|
123 | - ); ?> |
|
118 | + 'description', |
|
119 | + $display_description, |
|
120 | + $description, |
|
121 | + 'EED_Events_Archive_display_description', |
|
122 | + 'EED_Events_Archive_display_description' |
|
123 | + ); ?> |
|
124 | 124 | </td> |
125 | 125 | </tr> |
126 | 126 | |
@@ -128,18 +128,18 @@ discard block |
||
128 | 128 | <th> |
129 | 129 | <label for="EED_Events_Archive_display_ticket_selector"> |
130 | 130 | <?php esc_html_e('Display Ticket Selector', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
131 | - 'display_ticket_selector_info' |
|
132 | - ); ?> |
|
131 | + 'display_ticket_selector_info' |
|
132 | + ); ?> |
|
133 | 133 | </label> |
134 | 134 | </th> |
135 | 135 | <td> |
136 | 136 | <?php echo EEH_Form_Fields::select( |
137 | - 'ticket_selector', |
|
138 | - $display_ticket_selector, |
|
139 | - $values, |
|
140 | - 'EED_Events_Archive_display_ticket_selector', |
|
141 | - 'EED_Events_Archive_display_ticket_selector' |
|
142 | - ); ?> |
|
137 | + 'ticket_selector', |
|
138 | + $display_ticket_selector, |
|
139 | + $values, |
|
140 | + 'EED_Events_Archive_display_ticket_selector', |
|
141 | + 'EED_Events_Archive_display_ticket_selector' |
|
142 | + ); ?> |
|
143 | 143 | </td> |
144 | 144 | </tr> |
145 | 145 | |
@@ -147,18 +147,18 @@ discard block |
||
147 | 147 | <th> |
148 | 148 | <label for="EED_Events_Archive_display_datetimes"> |
149 | 149 | <?php esc_html_e('Display Datetimes', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
150 | - 'display_datetimes_info' |
|
151 | - ); ?> |
|
150 | + 'display_datetimes_info' |
|
151 | + ); ?> |
|
152 | 152 | </label> |
153 | 153 | </th> |
154 | 154 | <td> |
155 | 155 | <?php echo EEH_Form_Fields::select( |
156 | - 'venue_details', |
|
157 | - $display_datetimes, |
|
158 | - $values, |
|
159 | - 'EED_Events_Archive_display_datetimes', |
|
160 | - 'EED_Events_Archive_display_datetimes' |
|
161 | - ); ?> |
|
156 | + 'venue_details', |
|
157 | + $display_datetimes, |
|
158 | + $values, |
|
159 | + 'EED_Events_Archive_display_datetimes', |
|
160 | + 'EED_Events_Archive_display_datetimes' |
|
161 | + ); ?> |
|
162 | 162 | </td> |
163 | 163 | </tr> |
164 | 164 | |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | <th> |
167 | 167 | <label for="EED_Events_Archive_display_venue"> |
168 | 168 | <?php esc_html_e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
169 | - 'display_venue_details_info' |
|
170 | - ); ?> |
|
169 | + 'display_venue_details_info' |
|
170 | + ); ?> |
|
171 | 171 | </label> |
172 | 172 | </th> |
173 | 173 | <td> |
174 | 174 | <?php echo EEH_Form_Fields::select( |
175 | - 'display_venue', |
|
176 | - $display_venue, |
|
177 | - $values, |
|
178 | - 'EED_Events_Archive_display_venue', |
|
179 | - 'EED_Events_Archive_display_venue' |
|
180 | - ); ?> |
|
175 | + 'display_venue', |
|
176 | + $display_venue, |
|
177 | + $values, |
|
178 | + 'EED_Events_Archive_display_venue', |
|
179 | + 'EED_Events_Archive_display_venue' |
|
180 | + ); ?> |
|
181 | 181 | </td> |
182 | 182 | </tr> |
183 | 183 | |
@@ -185,18 +185,18 @@ discard block |
||
185 | 185 | <th> |
186 | 186 | <label for="EED_Events_Archive_display_expired_events"> |
187 | 187 | <?php esc_html_e('Display Expired Events', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
188 | - 'display_expired_events_info' |
|
189 | - ); ?> |
|
188 | + 'display_expired_events_info' |
|
189 | + ); ?> |
|
190 | 190 | </label> |
191 | 191 | </th> |
192 | 192 | <td> |
193 | 193 | <?php echo EEH_Form_Fields::select( |
194 | - 'expired_events', |
|
195 | - $display_expired_events, |
|
196 | - $values, |
|
197 | - 'EED_Events_Archive_display_expired_events', |
|
198 | - 'EED_Events_Archive_display_expired_events' |
|
199 | - ); ?> |
|
194 | + 'expired_events', |
|
195 | + $display_expired_events, |
|
196 | + $values, |
|
197 | + 'EED_Events_Archive_display_expired_events', |
|
198 | + 'EED_Events_Archive_display_expired_events' |
|
199 | + ); ?> |
|
200 | 200 | </td> |
201 | 201 | </tr> |
202 | 202 | |
@@ -204,43 +204,43 @@ discard block |
||
204 | 204 | <th> |
205 | 205 | <label for="EED_Events_Archive_use_sortable_display_order"> |
206 | 206 | <?php esc_html_e( |
207 | - 'Use Custom Display Order?', |
|
208 | - 'event_espresso' |
|
209 | - ); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?> |
|
207 | + 'Use Custom Display Order?', |
|
208 | + 'event_espresso' |
|
209 | + ); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?> |
|
210 | 210 | </label> |
211 | 211 | </th> |
212 | 212 | <td> |
213 | 213 | <?php echo EEH_Form_Fields::select( |
214 | - 'use_sortable_display_order', |
|
215 | - $use_sortable_display_order, |
|
216 | - $values, |
|
217 | - 'EED_Events_Archive_use_sortable_display_order', |
|
218 | - 'EED_Events_Archive_use_sortable_display_order' |
|
219 | - ); ?> |
|
214 | + 'use_sortable_display_order', |
|
215 | + $use_sortable_display_order, |
|
216 | + $values, |
|
217 | + 'EED_Events_Archive_use_sortable_display_order', |
|
218 | + 'EED_Events_Archive_use_sortable_display_order' |
|
219 | + ); ?> |
|
220 | 220 | </td> |
221 | 221 | </tr> |
222 | 222 | |
223 | 223 | <tr> |
224 | 224 | <th> |
225 | 225 | <?php esc_html_e( |
226 | - 'Display Order', |
|
227 | - 'event_espresso' |
|
228 | - ); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
226 | + 'Display Order', |
|
227 | + 'event_espresso' |
|
228 | + ); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
229 | 229 | </th> |
230 | 230 | <td> |
231 | 231 | |
232 | 232 | <?php wp_nonce_field( |
233 | - 'espresso_update_event_archive_order', |
|
234 | - 'espresso_update_event_archive_order_nonce', |
|
235 | - false |
|
236 | - ); ?> |
|
233 | + 'espresso_update_event_archive_order', |
|
234 | + 'espresso_update_event_archive_order_nonce', |
|
235 | + false |
|
236 | + ); ?> |
|
237 | 237 | <?php echo wp_kses($event_archive_display_order, AllowedTags::getWithFormTags()); ?> |
238 | 238 | |
239 | 239 | <p class="description"><?php |
240 | - esc_html_e( |
|
241 | - 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', |
|
242 | - 'event_espresso' |
|
243 | - ); ?></p> |
|
240 | + esc_html_e( |
|
241 | + 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', |
|
242 | + 'event_espresso' |
|
243 | + ); ?></p> |
|
244 | 244 | |
245 | 245 | </td> |
246 | 246 | </tr> |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | </th> |
254 | 254 | <td> |
255 | 255 | <?php echo EEH_Form_Fields::select( |
256 | - 'reset_event_list_settings', |
|
257 | - 0, |
|
258 | - $values, |
|
259 | - 'EED_Events_Archive_reset_event_list_settings', |
|
260 | - 'EED_Events_Archive_reset_event_list_settings' |
|
261 | - ); ?> |
|
256 | + 'reset_event_list_settings', |
|
257 | + 0, |
|
258 | + $values, |
|
259 | + 'EED_Events_Archive_reset_event_list_settings', |
|
260 | + 'EED_Events_Archive_reset_event_list_settings' |
|
261 | + ); ?> |
|
262 | 262 | </td> |
263 | 263 | </tr> |
264 | 264 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('No direct script access allowed'); |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** @type string $recaptcha_language */ |
6 | 6 | /** @type string $recaptcha_publickey */ |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** @type string $recaptcha_language */ |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | public function do_direct_payment($payment, $billing_info = null) |
78 | 78 | { |
79 | 79 | $transaction = $payment->transaction(); |
80 | - if (! $transaction instanceof EEI_Transaction) { |
|
80 | + if ( ! $transaction instanceof EEI_Transaction) { |
|
81 | 81 | throw new EE_Error( |
82 | 82 | esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso') |
83 | 83 | ); |
84 | 84 | } |
85 | 85 | $primary_registrant = $transaction->primary_registration(); |
86 | - if (! $primary_registrant instanceof EEI_Registration) { |
|
86 | + if ( ! $primary_registrant instanceof EEI_Registration) { |
|
87 | 87 | throw new EE_Error( |
88 | 88 | esc_html__( |
89 | 89 | 'No primary registration on transaction while paying with PayPal Pro.', |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } |
94 | 94 | $attendee = $primary_registrant->attendee(); |
95 | - if (! $attendee instanceof EEI_Attendee) { |
|
95 | + if ( ! $attendee instanceof EEI_Attendee) { |
|
96 | 96 | throw new EE_Error( |
97 | 97 | esc_html__( |
98 | 98 | 'No attendee on primary registration while paying with PayPal Pro.', |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // Required. Credit card number. No spaces or punctuation. |
190 | 190 | 'acct' => $billing_info['credit_card'], |
191 | 191 | // Required. Credit card expiration date. Format is MMYYYY |
192 | - 'expdate' => $billing_info['exp_month'] . $billing_info['exp_year'], |
|
192 | + 'expdate' => $billing_info['exp_month'].$billing_info['exp_year'], |
|
193 | 193 | // Requirements determined by your PayPal account settings. Security digits for credit card. |
194 | 194 | 'cvv2' => $billing_info['cvv'], |
195 | 195 | ); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $ShippingAddress = array( |
242 | 242 | 'shiptoname' => substr($use_registration_address_info |
243 | 243 | ? $attendee->full_name() |
244 | - : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32), |
|
244 | + : $billing_info['first_name'].' '.$billing_info['last_name'], 0, 32), |
|
245 | 245 | 'shiptostreet' => substr($use_registration_address_info |
246 | 246 | ? $attendee->address() |
247 | 247 | : $billing_info['address'], 0, 100), |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'currencycode' => $payment->currency_code(), |
271 | 271 | // Required if you include itemized cart details. (L_AMTn, etc.) |
272 | 272 | // Subtotal of items not including S&H, or tax. |
273 | - 'itemamt' => $gateway_formatter->formatCurrency($item_amount),// |
|
273 | + 'itemamt' => $gateway_formatter->formatCurrency($item_amount), // |
|
274 | 274 | // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
275 | 275 | 'shippingamt' => '', |
276 | 276 | // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | // Free-form field for your own use. 256 char max. |
284 | 284 | 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
285 | 285 | // Your own invoice or tracking number |
286 | - 'invnum' => wp_generate_password(12, false),// $transaction->ID(), |
|
286 | + 'invnum' => wp_generate_password(12, false), // $transaction->ID(), |
|
287 | 287 | // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
288 | 288 | 'notifyurl' => '', |
289 | - 'buttonsource' => 'EventEspresso_SP',// EE will blow up if you change this |
|
289 | + 'buttonsource' => 'EventEspresso_SP', // EE will blow up if you change this |
|
290 | 290 | ); |
291 | 291 | // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
292 | 292 | $PayPalRequestData = array( |
@@ -396,52 +396,52 @@ discard block |
||
396 | 396 | // DP Fields |
397 | 397 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
398 | 398 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) { |
399 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
399 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
400 | 400 | } |
401 | 401 | // CC Details Fields |
402 | 402 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
403 | 403 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) { |
404 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
404 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
405 | 405 | } |
406 | 406 | // PayerInfo Type Fields |
407 | 407 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
408 | 408 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) { |
409 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
409 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
410 | 410 | } |
411 | 411 | // Payer Name Fields |
412 | 412 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
413 | 413 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) { |
414 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
414 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
415 | 415 | } |
416 | 416 | // Address Fields (Billing) |
417 | 417 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
418 | 418 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) { |
419 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
419 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
420 | 420 | } |
421 | 421 | // Payment Details Type Fields |
422 | 422 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
423 | 423 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) { |
424 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
424 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
425 | 425 | } |
426 | 426 | // Payment Details Item Type Fields |
427 | 427 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
428 | 428 | $n = 0; |
429 | 429 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
430 | - $CurrentItem = $OrderItems[ $OrderItemsVar ]; |
|
430 | + $CurrentItem = $OrderItems[$OrderItemsVar]; |
|
431 | 431 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) { |
432 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
432 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
433 | 433 | } |
434 | 434 | $n++; |
435 | 435 | } |
436 | 436 | // Ship To Address Fields |
437 | 437 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
438 | 438 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) { |
439 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
439 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
440 | 440 | } |
441 | 441 | // 3D Secure Fields |
442 | 442 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
443 | 443 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) { |
444 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
444 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
445 | 445 | } |
446 | 446 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
447 | 447 | $NVPRequest = 'USER=' |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString); |
513 | 513 | $valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1); |
514 | 514 | // decoding the response |
515 | - $proArray[ $keyval ] = urldecode($valval); |
|
515 | + $proArray[$keyval] = urldecode($valval); |
|
516 | 516 | $NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString)); |
517 | 517 | } |
518 | 518 | return $proArray; |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | { |
546 | 546 | $Errors = array(); |
547 | 547 | $n = 0; |
548 | - while (isset($DataArray[ 'L_ERRORCODE' . $n . '' ])) { |
|
549 | - $LErrorCode = isset($DataArray[ 'L_ERRORCODE' . $n . '' ]) ? $DataArray[ 'L_ERRORCODE' . $n . '' ] : ''; |
|
550 | - $LShortMessage = isset($DataArray[ 'L_SHORTMESSAGE' . $n . '' ]) |
|
551 | - ? $DataArray[ 'L_SHORTMESSAGE' . $n . '' ] |
|
548 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
549 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
550 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) |
|
551 | + ? $DataArray['L_SHORTMESSAGE'.$n.''] |
|
552 | 552 | : ''; |
553 | - $LLongMessage = isset($DataArray[ 'L_LONGMESSAGE' . $n . '' ]) |
|
554 | - ? $DataArray[ 'L_LONGMESSAGE' . $n . '' ] |
|
553 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) |
|
554 | + ? $DataArray['L_LONGMESSAGE'.$n.''] |
|
555 | 555 | : ''; |
556 | - $LSeverityCode = isset($DataArray[ 'L_SEVERITYCODE' . $n . '' ]) |
|
557 | - ? $DataArray[ 'L_SEVERITYCODE' . $n . '' ] |
|
556 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) |
|
557 | + ? $DataArray['L_SEVERITYCODE'.$n.''] |
|
558 | 558 | : ''; |
559 | 559 | $CurrentItem = array( |
560 | 560 | 'L_ERRORCODE' => $LErrorCode, |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | { |
582 | 582 | $error = ''; |
583 | 583 | foreach ($Errors as $ErrorVar => $ErrorVal) { |
584 | - $CurrentError = $Errors[ $ErrorVar ]; |
|
584 | + $CurrentError = $Errors[$ErrorVar]; |
|
585 | 585 | foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) { |
586 | 586 | $CurrentVarName = ''; |
587 | 587 | if ($CurrentErrorVar == 'L_ERRORCODE') { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') { |
594 | 594 | $CurrentVarName = 'Severity Code'; |
595 | 595 | } |
596 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
596 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | return $error; |
@@ -13,610 +13,610 @@ |
||
13 | 13 | */ |
14 | 14 | class EEG_Paypal_Pro extends EE_Onsite_Gateway |
15 | 15 | { |
16 | - /** |
|
17 | - * @var $_paypal_api_username string |
|
18 | - */ |
|
19 | - protected $_api_username = null; |
|
20 | - |
|
21 | - /** |
|
22 | - * @var $_api_password string |
|
23 | - */ |
|
24 | - protected $_api_password = null; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var $_api_signature string |
|
28 | - */ |
|
29 | - protected $_api_signature = null; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var $_credit_card_types array with the keys for credit card types accepted on this account |
|
33 | - */ |
|
34 | - protected $_credit_card_types = null; |
|
35 | - |
|
36 | - protected $_currencies_supported = array( |
|
37 | - 'USD', |
|
38 | - 'GBP', |
|
39 | - 'CAD', |
|
40 | - 'AUD', |
|
41 | - 'BRL', |
|
42 | - 'CHF', |
|
43 | - 'CZK', |
|
44 | - 'DKK', |
|
45 | - 'EUR', |
|
46 | - 'HKD', |
|
47 | - 'HUF', |
|
48 | - 'ILS', |
|
49 | - 'JPY', |
|
50 | - 'MXN', |
|
51 | - 'MYR', |
|
52 | - 'NOK', |
|
53 | - 'NZD', |
|
54 | - 'PHP', |
|
55 | - 'PLN', |
|
56 | - 'SEK', |
|
57 | - 'SGD', |
|
58 | - 'THB', |
|
59 | - 'TRY', |
|
60 | - 'TWD', |
|
61 | - 'RUB', |
|
62 | - 'INR', |
|
63 | - ); |
|
64 | - |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @param EEI_Payment $payment |
|
69 | - * @param array $billing_info { |
|
70 | - * @type string $credit_card |
|
71 | - * @type string $credit_card_type |
|
72 | - * @type string $exp_month always 2 characters |
|
73 | - * @type string $exp_year always 4 characters |
|
74 | - * @type string $cvv |
|
75 | - * } |
|
76 | - * @see parent::do_direct_payment for more info |
|
77 | - * @return EE_Payment|EEI_Payment |
|
78 | - * @throws EE_Error |
|
79 | - */ |
|
80 | - public function do_direct_payment($payment, $billing_info = null) |
|
81 | - { |
|
82 | - $transaction = $payment->transaction(); |
|
83 | - if (! $transaction instanceof EEI_Transaction) { |
|
84 | - throw new EE_Error( |
|
85 | - esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso') |
|
86 | - ); |
|
87 | - } |
|
88 | - $primary_registrant = $transaction->primary_registration(); |
|
89 | - if (! $primary_registrant instanceof EEI_Registration) { |
|
90 | - throw new EE_Error( |
|
91 | - esc_html__( |
|
92 | - 'No primary registration on transaction while paying with PayPal Pro.', |
|
93 | - 'event_espresso' |
|
94 | - ) |
|
95 | - ); |
|
96 | - } |
|
97 | - $attendee = $primary_registrant->attendee(); |
|
98 | - if (! $attendee instanceof EEI_Attendee) { |
|
99 | - throw new EE_Error( |
|
100 | - esc_html__( |
|
101 | - 'No attendee on primary registration while paying with PayPal Pro.', |
|
102 | - 'event_espresso' |
|
103 | - ) |
|
104 | - ); |
|
105 | - } |
|
106 | - $gateway_formatter = $this->_get_gateway_formatter(); |
|
107 | - $order_description = substr($gateway_formatter->formatOrderDescription($payment), 0, 127); |
|
108 | - // charge for the full amount. Show itemized list |
|
109 | - if ($this->_money->compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
110 | - $item_num = 1; |
|
111 | - $total_line_item = $transaction->total_line_item(); |
|
112 | - $order_items = array(); |
|
113 | - foreach ($total_line_item->get_items() as $line_item) { |
|
114 | - // ignore line items with a quantity of 0 |
|
115 | - if ($line_item->quantity() == 0) { |
|
116 | - continue; |
|
117 | - } |
|
118 | - // For percent items, whose unit_price is 0, use the total instead. |
|
119 | - if ($line_item->is_percent()) { |
|
120 | - $unit_price = $line_item->total(); |
|
121 | - $line_item_quantity = 1; |
|
122 | - } else { |
|
123 | - $unit_price = $line_item->unit_price(); |
|
124 | - $line_item_quantity = $line_item->quantity(); |
|
125 | - } |
|
126 | - $item = array( |
|
127 | - // Item Name. 127 char max. |
|
128 | - 'l_name' => substr( |
|
129 | - $gateway_formatter->formatLineItemName($line_item, $payment), |
|
130 | - 0, |
|
131 | - 127 |
|
132 | - ), |
|
133 | - // Item description. 127 char max. |
|
134 | - 'l_desc' => substr( |
|
135 | - $gateway_formatter->formatLineItemDesc($line_item, $payment), |
|
136 | - 0, |
|
137 | - 127 |
|
138 | - ), |
|
139 | - // Cost of individual item. |
|
140 | - 'l_amt' => $unit_price, |
|
141 | - // Item Number. 127 char max. |
|
142 | - 'l_number' => $item_num++, |
|
143 | - // Item quantity. Must be any positive integer. |
|
144 | - 'l_qty' => $line_item_quantity, |
|
145 | - // Item's sales tax amount. |
|
146 | - 'l_taxamt' => '', |
|
147 | - // eBay auction number of item. |
|
148 | - 'l_ebayitemnumber' => '', |
|
149 | - // eBay transaction ID of purchased item. |
|
150 | - 'l_ebayitemauctiontxnid' => '', |
|
151 | - // eBay order ID for the item. |
|
152 | - 'l_ebayitemorderid' => '', |
|
153 | - ); |
|
154 | - // add to array of all items |
|
155 | - array_push($order_items, $item); |
|
156 | - } |
|
157 | - $item_amount = $total_line_item->get_items_total(); |
|
158 | - $tax_amount = $total_line_item->get_total_tax(); |
|
159 | - } else { |
|
160 | - $order_items = array(); |
|
161 | - $item_amount = $payment->amount(); |
|
162 | - $tax_amount = 0; |
|
163 | - array_push($order_items, array( |
|
164 | - // Item Name. 127 char max. |
|
165 | - 'l_name' => substr( |
|
166 | - $gateway_formatter->formatPartialPaymentLineItemName($payment), |
|
167 | - 0, |
|
168 | - 127 |
|
169 | - ), |
|
170 | - // Item description. 127 char max. |
|
171 | - 'l_desc' => substr( |
|
172 | - $gateway_formatter->formatPartialPaymentLineItemDesc($payment), |
|
173 | - 0, |
|
174 | - 127 |
|
175 | - ), |
|
176 | - // Cost of individual item. |
|
177 | - 'l_amt' => $payment->amount(), |
|
178 | - // Item Number. 127 char max. |
|
179 | - 'l_number' => 1, |
|
180 | - // Item quantity. Must be any positive integer. |
|
181 | - 'l_qty' => 1, |
|
182 | - )); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** @var RequestInterface $request */ |
|
187 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
188 | - // Populate data arrays with order data. |
|
189 | - $DPFields = array( |
|
190 | - // How you want to obtain payment ? |
|
191 | - // Authorization indicates the payment is a basic auth subject to settlement with Auth & Capture. |
|
192 | - // Sale indicates that this is a final sale for which you are requesting payment. Default is Sale. |
|
193 | - 'paymentaction' => 'Sale', |
|
194 | - // Required. IP address of the payer's browser. |
|
195 | - 'ipaddress' => $request->ipAddress(), |
|
196 | - // Flag to determine whether you want the results returned by FMF. 1 or 0. Default is 0. |
|
197 | - 'returnfmfdetails' => '1', |
|
198 | - ); |
|
199 | - $CCDetails = array( |
|
200 | - // Required. Type of credit card. Visa, MasterCard, Discover, Amex, Maestro, Solo. |
|
201 | - // If Maestro or Solo, the currency code must be GBP. |
|
202 | - // In addition, either start date or issue number must be specified. |
|
203 | - 'creditcardtype' => $billing_info['credit_card_type'], |
|
204 | - // Required. Credit card number. No spaces or punctuation. |
|
205 | - 'acct' => $billing_info['credit_card'], |
|
206 | - // Required. Credit card expiration date. Format is MMYYYY |
|
207 | - 'expdate' => $billing_info['exp_month'] . $billing_info['exp_year'], |
|
208 | - // Requirements determined by your PayPal account settings. Security digits for credit card. |
|
209 | - 'cvv2' => $billing_info['cvv'], |
|
210 | - ); |
|
211 | - $PayerInfo = array( |
|
212 | - // Email address of payer. |
|
213 | - 'email' => $billing_info['email'], |
|
214 | - // Unique PayPal customer ID for payer. |
|
215 | - 'payerid' => '', |
|
216 | - // Status of payer. Values are verified or unverified |
|
217 | - 'payerstatus' => '', |
|
218 | - // Payer's business name. |
|
219 | - 'business' => '', |
|
220 | - ); |
|
221 | - $PayerName = array( |
|
222 | - // Payer's salutation. 20 char max. |
|
223 | - 'salutation' => '', |
|
224 | - // Payer's first name. 25 char max. |
|
225 | - 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
226 | - // Payer's middle name. 25 char max. |
|
227 | - 'middlename' => '', |
|
228 | - // Payer's last name. 25 char max. |
|
229 | - 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
230 | - // Payer's suffix. 12 char max. |
|
231 | - 'suffix' => '', |
|
232 | - ); |
|
233 | - $BillingAddress = array( |
|
234 | - // Required. First street address. |
|
235 | - 'street' => $billing_info['address'], |
|
236 | - // Second street address. |
|
237 | - 'street2' => $billing_info['address2'], |
|
238 | - // Required. Name of City. |
|
239 | - 'city' => $billing_info['city'], |
|
240 | - // Required. Name of State or Province. |
|
241 | - 'state' => substr($billing_info['state'], 0, 40), |
|
242 | - // Required. Country code. |
|
243 | - 'countrycode' => $billing_info['country'], |
|
244 | - // Required. Postal code of payer. |
|
245 | - 'zip' => $billing_info['zip'], |
|
246 | - ); |
|
247 | - // check if the registration info contains the needed fields for paypal pro |
|
248 | - // (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/) |
|
249 | - if ($attendee->address() && $attendee->city() && $attendee->country_ID()) { |
|
250 | - $use_registration_address_info = true; |
|
251 | - } else { |
|
252 | - $use_registration_address_info = false; |
|
253 | - } |
|
254 | - // so if the attendee has enough data to fill out PayPal Pro's shipping info, use it. |
|
255 | - // If not, use the billing info again |
|
256 | - $ShippingAddress = array( |
|
257 | - 'shiptoname' => substr($use_registration_address_info |
|
258 | - ? $attendee->full_name() |
|
259 | - : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32), |
|
260 | - 'shiptostreet' => substr($use_registration_address_info |
|
261 | - ? $attendee->address() |
|
262 | - : $billing_info['address'], 0, 100), |
|
263 | - 'shiptostreet2' => substr($use_registration_address_info |
|
264 | - ? $attendee->address2() : $billing_info['address2'], 0, 100), |
|
265 | - 'shiptocity' => substr($use_registration_address_info |
|
266 | - ? $attendee->city() |
|
267 | - : $billing_info['city'], 0, 40), |
|
268 | - 'shiptostate' => substr($use_registration_address_info |
|
269 | - ? $attendee->state_name() |
|
270 | - : $billing_info['state'], 0, 40), |
|
271 | - 'shiptocountry' => $use_registration_address_info |
|
272 | - ? $attendee->country_ID() |
|
273 | - : $billing_info['country'], |
|
274 | - 'shiptozip' => substr($use_registration_address_info |
|
275 | - ? $attendee->zip() |
|
276 | - : $billing_info['zip'], 0, 20), |
|
277 | - 'shiptophonenum' => substr($use_registration_address_info |
|
278 | - ? $attendee->phone() |
|
279 | - : $billing_info['phone'], 0, 20), |
|
280 | - ); |
|
281 | - $PaymentDetails = array( |
|
282 | - // Required. Total amount of order, including shipping, handling, and tax. |
|
283 | - 'amt' => $gateway_formatter->formatCurrency($payment->amount()), |
|
284 | - // Required. Three-letter currency code. Default is USD. |
|
285 | - 'currencycode' => $payment->currency_code(), |
|
286 | - // Required if you include itemized cart details. (L_AMTn, etc.) |
|
287 | - // Subtotal of items not including S&H, or tax. |
|
288 | - 'itemamt' => $gateway_formatter->formatCurrency($item_amount),// |
|
289 | - // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
|
290 | - 'shippingamt' => '', |
|
291 | - // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
|
292 | - 'handlingamt' => '', |
|
293 | - // Required if you specify itemized cart tax details. |
|
294 | - // Sum of tax for all items on the order. Total sales tax. |
|
295 | - 'taxamt' => $gateway_formatter->formatCurrency($tax_amount), |
|
296 | - // Description of the order the customer is purchasing. 127 char max. |
|
297 | - 'desc' => $order_description, |
|
298 | - // Free-form field for your own use. 256 char max. |
|
299 | - 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
|
300 | - // Your own invoice or tracking number |
|
301 | - 'invnum' => wp_generate_password(12, false),// $transaction->ID(), |
|
302 | - // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
|
303 | - 'notifyurl' => '', |
|
304 | - 'buttonsource' => 'EventEspresso_SP',// EE will blow up if you change this |
|
305 | - ); |
|
306 | - // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
|
307 | - $PayPalRequestData = array( |
|
308 | - 'DPFields' => $DPFields, |
|
309 | - 'CCDetails' => $CCDetails, |
|
310 | - 'PayerInfo' => $PayerInfo, |
|
311 | - 'PayerName' => $PayerName, |
|
312 | - 'BillingAddress' => $BillingAddress, |
|
313 | - 'ShippingAddress' => $ShippingAddress, |
|
314 | - 'PaymentDetails' => $PaymentDetails, |
|
315 | - 'OrderItems' => $order_items, |
|
316 | - ); |
|
317 | - $this->_log_clean_request($PayPalRequestData, $payment); |
|
318 | - try { |
|
319 | - $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
|
320 | - // remove PCI-sensitive data so it doesn't get stored |
|
321 | - $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
322 | - if (isset($PayPalResult['L_ERRORCODE0']) && $PayPalResult['L_ERRORCODE0'] === '10002') { |
|
323 | - $message = esc_html__('PayPal did not accept your API username, password, or signature. Please double-check these credentials and if debug mode is on.', 'event_espresso'); |
|
324 | - } elseif (isset($PayPalResult['L_LONGMESSAGE0'])) { |
|
325 | - $message = $PayPalResult['L_LONGMESSAGE0']; |
|
326 | - } else { |
|
327 | - $message = $PayPalResult['ACK']; |
|
328 | - } |
|
329 | - if (empty($PayPalResult['RAWRESPONSE'])) { |
|
330 | - $payment->set_status($this->_pay_model->failed_status()); |
|
331 | - $payment->set_gateway_response(esc_html__('No response received from Paypal Pro', 'event_espresso')); |
|
332 | - $payment->set_details($PayPalResult); |
|
333 | - } else { |
|
334 | - if ($this->_APICallSuccessful($PayPalResult)) { |
|
335 | - $payment->set_status($this->_pay_model->approved_status()); |
|
336 | - } else { |
|
337 | - $payment->set_status($this->_pay_model->declined_status()); |
|
338 | - } |
|
339 | - // make sure we interpret the AMT as a float, not an international string |
|
340 | - // (where periods are thousand separators) |
|
341 | - $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
342 | - $payment->set_gateway_response($message); |
|
343 | - $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) |
|
344 | - ? $PayPalResult['TRANSACTIONID'] |
|
345 | - : null); |
|
346 | - $primary_registration_code = $primary_registrant instanceof EE_Registration |
|
347 | - ? $primary_registrant->reg_code() |
|
348 | - : ''; |
|
349 | - $payment->set_extra_accntng($primary_registration_code); |
|
350 | - $payment->set_details($PayPalResult); |
|
351 | - } |
|
352 | - } catch (Exception $e) { |
|
353 | - $payment->set_status($this->_pay_model->failed_status()); |
|
354 | - $payment->set_gateway_response($e->getMessage()); |
|
355 | - } |
|
356 | - // $payment->set_status( $this->_pay_model->declined_status() ); |
|
357 | - // $payment->set_gateway_response( '' ); |
|
358 | - return $payment; |
|
359 | - } |
|
360 | - |
|
361 | - |
|
362 | - |
|
363 | - /** |
|
364 | - * CLeans out sensitive CC data and then logs it, and returns the cleaned request |
|
365 | - * |
|
366 | - * @param array $request |
|
367 | - * @param EEI_Payment $payment |
|
368 | - * @return void |
|
369 | - */ |
|
370 | - private function _log_clean_request($request, $payment) |
|
371 | - { |
|
372 | - $cleaned_request_data = $request; |
|
373 | - unset($cleaned_request_data['CCDetails']['acct']); |
|
374 | - unset($cleaned_request_data['CCDetails']['cvv2']); |
|
375 | - unset($cleaned_request_data['CCDetails']['expdate']); |
|
376 | - $this->log(array('Paypal Request' => $cleaned_request_data), $payment); |
|
377 | - } |
|
378 | - |
|
379 | - |
|
380 | - |
|
381 | - /** |
|
382 | - * Cleans the response, logs it, and returns it |
|
383 | - * |
|
384 | - * @param array $response |
|
385 | - * @param EEI_Payment $payment |
|
386 | - * @return array cleaned |
|
387 | - */ |
|
388 | - private function _log_clean_response($response, $payment) |
|
389 | - { |
|
390 | - unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
|
391 | - unset($response['REQUESTDATA']['ACCT']); |
|
392 | - unset($response['REQUESTDATA']['EXPDATE']); |
|
393 | - unset($response['REQUESTDATA']['CVV2']); |
|
394 | - unset($response['RAWREQUEST']); |
|
395 | - $this->log(array('Paypal Response' => $response), $payment); |
|
396 | - return $response; |
|
397 | - } |
|
398 | - |
|
399 | - |
|
400 | - |
|
401 | - /** |
|
402 | - * @param $DataArray |
|
403 | - * @return array |
|
404 | - */ |
|
405 | - private function prep_and_curl_request($DataArray) |
|
406 | - { |
|
407 | - // Create empty holders for each portion of the NVP string |
|
408 | - $DPFieldsNVP = '&METHOD=DoDirectPayment&BUTTONSOURCE=AngellEYE_PHP_Class_DDP'; |
|
409 | - $CCDetailsNVP = ''; |
|
410 | - $PayerInfoNVP = ''; |
|
411 | - $PayerNameNVP = ''; |
|
412 | - $BillingAddressNVP = ''; |
|
413 | - $ShippingAddressNVP = ''; |
|
414 | - $PaymentDetailsNVP = ''; |
|
415 | - $OrderItemsNVP = ''; |
|
416 | - $Secure3DNVP = ''; |
|
417 | - // DP Fields |
|
418 | - $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
|
419 | - foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) { |
|
420 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
421 | - } |
|
422 | - // CC Details Fields |
|
423 | - $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
|
424 | - foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) { |
|
425 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
426 | - } |
|
427 | - // PayerInfo Type Fields |
|
428 | - $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
|
429 | - foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) { |
|
430 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
431 | - } |
|
432 | - // Payer Name Fields |
|
433 | - $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
|
434 | - foreach ($PayerName as $PayerNameVar => $PayerNameVal) { |
|
435 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
436 | - } |
|
437 | - // Address Fields (Billing) |
|
438 | - $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
|
439 | - foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) { |
|
440 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
441 | - } |
|
442 | - // Payment Details Type Fields |
|
443 | - $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
|
444 | - foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) { |
|
445 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
446 | - } |
|
447 | - // Payment Details Item Type Fields |
|
448 | - $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
|
449 | - $n = 0; |
|
450 | - foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
|
451 | - $CurrentItem = $OrderItems[ $OrderItemsVar ]; |
|
452 | - foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) { |
|
453 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
454 | - } |
|
455 | - $n++; |
|
456 | - } |
|
457 | - // Ship To Address Fields |
|
458 | - $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
|
459 | - foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) { |
|
460 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
461 | - } |
|
462 | - // 3D Secure Fields |
|
463 | - $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
|
464 | - foreach ($Secure3D as $Secure3DVar => $Secure3DVal) { |
|
465 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
466 | - } |
|
467 | - // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
|
468 | - $NVPRequest = 'USER=' |
|
469 | - . $this->_api_username |
|
470 | - . '&PWD=' |
|
471 | - . $this->_api_password |
|
472 | - . '&VERSION=64.0' |
|
473 | - . '&SIGNATURE=' |
|
474 | - . $this->_api_signature |
|
475 | - . $DPFieldsNVP |
|
476 | - . $CCDetailsNVP |
|
477 | - . $PayerInfoNVP |
|
478 | - . $PayerNameNVP |
|
479 | - . $BillingAddressNVP |
|
480 | - . $PaymentDetailsNVP |
|
481 | - . $OrderItemsNVP |
|
482 | - . $ShippingAddressNVP |
|
483 | - . $Secure3DNVP; |
|
484 | - $NVPResponse = $this->_CURLRequest($NVPRequest); |
|
485 | - $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
|
486 | - $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
|
487 | - $Errors = $this->_GetErrors($NVPResponseArray); |
|
488 | - $NVPResponseArray['ERRORS'] = $Errors; |
|
489 | - $NVPResponseArray['REQUESTDATA'] = $NVPRequestArray; |
|
490 | - $NVPResponseArray['RAWREQUEST'] = $NVPRequest; |
|
491 | - $NVPResponseArray['RAWRESPONSE'] = $NVPResponse; |
|
492 | - return $NVPResponseArray; |
|
493 | - } |
|
494 | - |
|
495 | - |
|
496 | - |
|
497 | - /** |
|
498 | - * @param $Request |
|
499 | - * @return mixed |
|
500 | - */ |
|
501 | - private function _CURLRequest($Request) |
|
502 | - { |
|
503 | - $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
|
504 | - $curl = curl_init(); |
|
505 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', true)); |
|
506 | - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
|
507 | - curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
|
508 | - curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
|
509 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
510 | - curl_setopt($curl, CURLOPT_POSTFIELDS, $Request); |
|
511 | - curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
|
512 | - // execute the curl POST |
|
513 | - $Response = curl_exec($curl); |
|
514 | - curl_close($curl); |
|
515 | - return $Response; |
|
516 | - } |
|
517 | - |
|
518 | - |
|
519 | - |
|
520 | - /** |
|
521 | - * @param $NVPString |
|
522 | - * @return array |
|
523 | - */ |
|
524 | - private function _NVPToArray($NVPString) |
|
525 | - { |
|
526 | - // prepare responses into array |
|
527 | - $proArray = array(); |
|
528 | - while (strlen($NVPString)) { |
|
529 | - // name |
|
530 | - $keypos = strpos($NVPString, '='); |
|
531 | - $keyval = substr($NVPString, 0, $keypos); |
|
532 | - // value |
|
533 | - $valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString); |
|
534 | - $valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1); |
|
535 | - // decoding the response |
|
536 | - $proArray[ $keyval ] = urldecode($valval); |
|
537 | - $NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString)); |
|
538 | - } |
|
539 | - return $proArray; |
|
540 | - } |
|
541 | - |
|
542 | - |
|
543 | - |
|
544 | - /** |
|
545 | - * @param array $PayPalResult |
|
546 | - * @return bool |
|
547 | - */ |
|
548 | - private function _APICallSuccessful($PayPalResult) |
|
549 | - { |
|
550 | - $approved = false; |
|
551 | - // check main response message from PayPal |
|
552 | - if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
553 | - $ack = strtoupper($PayPalResult['ACK']); |
|
554 | - $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
555 | - } |
|
556 | - return $approved; |
|
557 | - } |
|
558 | - |
|
559 | - |
|
560 | - |
|
561 | - /** |
|
562 | - * @param $DataArray |
|
563 | - * @return array |
|
564 | - */ |
|
565 | - private function _GetErrors($DataArray) |
|
566 | - { |
|
567 | - $Errors = array(); |
|
568 | - $n = 0; |
|
569 | - while (isset($DataArray[ 'L_ERRORCODE' . $n . '' ])) { |
|
570 | - $LErrorCode = isset($DataArray[ 'L_ERRORCODE' . $n . '' ]) ? $DataArray[ 'L_ERRORCODE' . $n . '' ] : ''; |
|
571 | - $LShortMessage = isset($DataArray[ 'L_SHORTMESSAGE' . $n . '' ]) |
|
572 | - ? $DataArray[ 'L_SHORTMESSAGE' . $n . '' ] |
|
573 | - : ''; |
|
574 | - $LLongMessage = isset($DataArray[ 'L_LONGMESSAGE' . $n . '' ]) |
|
575 | - ? $DataArray[ 'L_LONGMESSAGE' . $n . '' ] |
|
576 | - : ''; |
|
577 | - $LSeverityCode = isset($DataArray[ 'L_SEVERITYCODE' . $n . '' ]) |
|
578 | - ? $DataArray[ 'L_SEVERITYCODE' . $n . '' ] |
|
579 | - : ''; |
|
580 | - $CurrentItem = array( |
|
581 | - 'L_ERRORCODE' => $LErrorCode, |
|
582 | - 'L_SHORTMESSAGE' => $LShortMessage, |
|
583 | - 'L_LONGMESSAGE' => $LLongMessage, |
|
584 | - 'L_SEVERITYCODE' => $LSeverityCode, |
|
585 | - ); |
|
586 | - array_push($Errors, $CurrentItem); |
|
587 | - $n++; |
|
588 | - } |
|
589 | - return $Errors; |
|
590 | - } |
|
591 | - |
|
592 | - |
|
593 | - |
|
594 | - /** |
|
595 | - * nothing to see here... move along.... |
|
596 | - * |
|
597 | - * @access protected |
|
598 | - * @param $Errors |
|
599 | - * @return string |
|
600 | - */ |
|
601 | - private function _DisplayErrors($Errors) |
|
602 | - { |
|
603 | - $error = ''; |
|
604 | - foreach ($Errors as $ErrorVar => $ErrorVal) { |
|
605 | - $CurrentError = $Errors[ $ErrorVar ]; |
|
606 | - foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) { |
|
607 | - $CurrentVarName = ''; |
|
608 | - if ($CurrentErrorVar == 'L_ERRORCODE') { |
|
609 | - $CurrentVarName = 'Error Code'; |
|
610 | - } elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') { |
|
611 | - $CurrentVarName = 'Short Message'; |
|
612 | - } elseif ($CurrentErrorVar == 'L_LONGMESSAGE') { |
|
613 | - $CurrentVarName = 'Long Message'; |
|
614 | - } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') { |
|
615 | - $CurrentVarName = 'Severity Code'; |
|
616 | - } |
|
617 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
618 | - } |
|
619 | - } |
|
620 | - return $error; |
|
621 | - } |
|
16 | + /** |
|
17 | + * @var $_paypal_api_username string |
|
18 | + */ |
|
19 | + protected $_api_username = null; |
|
20 | + |
|
21 | + /** |
|
22 | + * @var $_api_password string |
|
23 | + */ |
|
24 | + protected $_api_password = null; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var $_api_signature string |
|
28 | + */ |
|
29 | + protected $_api_signature = null; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var $_credit_card_types array with the keys for credit card types accepted on this account |
|
33 | + */ |
|
34 | + protected $_credit_card_types = null; |
|
35 | + |
|
36 | + protected $_currencies_supported = array( |
|
37 | + 'USD', |
|
38 | + 'GBP', |
|
39 | + 'CAD', |
|
40 | + 'AUD', |
|
41 | + 'BRL', |
|
42 | + 'CHF', |
|
43 | + 'CZK', |
|
44 | + 'DKK', |
|
45 | + 'EUR', |
|
46 | + 'HKD', |
|
47 | + 'HUF', |
|
48 | + 'ILS', |
|
49 | + 'JPY', |
|
50 | + 'MXN', |
|
51 | + 'MYR', |
|
52 | + 'NOK', |
|
53 | + 'NZD', |
|
54 | + 'PHP', |
|
55 | + 'PLN', |
|
56 | + 'SEK', |
|
57 | + 'SGD', |
|
58 | + 'THB', |
|
59 | + 'TRY', |
|
60 | + 'TWD', |
|
61 | + 'RUB', |
|
62 | + 'INR', |
|
63 | + ); |
|
64 | + |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @param EEI_Payment $payment |
|
69 | + * @param array $billing_info { |
|
70 | + * @type string $credit_card |
|
71 | + * @type string $credit_card_type |
|
72 | + * @type string $exp_month always 2 characters |
|
73 | + * @type string $exp_year always 4 characters |
|
74 | + * @type string $cvv |
|
75 | + * } |
|
76 | + * @see parent::do_direct_payment for more info |
|
77 | + * @return EE_Payment|EEI_Payment |
|
78 | + * @throws EE_Error |
|
79 | + */ |
|
80 | + public function do_direct_payment($payment, $billing_info = null) |
|
81 | + { |
|
82 | + $transaction = $payment->transaction(); |
|
83 | + if (! $transaction instanceof EEI_Transaction) { |
|
84 | + throw new EE_Error( |
|
85 | + esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso') |
|
86 | + ); |
|
87 | + } |
|
88 | + $primary_registrant = $transaction->primary_registration(); |
|
89 | + if (! $primary_registrant instanceof EEI_Registration) { |
|
90 | + throw new EE_Error( |
|
91 | + esc_html__( |
|
92 | + 'No primary registration on transaction while paying with PayPal Pro.', |
|
93 | + 'event_espresso' |
|
94 | + ) |
|
95 | + ); |
|
96 | + } |
|
97 | + $attendee = $primary_registrant->attendee(); |
|
98 | + if (! $attendee instanceof EEI_Attendee) { |
|
99 | + throw new EE_Error( |
|
100 | + esc_html__( |
|
101 | + 'No attendee on primary registration while paying with PayPal Pro.', |
|
102 | + 'event_espresso' |
|
103 | + ) |
|
104 | + ); |
|
105 | + } |
|
106 | + $gateway_formatter = $this->_get_gateway_formatter(); |
|
107 | + $order_description = substr($gateway_formatter->formatOrderDescription($payment), 0, 127); |
|
108 | + // charge for the full amount. Show itemized list |
|
109 | + if ($this->_money->compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
110 | + $item_num = 1; |
|
111 | + $total_line_item = $transaction->total_line_item(); |
|
112 | + $order_items = array(); |
|
113 | + foreach ($total_line_item->get_items() as $line_item) { |
|
114 | + // ignore line items with a quantity of 0 |
|
115 | + if ($line_item->quantity() == 0) { |
|
116 | + continue; |
|
117 | + } |
|
118 | + // For percent items, whose unit_price is 0, use the total instead. |
|
119 | + if ($line_item->is_percent()) { |
|
120 | + $unit_price = $line_item->total(); |
|
121 | + $line_item_quantity = 1; |
|
122 | + } else { |
|
123 | + $unit_price = $line_item->unit_price(); |
|
124 | + $line_item_quantity = $line_item->quantity(); |
|
125 | + } |
|
126 | + $item = array( |
|
127 | + // Item Name. 127 char max. |
|
128 | + 'l_name' => substr( |
|
129 | + $gateway_formatter->formatLineItemName($line_item, $payment), |
|
130 | + 0, |
|
131 | + 127 |
|
132 | + ), |
|
133 | + // Item description. 127 char max. |
|
134 | + 'l_desc' => substr( |
|
135 | + $gateway_formatter->formatLineItemDesc($line_item, $payment), |
|
136 | + 0, |
|
137 | + 127 |
|
138 | + ), |
|
139 | + // Cost of individual item. |
|
140 | + 'l_amt' => $unit_price, |
|
141 | + // Item Number. 127 char max. |
|
142 | + 'l_number' => $item_num++, |
|
143 | + // Item quantity. Must be any positive integer. |
|
144 | + 'l_qty' => $line_item_quantity, |
|
145 | + // Item's sales tax amount. |
|
146 | + 'l_taxamt' => '', |
|
147 | + // eBay auction number of item. |
|
148 | + 'l_ebayitemnumber' => '', |
|
149 | + // eBay transaction ID of purchased item. |
|
150 | + 'l_ebayitemauctiontxnid' => '', |
|
151 | + // eBay order ID for the item. |
|
152 | + 'l_ebayitemorderid' => '', |
|
153 | + ); |
|
154 | + // add to array of all items |
|
155 | + array_push($order_items, $item); |
|
156 | + } |
|
157 | + $item_amount = $total_line_item->get_items_total(); |
|
158 | + $tax_amount = $total_line_item->get_total_tax(); |
|
159 | + } else { |
|
160 | + $order_items = array(); |
|
161 | + $item_amount = $payment->amount(); |
|
162 | + $tax_amount = 0; |
|
163 | + array_push($order_items, array( |
|
164 | + // Item Name. 127 char max. |
|
165 | + 'l_name' => substr( |
|
166 | + $gateway_formatter->formatPartialPaymentLineItemName($payment), |
|
167 | + 0, |
|
168 | + 127 |
|
169 | + ), |
|
170 | + // Item description. 127 char max. |
|
171 | + 'l_desc' => substr( |
|
172 | + $gateway_formatter->formatPartialPaymentLineItemDesc($payment), |
|
173 | + 0, |
|
174 | + 127 |
|
175 | + ), |
|
176 | + // Cost of individual item. |
|
177 | + 'l_amt' => $payment->amount(), |
|
178 | + // Item Number. 127 char max. |
|
179 | + 'l_number' => 1, |
|
180 | + // Item quantity. Must be any positive integer. |
|
181 | + 'l_qty' => 1, |
|
182 | + )); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** @var RequestInterface $request */ |
|
187 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
188 | + // Populate data arrays with order data. |
|
189 | + $DPFields = array( |
|
190 | + // How you want to obtain payment ? |
|
191 | + // Authorization indicates the payment is a basic auth subject to settlement with Auth & Capture. |
|
192 | + // Sale indicates that this is a final sale for which you are requesting payment. Default is Sale. |
|
193 | + 'paymentaction' => 'Sale', |
|
194 | + // Required. IP address of the payer's browser. |
|
195 | + 'ipaddress' => $request->ipAddress(), |
|
196 | + // Flag to determine whether you want the results returned by FMF. 1 or 0. Default is 0. |
|
197 | + 'returnfmfdetails' => '1', |
|
198 | + ); |
|
199 | + $CCDetails = array( |
|
200 | + // Required. Type of credit card. Visa, MasterCard, Discover, Amex, Maestro, Solo. |
|
201 | + // If Maestro or Solo, the currency code must be GBP. |
|
202 | + // In addition, either start date or issue number must be specified. |
|
203 | + 'creditcardtype' => $billing_info['credit_card_type'], |
|
204 | + // Required. Credit card number. No spaces or punctuation. |
|
205 | + 'acct' => $billing_info['credit_card'], |
|
206 | + // Required. Credit card expiration date. Format is MMYYYY |
|
207 | + 'expdate' => $billing_info['exp_month'] . $billing_info['exp_year'], |
|
208 | + // Requirements determined by your PayPal account settings. Security digits for credit card. |
|
209 | + 'cvv2' => $billing_info['cvv'], |
|
210 | + ); |
|
211 | + $PayerInfo = array( |
|
212 | + // Email address of payer. |
|
213 | + 'email' => $billing_info['email'], |
|
214 | + // Unique PayPal customer ID for payer. |
|
215 | + 'payerid' => '', |
|
216 | + // Status of payer. Values are verified or unverified |
|
217 | + 'payerstatus' => '', |
|
218 | + // Payer's business name. |
|
219 | + 'business' => '', |
|
220 | + ); |
|
221 | + $PayerName = array( |
|
222 | + // Payer's salutation. 20 char max. |
|
223 | + 'salutation' => '', |
|
224 | + // Payer's first name. 25 char max. |
|
225 | + 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
226 | + // Payer's middle name. 25 char max. |
|
227 | + 'middlename' => '', |
|
228 | + // Payer's last name. 25 char max. |
|
229 | + 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
230 | + // Payer's suffix. 12 char max. |
|
231 | + 'suffix' => '', |
|
232 | + ); |
|
233 | + $BillingAddress = array( |
|
234 | + // Required. First street address. |
|
235 | + 'street' => $billing_info['address'], |
|
236 | + // Second street address. |
|
237 | + 'street2' => $billing_info['address2'], |
|
238 | + // Required. Name of City. |
|
239 | + 'city' => $billing_info['city'], |
|
240 | + // Required. Name of State or Province. |
|
241 | + 'state' => substr($billing_info['state'], 0, 40), |
|
242 | + // Required. Country code. |
|
243 | + 'countrycode' => $billing_info['country'], |
|
244 | + // Required. Postal code of payer. |
|
245 | + 'zip' => $billing_info['zip'], |
|
246 | + ); |
|
247 | + // check if the registration info contains the needed fields for paypal pro |
|
248 | + // (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/) |
|
249 | + if ($attendee->address() && $attendee->city() && $attendee->country_ID()) { |
|
250 | + $use_registration_address_info = true; |
|
251 | + } else { |
|
252 | + $use_registration_address_info = false; |
|
253 | + } |
|
254 | + // so if the attendee has enough data to fill out PayPal Pro's shipping info, use it. |
|
255 | + // If not, use the billing info again |
|
256 | + $ShippingAddress = array( |
|
257 | + 'shiptoname' => substr($use_registration_address_info |
|
258 | + ? $attendee->full_name() |
|
259 | + : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32), |
|
260 | + 'shiptostreet' => substr($use_registration_address_info |
|
261 | + ? $attendee->address() |
|
262 | + : $billing_info['address'], 0, 100), |
|
263 | + 'shiptostreet2' => substr($use_registration_address_info |
|
264 | + ? $attendee->address2() : $billing_info['address2'], 0, 100), |
|
265 | + 'shiptocity' => substr($use_registration_address_info |
|
266 | + ? $attendee->city() |
|
267 | + : $billing_info['city'], 0, 40), |
|
268 | + 'shiptostate' => substr($use_registration_address_info |
|
269 | + ? $attendee->state_name() |
|
270 | + : $billing_info['state'], 0, 40), |
|
271 | + 'shiptocountry' => $use_registration_address_info |
|
272 | + ? $attendee->country_ID() |
|
273 | + : $billing_info['country'], |
|
274 | + 'shiptozip' => substr($use_registration_address_info |
|
275 | + ? $attendee->zip() |
|
276 | + : $billing_info['zip'], 0, 20), |
|
277 | + 'shiptophonenum' => substr($use_registration_address_info |
|
278 | + ? $attendee->phone() |
|
279 | + : $billing_info['phone'], 0, 20), |
|
280 | + ); |
|
281 | + $PaymentDetails = array( |
|
282 | + // Required. Total amount of order, including shipping, handling, and tax. |
|
283 | + 'amt' => $gateway_formatter->formatCurrency($payment->amount()), |
|
284 | + // Required. Three-letter currency code. Default is USD. |
|
285 | + 'currencycode' => $payment->currency_code(), |
|
286 | + // Required if you include itemized cart details. (L_AMTn, etc.) |
|
287 | + // Subtotal of items not including S&H, or tax. |
|
288 | + 'itemamt' => $gateway_formatter->formatCurrency($item_amount),// |
|
289 | + // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
|
290 | + 'shippingamt' => '', |
|
291 | + // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
|
292 | + 'handlingamt' => '', |
|
293 | + // Required if you specify itemized cart tax details. |
|
294 | + // Sum of tax for all items on the order. Total sales tax. |
|
295 | + 'taxamt' => $gateway_formatter->formatCurrency($tax_amount), |
|
296 | + // Description of the order the customer is purchasing. 127 char max. |
|
297 | + 'desc' => $order_description, |
|
298 | + // Free-form field for your own use. 256 char max. |
|
299 | + 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
|
300 | + // Your own invoice or tracking number |
|
301 | + 'invnum' => wp_generate_password(12, false),// $transaction->ID(), |
|
302 | + // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
|
303 | + 'notifyurl' => '', |
|
304 | + 'buttonsource' => 'EventEspresso_SP',// EE will blow up if you change this |
|
305 | + ); |
|
306 | + // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
|
307 | + $PayPalRequestData = array( |
|
308 | + 'DPFields' => $DPFields, |
|
309 | + 'CCDetails' => $CCDetails, |
|
310 | + 'PayerInfo' => $PayerInfo, |
|
311 | + 'PayerName' => $PayerName, |
|
312 | + 'BillingAddress' => $BillingAddress, |
|
313 | + 'ShippingAddress' => $ShippingAddress, |
|
314 | + 'PaymentDetails' => $PaymentDetails, |
|
315 | + 'OrderItems' => $order_items, |
|
316 | + ); |
|
317 | + $this->_log_clean_request($PayPalRequestData, $payment); |
|
318 | + try { |
|
319 | + $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
|
320 | + // remove PCI-sensitive data so it doesn't get stored |
|
321 | + $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
322 | + if (isset($PayPalResult['L_ERRORCODE0']) && $PayPalResult['L_ERRORCODE0'] === '10002') { |
|
323 | + $message = esc_html__('PayPal did not accept your API username, password, or signature. Please double-check these credentials and if debug mode is on.', 'event_espresso'); |
|
324 | + } elseif (isset($PayPalResult['L_LONGMESSAGE0'])) { |
|
325 | + $message = $PayPalResult['L_LONGMESSAGE0']; |
|
326 | + } else { |
|
327 | + $message = $PayPalResult['ACK']; |
|
328 | + } |
|
329 | + if (empty($PayPalResult['RAWRESPONSE'])) { |
|
330 | + $payment->set_status($this->_pay_model->failed_status()); |
|
331 | + $payment->set_gateway_response(esc_html__('No response received from Paypal Pro', 'event_espresso')); |
|
332 | + $payment->set_details($PayPalResult); |
|
333 | + } else { |
|
334 | + if ($this->_APICallSuccessful($PayPalResult)) { |
|
335 | + $payment->set_status($this->_pay_model->approved_status()); |
|
336 | + } else { |
|
337 | + $payment->set_status($this->_pay_model->declined_status()); |
|
338 | + } |
|
339 | + // make sure we interpret the AMT as a float, not an international string |
|
340 | + // (where periods are thousand separators) |
|
341 | + $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
342 | + $payment->set_gateway_response($message); |
|
343 | + $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) |
|
344 | + ? $PayPalResult['TRANSACTIONID'] |
|
345 | + : null); |
|
346 | + $primary_registration_code = $primary_registrant instanceof EE_Registration |
|
347 | + ? $primary_registrant->reg_code() |
|
348 | + : ''; |
|
349 | + $payment->set_extra_accntng($primary_registration_code); |
|
350 | + $payment->set_details($PayPalResult); |
|
351 | + } |
|
352 | + } catch (Exception $e) { |
|
353 | + $payment->set_status($this->_pay_model->failed_status()); |
|
354 | + $payment->set_gateway_response($e->getMessage()); |
|
355 | + } |
|
356 | + // $payment->set_status( $this->_pay_model->declined_status() ); |
|
357 | + // $payment->set_gateway_response( '' ); |
|
358 | + return $payment; |
|
359 | + } |
|
360 | + |
|
361 | + |
|
362 | + |
|
363 | + /** |
|
364 | + * CLeans out sensitive CC data and then logs it, and returns the cleaned request |
|
365 | + * |
|
366 | + * @param array $request |
|
367 | + * @param EEI_Payment $payment |
|
368 | + * @return void |
|
369 | + */ |
|
370 | + private function _log_clean_request($request, $payment) |
|
371 | + { |
|
372 | + $cleaned_request_data = $request; |
|
373 | + unset($cleaned_request_data['CCDetails']['acct']); |
|
374 | + unset($cleaned_request_data['CCDetails']['cvv2']); |
|
375 | + unset($cleaned_request_data['CCDetails']['expdate']); |
|
376 | + $this->log(array('Paypal Request' => $cleaned_request_data), $payment); |
|
377 | + } |
|
378 | + |
|
379 | + |
|
380 | + |
|
381 | + /** |
|
382 | + * Cleans the response, logs it, and returns it |
|
383 | + * |
|
384 | + * @param array $response |
|
385 | + * @param EEI_Payment $payment |
|
386 | + * @return array cleaned |
|
387 | + */ |
|
388 | + private function _log_clean_response($response, $payment) |
|
389 | + { |
|
390 | + unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
|
391 | + unset($response['REQUESTDATA']['ACCT']); |
|
392 | + unset($response['REQUESTDATA']['EXPDATE']); |
|
393 | + unset($response['REQUESTDATA']['CVV2']); |
|
394 | + unset($response['RAWREQUEST']); |
|
395 | + $this->log(array('Paypal Response' => $response), $payment); |
|
396 | + return $response; |
|
397 | + } |
|
398 | + |
|
399 | + |
|
400 | + |
|
401 | + /** |
|
402 | + * @param $DataArray |
|
403 | + * @return array |
|
404 | + */ |
|
405 | + private function prep_and_curl_request($DataArray) |
|
406 | + { |
|
407 | + // Create empty holders for each portion of the NVP string |
|
408 | + $DPFieldsNVP = '&METHOD=DoDirectPayment&BUTTONSOURCE=AngellEYE_PHP_Class_DDP'; |
|
409 | + $CCDetailsNVP = ''; |
|
410 | + $PayerInfoNVP = ''; |
|
411 | + $PayerNameNVP = ''; |
|
412 | + $BillingAddressNVP = ''; |
|
413 | + $ShippingAddressNVP = ''; |
|
414 | + $PaymentDetailsNVP = ''; |
|
415 | + $OrderItemsNVP = ''; |
|
416 | + $Secure3DNVP = ''; |
|
417 | + // DP Fields |
|
418 | + $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
|
419 | + foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) { |
|
420 | + $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
421 | + } |
|
422 | + // CC Details Fields |
|
423 | + $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
|
424 | + foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) { |
|
425 | + $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
426 | + } |
|
427 | + // PayerInfo Type Fields |
|
428 | + $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
|
429 | + foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) { |
|
430 | + $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
431 | + } |
|
432 | + // Payer Name Fields |
|
433 | + $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
|
434 | + foreach ($PayerName as $PayerNameVar => $PayerNameVal) { |
|
435 | + $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
436 | + } |
|
437 | + // Address Fields (Billing) |
|
438 | + $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
|
439 | + foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) { |
|
440 | + $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
441 | + } |
|
442 | + // Payment Details Type Fields |
|
443 | + $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
|
444 | + foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) { |
|
445 | + $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
446 | + } |
|
447 | + // Payment Details Item Type Fields |
|
448 | + $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
|
449 | + $n = 0; |
|
450 | + foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
|
451 | + $CurrentItem = $OrderItems[ $OrderItemsVar ]; |
|
452 | + foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) { |
|
453 | + $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
454 | + } |
|
455 | + $n++; |
|
456 | + } |
|
457 | + // Ship To Address Fields |
|
458 | + $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
|
459 | + foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) { |
|
460 | + $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
461 | + } |
|
462 | + // 3D Secure Fields |
|
463 | + $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
|
464 | + foreach ($Secure3D as $Secure3DVar => $Secure3DVal) { |
|
465 | + $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
466 | + } |
|
467 | + // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
|
468 | + $NVPRequest = 'USER=' |
|
469 | + . $this->_api_username |
|
470 | + . '&PWD=' |
|
471 | + . $this->_api_password |
|
472 | + . '&VERSION=64.0' |
|
473 | + . '&SIGNATURE=' |
|
474 | + . $this->_api_signature |
|
475 | + . $DPFieldsNVP |
|
476 | + . $CCDetailsNVP |
|
477 | + . $PayerInfoNVP |
|
478 | + . $PayerNameNVP |
|
479 | + . $BillingAddressNVP |
|
480 | + . $PaymentDetailsNVP |
|
481 | + . $OrderItemsNVP |
|
482 | + . $ShippingAddressNVP |
|
483 | + . $Secure3DNVP; |
|
484 | + $NVPResponse = $this->_CURLRequest($NVPRequest); |
|
485 | + $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
|
486 | + $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
|
487 | + $Errors = $this->_GetErrors($NVPResponseArray); |
|
488 | + $NVPResponseArray['ERRORS'] = $Errors; |
|
489 | + $NVPResponseArray['REQUESTDATA'] = $NVPRequestArray; |
|
490 | + $NVPResponseArray['RAWREQUEST'] = $NVPRequest; |
|
491 | + $NVPResponseArray['RAWRESPONSE'] = $NVPResponse; |
|
492 | + return $NVPResponseArray; |
|
493 | + } |
|
494 | + |
|
495 | + |
|
496 | + |
|
497 | + /** |
|
498 | + * @param $Request |
|
499 | + * @return mixed |
|
500 | + */ |
|
501 | + private function _CURLRequest($Request) |
|
502 | + { |
|
503 | + $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
|
504 | + $curl = curl_init(); |
|
505 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', true)); |
|
506 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
|
507 | + curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
|
508 | + curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
|
509 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
510 | + curl_setopt($curl, CURLOPT_POSTFIELDS, $Request); |
|
511 | + curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
|
512 | + // execute the curl POST |
|
513 | + $Response = curl_exec($curl); |
|
514 | + curl_close($curl); |
|
515 | + return $Response; |
|
516 | + } |
|
517 | + |
|
518 | + |
|
519 | + |
|
520 | + /** |
|
521 | + * @param $NVPString |
|
522 | + * @return array |
|
523 | + */ |
|
524 | + private function _NVPToArray($NVPString) |
|
525 | + { |
|
526 | + // prepare responses into array |
|
527 | + $proArray = array(); |
|
528 | + while (strlen($NVPString)) { |
|
529 | + // name |
|
530 | + $keypos = strpos($NVPString, '='); |
|
531 | + $keyval = substr($NVPString, 0, $keypos); |
|
532 | + // value |
|
533 | + $valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString); |
|
534 | + $valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1); |
|
535 | + // decoding the response |
|
536 | + $proArray[ $keyval ] = urldecode($valval); |
|
537 | + $NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString)); |
|
538 | + } |
|
539 | + return $proArray; |
|
540 | + } |
|
541 | + |
|
542 | + |
|
543 | + |
|
544 | + /** |
|
545 | + * @param array $PayPalResult |
|
546 | + * @return bool |
|
547 | + */ |
|
548 | + private function _APICallSuccessful($PayPalResult) |
|
549 | + { |
|
550 | + $approved = false; |
|
551 | + // check main response message from PayPal |
|
552 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
553 | + $ack = strtoupper($PayPalResult['ACK']); |
|
554 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
555 | + } |
|
556 | + return $approved; |
|
557 | + } |
|
558 | + |
|
559 | + |
|
560 | + |
|
561 | + /** |
|
562 | + * @param $DataArray |
|
563 | + * @return array |
|
564 | + */ |
|
565 | + private function _GetErrors($DataArray) |
|
566 | + { |
|
567 | + $Errors = array(); |
|
568 | + $n = 0; |
|
569 | + while (isset($DataArray[ 'L_ERRORCODE' . $n . '' ])) { |
|
570 | + $LErrorCode = isset($DataArray[ 'L_ERRORCODE' . $n . '' ]) ? $DataArray[ 'L_ERRORCODE' . $n . '' ] : ''; |
|
571 | + $LShortMessage = isset($DataArray[ 'L_SHORTMESSAGE' . $n . '' ]) |
|
572 | + ? $DataArray[ 'L_SHORTMESSAGE' . $n . '' ] |
|
573 | + : ''; |
|
574 | + $LLongMessage = isset($DataArray[ 'L_LONGMESSAGE' . $n . '' ]) |
|
575 | + ? $DataArray[ 'L_LONGMESSAGE' . $n . '' ] |
|
576 | + : ''; |
|
577 | + $LSeverityCode = isset($DataArray[ 'L_SEVERITYCODE' . $n . '' ]) |
|
578 | + ? $DataArray[ 'L_SEVERITYCODE' . $n . '' ] |
|
579 | + : ''; |
|
580 | + $CurrentItem = array( |
|
581 | + 'L_ERRORCODE' => $LErrorCode, |
|
582 | + 'L_SHORTMESSAGE' => $LShortMessage, |
|
583 | + 'L_LONGMESSAGE' => $LLongMessage, |
|
584 | + 'L_SEVERITYCODE' => $LSeverityCode, |
|
585 | + ); |
|
586 | + array_push($Errors, $CurrentItem); |
|
587 | + $n++; |
|
588 | + } |
|
589 | + return $Errors; |
|
590 | + } |
|
591 | + |
|
592 | + |
|
593 | + |
|
594 | + /** |
|
595 | + * nothing to see here... move along.... |
|
596 | + * |
|
597 | + * @access protected |
|
598 | + * @param $Errors |
|
599 | + * @return string |
|
600 | + */ |
|
601 | + private function _DisplayErrors($Errors) |
|
602 | + { |
|
603 | + $error = ''; |
|
604 | + foreach ($Errors as $ErrorVar => $ErrorVal) { |
|
605 | + $CurrentError = $Errors[ $ErrorVar ]; |
|
606 | + foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) { |
|
607 | + $CurrentVarName = ''; |
|
608 | + if ($CurrentErrorVar == 'L_ERRORCODE') { |
|
609 | + $CurrentVarName = 'Error Code'; |
|
610 | + } elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') { |
|
611 | + $CurrentVarName = 'Short Message'; |
|
612 | + } elseif ($CurrentErrorVar == 'L_LONGMESSAGE') { |
|
613 | + $CurrentVarName = 'Long Message'; |
|
614 | + } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') { |
|
615 | + $CurrentVarName = 'Severity Code'; |
|
616 | + } |
|
617 | + $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
618 | + } |
|
619 | + } |
|
620 | + return $error; |
|
621 | + } |
|
622 | 622 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | |
33 | 33 | // modify just event_list |
34 | 34 | $new_config['event_list'] = array( |
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | 36 | ); |
37 | 37 | $new_config['ticket_list'] = array( |
38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
39 | 39 | ); |
40 | 40 | $new_config['content'] = array( |
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | 42 | ); |
43 | 43 | $this->_messenger->set_validator_config($new_config); |
44 | 44 | |
45 | 45 | if ($this->_context != 'admin') { |
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,37 +13,37 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Messages_Email_Payment_Reminder_Validator extends EE_Messages_Validator |
15 | 15 | { |
16 | - public function __construct($fields, $context) |
|
17 | - { |
|
18 | - $this->_m_name = 'email'; |
|
19 | - $this->_mt_name = 'payment_reminder'; |
|
16 | + public function __construct($fields, $context) |
|
17 | + { |
|
18 | + $this->_m_name = 'email'; |
|
19 | + $this->_mt_name = 'payment_reminder'; |
|
20 | 20 | |
21 | - parent::__construct($fields, $context); |
|
22 | - } |
|
21 | + parent::__construct($fields, $context); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
26 | - */ |
|
27 | - protected function _modify_validator() |
|
28 | - { |
|
29 | - $new_config = $this->_messenger->get_validator_config(); |
|
24 | + /** |
|
25 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
26 | + */ |
|
27 | + protected function _modify_validator() |
|
28 | + { |
|
29 | + $new_config = $this->_messenger->get_validator_config(); |
|
30 | 30 | |
31 | - // modify just event_list |
|
32 | - $new_config['event_list'] = array( |
|
33 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
34 | - ); |
|
35 | - $new_config['ticket_list'] = array( |
|
36 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
37 | - ); |
|
38 | - $new_config['content'] = array( |
|
39 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
40 | - ); |
|
41 | - $this->_messenger->set_validator_config($new_config); |
|
31 | + // modify just event_list |
|
32 | + $new_config['event_list'] = array( |
|
33 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
34 | + ); |
|
35 | + $new_config['ticket_list'] = array( |
|
36 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
37 | + ); |
|
38 | + $new_config['content'] = array( |
|
39 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
40 | + ); |
|
41 | + $this->_messenger->set_validator_config($new_config); |
|
42 | 42 | |
43 | - if ($this->_context != 'admin') { |
|
44 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
45 | - } |
|
43 | + if ($this->_context != 'admin') { |
|
44 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
45 | + } |
|
46 | 46 | |
47 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
48 | - } |
|
47 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
48 | + } |
|
49 | 49 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | |
33 | 33 | // modify just event_list |
34 | 34 | $new_config['event_list'] = array( |
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | 36 | ); |
37 | 37 | $new_config['ticket_list'] = array( |
38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
39 | 39 | ); |
40 | 40 | $new_config['content'] = array( |
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | 42 | ); |
43 | 43 | $this->_messenger->set_validator_config($new_config); |
44 | 44 | |
45 | 45 | if ($this->_context != 'admin') { |
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,37 +13,37 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Messages_Email_Payment_Declined_Validator extends EE_Messages_Validator |
15 | 15 | { |
16 | - public function __construct($fields, $context) |
|
17 | - { |
|
18 | - $this->_m_name = 'email'; |
|
19 | - $this->_mt_name = 'payment_declined'; |
|
16 | + public function __construct($fields, $context) |
|
17 | + { |
|
18 | + $this->_m_name = 'email'; |
|
19 | + $this->_mt_name = 'payment_declined'; |
|
20 | 20 | |
21 | - parent::__construct($fields, $context); |
|
22 | - } |
|
21 | + parent::__construct($fields, $context); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
26 | - */ |
|
27 | - protected function _modify_validator() |
|
28 | - { |
|
29 | - $new_config = $this->_messenger->get_validator_config(); |
|
24 | + /** |
|
25 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
26 | + */ |
|
27 | + protected function _modify_validator() |
|
28 | + { |
|
29 | + $new_config = $this->_messenger->get_validator_config(); |
|
30 | 30 | |
31 | - // modify just event_list |
|
32 | - $new_config['event_list'] = array( |
|
33 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
34 | - ); |
|
35 | - $new_config['ticket_list'] = array( |
|
36 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
37 | - ); |
|
38 | - $new_config['content'] = array( |
|
39 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
40 | - ); |
|
41 | - $this->_messenger->set_validator_config($new_config); |
|
31 | + // modify just event_list |
|
32 | + $new_config['event_list'] = array( |
|
33 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
34 | + ); |
|
35 | + $new_config['ticket_list'] = array( |
|
36 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
37 | + ); |
|
38 | + $new_config['content'] = array( |
|
39 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
40 | + ); |
|
41 | + $this->_messenger->set_validator_config($new_config); |
|
42 | 42 | |
43 | - if ($this->_context != 'admin') { |
|
44 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
45 | - } |
|
43 | + if ($this->_context != 'admin') { |
|
44 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
45 | + } |
|
46 | 46 | |
47 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
48 | - } |
|
47 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
48 | + } |
|
49 | 49 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | |
33 | 33 | // modify just event_list |
34 | 34 | $new_config['event_list'] = array( |
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | 36 | ); |
37 | 37 | $new_config['ticket_list'] = array( |
38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
39 | 39 | ); |
40 | 40 | $new_config['content'] = array( |
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | 42 | ); |
43 | 43 | $this->_messenger->set_validator_config($new_config); |
44 | 44 | |
45 | 45 | if ($this->_context != 'admin') { |
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -14,37 +14,37 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_Messages_Email_Payment_Cancelled_Validator extends EE_Messages_Validator |
16 | 16 | { |
17 | - public function __construct($fields, $context) |
|
18 | - { |
|
19 | - $this->_m_name = 'email'; |
|
20 | - $this->_mt_name = 'payment_cancelled'; |
|
17 | + public function __construct($fields, $context) |
|
18 | + { |
|
19 | + $this->_m_name = 'email'; |
|
20 | + $this->_mt_name = 'payment_cancelled'; |
|
21 | 21 | |
22 | - parent::__construct($fields, $context); |
|
23 | - } |
|
22 | + parent::__construct($fields, $context); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
27 | - */ |
|
28 | - protected function _modify_validator() |
|
29 | - { |
|
30 | - $new_config = $this->_messenger->get_validator_config(); |
|
25 | + /** |
|
26 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
27 | + */ |
|
28 | + protected function _modify_validator() |
|
29 | + { |
|
30 | + $new_config = $this->_messenger->get_validator_config(); |
|
31 | 31 | |
32 | - // modify just event_list |
|
33 | - $new_config['event_list'] = array( |
|
34 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | - ); |
|
36 | - $new_config['ticket_list'] = array( |
|
37 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
38 | - ); |
|
39 | - $new_config['content'] = array( |
|
40 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | - ); |
|
42 | - $this->_messenger->set_validator_config($new_config); |
|
32 | + // modify just event_list |
|
33 | + $new_config['event_list'] = array( |
|
34 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + ); |
|
36 | + $new_config['ticket_list'] = array( |
|
37 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
38 | + ); |
|
39 | + $new_config['content'] = array( |
|
40 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + ); |
|
42 | + $this->_messenger->set_validator_config($new_config); |
|
43 | 43 | |
44 | - if ($this->_context != 'admin') { |
|
45 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | - } |
|
44 | + if ($this->_context != 'admin') { |
|
45 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + } |
|
47 | 47 | |
48 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
49 | - } |
|
48 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
49 | + } |
|
50 | 50 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | |
33 | 33 | // modify just event_list |
34 | 34 | $new_config['event_list'] = array( |
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | 36 | ); |
37 | 37 | $new_config['ticket_list'] = array( |
38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
39 | 39 | ); |
40 | 40 | $new_config['content'] = array( |
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | 42 | ); |
43 | 43 | $this->_messenger->set_validator_config($new_config); |
44 | 44 | |
45 | 45 | if ($this->_context != 'admin') { |
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -14,37 +14,37 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_Messages_Email_Payment_Failed_Validator extends EE_Messages_Validator |
16 | 16 | { |
17 | - public function __construct($fields, $context) |
|
18 | - { |
|
19 | - $this->_m_name = 'email'; |
|
20 | - $this->_mt_name = 'payment_failed'; |
|
17 | + public function __construct($fields, $context) |
|
18 | + { |
|
19 | + $this->_m_name = 'email'; |
|
20 | + $this->_mt_name = 'payment_failed'; |
|
21 | 21 | |
22 | - parent::__construct($fields, $context); |
|
23 | - } |
|
22 | + parent::__construct($fields, $context); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
27 | - */ |
|
28 | - protected function _modify_validator() |
|
29 | - { |
|
30 | - $new_config = $this->_messenger->get_validator_config(); |
|
25 | + /** |
|
26 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
27 | + */ |
|
28 | + protected function _modify_validator() |
|
29 | + { |
|
30 | + $new_config = $this->_messenger->get_validator_config(); |
|
31 | 31 | |
32 | - // modify just event_list |
|
33 | - $new_config['event_list'] = array( |
|
34 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | - ); |
|
36 | - $new_config['ticket_list'] = array( |
|
37 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
38 | - ); |
|
39 | - $new_config['content'] = array( |
|
40 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | - ); |
|
42 | - $this->_messenger->set_validator_config($new_config); |
|
32 | + // modify just event_list |
|
33 | + $new_config['event_list'] = array( |
|
34 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + ); |
|
36 | + $new_config['ticket_list'] = array( |
|
37 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
38 | + ); |
|
39 | + $new_config['content'] = array( |
|
40 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + ); |
|
42 | + $this->_messenger->set_validator_config($new_config); |
|
43 | 43 | |
44 | - if ($this->_context != 'admin') { |
|
45 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | - } |
|
44 | + if ($this->_context != 'admin') { |
|
45 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + } |
|
47 | 47 | |
48 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
49 | - } |
|
48 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
49 | + } |
|
50 | 50 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->_messenger->set_validator_config($new_config); |
39 | 39 | |
40 | 40 | if ($this->_context != 'admin') { |
41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,30 +13,30 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Messages_Email_Cancelled_Registration_Validator extends EE_Messages_Validator |
15 | 15 | { |
16 | - public function __construct($fields, $context) |
|
17 | - { |
|
18 | - $this->_m_name = 'email'; |
|
19 | - $this->_mt_name = 'cancelled_registration'; |
|
16 | + public function __construct($fields, $context) |
|
17 | + { |
|
18 | + $this->_m_name = 'email'; |
|
19 | + $this->_mt_name = 'cancelled_registration'; |
|
20 | 20 | |
21 | - parent::__construct($fields, $context); |
|
22 | - } |
|
21 | + parent::__construct($fields, $context); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * custom validator (will override what was originally set by the message_type and messenger) |
|
26 | - */ |
|
27 | - protected function _modify_validator() |
|
28 | - { |
|
29 | - $new_config = $this->_messenger->get_validator_config(); |
|
30 | - $new_config['event_list'] = array( |
|
31 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
32 | - 'required' => array('[EVENT_LIST]') |
|
33 | - ); |
|
34 | - $this->_messenger->set_validator_config($new_config); |
|
24 | + /** |
|
25 | + * custom validator (will override what was originally set by the message_type and messenger) |
|
26 | + */ |
|
27 | + protected function _modify_validator() |
|
28 | + { |
|
29 | + $new_config = $this->_messenger->get_validator_config(); |
|
30 | + $new_config['event_list'] = array( |
|
31 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
32 | + 'required' => array('[EVENT_LIST]') |
|
33 | + ); |
|
34 | + $this->_messenger->set_validator_config($new_config); |
|
35 | 35 | |
36 | - if ($this->_context != 'admin') { |
|
37 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
38 | - } |
|
36 | + if ($this->_context != 'admin') { |
|
37 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
38 | + } |
|
39 | 39 | |
40 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
41 | - } |
|
40 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
41 | + } |
|
42 | 42 | } |