}
}
if ($_REQUEST['action'] == 'complete') {
    $invoice_row = JB_get_subscription_invoice_row($_REQUEST['invoice_id']);
    if (isset($invoice_row['employer_id'])) {
        $txn_prefix = 'E';
    } else {
        $txn_prefix = 'P';
    }
    JB_complete_subscription_invoice($_REQUEST['invoice_id'], '');
    JB_debit_transaction($_REQUEST['invoice_id'], $invoice_row['amount'], $invoice_row['currency_code'], $txn_prefix . "S" . $invoice_row['invoice_id'], '', 'Admin', 'S');
    $JBMarkup->ok_msg('Order completed, user subscription activated!');
}
if ($_REQUEST['action'] == 'confirm') {
    echo "confirmed: " . $_REQUEST['invoice_id'];
    JB_confirm_subscription_invoice($_REQUEST['invoice_id']);
    $JBMarkup->ok_msg('Order Confirmed');
}
if ($_REQUEST['action'] == 'cancel') {
    JB_cancel_subscription_invoice($_REQUEST['invoice_id']);
    $JBMarkup->ok_msg('Order Cancelled');
}
if ($_REQUEST['action'] == 'void') {
    JB_void_subscription_invoice($_REQUEST['invoice_id']);
    $JBMarkup->ok_msg('Order set to void');
}
if ($_REQUEST['clean_up'] != '') {
    $sql = "DELETE FROM subscription_invoices WHERE status='Void' ";
    JB_mysql_query($sql) or die(mysql_error());
    $JBMarkup->ok_msg('Deleted all void orders');
}
Exemple #2
0
 if ($txn_type == 'subscr_payment') {
     // process re-bills
     if ($product_type == 'S') {
         // check to see if invoice was already paid, if paid then start a new invoice
         $sql = "SELECT * FROM jb_txn WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and product_type='S' 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.
             $invoice_row = JB_get_subscription_invoice_row($invoice_id);
             // force an expiration of the old invoice
             JB_expire_subscription($invoice_row, $send_email = false);
             // clone the old invoice, using old invoice id
             // $invoice_row['invoice_id'] == $old_invoice_id
             $invoice_id = JB_place_subscription_invoice_clone($invoice_row['invoice_id']);
             // confirm the new invoice clone
             JB_confirm_subscription_invoice($invoice_id);
             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