Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function payment_update( $postId, $eventId, $post ) {
- $paymentTypes = array('check' => '', 'cash' => '', 'invoice' => '');
- $requestParams = 'event_id=' . $eventId;
- // make it accept cash if free & assign a message
- if ( 2 == $post['EventBriteIsDonation'] ) {
- $requestParams .= '&accept_cash=1';
- $requestParams .= '&instructions_cash=' . urlencode( __( 'This event is free to attend', 'tribe-eventbrite' ) );
- } else {
- // otherwise loop through the payment methods as it's supposed to
- foreach( $paymentTypes as $key => $val ) {
- $onOff = $post['EventBritePayment_accept_' . $key];
- if ( $onOff ) $requestParams .= '&accept_' . $key . '=' . $onOff;
- $paymentTypes[$key] = $onOff;
- }
- foreach( $paymentTypes as $key => $val ) {
- if ( $val ) {
- $instructions = $post['EventBritePayment_instructions_'.$key];
- if ( $instructions ) $requestParams .= '&instructions_' . $key . '=' . urlencode( stripslashes( $instructions ) );
- }
- }
- // Online payment method is either/or (not both)
- $onlineMethod = $post['EventBritePayment_accept_online'];
- if ( !empty( $post['EventBritePayment_accept_online'] ) ) {
- switch( $onlineMethod ) {
- case 'paypal':
- $requestParams .= '&accept_paypal=1&paypal_email=' . $post['EventBritePayment_paypal_email'];
- break;
- case 'google':
- $requestParams .= '&accept_google=1&google_merchant_id=' . $post['EventBritePayment_google_merchant_id'] . '&google_merchant_key=' . $post['EventBritePayment_google_merchant_key'];
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement