function stripe_process() { global $event_details, $cart_totals; $event_id = $event_details['ID']; $regis_id = $this->erm->get_regis_id(); $post_ID = $this->erm->get_regis_post_id(); $this->epl->load_file('libraries/gateways/stripe/Stripe.php'); $this->ecm->setup_event_details($event_id); $_totals = $this->erm->calculate_cart_totals(true); $gateway_info = $this->erm->get_gateway_info(); $secret_key = $gateway_info['_epl_secret_key']; $publishable_key = $gateway_info['_epl_publishable_key']; $data['stripe'] = array("secret_key" => $secret_key, "publishable_key" => $publishable_key); Stripe::setApiKey($data['stripe']['secret_key']); // Get the credit card details submitted by the form $token = $_POST['stripeToken']; // Create the charge on Stripe's servers - this will charge the user's card try { $charge = Stripe_Charge::create(array("amount" => epl_get_balance_due() * 100, "currency" => strtolower(epl_nz(epl_get_general_setting('epl_currency_code'), 'USD')), "card" => $token, "description" => $event_details['post_title'], "metadata" => array("regis_id" => $post_ID))); $data['post_ID'] = $post_ID; $data['_epl_grand_total'] = $cart_totals['money_totals']['grand_total']; $data['_epl_payment_amount'] = $cart_totals['money_totals']['grand_total']; $data['_epl_payment_date'] = current_time('mysql'); $data['_epl_payment_method'] = $this->erm->get_payment_profile_id(); $data['_epl_transaction_id'] = $charge->id; $data['_epl_prediscount_total'] = epl_get_element('pre_discount_total', $cart_totals['money_totals'], 0); $data['_epl_discount_amount'] = epl_get_element('discount_amount', $cart_totals['money_totals'], 0); $data = apply_filters('epl_stripe_response_data', $data); $this->erm->update_payment_data($data); return true; } catch (Stripe_CardError $e) { $body = $e->getJsonBody(); $err = $body['error']; return '<div class="epl_error">Error: ' . $err['message'] . '</div>'; } }
?> </td> </tr> <tr> <td style="width:50%"><span class="small1"><?php epl_e('Total'); ?> : </span><span class="amount"><?php echo $grand_total; ?> </span></td> <td><span class="small1"><?php epl_e('Balance Due'); ?> : </span><span class="amount"><?php echo epl_get_formatted_curr(epl_get_balance_due(), null, true); ?> </span></td> </tr> <?php $payment_data = epl_get_regis_payments(); foreach ($payment_data as $t => $p) { if ($p['_epl_payment_amount'] == 0) { continue; } ?> <tr style="border-top:1px solid #d7d7d7;"> <td><?php echo epl_formatted_date($p['_epl_payment_date']); ?>
function epl_get_true_regis_status() { global $regis_details; $source = !empty($regis_details) ? $regis_details : EPL_registration_model::get_instance()->current_data; $balance_due = epl_get_balance_due(); $current_status = epl_get_element('_epl_regis_status', $source, 1); $is_waitlist = $current_status == 20; $is_active = $current_status < 10; if ($balance_due == 0 && $is_active && !$is_waitlist) { return 5; } elseif ($balance_due > 0 && $is_active && !$is_waitlist) { return 2; } else { return $current_status; } }