<?php if ($_REQUEST['payment_cancel']) { if ($_REQUEST['product_type'] == 'M') { $_REQUEST['confirm'] = ''; $invoice_id = (int) $_REQUEST['invoice_id']; $sql = "DELETE FROM membership_invoices WHERE `invoice_id`='" . jb_escape_sql($invoice_id) . "' AND (`status` = 'in_cart' OR `status`='Confirmed') AND user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND user_type='C' "; $result = JB_mysql_query($sql) or die($sql . mysql_error()); $JBMarkup->ok_msg($label['payment_mem_cancelled']); } } if ($_REQUEST['pay_method'] != '') { $_REQUEST['confirm'] = ''; echo "<p style='margin:50px;'>"; $_PAYMENT_OBJECTS[$_REQUEST['pay_method']]->payment_button($_REQUEST['invoice_id'], $_REQUEST['product_type']); JB_update_payment_method($_REQUEST['product_type'], $_REQUEST['invoice_id'], $_REQUEST['pay_method']); echo "</p>"; } if ($_REQUEST['confirm'] == 'yes' && $_REQUEST['action'] == 'membership') { // confirm the Invoice $_REQUEST['product_type'] = 'M'; $invoice_row = JB_confirm_membership_invoice($_REQUEST['invoice_id']); echo "<p> </p><p>"; JB_render_box_top(80, $label['payment_please_select']); $product_type = 'M'; # S for Membership JB_payment_option_list($invoice_row, $product_type); JB_render_box_bottom(); echo "</p><p> </p><p> </p>"; } JB_template_candidates_footer();
pp_log_entry("Placed & confirmed invoice {$invoice_id}"); } JB_complete_subscription_invoice($invoice_id, 'PayPal'); JB_debit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, "PayPal", $product_type, $_REQUEST['subscr_id']); } elseif ($product_type == 'M') { // check to see if invoice was already paid, if paid then start a new invoice $sql = "SELECT * FROM jb_txn WHERE invoice_id='{$invoice_id}' and product_type='M' AND origin='PayPal' "; $result = JB_mysql_query($sql) or JB_pp_mail_error(mysql_error . ":" . $sql); if (mysql_num_rows($result) > 0) { // paid & transaction exists. Start a new invoice by cloning the old one. $invoice_row = JB_get_membership_invoice_row($invoice_id); // force an expiration of the old invoice JB_expire_membership($invoice_row, $send_email = false); $invoice_id = JB_place_membership_invoice_clone($invoice_row['invoice_id']); // confirm the new invoice clone JB_confirm_membership_invoice($invoice_id); pp_log_entry("Placed & confirmed invoice {$invoice_id}"); } JB_complete_membership_invoice($invoice_id, 'PayPal'); JB_debit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, "PayPal", $product_type, $_REQUEST['subscr_id']); } JBPLUG_do_callback('pay_trn_subscr_completed', $invoice_id, $product_type); } if ($txn_type == 'subscr_failed') { } if ($txn_type == 'subscr_eot') { if ($product_type == 'S') { // subscriptions to view resume $invoice_row = JB_get_subscription_invoice_row($invoice_id); JB_expire_subscription($invoice_row); }