Changeset 7028 for sites/trunk/wordcamp.org/public_html/wp-content/plugins
- Timestamp:
- 04/04/2018 07:41:24 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-payment-stripe.php
r7027 r7028 10 10 use Exception; 11 11 12 defined( 'WPINC' ) ordie();12 defined( 'WPINC' ) || die(); 13 13 14 14 const STEP_SELECT_INVOICE = 1; … … 98 98 'key' => 'Start Date (YYYY-mm-dd)', 99 99 'value' => strtotime( '-2 years' ), 100 'compare' => '>' 101 ) 102 ) 100 'compare' => '>', 101 ), 102 ), 103 103 ); 104 104 } … … 118 118 switch ( $step ) { 119 119 // An invoice, event, currency and amount have been selected. 120 default 121 case STEP_SELECT_INVOICE 120 default: 121 case STEP_SELECT_INVOICE: 122 122 $payment_type = filter_input( INPUT_POST, 'payment_type' ); 123 123 $wordcamp_id = filter_input( INPUT_POST, 'wordcamp_id', FILTER_VALIDATE_INT ); … … 128 128 129 129 switch ( $payment_type ) { 130 default 131 case 'invoice' 130 default: 131 case 'invoice': 132 132 if ( ! $wordcamp_id ) { 133 133 $data['errors'][] = 'Please select an event.'; … … 156 156 break; 157 157 158 case 'other' 158 case 'other': 159 159 $description = substr( sanitize_text_field( $description ), 0, 100 ); 160 160 … … 200 200 201 201 // Passed through to the charge step. 202 $data['payment_data_json'] = json_encode( $data['payment'] );202 $data['payment_data_json'] = wp_json_encode( $data['payment'] ); 203 203 $data['payment_data_signature'] = hash_hmac( 'sha256', $data['payment_data_json'], $data['keys']['hmac_key'] ); 204 204 … … 208 208 209 209 // The card details have been entered and Stripe has submitted our form. 210 case STEP_PAYMENT_DETAILS 210 case STEP_PAYMENT_DETAILS: 211 211 $stripe_token = filter_input( INPUT_POST, 'stripeToken' ); 212 212 $payment_data_json = filter_input( INPUT_POST, 'payment_data_json' ); … … 224 224 225 225 // Make sure our data hasn't been altered. 226 227 226 if ( ! hash_equals( hash_hmac( 'sha256', $payment_data_json, $data['keys']['hmac_key'] ), $payment_data_signature ) ) { 228 227 $data['errors'][] = 'Could not verify payload signature.'; … … 233 232 234 233 switch ( $payment_data['payment_type'] ) { 235 case 'invoice' 234 case 'invoice': 236 235 $wordcamp_obj = get_post( $payment_data['wordcamp_id'] ); 237 236 $wordcamp_site_id = get_wordcamp_site_id( $wordcamp_obj ); … … 246 245 break; 247 246 248 case 'other' 247 case 'other': 249 248 $description = 'Other Payment'; 250 249 $metadata = array(
Note: See TracChangeset
for help on using the changeset viewer.